当前位置: 首页>>代码示例>>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;未经允许,请勿转载。