get_instance() публичный статический Метод

Singleton
public static get_instance ( )
function cptp_init_instance()
{
    CPTP::get_instance();
}
<?php

/*
Plugin Name: Custom Post Type Permalinks
Plugin URI: http://www.torounit.com
Description:  Add post archives of custom post type and customizable permalinks.
Author: Toro_Unit
Author URI: http://www.torounit.com/plugins/custom-post-type-permalinks/
Version: 0.9.5.3
Text Domain: cptp
License: GPL2 or later
Domain Path: /language/
*/
/**
 *
 * Custom Post Type Permalinks
 *
 * @package Custom_Post_Type_Permalinks
 * @version 0.9.4
 *
 */
require_once dirname(__FILE__) . '/CPTP.php';
CPTP::get_instance();
Пример #3
0
 /**
  *
  * Uninstall Hooks
  * This function will browse initialized modules and execute their uninstall_hook methods.
  *
  * @since 2.0.0
  */
 public static function uninstall()
 {
     $cptp = CPTP::get_instance();
     foreach ($cptp->modules as $module) {
         $module->uninstall_hook();
     }
 }
 * @package Custom_Post_Type_Permalinks
 * @version 2.2.1
 */
define('CPTP_PLUGIN_FILE', __FILE__);
$data = get_file_data(__FILE__, array('ver' => 'Version', 'lang_dir' => 'Domain Path'));
define('CPTP_VERSION', $data['ver']);
define('CPTP_DEFAULT_PERMALINK', '/%postname%/');
/**
 *
 * Autoloader for CPTP.
 *
 * @since 1.0.0
 */
function cptp_class_loader($class_name)
{
    $dir = dirname(__FILE__);
    $file_name = $dir . '/' . str_replace('_', '/', $class_name) . '.php';
    if (is_readable($file_name)) {
        include $file_name;
    }
}
spl_autoload_register('cptp_class_loader');
/**
 * initialize Plugin
 */
add_action('plugins_loaded', array(CPTP::get_instance(), 'init'));
/**
 * Activation hooks.
 */
register_activation_hook(CPTP_PLUGIN_FILE, array(CPTP::get_instance(), 'activate'));