当前位置: 首页>>代码示例>>PHP>>正文


PHP options函数代码示例

本文整理汇总了PHP中options函数的典型用法代码示例。如果您正苦于以下问题:PHP options函数的具体用法?PHP options怎么用?PHP options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($uri = null, $method = null, $params = null)
 {
     $this->server = new Hash();
     $this->server->merge($_SERVER);
     // set uri, method, and params from $_SERVER and $_REQUEST
     $this->uri = $uri ?: $this->server->get('REQUEST_URI', '/');
     $this->params = new Hash();
     $this->params->merge($params ?: $_REQUEST);
     $this->method = $method ?: $this->server->get('REQUEST_METHOD', 'GET');
     $this->method = strtoupper($this->method);
     if ($this->method === 'POST' && options()->get('requestMethodOverride', true)) {
         $method = strtoupper($this->params->get('_method', ''));
         if (in_array($method, array('DELETE', 'GET', 'PUT', 'POST'))) {
             $this->method = $method;
         }
     }
     // strip basePath from uri, if it is set and matches
     $basePath = rtrim(options()->get('requestBasePath', ''), '/');
     if ($basePath && strpos($this->uri, $basePath) === 0) {
         $this->uri = substr($this->uri, strlen($basePath)) ?: '/';
     }
     // split the uri into route and format
     $info = pathinfo($this->uri);
     $this->path = rtrim($info['dirname'], '/') . '/' . $info['filename'];
     if (!empty($info['extension'])) {
         $this->params->format = strtolower($info['extension']);
     } else {
         if (!$this->params->format) {
             $this->params->format = 'html';
         }
     }
     $this->format = $this->params->format;
 }
开发者ID:noonat,项目名称:pipes,代码行数:33,代码来源:request.php

示例2: render

 public function render()
 {
     # make sure we have a template
     if ($this->template === false) {
         throw new TemplateUndefined();
     }
     parent::render();
     # unpack the props
     extract($this->props);
     # trap the buffer
     ob_start();
     # include the template
     require \options('views') . '/' . $this->template . '.' . $this->extension;
     # get the buffer contents
     $parsed = ob_get_contents();
     # clean the buffer
     ob_clean();
     # if there is a layout
     if ($this->layout) {
         # push the content into the layout
         $content_for_layout = $parsed;
         # include the template
         include \options('views') . '/' . $this->layout . "." . $this->extension;
         # get the buffer contents
         $parsed = ob_get_contents();
     }
     # close the output buffer
     ob_end_clean();
     # echo the result
     echo $parsed;
 }
开发者ID:Epictetus,项目名称:vicious,代码行数:31,代码来源:PHTML.php

示例3: login

 public function login($uid = null)
 {
     if (null !== $uid) {
         $this->user->login(models\User::get($uid));
     }
     if ($this->user->isLoggedIn()) {
         $this->_redirect('/blog');
     }
     if ($this->POST) {
         $post = options($_POST);
         $get = options($_GET);
         try {
             // get user object
             $user = models\User::withCredentials(array('username' => (string) $post->username, 'password' => (string) $post->password));
             // log user in(to SessionUser)
             $this->user->login($user);
             // debug direct logged in status
             Session::message('<pre>' . var_export($this->user->isLoggedIn(), 1) . '</pre>');
             // message OK
             Session::success('Alright, alright, alright, you\'re logged in...');
             // back to blog
             return $this->_redirect($post->get('goto', $get->get('goto', 'blog')));
         } catch (\Exception $ex) {
         }
         // message FAIL
         Session::error('Sorry, buddy, that\'s not your username!');
     }
     $messages = Session::messages();
     return get_defined_vars();
 }
开发者ID:rudiedirkx,项目名称:Rudie-on-wheels,代码行数:30,代码来源:userController.php

示例4: process_request

function process_request($ingredients)
{
    $url = NUT_API . urlencode(options($ingredients));
    $context = stream_context_create(array('http' => array('method' => 'GET', 'ignore_errors' => TRUE)));
    $json = file_get_contents($url, 0, $context);
    return json_encode(json_decode($json, true), JSON_PRETTY_PRINT);
}
开发者ID:clintwine,项目名称:nutrition-facts-label,代码行数:7,代码来源:process.php

示例5: load_script

/**
 * Google Analytics snippet from HTML5 Boilerplate
 *
 * Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support('soil-google-analytics', 'UA-XXXXX-Y', 'wp_footer');
 */
function load_script()
{
    $gaID = options('gaID');
    if (!$gaID) {
        return;
    }
    $loadGA = (!defined('WP_ENV') || \WP_ENV === 'production') && !current_user_can('manage_options');
    $loadGA = apply_filters('soil/loadGA', $loadGA);
    ?>
  <script>
    <?php 
    if ($loadGA) {
        ?>
      window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
    <?php 
    } else {
        ?>
      (function(s,o,i,l){s.ga=function(){s.ga.q.push(arguments);if(o['log'])o.log(i+l.call(arguments))}
      s.ga.q=[];s.ga.l=+new Date;}(window,console,'Google Analytics: ',[].slice))
    <?php 
    }
    ?>
    ga('create','<?php 
    echo $gaID;
    ?>
','auto');ga('send','pageview')
  </script>
  <?php 
    if ($loadGA) {
        ?>
    <script src="https://www.google-analytics.com/analytics.js" async defer></script>
  <?php 
    }
}
开发者ID:rku4er,项目名称:vafpress-wp,代码行数:41,代码来源:google-analytics.php

示例6: _chain

 public function _chain($type, Closure $event = null, array $args = array())
 {
     $event or $event = function () {
     };
     $chain = static::event($type);
     $chain->first($event);
     return $chain->start($this, options($args));
 }
开发者ID:rudiedirkx,项目名称:Rudie-on-wheels,代码行数:8,代码来源:Object.php

示例7: load_fonts

/**
 * Add requested Google Fonts in head
 *
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support(
 *	'solero-google-fonts',
 *	[
 *		'Open Sans' => '400,700,400italic,700italic',
 *		'Noto Sans' => '400,400italic'
 *	]
 * );
 */
function load_fonts()
{
    $fonts = options('fonts');
    if (!$fonts) {
        return;
    }
    $query = '//fonts.googleapis.com/css?family=' . $fonts;
    wp_register_style('solero-google-fonts', $query, [], null);
    wp_enqueue_style('solero-google-fonts');
}
开发者ID:starise,项目名称:solero,代码行数:22,代码来源:google-fonts.php

示例8: autofind_layout

 /**
  * Autodetect the layout
  * Looks for a file named "layout.$this->extension" in the views dir
  */
 protected function autofind_layout()
 {
     if ($this->extension != false) {
         $l = \options('views') . '/layout.' . $this->extension;
         if (file_exists($l)) {
             $this->set_layout('layout');
             return 'layout';
         }
     }
     return false;
 }
开发者ID:Epictetus,项目名称:vicious,代码行数:15,代码来源:AbstractView.php

示例9: context

 public static function context($name, $options = array())
 {
     // set context
     if (is_object($options) && is_callable($options)) {
         static::$contexts[$name] = $options;
     }
     // execute & return context
     if (isset(static::$contexts[$name])) {
         $ctx = static::$contexts[$name];
         return $ctx(get_called_class(), options($options));
     }
 }
开发者ID:rudiedirkx,项目名称:Rudie-on-wheels,代码行数:12,代码来源:Email.php

示例10: options

function options($self, $title, $prefix, $entityName, $withCsvOptions, $withMagmiDelete, $withEnable, $withDefaults, $pruneKeepDefaultValue, $sourceText, $plugin)
{
    $default_rows_for_sets = "attribute_set_name,attribute_code,attribute_group_name\n*,name,General\n*,description,General\n*,short_description,General\n*,sku,General\n*,weight,General\n*,news_from_date,General\n*,news_to_date,General\n*,status,General\n*,url_key,General\n*,visibility,General\n*,country_of_manufacture,General\n*,price,Prices\n*,group_price,Prices\n*,special_price,Prices\n*,special_from_date,Prices\n*,special_to_date,Prices\n*,tier_price,Prices\n*,msrp_enabled,Prices\n*,msrp_display_actual_price_type,Prices\n*,msrp,Prices\n*,tax_class_id,Prices\n*,price_view,Prices\n*,meta_title,Meta Information\n*,meta_keyword,Meta Information\n*,meta_description,Meta Information\n*,image,Images\n*,small_image,Images\n*,thumbnail,Images\n*,media_gallery,Images\n*,gallery,Images\n*,is_recurring,Recurring Profile\n*,recurring_profile,Recurring Profile\n*,custom_design,Design\n*,custom_design_from,Design\n*,custom_design_to,Design\n*,custom_layout_update,Design\n*,page_layout,Design\n*,options_container,Design\n*,gift_message_available,Gift Options";
    if (isset($title)) {
        ?>
<h3><?php 
        echo $title;
        ?>
</h3><?php 
    }
    if ($withEnable) {
        checkbox($self, $prefix, 'enable', true, "Enable {$entityName} import");
        startDiv($self, $prefix, 'enabled', $self->getParam($prefix . ":enable", "on") == "on");
    }
    if ($withCsvOptions) {
        csvOptions($self, $prefix);
    }
    ?>
    <h4>Import behavior</h4>
    <?php 
    if ($withDefaults) {
        text($self, $prefix, 'default_values', "", "Set default values for non-existing columns in {$sourceText} (JSON)");
    }
    if ($prefix == '5B5AAI') {
        textarea($self, $prefix, 'default_rows', $default_rows_for_sets, "Add these attribute associations to given CSV data, '*' for attribute set name  means 'for each attribute set from given CSV' (Format: CSV with titles, spearator ',', enclosure '\"').");
    }
    checkbox($self, $prefix, 'prune', true, "Prune {$entityName}s which are not in {$sourceText} from database");
    startDiv($self, $prefix, 'prune_opts');
    if ($prefix == '5B5ATI' || $prefix == '5B5AAI') {
        checkbox($self, $prefix, 'prune_keep_system_attributes', true, "Dont touch non-user attributes when pruning.");
    }
    text($self, $prefix, 'prune_only', '', "prune only {$entityName}s matching regexp");
    text($self, $prefix, 'prune_keep', $pruneKeepDefaultValue, "additionally, keep following {$entityName}s when pruning, even if not given in {$sourceText} (comma-separated)");
    endDiv($self);
    if ($withMagmiDelete) {
        checkbox($self, $prefix, 'magmi_delete', true, "Delete {$entityName}s marked \"magmi:delete\" = 1");
    }
    checkbox($self, $prefix, 'create', true, "Create {$entityName}s from {$sourceText} which are not in database");
    checkbox($self, $prefix, 'update', true, "Update {$entityName}s from {$sourceText} which are already in database");
    if ($prefix == '5B5ASI') {
        startDiv($self, $prefix, 'attribute_groups');
        options($self, null, '5B5AGI', 'attribute group', false, false, false, false, "General,Prices,Meta Information,Images,Recurring Profile,Design,Gift Options", '"magmi:groups"', $plugin);
        endDiv($self);
    }
    if ($withEnable) {
        endDiv($self);
    }
    javascript($self, $prefix, $withCsvOptions, $plugin);
}
开发者ID:bjoern-tantau,项目名称:magmi-git,代码行数:49,代码来源:functions.php

示例11: __construct

 public function __construct($uri = false, $method = false)
 {
     if ($uri === false) {
         if (array_key_exists('REQUEST_URI', $_SERVER)) {
             $this->uri = $_SERVER['REQUEST_URI'];
         }
     } else {
         $this->uri = $uri;
     }
     if ($method !== false) {
         $this->method = $method;
     }
     if (\options('methodoverride')) {
         $this->method_override();
     }
 }
开发者ID:Epictetus,项目名称:vicious,代码行数:16,代码来源:Request.php

示例12: load_script

/**
 * Google Analytics snippet from HTML5 Boilerplate
 *
 * Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
 * You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
 * add_theme_support('solero-google-analytics', 'UA-XXXXX-Y', 'wp_footer');
 */
function load_script()
{
    $gaID = options('gaID');
    if (!$gaID) {
        return;
    }
    $loadGA = (!defined('WP_ENV') || \WP_ENV === 'production') && !current_user_can('manage_options');
    $loadGA = apply_filters('solero/loadGA', $loadGA);
    $cookieGA = true;
    $cookieGA = apply_filters('solero/cookieGA', $cookieGA);
    ?>
	<script>
		<?php 
    if ($loadGA) {
        ?>
			window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
		<?php 
    } else {
        ?>
			(function(so,le,r,o){so.ga=function(){so.ga.q.push(arguments);if(le['log'])le.log(r+o.call(arguments))}
			so.ga.q=[];so.ga.o=+new Date;}(window,console,'Google Analytics: ',[].slice))
		<?php 
    }
    ?>
		ga('create','<?php 
    echo $gaID;
    ?>
','auto');
		<?php 
    if (!$cookieGA) {
        ?>
		ga('set', 'anonymizeIp', true);
		<?php 
    }
    ?>
		ga('send','pageview');
	</script>
	<?php 
    if ($loadGA) {
        ?>
		<script src="https://www.google-analytics.com/analytics.js" async defer></script>
	<?php 
    }
}
开发者ID:starise,项目名称:solero,代码行数:51,代码来源:google-analytics.php

示例13: run

function run($options = array())
{
    $options = options()->merge($options);
    $request = request();
    $response = response();
    foreach (routes() as $route) {
        if ($route->matches($request, $matches)) {
            route($route);
            $path = isset($matches['path']) ? $matches['path'] : $request->path;
            $data = $route->run($path, $matches);
            if ($data) {
                $response->write($data);
            }
            if ($options->get('flush', true)) {
                $response->flush();
            }
            return $route;
        }
    }
    return null;
}
开发者ID:noonat,项目名称:pipes,代码行数:21,代码来源:helpers.php

示例14: saveform

     saveform();
     break;
 case "qiangzhisave":
     qiangzhisave();
     break;
 case "addform":
     addform($action);
     break;
 case "qiangzhi":
     qiangzhi($action);
     break;
 case "modify":
     addform($action);
     break;
 case "options":
     options(intval($_GET["site_id"]));
     break;
 case "dell_links":
     dell_links(HtmlReplace($_GET["url"]));
     break;
 case "del":
     $site_id = intval($_GET["site_id"]);
     $db->query("delete from ve123_sites where site_id='" . $site_id . "'");
     break;
 case "add_in_site_link":
     $site_id = $_GET["site_id"];
     echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"98%\"><iframe src=\"start.php?action=add_in_site_link&site_id=" . $site_id . "\" height=\"450\" width=\"100%\"></iframe></td></tr></table><br>";
     break;
 case "add_all_lry":
     //收录全站
     $site_id = $_GET["site_id"];
开发者ID:tanny2015,项目名称:DataStructure,代码行数:31,代码来源:sites.php

示例15: options

<?php

/**
 * Mailing List Plugin, Furasta.Org
 *
 * @author	Conor Mac Aoidh <conormacaoidh@gmail.com>
 * @licence	http://furasta.org/licence.txt The BSD Licence
 * @version	1
 */
$Template = Template::getInstance();
$mailing_list_options = options('mailing_list_options');
$page = @$_GET['page'];
switch ($page) {
    case 'options':
        require HOME . '_plugins/Mailing-List/admin/options.php';
        break;
    case 'mail':
    case 'send':
        $conds = array('Subject' => array('name' => $Template->e('mailing_list_subject'), 'required' => true), 'BCC' => array('name' => $Template->e('mailing_list_bcc'), 'required' => true), 'Content' => array('name' => $Template->e('mailing_list_content'), 'required' => true));
        $valid = validate($conds, '#mail-form', 'mail-form-submit');
        if ($page == 'send') {
            require HOME . '_plugins/Mailing-List/admin/send.php';
        } else {
            require HOME . '_plugins/Mailing-List/admin/mail.php';
        }
        break;
    default:
        require HOME . '_plugins/Mailing-List/admin/list.php';
}
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:29,代码来源:index.php


注:本文中的options函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。