本文整理汇总了PHP中Settings::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::instance方法的具体用法?PHP Settings::instance怎么用?PHP Settings::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例2: get_instance
public static function get_instance()
{
if (self::$instance === NULL) {
self::$instance = new self();
}
return self::$instance;
}
示例3: getInstance
/**
* Singleton method that returns a unique instance of the class.
*
* @return
*/
private static function getInstance()
{
if (!self::$instance instanceof self) {
self::$instance = new self();
}
return self::$instance;
}
示例4: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
示例5: getInstance
public static function getInstance()
{
if (self::$instance === null) {
self::$instance = new Settings();
}
return self::$instance;
}
示例6: getInstance
static function getInstance()
{
if (self::$instance == NULL) {
self::$instance = new Settings();
}
return self::$instance;
}
示例7: initate
static function initate()
{
$class = __CLASS__;
if (!isset(self::$instance)) {
self::$instance = new $class();
}
return self::$instance;
}
示例8: getInstance
function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例9: get_post_image_url
public function get_post_image_url($filename)
{
$settings = Settings::instance();
$supportedFormats = array("jpg", "png", "gif");
$slug = pathinfo($filename, PATHINFO_FILENAME);
foreach ($supportedFormats as $fmt) {
$imgFile = sprintf("%s%s.%s", $settings->posts_dir, $slug, $fmt);
if (file_exists($imgFile)) {
return sprintf("%s/%s.%s", "{$blog_url}posts", $slug, $fmt);
}
}
return false;
}
示例10: run
public function run()
{
$menu = Menu::instance();
$manager = Manager::instance();
$settings = Settings::instance();
$attachment_edit = AttachmentEdit::instance();
$menu->set_manager($manager);
$menu->set_settings($settings);
$menu->init_pages();
add_action('wpod', array($menu, 'add_components'));
add_action('admin_enqueue_scripts', array($attachment_edit, 'enqueue_scripts'), 10, 1);
add_action('attachment_submitbox_misc_actions', array($attachment_edit, 'attachment_submitbox_misc_actions'), 100, 0);
add_filter('map_meta_cap', array($this, 'map_meta_cap'), 10, 4);
}
示例11: instance
private static function instance($mailer_settings = array())
{
if (empty(self::$default_settings)) {
self::$default_settings = Settings::instance()->getValues('Emails');
}
if (empty($mailer_settings)) {
$mailer_settings = self::$default_settings;
}
if (empty(self::$_mailer)) {
self::$_mailer = new Mailer();
self::$_mailer->LE = defined('IS_WINDOWS') ? "\r\n" : "\n";
self::$_mailer->PluginDir = Registry::get('config.dir.lib') . 'vendor/phpmailer/phpmailer';
}
if ($mailer_settings['mailer_send_method'] == 'smtp') {
self::$_mailer->IsSMTP();
self::$_mailer->SMTPAuth = $mailer_settings['mailer_smtp_auth'] == 'Y' ? true : false;
self::$_mailer->Host = $mailer_settings['mailer_smtp_host'];
self::$_mailer->Username = $mailer_settings['mailer_smtp_username'];
self::$_mailer->Password = $mailer_settings['mailer_smtp_password'];
self::$_mailer->SMTPSecure = $mailer_settings['mailer_smtp_ecrypted_connection'];
} elseif ($mailer_settings['mailer_send_method'] == 'sendmail') {
self::$_mailer->IsSendmail();
self::$_mailer->Sendmail = $mailer_settings['mailer_sendmail_path'];
} else {
self::$_mailer->IsMail();
}
return self::$_mailer;
}
示例12: __construct
public function __construct()
{
$this->settings = Settings::instance();
}
示例13: init
public static function init() {
if(! isset(self::$instance)) {
self::$instance = new Settings(getrootdirsrvinclude()."settings.php");
}
return self::$instance;
}
示例14: getInstance
/**
* Get Instance of Singleton Object
*
* @return Setting
*/
public static function getInstance()
{
/* Check Instance */
if (!self::$instance instanceof self) {
self::$instance = new self();
}
/* Return */
return self::$instance;
}
示例15: __construct
public function __construct()
{
$this->settings = Settings::instance();
$this->tools = new Tools();
}