Plugin Directory

Changeset 3083670


Ignore:
Timestamp:
05/09/2024 03:43:13 AM (22 months ago)
Author:
mxp
Message:

update 3.1.12

Location:
mxp-dev-tools
Files:
5 edited
18 copied

Legend:

Unmodified
Added
Removed
  • mxp-dev-tools/tags/3.1.12/index.php

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

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/tags/3.1.12/mxp-site-manager.php

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    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.1.10';
     41    public static $VERSION = '3.1.12';
    4242
    4343    public function __construct() {
  • mxp-dev-tools/tags/3.1.12/mxp-snippets.php

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    159159if (!defined("MDT_BLOCK_ALL_NETWORK_FUNCTION")) {
    160160    define('MDT_BLOCK_ALL_NETWORK_FUNCTION', false);
     161}
     162// 預設開啟登入後分權限轉址
     163if (!defined("MDT_ENABLE_LOGIN_REDIRECT")) {
     164    define('MDT_ENABLE_LOGIN_REDIRECT', true);
     165}
     166// 開啟子主題下的 languages 目錄繼承翻譯 mo 檔案的功能
     167if (!defined("MDT_ENABLE_OVERWRITE_I18N_MO_FILE")) {
     168    define('MDT_ENABLE_OVERWRITE_I18N_MO_FILE', true);
    161169}
    162170class MDTSnippets {
     
    310318        add_filter('login_headerurl', array($this, 'login_page_url'));
    311319        add_filter('login_headertext', array($this, 'login_page_url_title'));
    312         add_filter('login_redirect', array($this, 'login_redirect'), 11, 3);
     320        if (MDT_ENABLE_LOGIN_REDIRECT) {
     321            add_filter('login_redirect', array($this, 'login_redirect'), 11, 3);
     322        }
    313323        if (!empty(MDT_LOGINPAGE_LOGO_URL) && filter_var(MDT_LOGINPAGE_LOGO_URL, FILTER_VALIDATE_URL)) {
    314324            add_action('login_enqueue_scripts', array($this, 'login_css_enqueues'));
     
    356366            add_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3);
    357367        }
     368        if (MDT_ENABLE_OVERWRITE_I18N_MO_FILE) {
     369            add_filter('load_textdomain_mofile', array($this, 'load_custom_translation_mo_file'), 12, 2);
     370        }
     371    }
     372
     373    public function load_custom_translation_mo_file($mofile, $domain) {
     374        $overwrite_textdomains = apply_filters("mxp_dev_overwrite_i18n_textdomains", array('woocommerce'));
     375        if (is_array($overwrite_textdomains) && in_array($domain, $overwrite_textdomains)) {
     376            $theme_mofile = get_stylesheet_directory() . '/languages/' . $domain . '-' . get_locale() . '.mo';
     377            if (file_exists($theme_mofile)) {
     378                return $theme_mofile;
     379            }
     380        }
     381        return $mofile;
    358382    }
    359383
     
    439463        $current_user = wp_get_current_user();
    440464        //限制角色操作功能
    441         $allowed_roles = apply_filters('mxp_dev_block_user_roles', array('administrator'));
     465        $allowed_roles = apply_filters('mxp_dev_block_user_roles', array('administrator', 'shop_manager'));
    442466        if (array_intersect($allowed_roles, $current_user->roles)) {
    443467            update_user_meta($user_id, '_mxp_dev_block_user_check', intval($_POST['_mxp_dev_block_user_check']));
     
    775799        //管理員等級的角色不要隱藏 admin bar
    776800        $user          = wp_get_current_user();
    777         $allowed_roles = apply_filters('mxp_dev_show_admin_bar_roles', array('editor', 'administrator', 'author'));
     801        $allowed_roles = apply_filters('mxp_dev_show_admin_bar_roles', array('editor', 'administrator', 'author', 'shop_manager'));
    778802        if (!array_intersect($allowed_roles, $user->roles)) {
    779803            add_filter('show_admin_bar', '__return_false');
     
    786810        // 讓主題支援使用 WC 的方法
    787811        if (class_exists('WooCommerce')) {
    788             add_theme_support('woocommerce');
    789             add_theme_support('wc-product-gallery-zoom');
    790             add_theme_support('wc-product-gallery-lightbox');
    791             add_theme_support('wc-product-gallery-slider');
     812            // add_theme_support('woocommerce');
     813            // add_theme_support('wc-product-gallery-zoom');
     814            // add_theme_support('wc-product-gallery-lightbox');
     815            // add_theme_support('wc-product-gallery-slider');
    792816        }
    793817    }
     
    11161140            return basename($plugin_path);
    11171141        }
    1118         return array("Name" => $plugin_data['Name'], "Version" => $plugin_data['Version'], "Author" => strip_tags($plugin_data['AuthorName']));
     1142        return array("Name" => $plugin_data['Name'], "Version" => $plugin_data['Version'], "Author" => strip_tags($plugin_data['AuthorName']), "plugin_path" => $plugin_path);
    11191143    }
    11201144
  • mxp-dev-tools/tags/3.1.12/readme.txt

    r3080385 r3083670  
    66Requires PHP: 5.6
    77Tested up to: 6.5
    8 Stable tag: 3.1.10
     8Stable tag: 3.1.12
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7777
    7878== Changelog ==
     79
     80= 3.1.12 =
     81
     82* 新增 Snippets 子主題下 languages 目錄繼承翻譯 mo 檔案的功能
     83* 修正小問題
    7984
    8085= 3.1.10 =
  • mxp-dev-tools/trunk/index.php

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

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
  • mxp-dev-tools/trunk/mxp-site-manager.php

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    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.1.10';
     41    public static $VERSION = '3.1.12';
    4242
    4343    public function __construct() {
  • mxp-dev-tools/trunk/mxp-snippets.php

    r3080385 r3083670  
    77 * Requires PHP: 5.6
    88 * Tested up to: 6.5
    9  * Stable tag: 3.1.10
    10  * Version: 3.1.10
     9 * Stable tag: 3.1.12
     10 * Version: 3.1.12
    1111 * Author: Chun
    1212 * Author URI: https://www.mxp.tw/contact/
     
    159159if (!defined("MDT_BLOCK_ALL_NETWORK_FUNCTION")) {
    160160    define('MDT_BLOCK_ALL_NETWORK_FUNCTION', false);
     161}
     162// 預設開啟登入後分權限轉址
     163if (!defined("MDT_ENABLE_LOGIN_REDIRECT")) {
     164    define('MDT_ENABLE_LOGIN_REDIRECT', true);
     165}
     166// 開啟子主題下的 languages 目錄繼承翻譯 mo 檔案的功能
     167if (!defined("MDT_ENABLE_OVERWRITE_I18N_MO_FILE")) {
     168    define('MDT_ENABLE_OVERWRITE_I18N_MO_FILE', true);
    161169}
    162170class MDTSnippets {
     
    310318        add_filter('login_headerurl', array($this, 'login_page_url'));
    311319        add_filter('login_headertext', array($this, 'login_page_url_title'));
    312         add_filter('login_redirect', array($this, 'login_redirect'), 11, 3);
     320        if (MDT_ENABLE_LOGIN_REDIRECT) {
     321            add_filter('login_redirect', array($this, 'login_redirect'), 11, 3);
     322        }
    313323        if (!empty(MDT_LOGINPAGE_LOGO_URL) && filter_var(MDT_LOGINPAGE_LOGO_URL, FILTER_VALIDATE_URL)) {
    314324            add_action('login_enqueue_scripts', array($this, 'login_css_enqueues'));
     
    356366            add_filter('pre_count_users', array($this, 'filter_user_counts'), 99999, 3);
    357367        }
     368        if (MDT_ENABLE_OVERWRITE_I18N_MO_FILE) {
     369            add_filter('load_textdomain_mofile', array($this, 'load_custom_translation_mo_file'), 12, 2);
     370        }
     371    }
     372
     373    public function load_custom_translation_mo_file($mofile, $domain) {
     374        $overwrite_textdomains = apply_filters("mxp_dev_overwrite_i18n_textdomains", array('woocommerce'));
     375        if (is_array($overwrite_textdomains) && in_array($domain, $overwrite_textdomains)) {
     376            $theme_mofile = get_stylesheet_directory() . '/languages/' . $domain . '-' . get_locale() . '.mo';
     377            if (file_exists($theme_mofile)) {
     378                return $theme_mofile;
     379            }
     380        }
     381        return $mofile;
    358382    }
    359383
     
    439463        $current_user = wp_get_current_user();
    440464        //限制角色操作功能
    441         $allowed_roles = apply_filters('mxp_dev_block_user_roles', array('administrator'));
     465        $allowed_roles = apply_filters('mxp_dev_block_user_roles', array('administrator', 'shop_manager'));
    442466        if (array_intersect($allowed_roles, $current_user->roles)) {
    443467            update_user_meta($user_id, '_mxp_dev_block_user_check', intval($_POST['_mxp_dev_block_user_check']));
     
    775799        //管理員等級的角色不要隱藏 admin bar
    776800        $user          = wp_get_current_user();
    777         $allowed_roles = apply_filters('mxp_dev_show_admin_bar_roles', array('editor', 'administrator', 'author'));
     801        $allowed_roles = apply_filters('mxp_dev_show_admin_bar_roles', array('editor', 'administrator', 'author', 'shop_manager'));
    778802        if (!array_intersect($allowed_roles, $user->roles)) {
    779803            add_filter('show_admin_bar', '__return_false');
     
    786810        // 讓主題支援使用 WC 的方法
    787811        if (class_exists('WooCommerce')) {
    788             add_theme_support('woocommerce');
    789             add_theme_support('wc-product-gallery-zoom');
    790             add_theme_support('wc-product-gallery-lightbox');
    791             add_theme_support('wc-product-gallery-slider');
     812            // add_theme_support('woocommerce');
     813            // add_theme_support('wc-product-gallery-zoom');
     814            // add_theme_support('wc-product-gallery-lightbox');
     815            // add_theme_support('wc-product-gallery-slider');
    792816        }
    793817    }
     
    11161140            return basename($plugin_path);
    11171141        }
    1118         return array("Name" => $plugin_data['Name'], "Version" => $plugin_data['Version'], "Author" => strip_tags($plugin_data['AuthorName']));
     1142        return array("Name" => $plugin_data['Name'], "Version" => $plugin_data['Version'], "Author" => strip_tags($plugin_data['AuthorName']), "plugin_path" => $plugin_path);
    11191143    }
    11201144
  • mxp-dev-tools/trunk/readme.txt

    r3080385 r3083670  
    66Requires PHP: 5.6
    77Tested up to: 6.5
    8 Stable tag: 3.1.10
     8Stable tag: 3.1.12
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7777
    7878== Changelog ==
     79
     80= 3.1.12 =
     81
     82* 新增 Snippets 子主題下 languages 目錄繼承翻譯 mo 檔案的功能
     83* 修正小問題
    7984
    8085= 3.1.10 =
Note: See TracChangeset for help on using the changeset viewer.