Plugin Directory

Changeset 2316295


Ignore:
Timestamp:
06/02/2020 03:32:06 AM (6 years ago)
Author:
kanakogi
Message:

1.1.3

Location:
wp-theme-test
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-theme-test/tags/1.1.3/readme.txt

    r2244269 r2316295  
    44Tags: : page, pages,theme, themes
    55Requires at least: 3.0 or higher
    6 Tested up to: 5.3.2
    7 Stable tag: 1.1.2
     6Tested up to: 5.4.1
     7Stable tag: 1.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • wp-theme-test/tags/1.1.3/wp-theme-test.php

    r2244269 r2316295  
    55Description: The theme can be changed and displayed to only logged in users.
    66Author: Nakashima Masahiro
    7 Version: 1.1.2
     7Version: 1.1.3
    88Author URI: http://www.kigurumi.asia
    99Text Domain: wptt
    1010Domain Path: /languages/
    1111*/
    12 define( 'WPTT_VERSION', '1.1.2' );
    13 define( 'WPTT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    14 define( 'WPTT_PLUGIN_NAME', trim( dirname( WPTT_PLUGIN_BASENAME ), '/' ) );
    15 define( 'WPTT_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) );
    16 define( 'WPTT_PLUGIN_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
    17 define( 'WPTT_TEXT_DOMAIN', 'wptt' );
     12define('WPTT_VERSION', '1.1.3');
     13define('WPTT_PLUGIN_BASENAME', plugin_basename(__FILE__));
     14define('WPTT_PLUGIN_NAME', trim(dirname(WPTT_PLUGIN_BASENAME), '/'));
     15define('WPTT_PLUGIN_DIR', untrailingslashit(dirname(__FILE__)));
     16define('WPTT_PLUGIN_URL', untrailingslashit(plugins_url('', __FILE__)));
     17define('WPTT_TEXT_DOMAIN', 'wptt');
    1818
    1919require_once WPTT_PLUGIN_DIR . '/classes/class.core.php';
    2020
    21 class WP_Theme_Test extends WPTT_Core {
     21class WP_Theme_Test extends WPTT_Core
     22{
    2223
    2324    /**
    2425     * __construct
    2526     */
    26     public function __construct() {
     27    public function __construct()
     28    {
    2729        //他言語化
    28         load_plugin_textdomain( WPTT_TEXT_DOMAIN, false, basename( dirname( __FILE__ ) ) . '/languages/' );
     30        load_plugin_textdomain(WPTT_TEXT_DOMAIN, false, basename(dirname(__FILE__)) . '/languages/');
    2931        //actions
    30         add_action( 'init', array( $this, 'load_files' ) );
     32        add_action('init', array($this, 'load_files'));
    3133        //filters
    32         add_filter( 'template', array( $this, 'template_filter' ) );
    33         add_filter( 'stylesheet', array( $this, 'stylesheet_filter' ) );
     34        add_filter('template', array($this, 'template_filter'));
     35        add_filter('stylesheet', array($this, 'stylesheet_filter'));
    3436        // プラグインが有効・無効化されたとき
    35         register_activation_hook( __FILE__, array( $this, 'activation_hook' ) );
    36         register_deactivation_hook( __FILE__, array( $this, 'deactivation_hook' ) );
    37         register_uninstall_hook( __FILE__, array( $this, 'uninstall_hook' ) );
     37        // register_activation_hook(__FILE__, array($this, 'activation_hook'));
     38        // register_deactivation_hook(__FILE__, array($this, 'deactivation_hook'));
     39        // register_uninstall_hook(__FILE__, array($this, 'uninstall_hook'));
    3840    }
    3941
     
    4143     * load_files
    4244     */
    43     public function load_files() {
     45    public function load_files()
     46    {
    4447        // Classes
    4548        include_once WPTT_PLUGIN_DIR . '/classes/class.admin.php';
     
    4952     * apply_test_theme
    5053     */
    51     function apply_test_theme() {
     54    function apply_test_theme()
     55    {
    5256        //GETでも変えれるようにする
    53         if ( isset( $_GET['theme'] ) && $this->get_parameter() ) {
    54             $theme_object = wp_get_theme( esc_html( $_GET['theme'] ) );
     57        if (isset($_GET['theme']) && $this->get_parameter()) {
     58            $theme_object = wp_get_theme(esc_html($_GET['theme']));
    5559            return $theme_object;
    5660        }
    5761
    5862        //IPアドレスでも変えれるようにする
    59         if ( $this->get_ip_list() ) {
     63        if ($this->get_ip_list()) {
    6064            $ip_list = $this->get_ip_list();
    61             $ip_list = str_replace(array("\r\n", "\n", "\r"),"\n",$ip_list); //改行を\nに統一
    62             $ip_list = explode( "\n", $ip_list );
    63             if( in_array($_SERVER['REMOTE_ADDR'], $ip_list) ){
    64               return wp_get_theme( $this->get_theme() );
     65            $ip_list = str_replace(array("\r\n", "\n", "\r"), "\n", $ip_list); //改行を\nに統一
     66            $ip_list = explode("\n", $ip_list);
     67            if (in_array($_SERVER['REMOTE_ADDR'], $ip_list)) {
     68                return wp_get_theme($this->get_theme());
    6569            }
    6670        }
    6771
    6872        // ログイン状態とレベルをチェック
    69         if ( $this->has_capability() && $this->is_test_enabled() ) {
     73        if ($this->has_capability() && $this->is_test_enabled()) {
    7074
    7175            // 現在の設定されているテーマを取得
    72             if ( !$theme = $this->get_theme() ) {
     76            if (!$theme = $this->get_theme()) {
    7377                return false;
    7478            }
    7579
    7680            // 設定されているテーマがあれば取得する
    77             $theme_object = wp_get_theme( $theme );
    78             if ( !empty( $theme_object ) ) {
    79                 if ( isset( $theme_object->Status ) && $theme_object->Status != 'publish' ) {
     81            $theme_object = wp_get_theme($theme);
     82            if (!empty($theme_object)) {
     83                if (isset($theme_object->Status) && $theme_object->Status != 'publish') {
    8084                    return false;
    8185                }
     
    9397     * テンプレートを設定
    9498     */
    95     function template_filter( $template ) {
     99    function template_filter($template)
     100    {
    96101        $theme = $this->apply_test_theme();
    97         if ( $theme === false ) {
     102        if ($theme === false) {
    98103            return $template;
    99104        }
     
    105110     * スタイルシートを設定
    106111     */
    107     function stylesheet_filter( $stylesheet ) {
     112    function stylesheet_filter($stylesheet)
     113    {
    108114        $theme = $this->apply_test_theme();
    109         if ( $theme === false ) {
     115        if ($theme === false) {
    110116            return $stylesheet;
    111117        }
  • wp-theme-test/trunk/readme.txt

    r2244269 r2316295  
    44Tags: : page, pages,theme, themes
    55Requires at least: 3.0 or higher
    6 Tested up to: 5.3.2
    7 Stable tag: 1.1.2
     6Tested up to: 5.4.1
     7Stable tag: 1.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • wp-theme-test/trunk/wp-theme-test.php

    r2244269 r2316295  
    55Description: The theme can be changed and displayed to only logged in users.
    66Author: Nakashima Masahiro
    7 Version: 1.1.2
     7Version: 1.1.3
    88Author URI: http://www.kigurumi.asia
    99Text Domain: wptt
    1010Domain Path: /languages/
    1111*/
    12 define( 'WPTT_VERSION', '1.1.2' );
    13 define( 'WPTT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    14 define( 'WPTT_PLUGIN_NAME', trim( dirname( WPTT_PLUGIN_BASENAME ), '/' ) );
    15 define( 'WPTT_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) );
    16 define( 'WPTT_PLUGIN_URL', untrailingslashit( plugins_url( '', __FILE__ ) ) );
    17 define( 'WPTT_TEXT_DOMAIN', 'wptt' );
     12define('WPTT_VERSION', '1.1.3');
     13define('WPTT_PLUGIN_BASENAME', plugin_basename(__FILE__));
     14define('WPTT_PLUGIN_NAME', trim(dirname(WPTT_PLUGIN_BASENAME), '/'));
     15define('WPTT_PLUGIN_DIR', untrailingslashit(dirname(__FILE__)));
     16define('WPTT_PLUGIN_URL', untrailingslashit(plugins_url('', __FILE__)));
     17define('WPTT_TEXT_DOMAIN', 'wptt');
    1818
    1919require_once WPTT_PLUGIN_DIR . '/classes/class.core.php';
    2020
    21 class WP_Theme_Test extends WPTT_Core {
     21class WP_Theme_Test extends WPTT_Core
     22{
    2223
    2324    /**
    2425     * __construct
    2526     */
    26     public function __construct() {
     27    public function __construct()
     28    {
    2729        //他言語化
    28         load_plugin_textdomain( WPTT_TEXT_DOMAIN, false, basename( dirname( __FILE__ ) ) . '/languages/' );
     30        load_plugin_textdomain(WPTT_TEXT_DOMAIN, false, basename(dirname(__FILE__)) . '/languages/');
    2931        //actions
    30         add_action( 'init', array( $this, 'load_files' ) );
     32        add_action('init', array($this, 'load_files'));
    3133        //filters
    32         add_filter( 'template', array( $this, 'template_filter' ) );
    33         add_filter( 'stylesheet', array( $this, 'stylesheet_filter' ) );
     34        add_filter('template', array($this, 'template_filter'));
     35        add_filter('stylesheet', array($this, 'stylesheet_filter'));
    3436        // プラグインが有効・無効化されたとき
    35         register_activation_hook( __FILE__, array( $this, 'activation_hook' ) );
    36         register_deactivation_hook( __FILE__, array( $this, 'deactivation_hook' ) );
    37         register_uninstall_hook( __FILE__, array( $this, 'uninstall_hook' ) );
     37        // register_activation_hook(__FILE__, array($this, 'activation_hook'));
     38        // register_deactivation_hook(__FILE__, array($this, 'deactivation_hook'));
     39        // register_uninstall_hook(__FILE__, array($this, 'uninstall_hook'));
    3840    }
    3941
     
    4143     * load_files
    4244     */
    43     public function load_files() {
     45    public function load_files()
     46    {
    4447        // Classes
    4548        include_once WPTT_PLUGIN_DIR . '/classes/class.admin.php';
     
    4952     * apply_test_theme
    5053     */
    51     function apply_test_theme() {
     54    function apply_test_theme()
     55    {
    5256        //GETでも変えれるようにする
    53         if ( isset( $_GET['theme'] ) && $this->get_parameter() ) {
    54             $theme_object = wp_get_theme( esc_html( $_GET['theme'] ) );
     57        if (isset($_GET['theme']) && $this->get_parameter()) {
     58            $theme_object = wp_get_theme(esc_html($_GET['theme']));
    5559            return $theme_object;
    5660        }
    5761
    5862        //IPアドレスでも変えれるようにする
    59         if ( $this->get_ip_list() ) {
     63        if ($this->get_ip_list()) {
    6064            $ip_list = $this->get_ip_list();
    61             $ip_list = str_replace(array("\r\n", "\n", "\r"),"\n",$ip_list); //改行を\nに統一
    62             $ip_list = explode( "\n", $ip_list );
    63             if( in_array($_SERVER['REMOTE_ADDR'], $ip_list) ){
    64               return wp_get_theme( $this->get_theme() );
     65            $ip_list = str_replace(array("\r\n", "\n", "\r"), "\n", $ip_list); //改行を\nに統一
     66            $ip_list = explode("\n", $ip_list);
     67            if (in_array($_SERVER['REMOTE_ADDR'], $ip_list)) {
     68                return wp_get_theme($this->get_theme());
    6569            }
    6670        }
    6771
    6872        // ログイン状態とレベルをチェック
    69         if ( $this->has_capability() && $this->is_test_enabled() ) {
     73        if ($this->has_capability() && $this->is_test_enabled()) {
    7074
    7175            // 現在の設定されているテーマを取得
    72             if ( !$theme = $this->get_theme() ) {
     76            if (!$theme = $this->get_theme()) {
    7377                return false;
    7478            }
    7579
    7680            // 設定されているテーマがあれば取得する
    77             $theme_object = wp_get_theme( $theme );
    78             if ( !empty( $theme_object ) ) {
    79                 if ( isset( $theme_object->Status ) && $theme_object->Status != 'publish' ) {
     81            $theme_object = wp_get_theme($theme);
     82            if (!empty($theme_object)) {
     83                if (isset($theme_object->Status) && $theme_object->Status != 'publish') {
    8084                    return false;
    8185                }
     
    9397     * テンプレートを設定
    9498     */
    95     function template_filter( $template ) {
     99    function template_filter($template)
     100    {
    96101        $theme = $this->apply_test_theme();
    97         if ( $theme === false ) {
     102        if ($theme === false) {
    98103            return $template;
    99104        }
     
    105110     * スタイルシートを設定
    106111     */
    107     function stylesheet_filter( $stylesheet ) {
     112    function stylesheet_filter($stylesheet)
     113    {
    108114        $theme = $this->apply_test_theme();
    109         if ( $theme === false ) {
     115        if ($theme === false) {
    110116            return $stylesheet;
    111117        }
Note: See TracChangeset for help on using the changeset viewer.