Plugin Directory

Changeset 2239071


Ignore:
Timestamp:
02/05/2020 01:26:39 PM (6 years ago)
Author:
themecentury
Message:

Newer version released

Location:
century-toolkit
Files:
92 added
16 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • century-toolkit/trunk/century-toolkit.php

    r2204291 r2239071  
    11<?php
    2 /*
    3 Plugin Name: Century ToolKit
    4 Plugin URI: https://wordpress.org/plugins/century-toolkit/
    5 Description: Demo importer for WordPress themes.
    6 Version: 1.0.6
    7 Author: ThemeCentury Team
    8 Author URI: https://themecentury.com/
    9 License: GPL3
    10 License URI: http://www.gnu.org/licenses/gpl.html
    11 Text Domain: century-toolkit
    12 */
     2/**
     3 * Plugin Name:       Century ToolKit
     4 * Plugin URI:        https://wordpress.org/plugins/century-toolkit
     5 * Description:       Century ToolKit is specially developed for themecentury themes. This plugin help to import demo content and related settings.
     6 * Version:           1.1.0
     7 * Author:            themecentury
     8 * Author URI:        https://themecentury.com/
     9 * License:           GPL-2.0+
     10 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     11 * Text Domain:       century-toolkit
     12 * Domain Path:       /languages
     13 */
    1314
    14 // Block direct access to the main plugin file.
    15 if ( ! defined( 'ABSPATH' ) ) {
    16     exit; // Exit if accessed directly.
     15if (!defined('ABSPATH')) {
     16    exit; // Exit if accessed directly.
    1717}
    1818
    19 // Define TCY_TOOLKIT_FILE.
    20 if ( ! defined( 'TCY_TOOLKIT_FILE' ) ) {
    21     define( 'TCY_TOOLKIT_FILE', __FILE__ );
     19// Define CENTURY_TOOLKIT_PLUGIN_FILE.
     20if (!defined('CENTURY_TOOLKIT_FILE')) {
     21    define('CENTURY_TOOLKIT_FILE', __FILE__);
    2222}
    2323
    24 // Include the main WooCommerce class.
    25 if ( ! class_exists( 'ThemeCentury_Demo_Importer' ) ) {
    26     include_once dirname( __FILE__ ) . '/includes/class-century-toolkit.php';
     24// Define CENTURY_TOOLKIT_VERSION.
     25if (!defined('CENTURY_TOOLKIT_VERSION')) {
     26    define('CENTURY_TOOLKIT_VERSION', '1.1.0');
     27}
     28
     29// Define CENTURY_TOOLKIT_PLUGIN_URI.
     30if (!defined('CENTURY_TOOLKIT_PLUGIN_URI')) {
     31    define('CENTURY_TOOLKIT_PLUGIN_URI', plugins_url('', CENTURY_TOOLKIT_FILE) . '/');
     32}
     33
     34// Define CENTURY_TOOLKIT_PLUGIN_DIR.
     35if (!defined('CENTURY_TOOLKIT_PLUGIN_DIR')) {
     36    define('CENTURY_TOOLKIT_PLUGIN_DIR', plugin_dir_path(CENTURY_TOOLKIT_FILE) );
     37}
     38
     39// Include the main Century_Toolkit class.
     40if (!class_exists('Century_Toolkit')) {
     41    include_once dirname(__FILE__) . '/includes/class-century-toolkit.php';
    2742}
    2843
    2944/**
    30  * Main instance of ThemeCentury_Demo_Importer.
     45 * Main instance of Century_Toolkit.
    3146 *
    32  * Returns the main instance of TET to prevent the need to use globals.
     47 * Returns the main instance of Century_Toolkit to prevent the need to use globals.
    3348 *
    3449 * @since 1.0.0
    35  * @return ThemeCentury_Demo_Importer
     50 * @return Century_Toolkit
    3651 */
    37 function century_toolkit() {
    38     return ThemeCentury_Demo_Importer::instance();
    39 }
     52if(!function_exists('century_toolkit_instance')):
     53
     54    function century_toolkit_instance(){
     55
     56        return Century_Toolkit::instance();
     57
     58    }
     59
     60endif;
    4061
    4162// Global for backwards compatibility.
    42 $GLOBALS['century-toolkit'] = century_toolkit();
     63$GLOBALS['century-toolkit-instance'] = century_toolkit_instance();
  • century-toolkit/trunk/includes/class-century-toolkit.php

    r2140357 r2239071  
    11<?php
    2 /**
    3  * ThemeCentury_Demo_Importer setup
    4  *
    5  * @author   ThemeCentury
    6  * @category API
    7  * @package  ThemeCentury_Demo_Importer
    8  * @since 1.0.0
    9  */
    102
    11 if ( ! defined( 'ABSPATH' ) ) {
    12     exit; // Exit if accessed directly.
    13 }
     3final class Century_Toolkit
     4{
    145
    15 /**
    16  * Main ThemeCentury_Demo_Importer Class.
    17  *
    18  * @class ThemeCentury_Demo_Importer
    19  * @version    1.0.0
    20  */
    21 final class ThemeCentury_Demo_Importer {
    22 
    23     /**
    24      * ThemeCentury_Demo_Importer version.
    25      *
    26      * @var string
    27      */
    28     public $version = '1.2.5';
    29 
    30     /**
    31      * The single instance of the class.
    32      *
    33      * @var ThemeCentury_Demo_Importer
    34      * @since 1.0.0
    35      */
    36     protected static $_instance = null;
    37 
    38     /**
    39      * Main ThemeCentury_Demo_Importer Instance.
    40      *
    41      * Ensures only one instance of ThemeCentury_Demo_Importer is loaded or can be loaded.
    42      *
    43      * @since 1.0.0
    44      * @static
    45      * @see TET()
    46      * @return ThemeCentury_Demo_Importer - Main instance.
    47      */
    48     public static function instance() {
    49         if ( is_null( self::$_instance ) ) {
    50             self::$_instance = new self();
    51         }
    52 
    53         return self::$_instance;
    54     }
    55 
    56     /**
    57      * Cloning is forbidden.
    58      *
    59      * @since 1.0.0
    60      */
    61     public function __clone() {
    62         _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'century-toolkit' ), '1.0.0' );
    63     }
    64 
    65     /**
    66      * Unserializing instances of this class is forbidden.
    67      *
    68      * @since 1.0.0
    69      */
    70     public function __wakeup() {
    71         _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'century-toolkit' ), '1.0.0' );
    72     }
    73 
    74     /**
    75      * Auto-load in-accessible properties on demand.
    76      *
    77      * @param mixed $key Key name.
    78      *
    79      * @return mixed
    80      */
    81     public function __get( $key ) {
    82         if ( in_array( $key, array( '' ), true ) ) {
    83             return $this->$key();
    84         }
    85     }
    86 
    87     /**
    88      * ThemeCentury_Demo_Importer Constructor.
    89      */
    90     public function __construct() {
    91         $this->define_constants();
    92         $this->includes();
    93         $this->init_hooks();
    94 
    95         do_action( 'themecentury_toolkit_loaded' );
    96     }
    97 
    98     /**
    99      * Hook into actions and filters.
    100      *
    101      * @since 1.0.0
    102      */
    103     private function init_hooks() {
    104         //register_activation_hook( TCY_TOOLKIT_FILE, array( 'TCY_Install', 'install' ) );
    105         register_shutdown_function( array( $this, 'log_errors' ) );
    106         add_action( 'after_setup_theme', array( $this, 'include_template_functions' ), 11 );
    107         add_action( 'init', array( $this, 'init' ), 0 );
    108     }
    109 
    110     /**
    111      * Ensures fatal errors are logged so they can be picked up in the status report.
    112      *
    113      * @since 1.0.0
    114      */
    115     public function log_errors() {
    116 
    117     }
    118 
    119     /**
    120      * Define WC Constants.
    121      */
    122     private function define_constants() {
    123         $upload_dir = wp_upload_dir( null, false );
    124 
    125         $this->define( 'TCY_ABSPATH', dirname( TCY_TOOLKIT_FILE ) . '/' );
    126         $this->define( 'TCY_PLUGIN_BASENAME', plugin_basename( TCY_TOOLKIT_FILE ) );
    127         $this->define( 'TCY_VERSION', $this->version );
    128         $this->define( 'CENTURY_TOOLKIT_VERSION', $this->version );
    129         $this->define( 'TCY_LOG_DIR', $upload_dir['basedir'] . '/mg-logs/' );
    130     }
    131 
    132     /**
    133      * Define constant if not already set.
    134      *
    135      * @param string $name Constant name.
    136      * @param string|bool $value Constant value.
    137      */
    138     private function define( $name, $value ) {
    139         if ( ! defined( $name ) ) {
    140             define( $name, $value );
    141         }
    142     }
    143 
    144     /**
    145      * What type of request is this?
    146      *
    147      * @param  string $type admin, ajax, cron or frontend.
    148      *
    149      * @return bool
    150      */
    151     private function is_request( $type ) {
    152         switch ( $type ) {
    153             case 'admin' :
    154                 return is_admin();
    155             case 'ajax' :
    156                 return defined( 'DOING_AJAX' );
    157             case 'cron' :
    158                 return defined( 'DOING_CRON' );
    159             case 'frontend' :
    160                 return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
    161         }
    162     }
    163 
    164     /**
    165      * Check the active theme.
    166      *
    167      * @since 1.0.0
    168      *
    169      * @param  string $theme Theme slug to check.
    170      *
    171      * @return bool
    172      */
    173     private function is_active_theme( $theme ) {
    174         return get_template() === $theme;
    175     }
    176 
    177     /**
    178      * Include required core files used in admin and on the frontend.
    179      */
    180     public function includes() {
    181         /**
    182          * Class autoloader.
    183          */
    184         include_once( TCY_ABSPATH . 'includes/class-tcy-autoloader.php' );
    185 
    186         /**
    187          * Abstract classes.
    188          */
    189         include_once( TCY_ABSPATH . 'includes/abstracts/abstract-tcy-theme-demo.php' ); // TCY_Data for CRUD.
    190         /**
    191          * Core classes.
    192          */
    193         include_once( TCY_ABSPATH . 'includes/tcy-core-functions.php' );
    194         include_once( TCY_ABSPATH . 'includes/class-tcy-ajax.php' );
     6    private static $_instance = null;
    1957
    1968
    197         if ( $this->is_request( 'admin' ) ) {
    198             include_once( TCY_ABSPATH . 'includes/admin/class-tcy-admin.php' );
    199         }
     9    public static function instance()
     10    {
     11        if (is_null(self::$_instance))
     12            self::$_instance = new self();
     13        return self::$_instance;
     14    }
    20015
    201         if ( $this->is_request( 'frontend' ) ) {
    202             $this->frontend_includes();
    203         }
    204     }
    20516
    206     /**
    207      * Include required frontend files.
    208      */
    209     public function frontend_includes() {
     17    public function __construct(){
    21018
    211     }
     19        $this->define_constants();
     20        $this->includes();
     21        $this->init_hooks();
     22    }
    21223
    213     /**
    214      * Function used to Init ThemeCentury_Demo_Importer Template Functions - This makes them pluggable by plugins and themes.
    215      */
    216     public function include_template_functions() {
    217     }
     24    private function define($name, $value)
     25    {
     26        if (!defined($name)) {
     27            define($name, $value);
     28        }
     29    }
    21830
    219     /**
    220      * Init ThemeCentury_Demo_Importer when WordPress Initialises.
    221      */
    222     public function init() {
    223         // Before init action.
    224         do_action( 'before_themecentury_toolkit_init' );
     31    private function define_constants()
     32    {
     33        $upload_dir = wp_upload_dir(null, false);
    22534
    226         // Set up localisation.
    227         $this->load_plugin_textdomain();
    22835
    229         // Init action.
    230         do_action( 'themecentury_toolkit_init' );
    231     }
     36        $this->define('CENTURY_TOOLKIT_ABSPATH', dirname(CENTURY_TOOLKIT_FILE) . '/');
     37        $this->define('CENTURY_TOOLKIT_BASENAME', plugin_basename(CENTURY_TOOLKIT_FILE));
     38        $this->define('CENTURY_TOOLKIT_UPLOAD_DIR', $upload_dir['basedir'] . '/century-toolkit-upload/');
     39        $this->define('CENTURY_TOOLKIT_DYNAMIC_CSS_PATH', CENTURY_TOOLKIT_UPLOAD_DIR . 'century-toolkit-dynamic.css');
     40        $this->define('CENTURY_TOOLKIT_DYNAMIC_CSS_URI', $upload_dir['baseurl'] . '/century-toolkit-upload/century-toolkit-dynamic.css');
    23241
    233     /**
    234      * Load Localisation files.
    235      *
    236      * Note: the first-loaded translation file overrides any following ones if the same translation is present.
    237      *
    238      * Locales found in:
    239      *      - WP_LANG_DIR/century-toolkit/century-toolkit-LOCALE.mo
    240      *      - WP_LANG_DIR/plugins/century-toolkit-LOCALE.mo
    241      */
    242     public function load_plugin_textdomain() {
    243         $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
    244         $locale = apply_filters( 'plugin_locale', $locale, 'century-toolkit' );
    24542
    246         unload_textdomain( 'century-toolkit' );
    247         load_textdomain( 'century-toolkit', WP_LANG_DIR . '/century-toolkit/century-toolkit-' . $locale . '.mo' );
    248         load_plugin_textdomain( 'century-toolkit', false, plugin_basename( dirname( TCY_TOOLKIT_FILE ) ) . '/i18n/languages' );
    249     }
     43    }
    25044
    251     /**
    252      * Get the plugin url.
    253      *
    254      * @return string
    255      */
    256     public function plugin_url() {
    257         return untrailingslashit( plugins_url( '/', TCY_TOOLKIT_FILE ) );
    258     }
     45    public function includes()
     46    {
     47        include_once CENTURY_TOOLKIT_ABSPATH . 'includes/class-century-toolkit-install.php';
    25948
    260     /**
    261      * Get the plugin path.
    262      *
    263      * @return string
    264      */
    265     public function plugin_path() {
    266         return untrailingslashit( plugin_dir_path( TCY_TOOLKIT_FILE ) );
    267     }
     49        include_once CENTURY_TOOLKIT_ABSPATH . 'includes/century-toolkit-demo-data.php';
     50        include_once CENTURY_TOOLKIT_ABSPATH . 'includes/panel/demos.php';
    26851
    269     /**
    270      * Get the template path.
    271      *
    272      * @return string
    273      */
    274     public function template_path() {
    275         return apply_filters( 'themecentury_toolkit_template_path', 'century-toolkit/' );
    276     }
     52    }
    27753
    278     /**
    279      * Get Ajax URL.
    280      *
    281      * @return string
    282      */
    283     public function ajax_url() {
    284         return admin_url( 'admin-ajax.php', 'relative' );
    285     }
     54
     55    public function init_hooks()
     56    {
     57        register_activation_hook(CENTURY_TOOLKIT_FILE, array('Century_Toolkit_Install', 'install'));
     58
     59        add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
     60
     61    }
     62
     63
     64    public function load_plugin_textdomain(){
     65        $current_folder_path = dirname(plugin_basename(__FILE__));
     66        load_plugin_textdomain('century-toolkit', false, dirname($current_folder_path) . '/languages/');
     67    }
     68
     69    /**
     70     * Cloning is forbidden.
     71     *
     72     * @since 1.0.0
     73     */
     74    public function __clone()
     75    {
     76        _doing_it_wrong(__FUNCTION__, __( 'Cheatin&#8217; huh?', 'century-toolkit' ), '1.0.0');
     77    }
     78
     79    /**
     80     * Unserializing instances of this class is forbidden.
     81     *
     82     * @since 1.0.0
     83     */
     84    public function __wakeup()
     85    {
     86        _doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'century-toolkit'), '1.0.0');
     87    }
     88
    28689}
  • century-toolkit/trunk/readme.txt

    r2204291 r2239071  
    44Requires at least: 4.0.0
    55Tested up to: 5.3
    6 Stable tag: 1.0.6
     6Stable tag: 1.1.0
    77License: GPLv3 or later
    88
     
    4343== Changelog ==
    4444
     45= 1.1.0 - 2020/02/05 =
     46* Updated: Century ToolKit Updated
     47
    4548= 1.0.6 - 2019/09/23 =
    4649* Updated: HamroClass Demo Update
     
    5962= 1.0.2 - 2019/03/24 =
    6063* Added: Importer for Lekh theme
    61 * Added: Importer for MultiBusiness Theme
    6264
    6365= 1.0.1 - 2019/03/22 =
Note: See TracChangeset for help on using the changeset viewer.