Plugin Directory

Changeset 3162623

Timestamp:
10/04/2024 09:45:39 AM (17 months ago)
Author:
mxp
Message:

update 3.2.1

Location:
mxp-dev-tools
Files:
8 edited
7 copied

Legend:

Unmodified
Added
Removed
  • mxp-dev-tools/tags/3.2.1/includes/class_plugins_list_table.php

    r3161580 r3162623  
    187187    public function column_id($item) {
    188188        $actions = array();
    189         $actions['activate'] = sprintf('<button class="mxp-activate" data-id="p_%s" disabled>啟用</button>', $item['id']);
    190         $actions['update'] = sprintf('<button class="mxp-update" data-id="p_%s" disabled>更新</button>', $item['id']);
    191         $actions['install'] = sprintf('<button class="mxp-install" data-id="p_%s" disabled>安裝</button>', $item['id']);
     189        $actions['activate'] = sprintf('<button mxp-activate" data-id="p_%s" disabled>啟用</button>', $item['id']);
     190        $actions['update'] = sprintf('<button mxp-update" data-id="p_%s" disabled>更新</button>', $item['id']);
     191        $actions['install'] = sprintf('<button mxp-install" data-id="p_%s" disabled>安裝</button>', $item['id']);
    192192        return sprintf('%1$s %2$s', $item['id'], $this->row_actions($actions));
    193193    }
  • mxp-dev-tools/tags/3.2.1/includes/hooks-usage.php

    r2986482 r3162623  
    33
    44if (!defined('WPINC')) {
    5     die;
     5die;
    66}
    77
     
    99class MxpDevHooksUsage {
    1010
    11     public $data = array();
     11public $data = array();
    1212
    13     public function __construct() {
    14         add_action('admin_bar_menu', array($this, 'customize_admin_bar'), 99);
    15         add_action('all', array($this, 'filter_start'));
    16         add_action('shutdown', array($this, 'results'));
    17     }
     13public function __construct() {
     14add_action('admin_bar_menu', array($this, 'customize_admin_bar'), 99);
     15add_action('all', array($this, 'filter_start'));
     16add_action('shutdown', array($this, 'results'));
     17}
    1818
    19     public function customize_admin_bar() {
    20         global $wp_admin_bar;
    21         $wp_admin_bar->add_menu(array(
    22             'id'    => 'mxp_dev_hooks_usage',
    23             'title' => 'Hooks 執行時間',
    24             'href' => false,
    25         ));
    26         $wp_admin_bar->add_menu(array(
    27             'id'    => 'demo-sub-menu',
    28             'parent' => 'mxp_dev_hooks_usage',
    29             'title' => 'hook:ms',
    30             'href'  => false,
    31         ));
    32     }
     19public function customize_admin_bar() {
     20global $wp_admin_bar;
     21$wp_admin_bar->add_menu(array(
     22 => 'mxp_dev_hooks_usage',
     23'title' => 'Hooks 執行時間',
     24 => false,
     25));
     26$wp_admin_bar->add_menu(array(
     27 => 'demo-sub-menu',
     28'parent' => 'mxp_dev_hooks_usage',
     29 => 'hook:ms',
     30 => false,
     31));
     32}
    3333
    34     // This runs first for all actions and filters.
    35     // It starts a timer for this hook.
    36     public function filter_start() {
    37         $current_filter                        = current_filter();
    38         $this->data[$current_filter][]['start'] = microtime(true);
    39         add_filter($current_filter, array($this, 'filter_end'), 99999);
    40     }
     34// This runs first for all actions and filters.
     35// It starts a timer for this hook.
     36) {
     37 = current_filter();
     38$this->data[$current_filter][]['start'] = microtime(true);
     39);
     40}
    4141
    42     // This runs last (hopefully) for each hook and records the end time.
    43     // This has problems if a hook fires inside of itself since it assumes
    44     // the last entry in the data key for this hook is the matching pair.
    45     public function filter_end($filter_data = null) {
    46         $current_filter = current_filter();
    47         remove_filter($current_filter, array($this, 'filter_end'), 99999);
    48         end($this->data[$current_filter]);
    49         $last_key                                      = key($this->data[$current_filter]);
    50         $this->data[$current_filter][$last_key]['stop'] = microtime(true);
    51         return $filter_data;
    52     }
     42// This runs last (hopefully) for each hook and records the end time.
     43// This has problems if a hook fires inside of itself since it assumes
     44// the last entry in the data key for this hook is the matching pair.
     45public function filter_end($filter_data = null) {
     46$current_filter = current_filter();
     47);
     48end($this->data[$current_filter]);
     49 = key($this->data[$current_filter]);
     50$this->data[$current_filter][$last_key]['stop'] = microtime(true);
     51return $filter_data;
     52}
    5353
    54     // Processes the results and var_dump()'s them. TODO: Debug bar panel?
    55     public function results() {
    56         $results = array();
    57         foreach ($this->data as $filter => $calls) {
    58             foreach ($calls as $call) {
    59                 // Skip filters with no end point (i.e. the hook this function is hooked into)
    60                 if (!isset($call['stop'])) {
    61                     continue;
    62                 }
    63                 if (!isset($results[$filter])) {
    64                     $results[$filter] = 0;
    65                 }
    66                 $results[$filter] = $results[$filter] + ($call['stop'] - $call['start']);
    67             }
    68         }
    69         asort($results, SORT_NUMERIC);
    70         $results = array_reverse($results);
    71         $now     = time();
    72         $new_res = array();
    73         $total   = 0;
    74         foreach ($results as $hook_name => $time_diff) {
    75             $time = round($time_diff, 3);
    76             $total += $time;
    77             if ($time > 0.01) {
    78                 $new_res[$hook_name] = $time;
    79             }
    80         }
    81         $insert      = array('總計' => round($total, 3));
    82         $resultArray = $insert + $new_res;
    83         echo '<script>var mxp_hooks_usage=' . json_encode($resultArray) . ';var ulElement = document.getElementById("wp-admin-bar-mxp_dev_hooks_usage-default");ulElement.innerHTML = "";for (var hook in mxp_hooks_usage) { if (mxp_hooks_usage.hasOwnProperty(hook)) { console.log(hook,mxp_hooks_usage[hook]+" 秒");var liElement = document.createElement("li"); liElement.innerHTML = "<div class=\'ab-item ab-empty-item\'>"+hook + " : " + mxp_hooks_usage[hook]+" 秒</div>"; ulElement.appendChild(liElement); } }
     54    // Processes the results and var_dump()'s them. TODO: Debug bar panel?
     55    public function results() {
     56        $results = array();
     57        foreach ($this->data as $filter => $calls) {
     58            foreach ($calls as $call) {
     59                // Skip filters with no end point (i.e. the hook this function is hooked into)
     60                if (!isset($call['stop'])) {
     61                    continue;
     62                }
     63                if (!isset($results[$filter])) {
     64                    $results[$filter] = 0;
     65                }
     66                $results[$filter] = $results[$filter] + ($call['stop'] - $call['start']);
     67            }
     68        }
     69        asort($results, SORT_NUMERIC);
     70        $results = array_reverse($results);
     71        $now = time();
     72        $new_res = array();
     73        $total = 0;
     74        foreach ($results as $hook_name => $time_diff) {
     75            $time = round($time_diff, 3);
     76            $total += $time;
     77            if ($time > 0.001) {
     78                $new_res[$hook_name] = $time;
     79            }
     80        }
     81        $insert = array('總計' => round($total, 3));
     82        $resultArray = $insert + $new_res;
     83        if ((defined('DOING_AJAX') && DOING_AJAX) || wp_doing_cron()) {
     84            return;
     85        }
     86        echo '<script>var mxp_hooks_usage=' . json_encode($resultArray) . ';var ulElement = document.getElementById("wp-admin-bar-mxp_dev_hooks_usage-default");ulElement.innerHTML = "";for (var hook in mxp_hooks_usage) { if (mxp_hooks_usage.hasOwnProperty(hook)) { console.log(hook,mxp_hooks_usage[hook]+" 秒");var liElement = document.createElement("li"); liElement.innerHTML = "<div class=\'ab-item ab-empty-item\'>"+hook + " : " + mxp_hooks_usage[hook]+" 秒</div>"; ulElement.appendChild(liElement); } }
    8487</script>';
    85     }
     88}
    8689}
    8790
    88 if (!function_exists('wp_get_current_user')) {
    89     include_once ABSPATH . WPINC . '/pluggable.php';
     91$cookie = isset($_COOKIE) ? $_COOKIE : array();
     92$login_flag = false;
     93foreach ($cookie as $cookie_key => $cookie_value) {
     94    if (strpos($cookie_key, 'wordpress_logged_in_') === 0 && $cookie_value != '') {
     95        $login_flag = true;
     96    }
    9097}
    91 if (isset($_REQUEST['debug']) && \is_super_admin()) {
    92     new MxpDevHooksUsage();
     98if (isset($_REQUEST['debug']) && ) {
     99new MxpDevHooksUsage();
    93100}
  • mxp-dev-tools/tags/3.2.1/index.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939    use SearchReplace;
    4040    use Utility;
    41     static $VERSION = '3.2.0';
     41    static $VERSION = '3.2.';
    4242    private $themeforest_api_base_url = 'https://api.envato.com/v3';
    4343    protected static $instance = null;
  • mxp-dev-tools/tags/3.2.1/mxp-login-path.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/tags/3.2.1/mxp-site-manager.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939class MDTSiteManager {
    4040    public $plugin_slug = 'mdt-site-manager';
    41     public static $VERSION = '3.2.0';
     41    public static $VERSION = '3.2.';
    4242
    4343    public function __construct() {
     
    5555        add_action('template_redirect', array($this, 'verify_login_request'), -1);
    5656        add_action('wp_ajax_mxp_ajax_site_mamager', array($this, 'ajax_action'));
     57
     58
     59
     60
     61
    5762        // 避免單獨啟用時呼叫判斷 is_super_admin() 噴錯
    5863        if (!function_exists('wp_get_current_user')) {
     
    6166        // 新增「設定」中的外掛選單
    6267        if (is_super_admin()) {
     68
     69
     70
    6371            add_action('admin_menu', array($this, 'admin_menu'));
    6472        }
    65         add_action('admin_enqueue_scripts', array($this, 'load_assets'));
    6673    }
    6774
     
    102109                )
    103110            );
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
    104121        }
    105122    }
  • mxp-dev-tools/tags/3.2.1/mxp-snippets.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/tags/3.2.1/readme.txt

    r3161580 r3162623  
    66Requires PHP: 5.6
    77Tested up to: 6.6
    8 Stable tag: 3.2.0
     8Stable tag: 3.2.
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7777
    7878== Changelog ==
     79
     80
     81
     82
     83
     84
    7985
    8086= 3.2.0 =
  • mxp-dev-tools/trunk/includes/class_plugins_list_table.php

    r3161580 r3162623  
    187187    public function column_id($item) {
    188188        $actions = array();
    189         $actions['activate'] = sprintf('<button class="mxp-activate" data-id="p_%s" disabled>啟用</button>', $item['id']);
    190         $actions['update'] = sprintf('<button class="mxp-update" data-id="p_%s" disabled>更新</button>', $item['id']);
    191         $actions['install'] = sprintf('<button class="mxp-install" data-id="p_%s" disabled>安裝</button>', $item['id']);
     189        $actions['activate'] = sprintf('<button mxp-activate" data-id="p_%s" disabled>���用</button>', $item['id']);
     190        $actions['update'] = sprintf('<button mxp-update" data-id="p_%s" disabled>更新</button>', $item['id']);
     191        $actions['install'] = sprintf('<button mxp-install" data-id="p_%s" disabled>安裝</button>', $item['id']);
    192192        return sprintf('%1$s %2$s', $item['id'], $this->row_actions($actions));
    193193    }
  • mxp-dev-tools/trunk/includes/hooks-usage.php

    r2986482 r3162623  
    33
    44if (!defined('WPINC')) {
    5     die;
     5die;
    66}
    77
     
    99class MxpDevHooksUsage {
    1010
    11     public $data = array();
     11public $data = array();
    1212
    13     public function __construct() {
    14         add_action('admin_bar_menu', array($this, 'customize_admin_bar'), 99);
    15         add_action('all', array($this, 'filter_start'));
    16         add_action('shutdown', array($this, 'results'));
    17     }
     13public function __construct() {
     14add_action('admin_bar_menu', array($this, 'customize_admin_bar'), 99);
     15add_action('all', array($this, 'filter_start'));
     16add_action('shutdown', array($this, 'results'));
     17}
    1818
    19     public function customize_admin_bar() {
    20         global $wp_admin_bar;
    21         $wp_admin_bar->add_menu(array(
    22             'id'    => 'mxp_dev_hooks_usage',
    23             'title' => 'Hooks 執行時間',
    24             'href' => false,
    25         ));
    26         $wp_admin_bar->add_menu(array(
    27             'id'    => 'demo-sub-menu',
    28             'parent' => 'mxp_dev_hooks_usage',
    29             'title' => 'hook:ms',
    30             'href'  => false,
    31         ));
    32     }
     19public function customize_admin_bar() {
     20global $wp_admin_bar;
     21$wp_admin_bar->add_menu(array(
     22 => 'mxp_dev_hooks_usage',
     23'title' => 'Hooks 執行時間',
     24 => false,
     25));
     26$wp_admin_bar->add_menu(array(
     27 => 'demo-sub-menu',
     28'parent' => 'mxp_dev_hooks_usage',
     29 => 'hook:ms',
     30 => false,
     31));
     32}
    3333
    34     // This runs first for all actions and filters.
    35     // It starts a timer for this hook.
    36     public function filter_start() {
    37         $current_filter                        = current_filter();
    38         $this->data[$current_filter][]['start'] = microtime(true);
    39         add_filter($current_filter, array($this, 'filter_end'), 99999);
    40     }
     34// This runs first for all actions and filters.
     35// It starts a timer for this hook.
     36) {
     37 = current_filter();
     38$this->data[$current_filter][]['start'] = microtime(true);
     39);
     40}
    4141
    42     // This runs last (hopefully) for each hook and records the end time.
    43     // This has problems if a hook fires inside of itself since it assumes
    44     // the last entry in the data key for this hook is the matching pair.
    45     public function filter_end($filter_data = null) {
    46         $current_filter = current_filter();
    47         remove_filter($current_filter, array($this, 'filter_end'), 99999);
    48         end($this->data[$current_filter]);
    49         $last_key                                      = key($this->data[$current_filter]);
    50         $this->data[$current_filter][$last_key]['stop'] = microtime(true);
    51         return $filter_data;
    52     }
     42// This runs last (hopefully) for each hook and records the end time.
     43// This has problems if a hook fires inside of itself since it assumes
     44// the last entry in the data key for this hook is the matching pair.
     45public function filter_end($filter_data = null) {
     46$current_filter = current_filter();
     47);
     48end($this->data[$current_filter]);
     49 = key($this->data[$current_filter]);
     50$this->data[$current_filter][$last_key]['stop'] = microtime(true);
     51return $filter_data;
     52}
    5353
    54     // Processes the results and var_dump()'s them. TODO: Debug bar panel?
    55     public function results() {
    56         $results = array();
    57         foreach ($this->data as $filter => $calls) {
    58             foreach ($calls as $call) {
    59                 // Skip filters with no end point (i.e. the hook this function is hooked into)
    60                 if (!isset($call['stop'])) {
    61                     continue;
    62                 }
    63                 if (!isset($results[$filter])) {
    64                     $results[$filter] = 0;
    65                 }
    66                 $results[$filter] = $results[$filter] + ($call['stop'] - $call['start']);
    67             }
    68         }
    69         asort($results, SORT_NUMERIC);
    70         $results = array_reverse($results);
    71         $now     = time();
    72         $new_res = array();
    73         $total   = 0;
    74         foreach ($results as $hook_name => $time_diff) {
    75             $time = round($time_diff, 3);
    76             $total += $time;
    77             if ($time > 0.01) {
    78                 $new_res[$hook_name] = $time;
    79             }
    80         }
    81         $insert      = array('總計' => round($total, 3));
    82         $resultArray = $insert + $new_res;
    83         echo '<script>var mxp_hooks_usage=' . json_encode($resultArray) . ';var ulElement = document.getElementById("wp-admin-bar-mxp_dev_hooks_usage-default");ulElement.innerHTML = "";for (var hook in mxp_hooks_usage) { if (mxp_hooks_usage.hasOwnProperty(hook)) { console.log(hook,mxp_hooks_usage[hook]+" 秒");var liElement = document.createElement("li"); liElement.innerHTML = "<div class=\'ab-item ab-empty-item\'>"+hook + " : " + mxp_hooks_usage[hook]+" 秒</div>"; ulElement.appendChild(liElement); } }
     54    // Processes the results and var_dump()'s them. TODO: Debug bar panel?
     55    public function results() {
     56        $results = array();
     57        foreach ($this->data as $filter => $calls) {
     58            foreach ($calls as $call) {
     59                // Skip filters with no end point (i.e. the hook this function is hooked into)
     60                if (!isset($call['stop'])) {
     61                    continue;
     62                }
     63                if (!isset($results[$filter])) {
     64                    $results[$filter] = 0;
     65                }
     66                $results[$filter] = $results[$filter] + ($call['stop'] - $call['start']);
     67            }
     68        }
     69        asort($results, SORT_NUMERIC);
     70        $results = array_reverse($results);
     71        $now = time();
     72        $new_res = array();
     73        $total = 0;
     74        foreach ($results as $hook_name => $time_diff) {
     75            $time = round($time_diff, 3);
     76            $total += $time;
     77            if ($time > 0.001) {
     78                $new_res[$hook_name] = $time;
     79            }
     80        }
     81        $insert = array('總計' => round($total, 3));
     82        $resultArray = $insert + $new_res;
     83        if ((defined('DOING_AJAX') && DOING_AJAX) || wp_doing_cron()) {
     84            return;
     85        }
     86        echo '<script>var mxp_hooks_usage=' . json_encode($resultArray) . ';var ulElement = document.getElementById("wp-admin-bar-mxp_dev_hooks_usage-default");ulElement.innerHTML = "";for (var hook in mxp_hooks_usage) { if (mxp_hooks_usage.hasOwnProperty(hook)) { console.log(hook,mxp_hooks_usage[hook]+" 秒");var liElement = document.createElement("li"); liElement.innerHTML = "<div class=\'ab-item ab-empty-item\'>"+hook + " : " + mxp_hooks_usage[hook]+" 秒</div>"; ulElement.appendChild(liElement); } }
    8487</script>';
    85     }
     88}
    8689}
    8790
    88 if (!function_exists('wp_get_current_user')) {
    89     include_once ABSPATH . WPINC . '/pluggable.php';
     91$cookie = isset($_COOKIE) ? $_COOKIE : array();
     92$login_flag = false;
     93foreach ($cookie as $cookie_key => $cookie_value) {
     94    if (strpos($cookie_key, 'wordpress_logged_in_') === 0 && $cookie_value != '') {
     95        $login_flag = true;
     96    }
    9097}
    91 if (isset($_REQUEST['debug']) && \is_super_admin()) {
    92     new MxpDevHooksUsage();
     98if (isset($_REQUEST['debug']) && ) {
     99new MxpDevHooksUsage();
    93100}
  • mxp-dev-tools/trunk/index.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939    use SearchReplace;
    4040    use Utility;
    41     static $VERSION = '3.2.0';
     41    static $VERSION = '3.2.';
    4242    private $themeforest_api_base_url = 'https://api.envato.com/v3';
    4343    protected static $instance = null;
  • mxp-dev-tools/trunk/mxp-login-path.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/trunk/mxp-site-manager.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    3939class MDTSiteManager {
    4040    public $plugin_slug = 'mdt-site-manager';
    41     public static $VERSION = '3.2.0';
     41    public static $VERSION = '3.2.';
    4242
    4343    public function __construct() {
     
    5555        add_action('template_redirect', array($this, 'verify_login_request'), -1);
    5656        add_action('wp_ajax_mxp_ajax_site_mamager', array($this, 'ajax_action'));
     57
     58
     59
     60
     61
    5762        // 避免單獨啟用時呼叫判斷 is_super_admin() 噴錯
    5863        if (!function_exists('wp_get_current_user')) {
     
    6166        // 新增「設定」中的外掛選單
    6267        if (is_super_admin()) {
     68
     69
     70
    6371            add_action('admin_menu', array($this, 'admin_menu'));
    6472        }
    65         add_action('admin_enqueue_scripts', array($this, 'load_assets'));
    6673    }
    6774
     
    102109                )
    103110            );
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
    104121        }
    105122    }
  • mxp-dev-tools/trunk/mxp-snippets.php

    r3161580 r3162623  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.6
    9  * Stable tag: 3.2.0
    10  * Version: 3.2.0
     9 * Stable tag: 3.2.
     10 * Version: 3.2.
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/trunk/readme.txt

    r3161580 r3162623  
    66Requires PHP: 5.6
    77Tested up to: 6.6
    8 Stable tag: 3.2.0
     8Stable tag: 3.2.
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7777
    7878== Changelog ==
     79
     80
     81
     82
     83
     84
    7985
    8086= 3.2.0 =
Note: See TracChangeset for help on using the changeset viewer.