Esempio n. 1
0
 public static function removeDefaultEditorMenus()
 {
     // Remove default plugin editor
     if (WPEditorSetting::getValue('hide_default_plugin_editor') == 1) {
         global $submenu;
         unset($submenu['plugins.php'][15]);
     }
     if (WPEditorSetting::getValue('hide_default_theme_editor') == 1) {
         // Remove default themes editor
         remove_action('admin_menu', '_add_themes_utility_last', 101);
     }
 }
Esempio n. 2
0
 public static function addPostsJquery($editor)
 {
     global $post;
     if (WPEditorSetting::getValue('enable_post_editor')) {
         $theme = WPEditorSetting::getValue('post_editor_theme') ? WPEditorSetting::getValue('post_editor_theme') : 'default';
         $activeLine = WPEditorSetting::getValue('enable_post_active_line') == 1 ? 'activeline-' . $theme : false;
         $post_editor_settings = array('mode' => 'text/html', 'theme' => $theme, 'activeLine' => $activeLine, 'lineNumbers' => WPEditorSetting::getValue('enable_post_line_numbers') == 1 ? true : false, 'lineWrapping' => WPEditorSetting::getValue('enable_post_line_wrapping') == 1 ? true : false, 'enterImgUrl' => __('Enter the URL of the image:', 'wpeditor'), 'enterImgDescription' => __('Enter a description of the image:', 'wpeditor'), 'lookupWord' => __('Enter a word to look up:', 'wpeditor'), 'tabSize' => WPEditorSetting::getValue('enable_post_tab_size') ? WPEditorSetting::getValue('enable_post_tab_size') : 4, 'indentWithTabs' => WPEditorSetting::getValue('enable_post_tab_size') == 'tabs' ? true : false, 'indentUnit' => WPEditorSetting::getValue('post_indent_unit') == '' ? 2 : WPEditorSetting::getValue('post_indent_unit'), 'editorHeight' => WPEditorSetting::getValue('enable_post_editor_height') ? WPEditorSetting::getValue('enable_post_editor_height') : false, 'fontSize' => WPEditorSetting::getValue("change_post_editor_font_size") ? WPEditorSetting::getValue("change_post_editor_font_size") . "px" : "12px", 'save' => isset($post->post_status) && $post->post_status == 'publish' ? __('Update', 'wpeditor') : __('Save', 'wpeditor'));
         WPEditorAdmin::editorStylesheetAndScripts();
         wp_enqueue_script('wp-editor-posts-jquery');
         wp_localize_script('wp-editor-posts-jquery', 'WPEPosts', $post_editor_settings);
     }
     return $editor;
 }
Esempio n. 3
0
          'Esc': toggleFullscreenEditing
        } // set fullscreen options here
      });
      $jq('.CodeMirror').css('font-size', '<?php 
echo WPEditorSetting::getValue("change_theme_editor_font_size") ? WPEditorSetting::getValue("change_theme_editor_font_size") . "px" : "12px";
?>
');
      if(activeLine) {
        var hlLine = editor.setLineClass(0, activeLine);
      }
      <?php 
if (WPEditorSetting::getValue('enable_theme_editor_height')) {
    ?>
        $jq = jQuery.noConflict();
        $jq('.CodeMirror-scroll, .CodeMirror').height('<?php 
    echo WPEditorSetting::getValue("enable_theme_editor_height");
    ?>
px');
        var scrollDivHeight = $jq('.CodeMirror-scroll div:first-child').height();
        var editorDivHeight = $jq('.CodeMirror').height();
        if(scrollDivHeight > editorDivHeight) {
          $jq('.CodeMirror-gutter').height(scrollDivHeight);
        }
      <?php 
}
?>
      if(!$jq('.CodeMirror .quicktags-toolbar').length) {
        $jq('.CodeMirror').prepend('<div class="quicktags-toolbar">' + 
          '<a href="#" class="button-primary editor-button" id="theme_save">save</a>&nbsp;' + 
          '<a href="#" class="button-secondary editor-button" id="theme_undo">undo</a>&nbsp;' + 
          '<a href="#" class="button-secondary editor-button" id="theme_redo">redo</a>&nbsp;' + 
Esempio n. 4
0
          'Esc': toggleFullscreenEditing
        } // set fullscreen options here
      });
      $jq('.CodeMirror').css('font-size', '<?php 
echo WPEditorSetting::getValue("change_plugin_editor_font_size") ? WPEditorSetting::getValue("change_plugin_editor_font_size") . "px" : "12px";
?>
');
      if(activeLine) {
        var hlLine = editor.setLineClass(0, activeLine);
      }
      <?php 
if (WPEditorSetting::getValue('enable_plugin_editor_height')) {
    ?>
        $jq = jQuery.noConflict();
        $jq('.CodeMirror-scroll, .CodeMirror').height('<?php 
    echo WPEditorSetting::getValue("enable_plugin_editor_height");
    ?>
px');
        var scrollDivHeight = $jq('.CodeMirror-scroll div:first-child').height();
        var editorDivHeight = $jq('.CodeMirror').height();
        if(scrollDivHeight > editorDivHeight) {
          $jq('.CodeMirror-gutter').height(scrollDivHeight);
        }
      <?php 
}
?>
      if(!$jq('.CodeMirror .quicktags-toolbar').length) {
        $jq('.CodeMirror').prepend('<div class="quicktags-toolbar">' + 
          '<a href="#" class="button-primary editor-button" id="plugin_save">save</a>&nbsp;' + 
          '<a href="#" class="button-secondary editor-button" id="plugin_undo">undo</a>&nbsp;' + 
          '<a href="#" class="button-secondary editor-button" id="plugin_redo">redo</a>&nbsp;' + 
Esempio n. 5
0
 public static function replacePluginEditLinks($links)
 {
     $data = '';
     if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('mustuse', 'dropins'))) {
         $data = $links;
     } elseif (WPEditorSetting::getValue('replace_plugin_edit_links') == 1) {
         foreach ($links as $key => $value) {
             if ($key === 'edit') {
                 $value = str_replace('plugin-editor.php?', 'plugins.php?page=wpeditor_plugin&', $value);
             }
             $data[$key] = $value;
         }
     } else {
         $data = $links;
     }
     return $data;
 }
Esempio n. 6
0
                <h3><?php 
_e('Editor Height', 'wp-editor');
?>
</h3>
              </div>
              <div class="section-body">
                <ul>
                  <li>
                    <label for="enable_post_editor_height"><?php 
_e('Editor Height:', 'wp-editor');
?>
</label>
                  </li>
                  <li class="indent">
                    <input class="small-text" name="enable_post_editor_height" value="<?php 
echo WPEditorSetting::getValue('enable_post_editor_height');
?>
" />
                  </li>
                  <li class="indent description">
                    <p><?php 
_e("This will set the height in pixels for the post editor.<br />Default: 450", 'wp-editor');
?>
</p>
                  </li>
                </ul>
              </div>
            </div>
            <div id="save-settings">
              <ul>
                <li>
Esempio n. 7
0
 public static function allowedFiles($dir, $file)
 {
     $slash = '/';
     if (WPWINDOWS) {
         $slash = '\\';
     }
     $output = true;
     if (strstr($dir, 'plugins')) {
         $allowed_extensions = explode('~', WPEditorSetting::getValue('plugin_editor_allowed_extensions'));
     } elseif (strstr($dir, 'themes')) {
         $allowed_extensions = explode('~', WPEditorSetting::getValue('theme_editor_allowed_extensions'));
     }
     if (is_dir($dir . $slash . $file)) {
         $output = true;
     } else {
         $file = pathinfo($file);
         if (isset($file['extension']) && in_array($file['extension'], $allowed_extensions)) {
             $output = true;
         } else {
             $output = false;
         }
     }
     return $output;
 }