public static function getInstance() { if (self::$instance == false) { self::$instance = new Main(); } return self::$instance; }
public static function getInstance() { if (!Main::$instance) { Main::$instance = new Main(); } return Main::$instance; }
public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Constructor */ public function __construct() { $this->plugin = Main::instance(); // Register the menu page add_action('admin_menu', [$this, 'owl_submenu_page']); add_action('admin_init', [$this, 'display_settings_fields']); // Scripts add_action('wp_enqueue_scripts', [$this, 'enqueue_v2']); add_action('admin_enqueue_scripts', [$this, 'admin_enqueue']); }
/** * Constructor */ public function __construct() { $this->plugin = Main::instance(); // Initialize post type add_action('init', [$this, 'init_post_type']); // Add admin column add_action('manage_edit-owl-carousel_columns', [$this, 'owl_columnfilter']); add_action('manage_posts_custom_column', [$this, 'owl_column']); // Add functions to create a new attachments fields add_filter('attachment_fields_to_edit', [$this, 'owl_carousel_attachment_fields_to_edit'], null, 2); add_filter('attachment_fields_to_save', [$this, 'owl_carousel_attachment_fields_to_save'], null, 2); }
/** * Returns the main instance */ function main() { return Main::instance(); }
<?php namespace Fragen\Category_Colors; /* * Setup variables for CSS generation. */ $teccc = Main::instance(); $options = Admin::fetch_options($teccc); if (function_exists('tribe_get_mobile_breakpoint')) { $breakpoint = tribe_get_mobile_breakpoint(); } ?> /* The Events Calendar Category Colors <?php echo Main::$version; ?> generated CSS */ .teccc-legend a, .tribe-events-calendar a, #tribe-events-content .tribe-events-tooltip h4 { font-weight: <?php esc_attr_e($options['font_weight']); ?> ; } .tribe-events-list .vevent.hentry h2 { padding-left: 5px; } @media only screen and (max-width: <?php esc_attr_e($breakpoint); ?>
$this->__config = array_replace($this->__config, $new); } } } public function DBconfig($new = array()) { foreach ($new as $key => $value) { if (array_key_exists($key, $this->__DBconfig)) { $this->__DBconfig = array_replace($this->__DBconfig, $new); } } } protected $__config = array('sessionName' => 'SESSION', 'hashName' => 'token', 'cookiePath' => '/', 'authTime' => 10800, 'lockDelay' => 1200, 'checkIP' => 'strict', 'multiple' => true, 'onMultiple' => 'allow', 'reroute' => false, 'lockscreen' => true, 'loginPageUrl' => '/', 'lockscreenPageUrl' => '/lockscreen', 'successUrl' => '/dashboard', 'lockRef' => true, 'lockRef_Name' => 'referer'); protected $__DBconfig = array('tUserInfo' => 'user', 'tUserToken' => 'token', 'fLogin' => 'login', 'hashLogin' => true, 'fPassword' => 'pwd', 'fIdUser' => 'id_user', 'fToken' => 'token', 'fTokenIp' => 'user_ip', 'fTokenAdd' => 'time_add'); } /** * Plugin exception */ class Auth_exception extends \Exception { public function __construct($message = null, $code = 0) { if (!$message) { throw new $this('Unknown exception'); } parent::__construct($message, $code); // log } } return Main::instance();
<?php /* Plugin Name: Cron Control Plugin URI: Description: Execute WordPress cron events in parallel, using a custom post type for event storage. Author: Erick Hitter, Automattic Version: 1.0 Text Domain: automattic-cron-control */ namespace Automattic\WP\Cron_Control; // Load basics needed to instantiate plugin require __DIR__ . '/includes/constants.php'; require __DIR__ . '/includes/utils.php'; require __DIR__ . '/includes/abstract-class-singleton.php'; require __DIR__ . '/includes/class-lock.php'; // For data consistency, ensure alternate data store is always loaded require __DIR__ . '/includes/class-cron-options-cpt.php'; // Instantiate main plugin class, which checks environment and loads remaining classes when appropriate require __DIR__ . '/includes/class-main.php'; Main::instance();