本文整理汇总了PHP中option::get方法的典型用法代码示例。如果您正苦于以下问题:PHP option::get方法的具体用法?PHP option::get怎么用?PHP option::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类option
的用法示例。
在下文中一共展示了option::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rand
/**
* MySQL 随机取记录
*
* @param $t 表
* @param $c ID列,默认为id
* @param $n 取多少个
* @param $w 条件语句
* @param $f bool 是否强制以多维数组形式返回,默认false
* @param $p string 随机数据前缀,如果产生冲突,请修改本项
* @return array 取1个直接返回结果数组(除非$f为true),取>1个返回多维数组,用foreach取出
*/
public function rand($t, $c = 'id', $n = '1', $w = '', $f = false, $p = 'tempval_')
{
switch (option::get('sign_scan')) {
case '0':
$sql = "SELECT * FROM `{$t}` ";
if (!empty($w)) {
$sql .= " WHERE {$w} ";
}
$sql .= " LIMIT {$n};";
break;
case '2':
$sql = "SELECT * FROM `{$t}` ";
if (!empty($w)) {
$sql .= " WHERE {$w} ";
}
$sql .= " ORDER BY RAND() LIMIT {$n};";
break;
default:
if (!empty($w)) {
$w = ' AND ' . $w;
}
$sql = "SELECT * FROM `{$t}` AS {$p}t1 JOIN ( SELECT ROUND( RAND() * ((SELECT MAX({$c}) FROM `{$t}`) - (SELECT MIN({$c}) FROM `{$t}`))) AS {$p}id ) AS {$p}t2 WHERE {$p}t1.{$c} >= {$p}t2.{$p}id {$w} ORDER BY {$p}t1.{$c} LIMIT {$n};";
break;
}
$xq = $this->query($sql);
$r = array();
while ($x = $this->fetch_array($xq)) {
$r[] = $x;
}
if ($f == false && count($r) == 1) {
return $r[0];
} else {
return $r;
}
}
示例2: cron_verifyTiezi
function cron_verifyTiezi()
{
global $m;
$set = unserialize(option::get('plugin_verifyTiezi'));
$today = date("Y-m-d");
//准备:扫描verifyTiezi表中lastdo不是今天的,然后更新verifyTiezi_data表的remain
$sy = $m->query("SELECT * FROM `" . DB_PREFIX . "verifyTiezi` WHERE `lastdo` != '{$today}';");
while ($sx = $m->fetch_array($sy)) {
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi_data` SET `remain` = \'' . $sx['num'] . '\' WHERE `uid` = ' . $sx['uid']);
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi` SET `lastdo` = \'' . $today . '\' WHERE `uid` = ' . $sx['uid']);
}
//开始:计划任务
$count = $m->once_fetch_array("SELECT COUNT(*) AS `c` FROM `" . DB_PREFIX . "verifyTiezi_data` WHERE `remain` > '0' LIMIT {$set['rem']};");
if ($count['c'] == $set['rem']) {
$y = rand_row(DB_PREFIX . 'verifyTiezi_data', 'id', $set['rem'], "`remain` > '0'");
} else {
$y = rand_row(DB_PREFIX . 'verifyTiezi_data', 'id', $count['c'], "`remain` > '0'");
}
//如果只有一条记录的兼容方案
if (isset($y['url'])) {
$y = array(0 => $y);
}
foreach ($y as $x) {
if (!empty($x['pid']) && !empty($x['uid'])) {
$u = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "verifyTiezi` WHERE `uid` = '{$x['uid']}'");
$cont = unserialize($u['cont']);
$remain = $x['remain'] - 1;
$res = verifyTiezi_send($x['uid'], $x['url'], $x['pid'], rand_array($cont), $set['device']);
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'verifyTiezi_data` SET `remain` = \'' . $remain . '\',`status` = \'' . $res['status'] . '\',`msg` = \'' . $res['msg'] . '\' WHERE `url` = \'' . $x['url'] . '\' AND `uid` = ' . $x['uid']);
sleep($set['sleep']);
}
}
}
示例3: widget
function widget($args, $instance)
{
extract($args);
/* User-selected settings. */
$title = apply_filters('widget_title', $instance['title']);
$category = $instance['category'];
$show_count = $instance['show_count'];
$show_date = $instance['show_date'] ? true : false;
$show_thumb = $instance['show_thumb'] ? true : false;
$show_excerpt = $instance['show_excerpt'] ? true : false;
$excerpt_length = $instance['excerpt_length'];
$show_title = $instance['hide_title'] ? false : true;
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<ul class="wpzoom-feature-posts">';
$query_opts = apply_filters('wpzoom_query', array('posts_per_page' => $show_count, 'post_type' => 'post'));
if ($category) {
$query_opts['cat'] = $category;
}
query_posts($query_opts);
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<li>';
if ($show_thumb) {
$custom_field = option::get('cf_use') == 'on' ? get_post_meta($post->ID, option::get('cf_photo'), true) : '';
$args = array('size' => 'recent-widget', 'width' => $instance['thumb_width'], 'height' => $instance['thumb_height']);
if ($custom_field) {
$args['meta_key'] = option::get('cf_photo');
}
get_the_image($args);
}
if ($show_title) {
echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
}
if ($show_date) {
echo '<small>' . get_the_date() . '</small>';
}
if ($show_excerpt) {
$the_excerpt = get_the_excerpt();
// cut to character limit
$the_excerpt = substr($the_excerpt, 0, $excerpt_length);
// cut to last space
$the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' '));
echo '<span class="post-excerpt">' . $the_excerpt . '</span>';
}
echo '<div class="clear"></div></li>';
}
} else {
}
//Reset query_posts
wp_reset_query();
echo '</ul><div class="clear"></div>';
/* After widget (defined by themes). */
echo $after_widget;
}
示例4: mok_follow_check
function mok_follow_check()
{
$head = array('User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36', 'Cookie:BDUSS=' . $_GET['bduss']);
$opt = unserialize(option::get('mok_follow'));
foreach ($opt['mustTieba'] as $tb => $lv) {
$c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head);
$t = $c->get();
$c->close();
if (textMiddle($t, ' (等级', ')') < $lv) {
msg($opt['error'][0]);
}
}
if (count($opt['optionTieba']) > 0) {
$check = false;
foreach ($opt['optionTieba'] as $tb => $lv) {
$c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head);
$t = $c->get();
$c->close();
if (textMiddle($t, ' (等级', ')') >= $lv) {
$check = true;
break;
}
}
if ($check == false) {
msg($opt['error'][0]);
}
}
}
示例5: dl_pages_navi5
function dl_pages_navi5()
{
echo '<li ';
if (isset($_GET['plugin']) && $_GET['plugin'] == 'dl_pages' && $_REQUEST['page'] == 'dl_pages_five') {
echo 'class="active"';
}
echo '><a href="index.php?plugin=dl_pages&page=dl_pages_five"><span class="glyphicon glyphicon-file"></span>' . strip_tags(option::get('dl_pages_title5')) . '</a></li>';
}
示例6: rss
/**
* Includes rss link if is specified in theme options
*/
public static function rss()
{
$feed = esc_attr(trim(option::get('misc_feedburner')));
if (!$feed) {
bloginfo('rss2_url');
} else {
echo esc_url_raw(option::get('misc_feedburner'));
}
}
示例7: wpzoom_options_box
function wpzoom_options_box()
{
if (option::get('featured_type') == 'Posts') {
$FeaturedSource = 'post';
} else {
$FeaturedSource = 'page';
}
add_meta_box('wpzoom_post_layout', 'Post Layout', 'wpzoom_post_layout_options', 'post', 'normal', 'high');
add_meta_box('wpzoom_post_options', 'Post Options', 'wpzoom_post_info', $FeaturedSource, 'side', 'high');
}
示例8: addset
function addset($name, $type, $x, $other = '', $text = '')
{
if ($type == 'checkbox') {
if (option::get($x) == 1) {
$other .= ' checked="checked"';
}
$value = '1';
} else {
$value = option::get($x);
}
echo '<tr><td>' . $name . '</td><td><input type="' . $type . '" name="' . $x . '"id="' . $x . '" value="' . htmlspecialchars($value) . '" ' . $other . '><label for="' . $x . '">' . $text . '</label></td>';
}
示例9: cron_system_sign_retry
/**
* 云签到内部计划任务
* [重新尝试签到出错的贴吧]
*/
function cron_system_sign_retry()
{
global $i;
$today = date('Y-m-d');
$sign_again = unserialize(option::get('cron_sign_again'));
if ($sign_again['lastdo'] != $today) {
option::set('cron_sign_again', serialize(array('num' => 0, 'lastdo' => $today)));
}
foreach ($i['table'] as $value) {
misc::DoSign_retry($value);
}
}
示例10: callback_init
function callback_init()
{
$day = option::get('dl_backup_day');
$email = option::get('dl_backup_email');
if (empty($day)) {
option::set('dl_backup_day', 1);
}
if (empty($email)) {
option::set('dl_backup_email', EMAIL);
}
cron::set('dl_backup', 'plugins/dl_backup/backup.php', 0, 0, 0);
}
示例11: wmzz_anno_show
function wmzz_anno_show()
{
global $m;
$s = option::get('wmzz_anno_set');
if (!empty($s)) {
$y = '';
$x = explode("\n", $s);
foreach ($x as $value) {
$y .= $value . '<br/>';
}
echo str_replace('{$anno}', $y, option::get('wmzz_anno_tpl'));
}
}
示例12: cron_reg_supervise
function cron_reg_supervise()
{
if (option::get('reg_supervise_run') == date('d')) {
return ok;
}
global $m;
$m->query("DELETE FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users` WHERE `" . DB_PREFIX . "users`.`role` = 'banned'");
//当天清除昨天未激活用户(建议)
$m->query("truncate table `" . DB_NAME . "`.`" . DB_PREFIX . "reg`");
//清除注册ip记录(必须)
option::set('reg_supervise_run', date('d'));
return '成功';
}
示例13: cron_mok_zdwk
function cron_mok_zdwk()
{
//如果今天签到过了直接返回日志
if (option::get('mok_zdwk_run') == date('d')) {
return option::get('mok_zdwk_log');
}
global $m;
$prefix = DB_PREFIX;
//选出用户的options和bduss
$res = $m->query("SELECT {$prefix}users_options.`name` , {$prefix}users_options.`value` , {$prefix}baiduid.`bduss` \nFROM {$prefix}baiduid\nINNER JOIN {$prefix}users_options ON {$prefix}users_options.uid = {$prefix}baiduid.uid\nWHERE {$prefix}users_options.`name` = 'mok_zdwk_wk'\nOR {$prefix}users_options.`name` = 'mok_zdwk_zd'");
$wk = $zd = 0;
$bduss = array();
if ($m->num_rows($res) != 0) {
while ($row = $res->fetch_array()) {
//判断该选项是否开启
if ($row['value'] == 'on') {
//记录bduss(数量),如果bduss数组内没有该bduss,则加入数组
if (!in_array($row['bduss'], $bduss)) {
$bduss[] = $row['bduss'];
}
if ($row['name'] === 'mok_zdwk_wk') {
$wk++;
$head = array('Accept:*/*', 'Accept-Encoding:gzip, deflate, sdch', 'Accept-Language:zh-CN,zh;q=0.8', 'Connection:keep-alive', 'Host:wenku.baidu.com', 'Referer:http://wenku.baidu.com/task/browse/daily', 'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36', 'X-Requested-With:XMLHttpRequest');
$c = new wcurl('http://wenku.baidu.com/task/submit/signin', $head);
$c->addCookie('BDUSS=' . $row['bduss']);
$c->exec();
$c->close();
} else {
if ($row['name'] === 'mok_zdwk_zd') {
$zd++;
$c = new wcurl('http://zhidao.baidu.com/');
$c->addCookie('BDUSS=' . $row["bduss"]);
$stoken = $c->get();
$c->close();
$stoken = textMiddle($stoken, '"stoken":"', '",');
if ($stoken != "") {
$c = new wcurl('http://zhidao.baidu.com/submit/user');
$c->addCookie('BDUSS=' . $row["bduss"]);
$c->post(array('cm' => '100509', 'utdata' => '90,90,102,96,107,101,99,97,96,90,98,103,103,99,127,106,99,99,14138554765830', 'stoken' => $stoken));
$c->close();
}
}
}
}
}
}
$log = "知道、文库签到完毕<br/>" . date("Y-m-d H:i:s") . "<br/>共计百度账号: " . count($bduss) . " 个<br/>知道签到: {$zd} 个<br/>文库签到: {$wk} 个";
option::set('mok_zdwk_run', date('d'));
option::set('mok_zdwk_log', $log);
return $log;
}
示例14: weirdoga_dscomment
function weirdoga_dscomment()
{
?>
<li <?php
if (isset($_GET['plugin']) && $_GET['plugin'] == 'weirdoga_dscomment') {
echo 'class="active"';
}
?>
><a href="index.php?pub_plugin=weirdoga_dscomment"><span class="glyphicon glyphicon-comment"></span> <?php
echo option::get('weirdoga_dscomment_title');
?>
</a></li>
<?php
}
示例15: activate
public static function activate()
{
if (option::get('wpzoom_activated') != 'yes') {
option::set('wpzoom_activated', 'yes');
option::set('wpzoom_activated_time', time());
} else {
$activated_time = option::get('wpzoom_activated_time');
if (time() - $activated_time < 2592000) {
return;
}
}
option::set('wpzoom_activated_time', time());
require_once WPZOOM_INC . '/pages/welcome.php';
}