public
Description: Plug-in / filter for Frog CMS: WYMeditor
Homepage:
Clone URL: git://github.com/them/frog_wymeditor.git
them (author)
Fri Jul 17 11:35:03 -0700 2009
commit  77d596704d311f737f6030e5b6f89c1c522459bc
tree    e27ab2dd66dab45b6ba34ebbcbea40b7bdeef693
parent  5bcaa56618e830f09d4ac366d150f1914c068349
frog_wymeditor / index.php
100644 47 lines (40 sloc) 1.686 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
$plugin_id = "wymeditor";
 
// Register plugin
Plugin::setInfos(array(
    'id' => $plugin_id,
    'title' => __('WYMeditor'),
    'description' => __('WYMeditor is a web-based WYSIWYM (What You See Is What You Mean) XHTML editor (not WYSIWYG).'),
    'version' => '0.0.6',
    'license' => 'MIT',
    'author' => 'THE M',
    'website' => 'http://github.com/them/frog_wymeditor/',
    'update_url' => 'http://github.com/them/frog_wymeditor/raw/master/frog-plugins.xml',
    'require_frog_version' => '0.9.5'
));
 
// The plug-in is a filter
Filter::add($plugin_id, $plugin_id.'/'.ucfirst($plugin_id).'.php');
 
// The controller is required for the Frog integration (e.g. stylesheets)
Plugin::addController($plugin_id, __('WYMeditor'), null, false);
 
/* XXX: this is an ugly hack to include scripts that are not physically present in the file system */
// If frog is installed to a subfolder
$clean_url = URL_PUBLIC;
if (substr($clean_url, -1) != '/') {
  $clean_url .= '/';
}
 
$public_url_parts = parse_url($clean_url);
$url_depth = substr_count($public_url_parts['path'], '/') + 1;
 
// Path to the controller
$parts = parse_url(get_url('plugin/'.$plugin_id.'/environment'));
$path = $parts['path'];
// If 'USE_MOD_REWRITE' is set to false there is a query
if (isset($parts['query'])) {
  $path .= "?".$parts['query'];
}
// All the way up
$path_to_the_root = str_repeat('../', $url_depth);
Plugin::$javascripts[] = substr($path_to_the_root, 0, -1) . $path;
 
Plugin::addJavascript($plugin_id, 'jquery.wymeditor.min.js');
// Ensure that the Frog integration is included after the editor file
Plugin::addJavascript($plugin_id, 'frog_wymeditor.js');
?>