本文整理汇总了PHP中Main::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Main::instance方法的具体用法?PHP Main::instance怎么用?PHP Main::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main::instance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (self::$instance == false) {
self::$instance = new Main();
}
return self::$instance;
}
示例2: getInstance
public static function getInstance()
{
if (!Main::$instance) {
Main::$instance = new Main();
}
return Main::$instance;
}
示例3: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
示例4: __construct
/**
* 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']);
}
示例5: __construct
/**
* 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);
}
示例6: main
/**
* Returns the main instance
*/
function main()
{
return Main::instance();
}
示例7: and
<?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);
?>
示例8: array_replace
$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();
示例9:
<?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();