Example #1
0
 /**
  * Constructor - Call parent constructor with params array.
  *
  * This will set class properties based on the key value pairs in the array.
  *
  * @since 2.6.0
  *
  * @param array $params
  */
 public function __construct($params = array())
 {
     parent::__construct($params);
     if (isset($params['show_split_view'])) {
         $this->_show_split_view = $params['show_split_view'];
     }
 }
Example #2
0
 /**
  * Constructor - Call parent constructor with params array.
  *
  * This will set class properties based on the key value pairs in the array.
  *
  * @since 2.6.0
  *
  * @param array $params
  */
 function __construct($params = array())
 {
     parent::__construct($params);
 }
 function check_filterless_things()
 {
     // Var is string with length 113: /wp-admin/plugin-editor.php?file=my-plugin%2Fviews%2Fplugin-file.php
     $referer = wp_get_referer();
     // contains key "path" with value like "/wp-admin/plugin-editor.php"
     $referer_info = parse_url($referer);
     if ("/wp-admin/plugin-editor.php" === $referer_info["path"]) {
         // We are in plugin editor
         // Check for plugin edit saved
         if (isset($_POST["newcontent"]) && isset($_POST["action"]) && "update" == $_POST["action"] && isset($_POST["file"]) && !empty($_POST["file"])) {
             // A file was edited
             $file = $_POST["file"];
             // $plugins = get_plugins();
             // http://codex.wordpress.org/Function_Reference/wp_text_diff
             // Generate a diff of changes
             if (!class_exists('WP_Text_Diff_Renderer_Table')) {
                 require_once ABSPATH . WPINC . '/wp-diff.php';
             }
             $original_file_contents = file_get_contents(WP_PLUGIN_DIR . "/" . $file);
             $new_file_contents = wp_unslash($_POST["newcontent"]);
             $left_lines = explode("\n", $original_file_contents);
             $right_lines = explode("\n", $new_file_contents);
             $text_diff = new Text_Diff($left_lines, $right_lines);
             $num_added_lines = $text_diff->countAddedLines();
             $num_removed_lines = $text_diff->countDeletedLines();
             // Generate a diff in classic diff format
             $renderer = new Text_Diff_Renderer();
             $diff = $renderer->render($text_diff);
             $this->infoMessage('plugin_file_edited', array("plugin_edited_file" => $file, "plugin_edit_diff" => $diff, "plugin_edit_num_added_lines" => $num_added_lines, "plugin_edit_num_removed_lines" => $num_removed_lines));
             $did_log = true;
         }
     }
 }
Example #4
0
 function FDX_Text_Diff_Renderer()
 {
     parent::Text_Diff_Renderer();
 }
Example #5
0
 function render()
 {
     return parent::render($this->diff);
 }