From 1eb3d18ae24a221037a44d662439d50c74e6fe9f Mon Sep 17 00:00:00 2001 From: patdenice Date: Thu, 25 Sep 2008 17:46:27 +0000 Subject: - Move get_extents function to include/functions.inc.php. - Change all plugins version to 2.0. - LocalFiles Editor can now edit and create template extension. - Editarea (for LocalFiles Editor) go to version 0.7.2.2 (chrome compatible) - Editarea activation is now saved in database with AJAX. git-svn-id: http://piwigo.org/svn/trunk@2588 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/extend_for_templates.php | 33 ---- admin/include/functions.php | 28 +++ plugins/AMenuManager/main.inc.php | 6 +- plugins/LocalFilesEditor/admin.php | 215 ++++++++++++++------- plugins/LocalFilesEditor/admin.tpl | 97 ++++++++-- .../LocalFilesEditor/editarea/edit_area_full.js | 8 +- .../editarea/images/autocompletion.gif | Bin 0 -> 359 bytes plugins/LocalFilesEditor/editarea/langs/cs.js | 4 + plugins/LocalFilesEditor/editarea/langs/de.js | 4 + plugins/LocalFilesEditor/editarea/langs/dk.js | 4 + plugins/LocalFilesEditor/editarea/langs/en.js | 4 + plugins/LocalFilesEditor/editarea/langs/es.js | 1 + plugins/LocalFilesEditor/editarea/langs/fr.js | 4 + plugins/LocalFilesEditor/editarea/langs/hr.js | 4 + plugins/LocalFilesEditor/editarea/langs/it.js | 4 + plugins/LocalFilesEditor/editarea/langs/ja.js | 4 + plugins/LocalFilesEditor/editarea/langs/mk.js | 4 + plugins/LocalFilesEditor/editarea/langs/nl.js | 4 + plugins/LocalFilesEditor/editarea/langs/pl.js | 4 + plugins/LocalFilesEditor/editarea/langs/pt.js | 4 + plugins/LocalFilesEditor/editarea/langs/ru.js | 4 + plugins/LocalFilesEditor/editarea/langs/sk.js | 4 + .../LocalFilesEditor/editarea/reg_syntax/html.js | 5 +- plugins/LocalFilesEditor/editarea/reg_syntax/js.js | 60 ------ .../LocalFilesEditor/editarea/reg_syntax/php.js | 83 +++++++- .../LocalFilesEditor/editarea/reg_syntax/sql.js | 55 ------ .../LocalFilesEditor/editarea/reg_syntax/xml.js | 56 ------ plugins/LocalFilesEditor/functions.inc.php | 64 +++++- .../language/en_UK/plugin.lang.php | 12 +- .../language/es_ES/plugin.lang.php | 12 +- .../language/fr_FR/plugin.lang.php | 12 +- .../language/it_IT/plugin.lang.php | 12 +- plugins/LocalFilesEditor/locfiledit.css | 34 ++++ plugins/LocalFilesEditor/main.inc.php | 10 +- plugins/LocalFilesEditor/maintain.inc.php | 43 +++++ plugins/LocalFilesEditor/show_default.php | 27 ++- plugins/LocalFilesEditor/show_default.tpl | 47 ++++- plugins/LocalFilesEditor/update_config.php | 46 +++++ plugins/SwiftThemeCreator/main.inc.php | 2 +- plugins/add_index/main.inc.php | 2 +- plugins/admin_advices/main.inc.php | 2 +- plugins/admin_multi_view/main.inc.php | 2 +- plugins/c13y_upgrade/main.inc.php | 2 +- plugins/event_tracer/main.inc.php | 2 +- plugins/grum_plugins_classes-2/main.inc.php | 6 +- plugins/language_switch/main.inc.php | 2 +- 46 files changed, 692 insertions(+), 350 deletions(-) create mode 100644 plugins/LocalFilesEditor/editarea/images/autocompletion.gif delete mode 100644 plugins/LocalFilesEditor/editarea/reg_syntax/js.js delete mode 100644 plugins/LocalFilesEditor/editarea/reg_syntax/sql.js delete mode 100644 plugins/LocalFilesEditor/editarea/reg_syntax/xml.js create mode 100644 plugins/LocalFilesEditor/locfiledit.css create mode 100644 plugins/LocalFilesEditor/maintain.inc.php create mode 100644 plugins/LocalFilesEditor/update_config.php diff --git a/admin/extend_for_templates.php b/admin/extend_for_templates.php index 938b83fed..294d600af 100644 --- a/admin/extend_for_templates.php +++ b/admin/extend_for_templates.php @@ -35,39 +35,6 @@ * (see permalinks in our documentation for further explanation). */ -// +-----------------------------------------------------------------------+ -// | functions | -// +-----------------------------------------------------------------------+ - -/** - * returns a list of templates currently available in template-extension - * - * Each .tpl file is extracted from template-extension. - * - * @return array - */ -function get_extents($start='') -{ - if ($start == '') { $start = './template-extension'; } - $dir = opendir($start); - $extents = array(); - - while (($file = readdir($dir)) !== false) - { - if ( $file == '.' or $file == '..' or $file == '.svn') continue; - $path = $start . '/' . $file; - if (is_dir($path)) - { - $extents = array_merge($extents, get_extents($path)); - } - elseif ( !is_link($path) and file_exists($path) - and strripos($path,'.tpl') > 0 ) - { - $extents[] = substr($path, 21); - } - } - return $extents; -} // +-----------------------------------------------------------------------+ // initialization | // +-----------------------------------------------------------------------+ diff --git a/admin/include/functions.php b/admin/include/functions.php index fb482c3aa..b239b08a1 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1788,4 +1788,32 @@ function get_user_access_level_html_options($MinLevelAccess = ACCESS_FREE, $MaxL return $tpl_options; } +/** + * returns a list of templates currently available in template-extension + * Each .tpl file is extracted from template-extension. + * @return array + */ +function get_extents($start='') +{ + if ($start == '') { $start = './template-extension'; } + $dir = opendir($start); + $extents = array(); + + while (($file = readdir($dir)) !== false) + { + if ( $file == '.' or $file == '..' or $file == '.svn') continue; + $path = $start . '/' . $file; + if (is_dir($path)) + { + $extents = array_merge($extents, get_extents($path)); + } + elseif ( !is_link($path) and file_exists($path) + and get_extension($path) == 'tpl' ) + { + $extents[] = substr($path, 21); + } + } + return $extents; +} + ?> \ No newline at end of file diff --git a/plugins/AMenuManager/main.inc.php b/plugins/AMenuManager/main.inc.php index 79cbf674a..ac90f3c7f 100755 --- a/plugins/AMenuManager/main.inc.php +++ b/plugins/AMenuManager/main.inc.php @@ -1,9 +1,11 @@ assign(); // +-----------------------------------------------------------------------+ // | Variables init // +-----------------------------------------------------------------------+ -$edited_file = ''; +$edited_file = isset($_POST['edited_file']) ? $_POST['edited_file'] : ''; $content_file = ''; -$new_file['localconf'] = ""; -$new_file['css'] = l10n('locfiledit_newfile') . "\n\n"; -$new_file['lang'] = ""; +$new_file['localconf'] = ""; +$new_file['css'] = "/* " . l10n('locfiledit_newfile') . " */\n\n"; +$new_file['tpl'] = "{* " . l10n('locfiledit_newfile') . " *}\n\n"; +$new_file['lang'] = $new_file['localconf']; $new_file['plug'] = ""; +$newfile_page = isset($_GET['newfile']) ? true : false; // Editarea options -$editarea = array( - 'start_highlight' => true, +$editarea_options = array( 'language' => substr($user['language'], 0, 2), + 'start_highlight' => true, + 'allow_toggle' => false, 'toolbar' => 'search,fullscreen, |,select_font, |, undo, redo, change_smooth_selection, highlight, reset_highlight, |, help'); -if (isset($conf['editarea_options']) and is_array($conf['editarea_options'])) -{ - $editarea = array_merge($editarea, $conf['editarea_options']); -} // Edit selected file for CSS, template and language if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) @@ -90,13 +89,39 @@ if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) file_get_contents($edited_file) : $new_file[$page['tab']]; } +// Edit new tpl file +if (isset($_POST['create_tpl'])) +{ + $filename = $_POST['tpl_name']; + if (get_extension($filename) != 'tpl') + { + $filename .= '.tpl'; + } + if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename)) + { + array_push($page['errors'], l10n('locfiledit_filename_error')); + $newfile_page = true; + } + if (is_numeric($_POST['tpl_model']) and $_POST['tpl_model'] != '0') + { + array_push($page['errors'], l10n('locfiledit_model_error')); + $newfile_page = true; + } + if (file_exists($_POST['tpl_parent'] . '/' . $filename)) + { + array_push($page['errors'], l10n('locfiledit_file_already_exists')); + $newfile_page = true; + } + if (!$newfile_page) + { + $edited_file = $_POST['tpl_parent'] . '/' . $filename; + $content_file = ($_POST['tpl_model'] == '0') ? $new_file['tpl'] : file_get_contents($_POST['tpl_model']); + } +} // +-----------------------------------------------------------------------+ // | Process tabsheet // +-----------------------------------------------------------------------+ -$options[] = l10n('locfiledit_choose_file'); -$selected = 0; - switch ($page['tab']) { case 'localconf': @@ -108,11 +133,13 @@ switch ($page['tab']) array('SHOW_DEFAULT' => LOCALEDIT_PATH . 'show_default.php?file=include/config_default.inc.php', 'FILE' => 'config_default.inc.php'))); - $editarea['syntax'] = 'php'; + $editarea_options['syntax'] = 'php'; break; case 'css': $template_dir = PHPWG_ROOT_PATH . 'template'; + $selected = 0; + $options[] = l10n('locfiledit_choose_file'); $options[] = '----------------------'; $value = PHPWG_ROOT_PATH . "template-common/local-layout.css"; $options[$value] = 'template-common / local-layout.css'; @@ -135,37 +162,110 @@ switch ($page['tab']) $template->assign('css_lang_tpl', array( 'OPTIONS' => $options, 'SELECTED' => $selected)); - $editarea['syntax'] = 'css'; + $editarea_options['syntax'] = 'css'; break; case 'tpl': - $template_dir = PHPWG_ROOT_PATH . 'template'; - foreach (get_dirs($template_dir) as $pwg_template) + // New file form creation + if ($newfile_page and !is_adviser()) { - $dir = $template_dir . '/' . $pwg_template . '/'; - $options[] = '----------------------'; - if (is_dir($dir) and $content = opendir($dir)) + $filename = isset($_POST['tpl_name']) ? $_POST['tpl_name'] : ''; + $selected['model'] = isset($_POST['tpl_model']) ? $_POST['tpl_model'] : '0'; + $selected['parent'] = isset($_POST['tpl_parent']) ? $_POST['tpl_parent'] : PHPWG_ROOT_PATH . 'template-extension'; + + // Parent directories list + $options['parent'] = array(PHPWG_ROOT_PATH . 'template-extension' => 'template-extension'); + $options['parent'] = array_merge($options['parent'], get_rec_dirs(PHPWG_ROOT_PATH . 'template-extension')); + + // Model list + $eligible_templates = array( + 'about.tpl', + 'identification.tpl', + 'mainpage_categories.tpl', + 'thumbnails.tpl', + 'redirect.tpl', + // 'menubar.tpl' + 'header.tpl', + 'footer.tpl', + 'index.tpl', + 'nbm.tpl', + 'notification.tpl', + 'picture_content.tpl', + 'picture.tpl', + 'popuphelp.tpl', + 'profile.tpl', + 'profile_content.tpl', + 'register.tpl', + 'search.tpl', + 'search_rules.tpl', + 'slideshow.tpl', + 'tags.tpl', + 'upload.tpl'); + + $options['model'][] = l10n('locfiledit_empty_page'); + $options['model'][] = '----------------------'; + foreach (get_extents() as $pwg_template) { - while ($node = readdir($content)) + $value = PHPWG_ROOT_PATH . 'template-extension/' . $pwg_template; + $options['model'][$value] = 'template-extension / ' . str_replace('/', ' / ', $pwg_template); + } + $template_dir = PHPWG_ROOT_PATH . 'template'; + foreach (get_dirs($template_dir) as $pwg_template) + { + if (count($options['model']) > 2) + { + $options['model'][] = '----------------------'; + } + $dir = $template_dir . '/' . $pwg_template . '/'; + if (is_dir($dir) and $content = opendir($dir)) { - if (is_file($dir . $node) - and strtolower(get_extension($node)) == 'tpl' - and !strpos($node , '.bak.tpl')) + while ($node = readdir($content)) { - $value = $dir . $node; - $options[$value] = $pwg_template . ' / ' . $node; - if ($edited_file == $value) $selected = $value; + if (is_file($dir . $node) and in_array($node, $eligible_templates)) + { + $value = $dir . $node; + $options['model'][$value] = $pwg_template . ' / ' . $node; + } } } } + // Assign variables to template + $template->assign('create_tpl', array( + 'NEW_FILE_NAME' => $filename, + 'MODEL_OPTIONS' => $options['model'], + 'MODEL_SELECTED' => $selected['model'], + 'PARENT_OPTIONS' => $options['parent'], + 'PARENT_SELECTED' => $selected['parent'])); + break; + } + // List existing template extensions + $template_dir = PHPWG_ROOT_PATH . 'template-extension'; + $selected = 0; + $options[] = l10n('locfiledit_choose_file'); + $options[] = '----------------------'; + foreach (get_extents() as $pwg_template) + { + $value = './template-extension/' . $pwg_template; + $options[$value] = str_replace('/', ' / ', $pwg_template); + if ($edited_file == $value) $selected = $value; + } + if ($selected == 0 and !empty($edited_file)) + { + $options[$edited_file] = str_replace(array('./template-extension/', '/'), array('', ' / '), $edited_file); + $selected = $edited_file; } $template->assign('css_lang_tpl', array( - 'OPTIONS' => $options, - 'SELECTED' => $selected)); - $editarea['syntax'] = 'html'; + 'OPTIONS' => $options, + 'SELECTED' => $selected, + 'NEW_FILE_URL' => $my_base_url.'&tab=tpl&newfile', + 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right')); + + $editarea_options['syntax'] = 'html'; break; case 'lang': + $selected = 0; + $options[] = l10n('locfiledit_choose_file'); $options[] = '----------------------'; foreach (get_languages() as $language_code => $language_name) { @@ -188,33 +288,29 @@ switch ($page['tab']) $template->assign('css_lang_tpl', array( 'OPTIONS' => $options, 'SELECTED' => $selected)); - $editarea['syntax'] = 'php'; + $editarea_options['syntax'] = 'php'; break; case 'plug': $edited_file = PHPWG_PLUGINS_PATH . "PersonalPlugin/main.inc.php"; $content_file = file_exists($edited_file) ? file_get_contents($edited_file) : $new_file['plug']; - $editarea['syntax'] = 'php'; + $editarea_options['syntax'] = 'php'; break; } - // +-----------------------------------------------------------------------+ // | Load backup file // +-----------------------------------------------------------------------+ if (isset($_POST['restore']) and !is_adviser()) { $edited_file = $_POST['edited_file']; - $content_file = file_get_contents( - substr_replace($edited_file , '.bak' , strrpos($edited_file ,'.') , 0)); - + $content_file = file_get_contents(get_bak_file($edited_file)); array_push($page['infos'], - l10n('locfiledit_bak_loaded1'), - l10n('locfiledit_bak_loaded2')); + l10n('locfiledit_bak_loaded1'), + l10n('locfiledit_bak_loaded2')); } - // +-----------------------------------------------------------------------+ // | Save file // +-----------------------------------------------------------------------+ @@ -232,33 +328,21 @@ if (isset($_POST['submit']) and !is_adviser()) } else { - if ($page['tab'] == 'plug' - and !is_dir(PHPWG_PLUGINS_PATH . 'PersonalPlugin')) + if ($page['tab'] == 'plug' and !is_dir(PHPWG_PLUGINS_PATH . 'PersonalPlugin')) { @mkdir(PHPWG_PLUGINS_PATH . "PersonalPlugin"); } if (file_exists($edited_file)) { - @copy($edited_file, - substr_replace($edited_file, - '.bak', - strrpos($edited_file , '.'), - 0) - ); + @copy($edited_file, get_bak_file($edited_file)); + array_push($page['infos'], sprintf(l10n('locfiledit_saved_bak'), substr(get_bak_file($edited_file), 2))); } if ($file = @fopen($edited_file , "w")) { @fwrite($file , $content_file); @fclose($file); - array_push($page['infos'], - l10n('locfiledit_save_config'), - sprintf(l10n('locfiledit_saved_bak'), - substr(substr_replace($edited_file, - '.bak', - strrpos($edited_file , '.'), - 0), - 2))); + array_unshift($page['infos'], l10n('locfiledit_save_config')); } else { @@ -267,7 +351,6 @@ if (isset($_POST['submit']) and !is_adviser()) } } - // +-----------------------------------------------------------------------+ // | template initialization // +-----------------------------------------------------------------------+ @@ -284,20 +367,22 @@ if (!empty($edited_file)) array('EDITED_FILE' => $edited_file, 'CONTENT_FILE' => htmlspecialchars($content_file), 'FILE_NAME' => trim($edited_file, './\\'))); - if (file_exists( - substr_replace($edited_file ,'.bak',strrpos($edited_file , '.'),0))) + if (file_exists(get_bak_file($edited_file))) { $template->assign('restore', true); } + if (file_exists($edited_file)) + { + $template->assign('restore_infos', true); + } + } -// Editarea -if (!isset($conf['editarea_options']) or $conf['editarea_options'] !== false) -{ - $template->assign('editarea', array( - 'URL' => LOCALEDIT_PATH . 'editarea/edit_area_full.js', - 'OPTIONS' => $editarea)); -} +$template->assign(array( + 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin&section=LocalFilesEditor%2Fadmin.php&tab=' . $page['tab'], + 'LOCALEDIT_PATH' => LOCALEDIT_PATH, + 'LOAD_EDITAREA' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'off', + 'EDITAREA_OPTIONS' => $editarea_options)); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); diff --git a/plugins/LocalFilesEditor/admin.tpl b/plugins/LocalFilesEditor/admin.tpl index 6601ab8ac..249aabc58 100644 --- a/plugins/LocalFilesEditor/admin.tpl +++ b/plugins/LocalFilesEditor/admin.tpl @@ -1,48 +1,103 @@ -{if isset($editarea)} - +{* $Id$ *} +{html_head}{/html_head} +{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} +{known_script id="editarea" src=$LOCALEDIT_PATH|@cat:"editarea/edit_area_full.js"} -{/if}

LocalFiles Editor

-
-
+ + +
+ + + +{if isset ($create_tpl)} + + + + + + + + + + + + + +
{'locfiledit_new_filename'|@translate}
{'locfiledit_parent_directory'|@translate}{html_options name=tpl_parent options=$create_tpl.PARENT_OPTIONS selected=$create_tpl.PARENT_SELECTED}
{'locfiledit_model'|@translate}{html_options name=tpl_model options=$create_tpl.MODEL_OPTIONS selected=$create_tpl.MODEL_SELECTED}
+

+ +{/if} {if isset ($css_lang_tpl)} {html_options name=file_to_edit options=$css_lang_tpl.OPTIONS selected=$css_lang_tpl.SELECTED} -
-
+

+ {if isset ($css_lang_tpl.NEW_FILE_URL)} + + {'locfiledit_new_tpl'|@translate} + + {/if} {/if} -{foreach from=$show_default item=file} +{foreach from=$show_default item=file name=default_loop} + {'locfiledit_show_default'|@translate} "{$file.FILE}" -
+
+{if !($smarty.foreach.default_loop.last)}
{/if} {/foreach} {if isset ($zone_edit)} -
- {$zone_edit.FILE_NAME} + + + +
- -
{'locfiledit_save_bak'|@translate} -

+ {if isset ($restore)} {/if} + +{if isset ($restore_infos)} +

+{'locfiledit_save_bak'|@translate} {/if} -
+{/if}
+ + diff --git a/plugins/LocalFilesEditor/editarea/edit_area_full.js b/plugins/LocalFilesEditor/editarea/edit_area_full.js index ffbbb8f07..866103bfa 100644 --- a/plugins/LocalFilesEditor/editarea/edit_area_full.js +++ b/plugins/LocalFilesEditor/editarea/edit_area_full.js @@ -1,5 +1,5 @@ - function EAL(){this.version="0.7.1.1";date=new Date();this.start_time=date.getTime();this.win="loading";this.error=false;this.baseURL="";this.template="";this.lang=new Object();this.load_syntax=new Object();this.syntax=new Object();this.loadedFiles=new Array();this.waiting_loading=new Object();this.scripts_to_load=new Array();this.sub_scripts_to_load=new Array();this.resize=new Array();this.hidden=new Object();this.default_settings={debug:false ,smooth_selection:true ,font_size:"10" ,font_family:"monospace" ,start_highlight:false ,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,|,help" ,begin_toolbar:"" ,end_toolbar:"" ,is_multi_files:false ,allow_resize:"both" ,min_width:400 ,min_height:125 ,replace_tab_by_spaces:false ,allow_toggle:true ,language:"en" ,syntax:"" ,syntax_selection_allow:"basic,brainfuck,c,cpp,css,html,js,pas,php,python,ruby,sql,vb,xml" ,display:"onload" ,max_undo:30 ,browsers:"known" ,plugins:"" ,gecko_spellcheck:false ,fullscreen:false ,is_editable:true ,load_callback:"" ,save_callback:"" ,change_callback:"" ,submit_callback:"" ,EA_init_callback:"" ,EA_delete_callback:"" ,EA_load_callback:"" ,EA_unload_callback:"" ,EA_toggle_on_callback:"" ,EA_toggle_off_callback:"" ,EA_file_switch_on_callback:"" ,EA_file_switch_off_callback:"" ,EA_file_close_callback:"" };this.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false] ];ua=navigator.userAgent;this.nav=new Object();this.nav['isMacOS']=(ua.indexOf('Mac OS')!=-1);this.nav['isIE']=(navigator.appName=="Microsoft Internet Explorer");if(this.nav['isIE']){this.nav['isIE']=ua.replace(/^.*?MSIE ([0-9\.]*).*$/,"$1");if(this.nav['isIE']<6)this.has_error();}if(this.nav['isNS']=ua.indexOf('Netscape/')!=-1){this.nav['isNS']=ua.substr(ua.indexOf('Netscape/')+9);if(this.nav['isNS']<8||!this.nav['isIE'])this.has_error();}if(this.nav['isOpera']=(ua.indexOf('Opera')!=-1)){this.nav['isOpera']=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(this.nav['isOpera']<9)this.has_error();this.nav['isIE']=false;}this.nav['isGecko']=(ua.indexOf('Gecko')!=-1);if(this.nav['isFirefox'] =(ua.indexOf('Firefox')!=-1))this.nav['isFirefox']=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel')!=-1))this.nav['isFirefox']=this.nav['isIceweasel']=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(this.nav['isCamino'] =(ua.indexOf('Camino')!=-1))this.nav['isCamino']=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(this.nav['isSafari'] =(ua.indexOf('Safari')!=-1))this.nav['isSafari']=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(this.nav['isIE']>=6||this.nav['isOpera']>=9||this.nav['isFirefox']||this.nav['isCamino']||this.nav['isSafari']>=3)this.nav['isValidBrowser']=true; -else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="
";html+="";html+="
";}if(eAs[id]["settings"]["debug"])html+="
";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span); + function EAL(){this.version="0.7.2.2";date=new Date();this.start_time=date.getTime();this.win="loading";this.error=false;this.baseURL="";this.template="";this.lang=new Object();this.load_syntax=new Object();this.syntax=new Object();this.loadedFiles=new Array();this.waiting_loading=new Object();this.scripts_to_load=new Array();this.sub_scripts_to_load=new Array();this.resize=new Array();this.hidden=new Object();this.default_settings={debug:false ,smooth_selection:true ,font_size:"10" ,font_family:"monospace" ,start_highlight:false ,autocompletion:false ,toolbar:"search,go_to_line,fullscreen,|,undo,redo,|,select_font,|,change_smooth_selection,highlight,reset_highlight,|,help" ,begin_toolbar:"" ,end_toolbar:"" ,is_multi_files:false ,allow_resize:"both" ,show_line_colors:false ,min_width:400 ,min_height:125 ,replace_tab_by_spaces:false ,allow_toggle:true ,language:"en" ,syntax:"" ,syntax_selection_allow:"basic,brainfuck,c,coldfusion,cpp,css,html,js,pas,perl,php,python,ruby,robotstxt,sql,tsql,vb,xml" ,display:"onload" ,max_undo:30 ,browsers:"known" ,plugins:"" ,gecko_spellcheck:false ,fullscreen:false ,is_editable:true ,wrap_text:false ,load_callback:"" ,save_callback:"" ,change_callback:"" ,submit_callback:"" ,EA_init_callback:"" ,EA_delete_callback:"" ,EA_load_callback:"" ,EA_unload_callback:"" ,EA_toggle_on_callback:"" ,EA_toggle_off_callback:"" ,EA_file_switch_on_callback:"" ,EA_file_switch_off_callback:"" ,EA_file_close_callback:"" };this.advanced_buttons=[ ['new_document','newdocument.gif','new_document',false],['search','search.gif','show_search',false],['go_to_line','go_to_line.gif','go_to_line',false],['undo','undo.gif','undo',true],['redo','redo.gif','redo',true],['change_smooth_selection','smooth_selection.gif','change_smooth_selection_mode',true],['reset_highlight','reset_highlight.gif','resync_highlight',true],['highlight','highlight.gif','change_highlight',true],['help','help.gif','show_help',false],['save','save.gif','save',false],['load','load.gif','load',false],['fullscreen','fullscreen.gif','toggle_full_screen',false],['autocompletion','autocompletion.gif','toggle_autocompletion',true] ];ua=navigator.userAgent;this.nav=new Object();this.nav['isMacOS']=(ua.indexOf('Mac OS')!=-1);this.nav['isIE']=(navigator.appName=="Microsoft Internet Explorer");if(this.nav['isIE']){this.nav['isIE']=ua.replace(/^.*?MSIE ([0-9\.]*).*$/,"$1");if(this.nav['isIE']<6)this.has_error();}if(this.nav['isNS']=ua.indexOf('Netscape/')!=-1){this.nav['isNS']=ua.substr(ua.indexOf('Netscape/')+9);if(this.nav['isNS']<8||!this.nav['isIE'])this.has_error();}if(this.nav['isOpera']=(ua.indexOf('Opera')!=-1)){this.nav['isOpera']=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i,"$1");if(this.nav['isOpera']<9)this.has_error();this.nav['isIE']=false;}this.nav['isGecko']=(ua.indexOf('Gecko')!=-1);if(this.nav['isFirefox'] =(ua.indexOf('Firefox')!=-1))this.nav['isFirefox']=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i,"$1");if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel')!=-1))this.nav['isFirefox']=this.nav['isIceweasel']=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i,"$1");if(this.nav['GranParadiso'] =(ua.indexOf('GranParadiso')!=-1))this.nav['isFirefox']=this.nav['isGranParadiso']=ua.replace(/^.*?GranParadiso.*?([0-9\.]+).*$/i,"$1");if(this.nav['isCamino'] =(ua.indexOf('Camino')!=-1))this.nav['isCamino']=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i,"$1");if(this.nav['isChrome'] =(ua.indexOf('Chrome')!=-1))this.nav['isChrome']=ua.replace(/^.*?Chrome.*?([0-9\.]+).*$/i,"$1");if(this.nav['isSafari'] =(ua.indexOf('Safari')!=-1))this.nav['isSafari']=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i,"$1");if(this.nav['isIE']>=6||this.nav['isOpera']>=9||this.nav['isFirefox']||this.nav['isChrome']||this.nav['isCamino']||this.nav['isSafari']>=3)this.nav['isValidBrowser']=true; +else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i0)settings["toolbar"]=settings["begin_toolbar"] +","+settings["toolbar"];if(settings["end_toolbar"].length>0)settings["toolbar"]=settings["toolbar"] +","+settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL+"reg_syntax/"+settings["syntax"]+".js");}eAs[settings["id"]]={"settings":settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);},delete_instance:function(id){eAL.execCommand(id,"EA_delete");if(window.frames["frame_"+id]&&window.frames["frame_"+id].editArea){if(eAs[id]["displayed"])eAL.toggle(id,"off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span)span.parentNode.removeChild(span);var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];},start:function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');",50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded"&&typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');",50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]]||(eAs[id]["settings"]["syntax"].length>0&&!eAL.load_syntax[eAs[id]["settings"]["syntax"]])){setTimeout("eAL.start('"+id+"');",50);return;}if(eAs[id]["settings"]["syntax"].length>0)eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id)&&(eAs[id]["settings"]["debug"]||eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="
";html+="";html+="
";}if(eAs[id]["settings"]["debug"])html+="
";html=eAL.translate(html,eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null)father.appendChild(span); else father.insertBefore(span,next);}if(!eAs[id]["initialized"]){this.execCommand(id,"EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i';}for(var i=0;i';this.iframe_script+='';}if(!this.iframe_css){this.iframe_css="";}var template=this.template.replace(/\[__BASEURL__\]/g,this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template,area["settings"]["language"],"template");template=template.replace("[__CSSRULES__]",this.iframe_css);template=template.replace("[__JSCODE__]",this.iframe_script);template=template.replace("[__EA_VERSION__]",this.version);area.textarea=document.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined')delete window.frames["frame_"+area["settings"]["id"]];var father=area.textarea.parentNode;var content=document.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content,"frameBorder","0");content.style.overflow="hidden";content.style.display="none";var next=area.textarea.nextSibling;if(next==null)father.appendChild(content); else father.insertBefore(content,next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.document.close();},toggle:function(id,toggle_to){if(!toggle_to)toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true &&toggle_to=="off"){this.toggle_off(id);} else if(eAs[id]["displayed"]==false &&toggle_to=="on"){this.toggle_on(id);}return false;},toggle_off:function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];if(frame.editArea.fullscreen['isFull'])frame.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;eAs[id]["textarea"].wrap="off";setAttribute(eAs[id]["textarea"],"wrap","off");var parNod=eAs[id]["textarea"].parentNode;var nxtSib=eAs[id]["textarea"].nextSibling;parNod.removeChild(eAs[id]["textarea"]);parNod.insertBefore(eAs[id]["textarea"],nxtSib);eAs[id]["textarea"].value=frame.editArea.textarea.value;var selStart=frame.editArea.last_selection["selectionStart"];var selEnd=frame.editArea.last_selection["selectionEnd"];var scrollTop=frame.document.getElementById("result").scrollTop;var scrollLeft=frame.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';eAs[id]["textarea"].style.display="inline";eAs[id]["textarea"].focus();if(this.nav['isIE']){eAs[id]["textarea"].selectionStart=selStart;eAs[id]["textarea"].selectionEnd=selEnd;eAs[id]["textarea"].focused=true;set_IE_selection(eAs[id]["textarea"]);} @@ -33,6 +33,6 @@ else return null;}var move_current_element;function start_move_element(e,id,fram EAL.prototype.start_resize_area=function(){document.onmouseup=eAL.end_resize_area;document.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);var textarea=eAs[eAL.resize["id"]]["textarea"];var div=document.getElementById("edit_area_resize");if(!div){div=document.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}var width=textarea.offsetWidth -2;var height=textarea.offsetHeight -2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";var father=textarea.parentNode;father.insertBefore(div,textarea);textarea.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){document.onmouseup="";document.onmousemove="";var div=document.getElementById("edit_area_resize");var textarea=eAs[eAL.resize["id"]]["textarea"];var width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"],div.offsetWidth-4);var height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"],div.offsetHeight-4);if(eAL.nav['isIE']==6){width-=2;height-=2;}textarea.style.width=width+"px";textarea.style.height=height+"px";div.style.display="none";textarea.style.display="inline";textarea.selectionStart=eAL.resize["selectionStart"];textarea.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both"||allow=="y"){new_y=getMouseY(e);var new_height=Math.max(20,new_y-eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=new_height+"px";}if(allow=="both"||allow=="x"){new_x=getMouseX(e);var new_width=Math.max(20,new_x-eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=new_width+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0)res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g,"\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style=new Object();for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]=new Object();this.syntax[lang]["keywords_reg_exp"]=new Object();this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false)param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function")continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp(this.load_syntax[lang]['KEYWORDS'][i] ),param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0)this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function")continue;if(nb>0)str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0)this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=new Array();this.syntax[lang]["quotes"]=new Object();var quote_tab=new Array();if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(?:[^"+x+"\\\\]*(\\\\\\\\)*(\\\\"+x+"?)?)*("+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]=new Object();if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function")continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function")continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0)this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0)this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+syntax_trace.join("|")+"|$))","gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]=new Object();for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function")continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]=new Object();if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function")continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']])this.syntax[lang]["custom_regexp"][val['execute']]=new Object();this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp':new RegExp(val['search'],val['modifiers']),'class':val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]=new Object();for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function")continue;if(typeof(this.load_syntax[lang]['STYLES'][i])!="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}} else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+lang +" ."+i.toLowerCase()+" span{"+lang_style[lang][i]+"}\n";style+="."+lang +" ."+i.toLowerCase()+"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded"; -var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false'); +var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= "".replace(/Á/g,'this').replace(/Â/g,'textarea').replace(/Ã/g,'function').replace(/Ä/g,'prototype').replace(/Å/g,'settings').replace(/Æ/g,'length').replace(/Ç/g,'style').replace(/È/g,'parent').replace(/É/g,'last_selection').replace(/Ê/g,'value').replace(/Ë/g,'true').replace(/Ì/g,'false'); editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
[__TOOLBAR__]
 
 
{$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
{$processing}
{$search} {$close_popup}
{$replace} {$move_popup}

{$find_next} {$replace} {$replace_all}
{$close_popup}

Editarea [__EA_VERSION__]


{$shortcuts}:

{$tab}: {$add_tab}
{$shift}+{$tab}: {$remove_tab}
{$ctrl}+f: {$search_command}
{$ctrl}+r: {$replace_command}
{$ctrl}+h: {$highlight}
{$ctrl}+g: {$go_to_line}
{$ctrl}+z: {$undo}
{$ctrl}+y: {$redo}
{$ctrl}+e: {$help}
{$ctrl}+q, {$esc}: {$close_popup}
{$accesskey} E: {$toggle}

{$about_notice}
"; -editAreaLoader.iframe_css= ""; +editAreaLoader.iframe_css= ""; diff --git a/plugins/LocalFilesEditor/editarea/images/autocompletion.gif b/plugins/LocalFilesEditor/editarea/images/autocompletion.gif new file mode 100644 index 000000000..f3dfc2e3a Binary files /dev/null and b/plugins/LocalFilesEditor/editarea/images/autocompletion.gif differ diff --git a/plugins/LocalFilesEditor/editarea/langs/cs.js b/plugins/LocalFilesEditor/editarea/langs/cs.js index cb7ff1e89..359b15a30 100644 --- a/plugins/LocalFilesEditor/editarea/langs/cs.js +++ b/plugins/LocalFilesEditor/editarea/langs/cs.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/de.js b/plugins/LocalFilesEditor/editarea/langs/de.js index cd953473f..e238497f9 100644 --- a/plugins/LocalFilesEditor/editarea/langs/de.js +++ b/plugins/LocalFilesEditor/editarea/langs/de.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/dk.js b/plugins/LocalFilesEditor/editarea/langs/dk.js index 75700ec65..2970baabf 100644 --- a/plugins/LocalFilesEditor/editarea/langs/dk.js +++ b/plugins/LocalFilesEditor/editarea/langs/dk.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/en.js b/plugins/LocalFilesEditor/editarea/langs/en.js index aa432163b..2a942eb77 100644 --- a/plugins/LocalFilesEditor/editarea/langs/en.js +++ b/plugins/LocalFilesEditor/editarea/langs/en.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/es.js b/plugins/LocalFilesEditor/editarea/langs/es.js index 0e425014a..b49c84bbc 100644 --- a/plugins/LocalFilesEditor/editarea/langs/es.js +++ b/plugins/LocalFilesEditor/editarea/langs/es.js @@ -57,5 +57,6 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/fr.js b/plugins/LocalFilesEditor/editarea/langs/fr.js index b24bd03ae..99b49c738 100644 --- a/plugins/LocalFilesEditor/editarea/langs/fr.js +++ b/plugins/LocalFilesEditor/editarea/langs/fr.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Fermer le fichier" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/hr.js b/plugins/LocalFilesEditor/editarea/langs/hr.js index f37b28c5e..5980c1690 100644 --- a/plugins/LocalFilesEditor/editarea/langs/hr.js +++ b/plugins/LocalFilesEditor/editarea/langs/hr.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/it.js b/plugins/LocalFilesEditor/editarea/langs/it.js index 2191e6b26..a6840cdc6 100644 --- a/plugins/LocalFilesEditor/editarea/langs/it.js +++ b/plugins/LocalFilesEditor/editarea/langs/it.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/ja.js b/plugins/LocalFilesEditor/editarea/langs/ja.js index 3afc1cb7d..bb21ab139 100644 --- a/plugins/LocalFilesEditor/editarea/langs/ja.js +++ b/plugins/LocalFilesEditor/editarea/langs/ja.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/mk.js b/plugins/LocalFilesEditor/editarea/langs/mk.js index 7cacb038c..46daa3905 100644 --- a/plugins/LocalFilesEditor/editarea/langs/mk.js +++ b/plugins/LocalFilesEditor/editarea/langs/mk.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Избери датотека" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/nl.js b/plugins/LocalFilesEditor/editarea/langs/nl.js index 00cbbe3a6..920e9cf77 100644 --- a/plugins/LocalFilesEditor/editarea/langs/nl.js +++ b/plugins/LocalFilesEditor/editarea/langs/nl.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/pl.js b/plugins/LocalFilesEditor/editarea/langs/pl.js index 501ec9a2b..a820285f9 100644 --- a/plugins/LocalFilesEditor/editarea/langs/pl.js +++ b/plugins/LocalFilesEditor/editarea/langs/pl.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/pt.js b/plugins/LocalFilesEditor/editarea/langs/pt.js index 547796b0a..36d174225 100644 --- a/plugins/LocalFilesEditor/editarea/langs/pt.js +++ b/plugins/LocalFilesEditor/editarea/langs/pt.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/ru.js b/plugins/LocalFilesEditor/editarea/langs/ru.js index 56b3cd57c..e7e6b6edf 100644 --- a/plugins/LocalFilesEditor/editarea/langs/ru.js +++ b/plugins/LocalFilesEditor/editarea/langs/ru.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Закрыть файл" }; diff --git a/plugins/LocalFilesEditor/editarea/langs/sk.js b/plugins/LocalFilesEditor/editarea/langs/sk.js index 3d4881a3f..e72436527 100644 --- a/plugins/LocalFilesEditor/editarea/langs/sk.js +++ b/plugins/LocalFilesEditor/editarea/langs/sk.js @@ -57,5 +57,9 @@ syntax_pas: "Pascal", syntax_brainfuck: "Brainfuck", syntax_sql: "SQL", syntax_ruby: "Ruby", +syntax_robotstxt: "Robots txt", +syntax_tsql: "T-SQL", +syntax_perl: "Perl", +syntax_coldfusion: "Coldfusion", close_tab: "Close file" }; diff --git a/plugins/LocalFilesEditor/editarea/reg_syntax/html.js b/plugins/LocalFilesEditor/editarea/reg_syntax/html.js index cc2a90e6e..a6cf060fe 100644 --- a/plugins/LocalFilesEditor/editarea/reg_syntax/html.js +++ b/plugins/LocalFilesEditor/editarea/reg_syntax/html.js @@ -4,7 +4,10 @@ editAreaLoader.load_syntax["html"] = { 'COMMENT_SINGLE' : {} - ,'COMMENT_MULTI' : {''} + ,'COMMENT_MULTI' : { + '', + '{*' : '*}' + } ,'QUOTEMARKS' : {1: "'", 2: '"'} ,'KEYWORD_CASE_SENSITIVE' : false ,'KEYWORDS' : { diff --git a/plugins/LocalFilesEditor/editarea/reg_syntax/js.js b/plugins/LocalFilesEditor/editarea/reg_syntax/js.js deleted file mode 100644 index 8c7beb624..000000000 --- a/plugins/LocalFilesEditor/editarea/reg_syntax/js.js +++ /dev/null @@ -1,60 +0,0 @@ -editAreaLoader.load_syntax["js"] = { - 'COMMENT_SINGLE' : {1 : '//'} - ,'COMMENT_MULTI' : {'/*' : '*/'} - ,'QUOTEMARKS' : {1: "'", 2: '"'} - ,'KEYWORD_CASE_SENSITIVE' : false - ,'KEYWORDS' : { - 'statements' : [ - 'as', 'break', 'case', 'catch', 'continue', 'decodeURI', 'delete', 'do', - 'else', 'encodeURI', 'eval', 'finally', 'for', 'if', 'in', 'is', 'item', - 'instanceof', 'return', 'switch', 'this', 'throw', 'try', 'typeof', 'void', - 'while', 'write', 'with' - ] - ,'keywords' : [ - 'class', 'const', 'default', 'debugger', 'export', 'extends', 'false', - 'function', 'import', 'namespace', 'new', 'null', 'package', 'private', - 'protected', 'public', 'super', 'true', 'use', 'var', 'window', 'document', - // the list below must be sorted and checked (if it is a keywords or a function and if it is not present twice - 'Link ', 'outerHeight ', 'Anchor', 'FileUpload', - 'location', 'outerWidth', 'Select', 'Area', 'find', 'Location', 'Packages', 'self', - 'arguments', 'locationbar', 'pageXoffset', 'Form', - 'Math', 'pageYoffset', 'setTimeout', 'assign', 'Frame', 'menubar', 'parent', 'status', - 'blur', 'frames', 'MimeType', 'parseFloat', 'statusbar', 'Boolean', 'Function', 'moveBy', - 'parseInt', 'stop', 'Button', 'getClass', 'moveTo', 'Password', 'String', 'callee', 'Hidden', - 'name', 'personalbar', 'Submit', 'caller', 'history', 'NaN', 'Plugin', 'sun', 'captureEvents', - 'History', 'navigate', 'print', 'taint', 'Checkbox', 'home', 'navigator', 'prompt', 'Text', - 'Image', 'Navigator', 'prototype', 'Textarea', 'clearTimeout', 'Infinity', - 'netscape', 'Radio', 'toolbar', 'close', 'innerHeight', 'Number', 'ref', 'top', 'closed', - 'innerWidth', 'Object', 'RegExp', 'toString', 'confirm', 'isFinite', 'onBlur', 'releaseEvents', - 'unescape', 'constructor', 'isNan', 'onError', 'Reset', 'untaint', 'Date', 'java', 'onFocus', - 'resizeBy', 'unwatch', 'defaultStatus', 'JavaArray', 'onLoad', 'resizeTo', 'valueOf', 'document', - 'JavaClass', 'onUnload', 'routeEvent', 'watch', 'Document', 'JavaObject', 'open', 'scroll', 'window', - 'Element', 'JavaPackage', 'opener', 'scrollbars', 'Window', 'escape', 'length', 'Option', 'scrollBy' - ] - ,'functions' : [ - // common functions for Window object - 'alert', 'Array', 'back', 'blur', 'clearInterval', 'close', 'confirm', 'eval ', 'focus', 'forward', 'home', - 'name', 'navigate', 'onblur', 'onerror', 'onfocus', 'onload', 'onmove', - 'onresize', 'onunload', 'open', 'print', 'prompt', 'scroll', 'scrollTo', 'setInterval', 'status', - 'stop' - ] - } - ,'OPERATORS' :[ - '+', '-', '/', '*', '=', '<', '>', '%', '!' - ] - ,'DELIMITERS' :[ - '(', ')', '[', ']', '{', '}' - ] - ,'STYLES' : { - 'COMMENTS': 'color: #AAAAAA;' - ,'QUOTESMARKS': 'color: #6381F8;' - ,'KEYWORDS' : { - 'statements' : 'color: #60CA00;' - ,'keywords' : 'color: #48BDDF;' - ,'functions' : 'color: #2B60FF;' - } - ,'OPERATORS' : 'color: #FF00FF;' - ,'DELIMITERS' : 'color: #0038E1;' - - } -}; diff --git a/plugins/LocalFilesEditor/editarea/reg_syntax/php.js b/plugins/LocalFilesEditor/editarea/reg_syntax/php.js index 535a22bd3..a1c5883af 100644 --- a/plugins/LocalFilesEditor/editarea/reg_syntax/php.js +++ b/plugins/LocalFilesEditor/editarea/reg_syntax/php.js @@ -11,7 +11,7 @@ editAreaLoader.load_syntax["php"] = { 'return', 'break', 'continue' ] ,'reserved' : [ - '_GET', '_POST', '_SERVER', '_FILES', '_ENV', '_COOKIE', '_REQUEST', + '_GET', '_POST', '_SESSION', '_SERVER', '_FILES', '_ENV', '_COOKIE', '_REQUEST', 'null', '__LINE__', '__FILE__', 'false', '<?php', '?>', '<?', '<script language', '</script>', @@ -72,4 +72,85 @@ editAreaLoader.load_syntax["php"] = { 'variables' : 'color: #E0BD54;' } } + ,'AUTO_COMPLETION' : { + "default": { // the name of this definition group. It's posisble to have different rules inside the same definition file + "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.| + ,"possible_words_letters": "[a-zA-Z0-9_\$]+" + ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$" + ,"prefix_separator": "\\-\\>|\\:\\:" + } + ,"CASE_SENSITIVE": true + ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position + ,"KEYWORDS": { + '': [ // the prefix of thoses items + /** + * 0 : the keyword the user is typing + * 1 : (optionnal) the string inserted in code ("{@}" being the new position of the cursor, "§" beeing the equivalent to the value the typed string indicated if the previous ) + * If empty the keyword will be displayed + * 2 : (optionnal) the text that appear in the suggestion box (if empty, the string to insert will be displayed) + */ + ['$_POST'] + ,['$_GET'] + ,['$_SESSION'] + ,['$_SERVER'] + ,['$_FILES'] + ,['$_ENV'] + ,['$_COOKIE'] + ,['$_REQUEST'] + // magic methods + ,['__construct', '§( {@} )'] + ,['__destruct', '§( {@} )'] + ,['__sleep', '§( {@} )'] + ,['__wakeup', '§( {@} )'] + ,['__toString', '§( {@} )'] + // include + ,['include', '§ "{@}";'] + ,['include_once', '§ "{@}";'] + ,['require', '§ "{@}";'] + ,['require_once', '§ "{@}";'] + // statements + ,['for', '§( {@} )'] + ,['foreach', '§( {@} )'] + ,['if', '§( {@} )'] + ,['elseif', '§( {@} )'] + ,['while', '§( {@} )'] + ,['switch', '§( {@} )'] + ,['break'] + ,['case'] + ,['continue'] + ,['do'] + ,['else'] + ,['endif'] + ,['endswitch'] + ,['endwhile'] + ,['return'] + // function + ,['unset', '§( {@} )'] + ] + } + } + ,"live": { + + // class NAME: /class\W+([a-z]+)\W+/gi + // method: /^(public|private|protected)?\s*function\s+([a-z][a-z0-9\_]*)\s*(\([^\{]*\))/gmi + // static: /^(public|private|protected)?\s+static\s+(public|private|protected)?\s*function\s+([a-z][a-z0-9\_]*)\s*(\([^\{]*\))/gmi + // attributes: /(\$this\-\>|(?:var|public|protected|private)\W+\$)([a-z0-9\_]+)(?!\()\b/gi + // v1 : /(\$this\-\>|var\W+|public\W+|protected\W+|private\W+)([a-z0-9\_]+)\W*(=|;)/gi + // var type: /(\$(this\-\>)?[a-z0-9\_]+)\s*\=\s*new\s+([a-z0-9\_])+/gi + + + "REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.| + ,"possible_words_letters": "[a-zA-Z0-9_\$]+" + ,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$" + ,"prefix_separator": "\\-\\>" + } + ,"CASE_SENSITIVE": true + ,"MAX_TEXT_LENGTH": 100 // the maximum length of the text being analyzed before the cursor position + ,"KEYWORDS": { + '$this': [ // the prefix of thoses items + ['test'] + ] + } + } + } }; diff --git a/plugins/LocalFilesEditor/editarea/reg_syntax/sql.js b/plugins/LocalFilesEditor/editarea/reg_syntax/sql.js deleted file mode 100644 index f4530a99c..000000000 --- a/plugins/LocalFilesEditor/editarea/reg_syntax/sql.js +++ /dev/null @@ -1,55 +0,0 @@ -editAreaLoader.load_syntax["sql"] = { - 'COMMENT_SINGLE' : {1 : '--'} - ,'COMMENT_MULTI' : {'/*' : '*/'} - ,'QUOTEMARKS' : {1: "'", 2: '"', 3: '`'} - ,'KEYWORD_CASE_SENSITIVE' : false - ,'KEYWORDS' : { - 'statements' : [ - 'select', 'SELECT', 'where', 'order', 'by', - 'insert', 'from', 'update', 'grant', 'left join', 'right join', - 'union', 'group', 'having', 'limit', 'alter', 'LIKE','IN','CASE' - ] - ,'reserved' : [ - 'null', 'enum', 'int', 'boolean', 'add', 'varchar' - - ] - ,'functions' : [ - 'ABS','ACOS','ADDDATE','ADDTIME','AES_DECRYPT','AES_ENCRYPT','ASCII','ASIN','ATAN2 ATAN','ATAN','AVG','BENCHMARK','DISTINCT','BIN','BIT_AND','BIT_COUNT','BIT_LENGTH','BIT_OR','BIT_XOR','CAST','CEILING CEIL','CHAR_LENGTH','CHAR', -'CHARACTER_LENGTH','CHARSET','COALESCE','COERCIBILITY','COLLATION','COMPRESS','CONCAT_WS','CONCAT','CONNECTION_ID','CONV','CONVERT_TZ','COS','COT','COUNT','CRC32','CURDATE','CURRENT_DATE','CURRENT_TIME','CURRENT_TIMESTAMP','CURRENT_USER','CURTIME','DATABASE','DATE_ADD','DATE_FORMAT','DATE_SUB','DATE','DATEDIFF','DAY','DAYNAME','DAYOFMONTH', -'DAYOFWEEK','DAYOFYEAR','DECODE','DEFAULT','DEGREES','DES_DECRYPT','DES_ENCRYPT','ELT','ENCODE','ENCRYPT','EXP','EXPORT_SET','EXTRACT','FIELD','FIND_IN_SET','FLOOR','FORMAT','FOUND_ROWS','FROM_DAYS','FROM_UNIXTIME','GET_FORMAT','GET_LOCK','GREATEST','GROUP_CONCAT','HEX','HOUR','IF','IFNULL','INET_ATON','INET_NTOA', -'INSERT','INSTR','INTERVAL','IS_FREE_LOCK','IS_USED_LOCK','ISNULL','LAST_DAY','LAST_INSERT_ID','LCASE','LEAST','LEFT','LENGTH','LN','LOAD_FILE','LOCALTIME','LOCALTIMESTAMP','LOCATE','LOG10','LOG2','LOG','LOWER','LPAD','LTRIM','MAKE_SET','MAKEDATE','MAKETIME','MASTER_POS_WAIT','MAX','MD5','MICROSECOND', -'MID','MIN','MINUTE','MOD','MONTH','MONTHNAME','NOW','NULLIF','OCT','OCTET_LENGTH','OLD_PASSWORD','ORD','PASSWORD','PERIOD_ADD','PERIOD_DIFF','PI','POSITION','POW','POWER','PROCEDURE ANALYSE','QUARTER','QUOTE','RADIANS','RAND','RELEASE_LOCK','REPEAT','REPLACE','REVERSE','RIGHT','ROUND', -'RPAD','RTRIM','SEC_TO_TIME','SECOND','SESSION_USER','SHA1','SHA','SIGN','SIN','SOUNDEX','SOUNDS LIKE','SPACE','SQRT','STD','STDDEV','STR_TO_DATE','STRCMP','SUBDATE','SUBSTRING_INDEX','SUBSTRING','SUBSTR','SUBTIME','SUM','SYSDATE','SYSTEM_USER','TAN','TIME_FORMAT','TIME_TO_SEC','TIME','TIMEDIFF', -'TIMESTAMP','TO_DAYS','TRIM','TRUNCATE','UCASE','UNCOMPRESS','UNCOMPRESSED_LENGTH','UNHEX','UNIX_TIMESTAMP','UPPER','USER','UTC_DATE','UTC_TIME','UTC_TIMESTAMP','UUID','VALUES','VARIANCE','WEEK','WEEKDAY','WEEKOFYEAR','YEAR','YEARWEEK' - ] - } - ,'OPERATORS' :[ - 'AND','&&','BETWEEN','BINARY','&','|','^','/','DIV','<=>','=','>=','>','<<','>>','IS','NULL','<=','<','-','%','!=','<>','!','||','OR','+','REGEXP','RLIKE','XOR','~','*' - ] - ,'DELIMITERS' :[ - '(', ')', '[', ']', '{', '}' - ] - ,'REGEXPS' : { - // highlight all variables (@...) - 'variables' : { - 'search' : '()(\\@\\w+)()' - ,'class' : 'variables' - ,'modifiers' : 'g' - ,'execute' : 'before' // before or after - } - } - ,'STYLES' : { - 'COMMENTS': 'color: #AAAAAA;' - ,'QUOTESMARKS': 'color: #879EFA;' - ,'KEYWORDS' : { - 'reserved' : 'color: #48BDDF;' - ,'functions' : 'color: #0040FD;' - ,'statements' : 'color: #60CA00;' - } - ,'OPERATORS' : 'color: #FF00FF;' - ,'DELIMITERS' : 'color: #2B60FF;' - ,'REGEXPS' : { - 'variables' : 'color: #E0BD54;' - } - } -}; diff --git a/plugins/LocalFilesEditor/editarea/reg_syntax/xml.js b/plugins/LocalFilesEditor/editarea/reg_syntax/xml.js deleted file mode 100644 index a043dd63a..000000000 --- a/plugins/LocalFilesEditor/editarea/reg_syntax/xml.js +++ /dev/null @@ -1,56 +0,0 @@ -/* -* last update: 2006-08-24 -*/ - -editAreaLoader.load_syntax["xml"] = { - 'COMMENT_SINGLE' : {} - ,'COMMENT_MULTI' : {''} - ,'QUOTEMARKS' : {1: "'", 2: '"'} - ,'KEYWORD_CASE_SENSITIVE' : false - ,'KEYWORDS' : { - } - ,'OPERATORS' :[ - ] - ,'DELIMITERS' :[ - ] - ,'REGEXPS' : { - 'xml' : { - 'search' : '()(<\\?[^>]*?\\?>)()' - ,'class' : 'xml' - ,'modifiers' : 'g' - ,'execute' : 'before' // before or after - } - ,'cdatas' : { - 'search' : '()()()' - ,'class' : 'cdata' - ,'modifiers' : 'g' - ,'execute' : 'before' // before or after - } - ,'tags' : { - 'search' : '(<)(/?[a-z][^ \r\n\t>]*)([^>]*>)' - ,'class' : 'tags' - ,'modifiers' : 'gi' - ,'execute' : 'before' // before or after - } - ,'attributes' : { - 'search' : '( |\n|\r|\t)([^ \r\n\t=]+)(=)' - ,'class' : 'attributes' - ,'modifiers' : 'g' - ,'execute' : 'before' // before or after - } - } - ,'STYLES' : { - 'COMMENTS': 'color: #AAAAAA;' - ,'QUOTESMARKS': 'color: #6381F8;' - ,'KEYWORDS' : { - } - ,'OPERATORS' : 'color: #E775F0;' - ,'DELIMITERS' : '' - ,'REGEXPS' : { - 'attributes': 'color: #B1AC41;' - ,'tags': 'color: #E62253;' - ,'xml': 'color: #8DCFB5;' - ,'cdata': 'color: #50B020;' - } - } -}; diff --git a/plugins/LocalFilesEditor/functions.inc.php b/plugins/LocalFilesEditor/functions.inc.php index b53806bfb..97813dce0 100644 --- a/plugins/LocalFilesEditor/functions.inc.php +++ b/plugins/LocalFilesEditor/functions.inc.php @@ -29,22 +29,25 @@ */ function eval_syntax($code) { - $code = str_replace(array(''), '', $code); + $code = str_replace(array(''), '', $code); + if (function_exists('token_get_all')) + { $b = 0; foreach (token_get_all($code) as $token) - { - if ('{' == $token) ++$b; - else if ('}' == $token) --$b; + { + if ('{' == $token) ++$b; + else if ('}' == $token) --$b; } if ($b) return false; else - { - ob_start(); - $eval = eval('if(0){' . $code . '}'); - ob_end_clean(); - if ($eval === false) return false; - else return ''; + { + ob_start(); + $eval = eval('if(0){' . $code . '}'); + ob_end_clean(); + if ($eval === false) return false; } + } + return ''; } /** @@ -67,4 +70,45 @@ function editarea_quote($value) } } +/** + * returns bak file for restore + * @param string + */ +function get_bak_file($file) +{ + if (get_extension($file) == 'php') + { + return substr_replace($file, '.bak', strrpos($file , '.'), 0); + } + else + { + return $file . '.bak'; + } +} + +/** + * returns dirs and subdirs + * retun array + * @param string + */ +function get_rec_dirs($path='') +{ + $options = array(); + if (is_dir($path)) + { + $fh = opendir($path); + while ($file = readdir($fh)) + { + $pathfile = $path . '/' . $file; + if ($file != '.' and $file != '..' and $file != '.svn' and is_dir($pathfile)) + { + $options[$pathfile] = str_replace(array('./', '/'), array('', ' / '), $pathfile); + $options = array_merge($options, get_rec_dirs($pathfile)); + } + } + closedir($fh); + } + return $options; +} + ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php index 9f608efca..42f53aec4 100644 --- a/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php @@ -27,7 +27,7 @@ $lang['locfiledit_onglet_tpl'] = 'Templates'; $lang['locfiledit_onglet_lang'] = 'Languages'; $lang['locfiledit_onglet_plug'] = 'Personal Plugin'; $lang['locfiledit_cant_save'] = 'Current file isn\'t writeable. Check if a directory "include/" is writeable (chmod).'; -$lang['locfiledit_newfile'] = "/* File is not existing and will be created by LocalFiles Editor. */"; +$lang['locfiledit_newfile'] = 'File is not existing and will be created by LocalFiles Editor'; $lang['locfiledit_save_config'] = 'File written successfully.'; $lang['locfiledit_show_default'] = 'Display reference file: '; $lang['locfiledit_save_bak'] = 'Backup copy will be created on save.'; @@ -41,5 +41,15 @@ Restore won\'t be effective till next save.'; $lang['locfiledit_bak_loaded1'] = 'Backup file loaded.'; $lang['locfiledit_bak_loaded2'] = 'You must save file to restore it.'; $lang['locfiledit_syntax_error'] = 'Syntax error! File can\'t be saved.'; +$lang['locfiledit_enable_editarea'] = 'Enable Editarea'; +$lang['locfiledit_disable_editarea'] = 'Disable Editarea'; +$lang['locfiledit_new_tpl'] = 'Create new file'; +$lang['locfiledit_new_filename'] = 'File name'; +$lang['locfiledit_model'] = 'Model'; +$lang['locfiledit_empty_page'] = 'Empty page'; +$lang['locfiledit_parent_directory'] = 'Parent directory'; +$lang['locfiledit_filename_error'] = 'Forbidden caraters in file name.'; +$lang['locfiledit_file_already_exists'] = 'File already exists.'; +$lang['locfiledit_model_error'] = 'You must choose a model.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php index 3652a53e1..01a8a8922 100644 --- a/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php @@ -27,7 +27,7 @@ $lang['locfiledit_onglet_tpl'] = 'Templates'; $lang['locfiledit_onglet_lang'] = 'Idiomas'; $lang['locfiledit_onglet_plug'] = 'Plugin personal'; $lang['locfiledit_cant_save'] = 'Imposible escribir el fichero. Verifique los permisos (chmod) del expediente "include/".'; -$lang['locfiledit_newfile'] = "/* El fichero no existe y será creado en el momento del registro por LocalFiles Editor. */"; +$lang['locfiledit_newfile'] = 'El fichero no existe y será creado en el momento del registro por LocalFiles Editor'; $lang['locfiledit_save_config'] = 'El fichero ha sido registrado.'; $lang['locfiledit_show_default'] = 'Fijar el fichero '; $lang['locfiledit_save_bak'] = 'Una copia de salvaguardia del fichero será creada en el momento del registro'; @@ -41,5 +41,15 @@ Usted deberá luego hacer clic Registrar para restaurarlo.'; $lang['locfiledit_bak_loaded1'] = 'Fichero cargado de salvaguardia'; $lang['locfiledit_bak_loaded2'] = 'Usted debe registrarlo para salvaguardarlo.'; $lang['locfiledit_syntax_error'] = '¡ Error de sintaxis! Imposible registrar el fichero.'; +/* TODO */ $lang['locfiledit_enable_editarea'] = 'Enable Editarea'; +/* TODO */ $lang['locfiledit_disable_editarea'] = 'Disable Editarea'; +/* TODO */$lang['locfiledit_new_tpl'] = 'Créer un nouveau fichier'; +/* TODO */$lang['locfiledit_new_filename'] = 'Nom du fichier'; +/* TODO */$lang['locfiledit_model'] = 'Modèle'; +/* TODO */$lang['locfiledit_empty_page'] = 'Page vierge'; +/* TODO */$lang['locfiledit_parent_directory'] = 'Dossier parent'; +/* TODO */$lang['locfiledit_filename_error'] = 'Caractères interdits dans le nom du fichier.'; +/* TODO */$lang['locfiledit_file_already_exists'] = 'Le fichier existe déjà.'; +/* TODO */$lang['locfiledit_model_error'] = 'Veuillez sélectionner un modèle.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php index 3e0b65227..40c56492a 100644 --- a/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php @@ -27,7 +27,7 @@ $lang['locfiledit_onglet_tpl'] = 'Templates'; $lang['locfiledit_onglet_lang'] = 'Langues'; $lang['locfiledit_onglet_plug'] = 'Plugin Personnel'; $lang['locfiledit_cant_save'] = 'Impossible d\'écrire le fichier. Vérifiez les permissions (chmod) du dossier "include/".'; -$lang['locfiledit_newfile'] = "/* Le fichier n'existe pas et sera créé lors de l'enregistrement par LocalFiles Editor. */"; +$lang['locfiledit_newfile'] = 'Le fichier n\'existe pas et sera créé lors de l\'enregistrement par LocalFiles Editor'; $lang['locfiledit_save_config'] = 'Le fichier a été enregistré.'; $lang['locfiledit_show_default'] = 'Afficher le fichier '; $lang['locfiledit_save_bak'] = 'Une copie de sauvegarde du fichier sera créée lors de l\'enregistrement'; @@ -41,5 +41,15 @@ Vous devrez ensuite cliquer sur Enregistrer pour le restaurer.'; $lang['locfiledit_bak_loaded1'] = 'Fichier de sauvegarde chargé'; $lang['locfiledit_bak_loaded2'] = 'Vous devez l\'enregistrer pour le sauvegarder.'; $lang['locfiledit_syntax_error'] = 'Erreur de syntaxe! Impossible d\'enregistrer le fichier.'; +$lang['locfiledit_enable_editarea'] = 'Activer Editarea'; +$lang['locfiledit_disable_editarea'] = 'Désactiver Editarea'; +$lang['locfiledit_new_tpl'] = 'Créer un nouveau fichier'; +$lang['locfiledit_new_filename'] = 'Nom du fichier'; +$lang['locfiledit_model'] = 'Modèle'; +$lang['locfiledit_empty_page'] = 'Page vierge'; +$lang['locfiledit_parent_directory'] = 'Dossier parent'; +$lang['locfiledit_filename_error'] = 'Caractères interdits dans le nom du fichier.'; +$lang['locfiledit_file_already_exists'] = 'Le fichier existe déjà.'; +$lang['locfiledit_model_error'] = 'Veuillez sélectionner un modèle.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php b/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php index bbd151a11..fa9f6b076 100644 --- a/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php +++ b/plugins/LocalFilesEditor/language/it_IT/plugin.lang.php @@ -27,7 +27,7 @@ $lang['locfiledit_onglet_tpl'] = 'Templates'; $lang['locfiledit_onglet_lang'] = 'Lingue'; $lang['locfiledit_onglet_plug'] = 'Plugin Personale'; $lang['locfiledit_cant_save'] = 'Impossibile di scrivere il file. Verificare i permessi (chmod) della directory.'; -$lang['locfiledit_newfile'] = "/* Il file non esiste e sarà creato durante la fase di registrazione con LocalFiles Editor. */"; +$lang['locfiledit_newfile'] = 'Il file non esiste e sarà creato durante la fase di registrazione con LocalFiles Editor'; $lang['locfiledit_save_config'] = 'Il file è stato salvato.'; $lang['locfiledit_show_default'] = 'Visualizzare il file '; $lang['locfiledit_save_bak'] = 'Una copia di backup del file sarà creata durante la fase di registrazione'; @@ -40,5 +40,15 @@ $lang['locfiledit_restore_confirm'] = 'Volete caricare il file di backup? Dovret $lang['locfiledit_bak_loaded1'] = 'Copia di backup caricata'; $lang['locfiledit_bak_loaded2'] = 'Dovete registrarlo per salvarlo.'; $lang['locfiledit_syntax_error'] = 'Errore di sintassi! Impossible di registrare il file.'; +/* TODO */ $lang['locfiledit_enable_editarea'] = 'Enable Editarea'; +/* TODO */ $lang['locfiledit_disable_editarea'] = 'Disable Editarea'; +/* TODO */$lang['locfiledit_new_tpl'] = 'Créer un nouveau fichier'; +/* TODO */$lang['locfiledit_new_filename'] = 'Nom du fichier'; +/* TODO */$lang['locfiledit_model'] = 'Modèle'; +/* TODO */$lang['locfiledit_empty_page'] = 'Page vierge'; +/* TODO */$lang['locfiledit_parent_directory'] = 'Dossier parent'; +/* TODO */$lang['locfiledit_filename_error'] = 'Caractères interdits dans le nom du fichier.'; +/* TODO */$lang['locfiledit_file_already_exists'] = 'Le fichier existe déjà.'; +/* TODO */$lang['locfiledit_model_error'] = 'Veuillez sélectionner un modèle.'; ?> \ No newline at end of file diff --git a/plugins/LocalFilesEditor/locfiledit.css b/plugins/LocalFilesEditor/locfiledit.css new file mode 100644 index 000000000..9236a3137 --- /dev/null +++ b/plugins/LocalFilesEditor/locfiledit.css @@ -0,0 +1,34 @@ +#LocalFilesEditor { + text-align: center; + margin: 0 2em; +} + +#LocalFilesEditor .top_right { + float: right; + margin-right: 1%; +} + +#LocalFilesEditor B { + float: left; +} + +#LocalFilesEditor TEXTAREA { + margin: 0.5em 0; + width: 99.5%; + float: left; +} + +#LocalFilesEditor #editarea_buttons { + width: 100%; + float: left; + text-align: left; + display: none; +} + +#LocalFilesEditor #hideedit { + display: none; +} + +#LocalFilesEditor TD { + padding: 0.5em; +} diff --git a/plugins/LocalFilesEditor/main.inc.php b/plugins/LocalFilesEditor/main.inc.php index 378c69780..f717bafae 100644 --- a/plugins/LocalFilesEditor/main.inc.php +++ b/plugins/LocalFilesEditor/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: LocalFiles Editor -Version: 1.8 +Version: 2.0 Description: Edit local files from administration panel / Editeur de fichiers locaux Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=144 Author: Piwigo team @@ -35,10 +35,10 @@ define('LOCALEDIT_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/' function localfiles_admin_menu($menu) { - array_push($menu, array( - 'NAME' => 'LocalFiles Editor', - 'URL' => get_admin_plugin_menu_link(LOCALEDIT_PATH . 'admin.php'))); - return $menu; + array_push($menu, array( + 'NAME' => 'LocalFiles Editor', + 'URL' => get_admin_plugin_menu_link(LOCALEDIT_PATH . 'admin.php'))); + return $menu; } add_event_handler('get_admin_plugin_menu_links', 'localfiles_admin_menu'); diff --git a/plugins/LocalFilesEditor/maintain.inc.php b/plugins/LocalFilesEditor/maintain.inc.php new file mode 100644 index 000000000..7bd0b6d24 --- /dev/null +++ b/plugins/LocalFilesEditor/maintain.inc.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/plugins/LocalFilesEditor/show_default.php b/plugins/LocalFilesEditor/show_default.php index 3a70f258e..79e597358 100644 --- a/plugins/LocalFilesEditor/show_default.php +++ b/plugins/LocalFilesEditor/show_default.php @@ -24,6 +24,7 @@ define('PHPWG_ROOT_PATH', '../../'); include_once(PHPWG_ROOT_PATH . 'include/common.inc.php'); include_once(LOCALEDIT_PATH.'functions.inc.php'); +load_language('plugin.lang', LOCALEDIT_PATH); check_status(ACCESS_ADMINISTRATOR); if (isset($_GET['file'])) @@ -37,22 +38,20 @@ if (isset($_GET['file'])) $template->set_filename('show_default', dirname(__FILE__) . '/show_default.tpl'); // Editarea - if (!isset($conf['editarea_options']) or $conf['editarea_options'] !== false) - { - $editarea = array( - 'syntax' => 'php', - 'start_highlight' => true, - 'is_editable' => false, - 'language' => substr($user['language'], 0, 2)); - - $template->assign('editarea', array( - 'URL' => LOCALEDIT_PATH . 'editarea/edit_area_full.js', - 'OPTIONS' => $editarea)); - } + $editarea_options = array( + 'syntax' => 'php', + 'start_highlight' => true, + 'allow_toggle' => false, + 'is_editable' => false, + 'language' => substr($user['language'], 0, 2)); $file = file_get_contents(PHPWG_ROOT_PATH . $path); - - $template->assign(array('DEFAULT_CONTENT' => $file)); + + $template->assign(array( + 'DEFAULT_CONTENT' => $file, + 'LOCALEDIT_PATH' => LOCALEDIT_PATH, + 'LOAD_EDITAREA' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'on', + 'EDITAREA_OPTIONS' => $editarea_options)); $title = $path; $page['page_banner'] = '

'.str_replace('/', ' / ', $path).'

'; diff --git a/plugins/LocalFilesEditor/show_default.tpl b/plugins/LocalFilesEditor/show_default.tpl index bccfc9712..ffdca4d68 100644 --- a/plugins/LocalFilesEditor/show_default.tpl +++ b/plugins/LocalFilesEditor/show_default.tpl @@ -1,13 +1,40 @@ -{if isset($editarea)} - +{* $Id$ *} +{html_head}{/html_head} +{known_script id="jquery" src=$ROOT_URL|@cat:"template-common/lib/jquery.packed.js"} +{known_script id="editarea" src=$LOCALEDIT_PATH|@cat:"editarea/edit_area_full.js"} -{/if} - \ No newline at end of file +
+ + + + + +
+ + diff --git a/plugins/LocalFilesEditor/update_config.php b/plugins/LocalFilesEditor/update_config.php new file mode 100644 index 000000000..500ecc0b0 --- /dev/null +++ b/plugins/LocalFilesEditor/update_config.php @@ -0,0 +1,46 @@ + \ No newline at end of file diff --git a/plugins/SwiftThemeCreator/main.inc.php b/plugins/SwiftThemeCreator/main.inc.php index a2d0980f1..50b708f24 100644 --- a/plugins/SwiftThemeCreator/main.inc.php +++ b/plugins/SwiftThemeCreator/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Swift Theme Creator -Version: 1.8 +Version: 2.0 Description: Create new theme elements which can be manually updated later. Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/add_index/main.inc.php b/plugins/add_index/main.inc.php index 30e6b9ff6..7680c2cc5 100644 --- a/plugins/add_index/main.inc.php +++ b/plugins/add_index/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Add Index -Version: 1.8 +Version: 2.0 Description: Add file index.php file on all sub-directories of local galleries pictures. / Ajoute le fichier index.php sur les sous-répertoires de galeries d'images locales. Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/admin_advices/main.inc.php b/plugins/admin_advices/main.inc.php index b54f77751..7f6440fbf 100644 --- a/plugins/admin_advices/main.inc.php +++ b/plugins/admin_advices/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Admin Advices -Version: 1.8 +Version: 2.0 Description: Give you an advice on the administration page. Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/admin_multi_view/main.inc.php b/plugins/admin_multi_view/main.inc.php index d29486fd0..d4c4c3bdc 100644 --- a/plugins/admin_multi_view/main.inc.php +++ b/plugins/admin_multi_view/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Multi view -Version: 1.8 +Version: 2.0 Description: Allows administrators to view gallery as guests and/or change the language and/or theme on the fly. Practical to debug changes ... Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/c13y_upgrade/main.inc.php b/plugins/c13y_upgrade/main.inc.php index 41050663f..45848274a 100644 --- a/plugins/c13y_upgrade/main.inc.php +++ b/plugins/c13y_upgrade/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Check upgrades -Version: 1.8 +Version: 2.0 Description: Check integrity of upgrades / Contrôle d'intégrité des mises à jour Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/event_tracer/main.inc.php b/plugins/event_tracer/main.inc.php index 21f9ef011..e80d29238 100644 --- a/plugins/event_tracer/main.inc.php +++ b/plugins/event_tracer/main.inc.php @@ -23,7 +23,7 @@ /* Plugin Name: Event tracer -Version: 1.8.a +Version: 2.0 Description: For developers. Shows all calls to trigger_event. Plugin URI: http://piwigo.org Author: Piwigo team diff --git a/plugins/grum_plugins_classes-2/main.inc.php b/plugins/grum_plugins_classes-2/main.inc.php index 3ff10fc29..463c00a2a 100755 --- a/plugins/grum_plugins_classes-2/main.inc.php +++ b/plugins/grum_plugins_classes-2/main.inc.php @@ -1,9 +1,11 @@