本文整理汇总了PHP中option函数的典型用法代码示例。如果您正苦于以下问题:PHP option函数的具体用法?PHP option怎么用?PHP option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: password_form
function password_form($output = '')
{
if (empty($id = get_the_ID())) {
return $output;
}
return sprintf('%1$s<form action="%2$s" class="%3$s" method="post"><label for="%4$s" class="screen-reader-text">%5$s</label><input name="post_password" id="%4$s" type="password" size="20" required=""%6$s/><button id="submit" type="submit" name="submit"%7$s>%8$s</button></form>', sprintf('<p>%s</p>', esc_html(option('prompt'))), esc_url(site_url('wp-login.php?action=postpass', 'login_post')), option('class'), esc_attr('password-input-' . intval($id)), esc_html__('Password', 'ubik'), option('input_style') ? ' style="' . esc_attr(option('input_style')) . '"' : '', option('button_style') ? ' style="' . esc_attr(option('button_style')) . '"' : '', option('button'));
}
示例2: delete
public static function delete($file)
{
if (empty($file)) {
return false;
}
if (function_exists('option')) {
$bucket = option('config.attachment_up_bucket');
$user = option('config.attachment_up_username');
$pwd = option('config.attachment_up_password');
$unlink = option('config.attachment_upload_unlink');
} else {
$bucket = C('config.attachment_up_bucket');
$user = C('config.attachment_up_username');
$pwd = C('config.attachment_up_password');
$unlink = C('config.attachment_upload_unlink');
}
if (empty($bucket) || empty($user) || empty($pwd)) {
return false;
}
if (empty($unlink)) {
return false;
}
$upyun = new UpYun($bucket, $user, $pwd);
try {
error_log('upyunUser::delete:' . $file);
$upyun->delete($file);
} catch (Exception $e) {
print_r($e);
}
}
示例3: getListByProductId
/**
* 根据产品ID获得优惠活动
* $product_id_arr 产品ID数组
* $store_id 店铺ID
* $uid 店铺UID
*/
public function getListByProductId($product_id_arr, $store_id, $uid)
{
$tmp_product_id_arr = array();
foreach ($product_id_arr as $tmp) {
$tmp_product_id_arr[] = $tmp['product_id'];
}
$time = time();
$db_prefix = option('system.DB_PREFIX');
$sql = "SELECT distinct u.* FROM `" . $db_prefix . "user_coupon` AS u LEFT JOIN `" . $db_prefix . "coupon_to_product` AS cp ON `u`.`coupon_id` = `cp`.`coupon_id` WHERE `u`.`store_id` = '" . $store_id . "' AND (`u`.`is_all_product` = 0 or `cp`.`product_id` in (" . join(',', $tmp_product_id_arr) . ")) AND `u`.`uid` = '" . $uid . "' AND `u`.`start_time` <= '" . $time . "' AND `u`.`end_time` >= '" . $time . "' AND `u`.`is_use` = '0' AND `u`.is_valid = '1' AND `u`.`delete_flg` = '0'";
$user_coupon_list = $this->db->query($sql);
foreach ($user_coupon_list as &$user_coupon) {
$where = array();
$where['coupon_id'] = $user_coupon['coupon_id'];
// 优惠参加产品
if ($user_coupon['is_all_product'] == 1) {
$product_list = M('Coupon_to_product')->getList($where);
$product_id_arr = array();
foreach ($product_list as $tmp) {
$product_id_arr[$tmp['product_id']] = $tmp['product_id'];
}
$user_coupon['product_list'] = $product_id_arr;
} else {
$user_coupon['product_list'] = array();
}
}
return $user_coupon_list;
}
示例4: getListByProductId
/**
* 根据产品ID获得优惠活动
* $product_id_arr 产品ID数组
* $store_id 店铺ID
* $uid 店铺UID
*/
public function getListByProductId($product_id_arr, $store_id, $uid)
{
$time = time();
$db_prefix = option('system.DB_PREFIX');
$sql = "SELECT distinct r.* FROM `" . $db_prefix . "reward` AS r LEFT JOIN `" . $db_prefix . "reward_product` AS rp ON `r`.`id` = `rp`.`rid` WHERE `r`.`store_id` = '" . $store_id . "' AND (`r`.`is_all` = 1 or `rp`.`product_id` in (" . join(',', $product_id_arr) . ")) AND `r`.`uid` = '" . $uid . "' AND `r`.`status` = '1' AND `r`.`start_time` <= '" . $time . "' AND `r`.`end_time` >= '" . $time . "'";
$reward_list = $this->db->query($sql);
foreach ($reward_list as &$reward) {
$where = array();
$where['rid'] = $reward['id'];
// 优惠条件
$reward_condition_list = M('Reward_condition')->getList($where, 0, 0, 'id desc');
$reward['condition_list'] = $reward_condition_list;
// 优惠参加产品
if ($reward['is_all'] == 2) {
$reward_product_list = M('Reward_product')->getList($where);
$product_id_arr = array();
foreach ($reward_product_list as $tmp) {
$product_id_arr[$tmp['product_id']] = $tmp['product_id'];
}
$reward['product_list'] = $product_id_arr;
} else {
$reward['product_list'] = array();
}
}
return $reward_list;
}
示例5: configure
function configure()
{
option('views_dir', APP_ROOT . '/views');
option('lib_dir', APP_ROOT . '/lib');
option('base_uri', '/');
option('debug', false);
}
示例6: get_posts
function get_posts($query)
{
if (is_tax('series') && $query->is_main_query()) {
$query->set('order', option('order'));
}
return $query;
}
示例7: setUp
/**
* setUp.
*
* @return void
*/
public function setUp()
{
parent::setUp();
$view = new View();
$view->theme(option('front_theme'));
$this->helper = new MenuHelper($view);
}
示例8: configure
function configure()
{
$cfg = ActiveRecord\Config::instance();
$cfg->set_model_directory("models");
$cfg->set_connections(array("development" => "mysql://benchmarkdbuser:benchmarkdbpass@localhost/hello_world?charset=utf8"));
option("bas_url", "/");
}
示例9: filteredgrid
function filteredgrid()
{
$this->datasis->modulo_id(106, 1);
$this->rapyd->load("datafilter", "datagrid");
//
$filter = new DataFilter("Filtro por Partidas", "partida");
$filter->id_part = new inputField("Identificador", "id_part");
$filter->id_part->size = 5;
$filter->part_pres = new inputField("Código", "part_pres");
$filter->part_pres->size = 5;
$filter->nomb_part = new inputField("Nombre", "nomb_part");
$filter->nomb_part->size = 40;
$filter->conf_part = new dropdawnField("Condición", "conf_part");
$filter->conf_part = option('S', 'Si');
$filter->conf_part = option('N', 'Ni');
$filter->nro_cta->style = 'width:300px;';
$filter->buttons("reset", "search");
$filter->build();
$uri = anchor('presupuesto/partida/dataedit/show/<#id_unid#>', '<#id_unid#>');
$grid = new DataGrid("Lista de Unidades Ejecutoras");
$grid->order_by("cod_unid", "asc");
$grid->column("Identificador", $uri, "align='left'");
$grid->column("Unidades Ejecutoras", "cod_unid", "align='left'");
$grid->column("Nombre", "nomb_unid", "align='left'");
$grid->add("presupuesto/partida/dataedit/create");
$grid->build();
$data['content'] = $filter->output . $grid->output;
$data['title'] = " Partidas ";
$data["head"] = $this->rapyd->get_head();
$this->load->view('view_ventanas', $data);
}
示例10: configure
function configure()
{
option('views_dir', '../app/views');
option('controllers_dir', '../app/controllers');
option('encoding', 'utf-8');
layout('layouts/default.html.php');
}
示例11: redirect
function redirect()
{
global $wp_rewrite;
if (!is_search() || is_admin() || !isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->get_search_permastruct()) {
return;
}
// Set the search base and query
$search_base = $wp_rewrite->search_base;
$search_query = get_query_var('s');
// Skip the search results if there is exactly one result: http://wpglee.com/2011/04/redirect-when-search-query-only-returns-one-match/
if (option('redirect_single') && $search_query) {
global $wp_query;
if ($wp_query->post_count == 1) {
wp_redirect(esc_url(trailingslashit(get_permalink($wp_query->posts['0']->ID))));
exit;
}
}
// Return a random post when an empty search query is entered
// Allows the random results to be filtered (e.g. to limit to a particular category, post types, or anything else accepted by `get_posts`)
if (option('redirect_random') && $search_query === '') {
$random = get_posts(apply_filters('ubik_search_redirect_random_args', ['numberposts' => 1, 'orderby' => 'rand']));
wp_redirect(esc_url(trailingslashit(get_permalink($random[0]->ID))));
exit;
}
// "Nice search" rewrite; full credit to Mark Jaquith for this functionality: https://wordpress.org/plugins/nice-search/
if (strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false && strpos($_SERVER['REQUEST_URI'], '&') === false) {
//wp_redirect( esc_url( trailingslashit( home_url( "/{$search_base}/" . urlencode($search_query) ) ) ) );
wp_redirect(get_search_link());
exit;
}
}
示例12: hydrate_model
function hydrate_model($file)
{
if (is_file($file) && strpos($file, '.php')) {
preg_match_all('/class\\s(\\S+)\\s/', read($file), $match);
require $file;
foreach ($match[1] as $klass) {
$re = new \ReflectionClass($klass);
switch ($re->getParentClass()->getName()) {
case 'Servant\\Mapper\\Database':
status('hydrate', $file);
$dsn = option('database.' . $klass::CONNECTION);
$db = \Grocery\Base::connect($dsn);
$columns = $klass::columns();
$indexes = $klass::indexes();
if (!isset($db[$klass::table()])) {
$db[$klass::table()] = $columns;
}
\Grocery\Helpers::hydrate($db[$klass::table()], $columns, $indexes);
break;
case 'Servant\\Mapper\\MongoDB':
status('hydrate', $file);
$dsn_string = \Servant\Config::get($klass::CONNECTION);
$database = substr($dsn_string, strrpos($dsn_string, '/') + 1);
$mongo = $dsn_string ? new \Mongo($dsn_string) : new \Mongo();
$db = $mongo->{$database ?: 'default'};
\Servant\Helpers::reindex($db->{$klass::table()}, $klass::indexes());
break;
default:
break;
}
}
}
}
示例13: pay
public function pay()
{
if (empty($this->pay_config['pay_weixin_appid']) || empty($this->pay_config['pay_weixin_mchid']) || empty($this->pay_config['pay_weixin_key'])) {
return array('err_code' => 1, 'err_msg' => '微信支付缺少配置信息!请联系管理员处理或选择其他支付方式。');
}
if (empty($this->openid)) {
return array('err_code' => 1, 'err_msg' => '没有获取到用户的微信资料,无法使用微信支付');
}
import('source.class.pay.Weixinnewpay.WxPayPubHelper');
$jsApi = new JsApi_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
$unifiedOrder = new UnifiedOrder_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
$unifiedOrder->setParameter('openid', $this->openid);
$unifiedOrder->setParameter('body', $this->order_info['order_no_txt']);
$unifiedOrder->setParameter('out_trade_no', $this->order_info['trade_no']);
$unifiedOrder->setParameter('total_fee', floatval($this->order_info['total'] * 100));
$unifiedOrder->setParameter('notify_url', option('config.wap_site_url') . '/paynotice.php');
$unifiedOrder->setParameter('trade_type', 'JSAPI');
$unifiedOrder->setParameter('attach', 'weixin');
$prepay_result = $unifiedOrder->getPrepayId();
if ($prepay_result['return_code'] == 'FAIL') {
return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['return_msg']);
}
if ($prepay_result['err_code']) {
return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['err_code_des']);
}
$jsApi->setPrepayId($prepay_result['prepay_id']);
return array('err_code' => 0, 'pay_data' => $jsApi->getParameters());
}
示例14: add
public function add()
{
if (isPost()) {
return $this->_add();
}
$row = array('card' => m('Member')->getNewCard(option('member_unit')), 'shop_id' => session('shop_id'), 'level_discount' => '1', 'money' => '0.00', 'consume' => '0.00', 'point' => '0.00');
$this->view()->assign('title', '新增会员')->assign('action', url('Member', 'add'))->assign('row', $row)->assign('my_shop', getMyShop())->assign('member_level', getMemberLevel())->display('member_form');
}
示例15: add
public function add()
{
if (isPost()) {
return $this->_add();
}
$row = array('sn' => m('Customer')->getNewSn(option('customer_unit')), 'shop_id' => session('shop_id'), 'discount' => '1', 'money' => '0.00', 'consume' => '0.00', 'point' => '0.00', 'offer' => '0.00', 'overdraft' => '0.00', 'status' => '1');
$this->view()->assign('title', '新增客户')->assign('action', url('Customer', 'add'))->assign('row', $row)->assign('my_shop', getMyShop())->display('customer_form');
}