當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Options::get_instance方法代碼示例

本文整理匯總了PHP中Options::get_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Options::get_instance方法的具體用法?PHP Options::get_instance怎麽用?PHP Options::get_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Options的用法示例。


在下文中一共展示了Options::get_instance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Patch the 'parse_request' action in WordPress to handle calls to this web service.
  */
 function __construct()
 {
     add_action("parse_request", function ($wp) {
         if ($_GET[PLUGIN_SLUG . '_player'] == '1') {
             $opt = Options::get_instance();
             $site_root = esc_url(home_url('/'));
             include PLUGIN_DIR . 'views/player.php';
             exit;
         }
     });
 }
開發者ID:loonix,項目名稱:music-stream-vote,代碼行數:14,代碼來源:Player.php

示例2: load

 public function load()
 {
     require_once HM_LIMIT_LOGIN_DIR . 'inc/class-options.php';
     require_once HM_LIMIT_LOGIN_DIR . 'inc/class-errors.php';
     require_once HM_LIMIT_LOGIN_DIR . 'inc/class-cookies.php';
     require_once HM_LIMIT_LOGIN_DIR . 'inc/class-validation.php';
     require_once HM_LIMIT_LOGIN_DIR . 'inc/class-notifications.php';
     if (HM_LIMIT_LOGIN_VERSION !== get_option('hm_limit_login_version')) {
         $this->set_default_variables();
     }
     load_plugin_textdomain('limit-login-attempts', false, dirname(plugin_basename(__FILE__)));
     Options::get_instance();
     Errors::get_instance();
     Cookies::get_instance();
     Validation::get_instance();
     Notifications::get_instance();
 }
開發者ID:humanmade,項目名稱:hm-limit-login-attempts,代碼行數:17,代碼來源:class-setup.php

示例3: web_stats

 /**
  * (Web service method) Get current top 10 by vote sum
  * @param  mixed[] $args an empty array
  * @return mixed[] status; error_message; output (what to announce in IRC chat room)
  */
 private function web_stats($args)
 {
     // This function is messy. Maybe clean it up later, but it works now.
     $opt = Options::get_instance();
     $lengths = array();
     preg_replace_callback('/\\$\\{(\\w+),(\\d+)\\}/', function ($matches) {
         global $lengths;
         $lengths[$matches[1]] = $matches[2];
     }, $opt->txt_stats);
     // example: ${begin_repeat,10}#${num} ${title,21}${end_repeat}
     $response = preg_replace_callback('/\\$\\{begin_repeat,(\\d+)\\}(.*?)\\$\\{end_repeat\\}/i', function ($matches) {
         global $lengths;
         $limit = $matches[1];
         $template = $matches[2];
         $n = 1;
         $out = array();
         $results = Track::irc_stats($limit);
         foreach ($results as $result) {
             $v = get_object_vars($result);
             $stream_title = substr($result->stream_title, 0, $lengths['stream_title']);
             $title = substr($result->title, 0, $lengths['title']);
             $artist = substr($result->artist, 0, $lengths['artist']);
             $txt = $template;
             $txt = str_replace('${stream_title,' . $lengths['stream_title'] . '}', $stream_title, $txt);
             $txt = str_replace('${title,' . $lengths['title'] . '}', $title, $txt);
             $txt = str_replace('${artist,' . $lengths['artist'] . '}', $artist, $txt);
             $txt = str_ireplace('${num}', $n, $txt);
             $out[] = $txt;
             $n++;
         }
         return implode(' ', $out);
     }, $opt->txt_stats);
     return array('status' => 'ok', 'error_message' => '', 'output' => $response, 'private' => $opt->txt_stats_switch);
 }
開發者ID:loonix,項目名稱:music-stream-vote,代碼行數:39,代碼來源:BotService.php


注:本文中的Options::get_instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。