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


PHP option::get方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:pixode,项目名称:Tieba-Cloud-Sign,代码行数:46,代码来源:class.S.php

示例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']);
        }
    }
}
开发者ID:noinlijin,项目名称:tiebaSign,代码行数:33,代码来源:verifyTiezi_cron.php

示例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;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-FiveVirtues,代码行数:60,代码来源:recentposts.php

示例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, '&#160;(等级', ')') < $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, '&#160;(等级', ')') >= $lv) {
                $check = true;
                break;
            }
        }
        if ($check == false) {
            msg($opt['error'][0]);
        }
    }
}
开发者ID:chajianku,项目名称:mok_follow,代码行数:28,代码来源:mok_follow.php

示例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>';
}
开发者ID:chajianku,项目名称:dl_pages,代码行数:8,代码来源:dl_pages.php

示例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'));
     }
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:12,代码来源:ui.php

示例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');
}
开发者ID:MBerguer,项目名称:wp-demo,代码行数:10,代码来源:post-options.php

示例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>';
}
开发者ID:chajianku,项目名称:templates,代码行数:12,代码来源:admin-set.php

示例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);
    }
}
开发者ID:pixode,项目名称:Tieba-Cloud-Sign,代码行数:16,代码来源:cron_system_sign_retry.php

示例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);
}
开发者ID:MoeGakuen,项目名称:dl_backup,代码行数:12,代码来源:dl_backup_callback.php

示例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'));
    }
}
开发者ID:chajianku,项目名称:wmzz_anno,代码行数:13,代码来源:wmzz_anno.php

示例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 '成功';
}
开发者ID:chajianku,项目名称:reg_supervise,代码行数:13,代码来源:reg_supervise_cron.php

示例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;
}
开发者ID:chajianku,项目名称:mok_zdwk,代码行数:51,代码来源:mok_zdwk_cron.php

示例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 
}
开发者ID:chajianku,项目名称:weirdoga_dscomment,代码行数:14,代码来源:weirdoga_dscomment.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';
 }
开发者ID:siriuzwhite,项目名称:alpha,代码行数:14,代码来源:admin.php


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