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


PHP get_option_value函数代码示例

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


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

示例1: getBookmarksFile

/**
 * Get the bookmarks file as a string
 *
 * Uses the -f or --file parameter to open and read a
 * a bookmarks file
 *
 * @return string Contents of the file
 */
function getBookmarksFile()
{
    $filename = get_option_value('f', 'file');
    if (empty($filename)) {
        show_help();
        exit(1);
    }
    if (!file_exists($filename)) {
        // TRANS: Exception thrown when a file upload cannot be found.
        // TRANS: %s is the file that could not be found.
        throw new Exception(sprintf(_m('No such file "%s".'), $filename));
    }
    if (!is_file($filename)) {
        // TRANS: Exception thrown when a file upload is incorrect.
        // TRANS: %s is the irregular file.
        throw new Exception(sprintf(_m('Not a regular file: "%s".'), $filename));
    }
    if (!is_readable($filename)) {
        // TRANS: Exception thrown when a file upload is not readable.
        // TRANS: %s is the file that could not be read.
        throw new Exception(sprintf(_m('File "%s" not readable.'), $filename));
    }
    // TRANS: %s is the filename that contains a backup for a user.
    printfv(_m('Getting backup from file "%s".') . "\n", $filename);
    $html = file_get_contents($filename);
    return $html;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:35,代码来源:importbookmarks.php

示例2: sphinx_base

function sphinx_base()
{
    if (have_option('base')) {
        return get_option_value('base');
    } else {
        return "/usr/local/sphinx";
    }
}
开发者ID:microcosmx,项目名称:experiments,代码行数:8,代码来源:sphinx-utils.php

示例3: init

function init($worker)
{
    Redis::setCacheServer(get_option_value($worker->config, 'resources.cache', '127.0.0.1:6379'));
    Redis::setQueueServer(get_option_value($worker->config, 'resources.queue', '127.0.0.1:6379'));
    $worker->tarthTimerLastTime = 0;
    $currentTime = time();
    $minBacktrackTime = $currentTime - MAX_BACKTRACK_SECONDS;
    //读取上次执行到的时间
    $dir = get_option_value($worker->config, 'main.working_dir', '/tmp');
    $worker->tarthTimerLastTimeFile = "{$dir}/timer-last-{$worker->index}";
    if (file_exists($worker->tarthTimerLastTimeFile)) {
        $worker->tarthTimerLastTime = intval(file_get_contents($worker->tarthTimerLastTimeFile));
    }
    if ($minBacktrackTime > $worker->tarthTimerLastTime) {
        $worker->tarthTimerLastTime = $minBacktrackTime;
    } elseif ($worker->tarthTimerLastTime > $currentTime) {
        $worker->tarthTimerLastTime = $currentTime;
    }
}
开发者ID:pythias,项目名称:Tarth,代码行数:19,代码来源:timer.php

示例4: getActivityStreamDocument

function getActivityStreamDocument()
{
    $filename = get_option_value('f', 'file');
    if (empty($filename)) {
        show_help();
        exit(1);
    }
    if (!file_exists($filename)) {
        throw new Exception("No such file '{$filename}'.");
    }
    if (!is_file($filename)) {
        throw new Exception("Not a regular file: '{$filename}'.");
    }
    if (!is_readable($filename)) {
        throw new Exception("File '{$filename}' not readable.");
    }
    // TRANS: Commandline script output. %s is the filename that contains a backup for a user.
    printfv(_("Getting backup from file '%s'.") . "\n", $filename);
    $xml = file_get_contents($filename);
    return $xml;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:21,代码来源:restoreuser.php

示例5: getBookmarksFile

/**
 * Get the bookmarks file as a string
 * 
 * Uses the -f or --file parameter to open and read a
 * a bookmarks file
 *
 * @return string Contents of the file
 */
function getBookmarksFile()
{
    $filename = get_option_value('f', 'file');
    if (empty($filename)) {
        show_help();
        exit(1);
    }
    if (!file_exists($filename)) {
        throw new Exception("No such file '{$filename}'.");
    }
    if (!is_file($filename)) {
        throw new Exception("Not a regular file: '{$filename}'.");
    }
    if (!is_readable($filename)) {
        throw new Exception("File '{$filename}' not readable.");
    }
    // TRANS: %s is the filename that contains a backup for a user.
    printfv(_("Getting backup from file '%s'.") . "\n", $filename);
    $html = file_get_contents($filename);
    return $html;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:29,代码来源:importbookmarks.php

示例6: siteStreamForOwner

function siteStreamForOwner(User $user)
{
    // The user we auth as must be the owner of the application.
    $auth = twitterAuthForUser($user);
    if (have_option('apiroot')) {
        $stream = new TwitterSiteStream($auth, get_option_value('apiroot'));
    } else {
        $stream = new TwitterSiteStream($auth);
    }
    // Pull Twitter user IDs for all users we want to pull data for
    $userIds = array();
    $flink = new Foreign_link();
    $flink->service = TWITTER_SERVICE;
    $flink->find();
    while ($flink->fetch()) {
        if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) {
            $userIds[] = $flink->foreign_id;
        }
    }
    $stream->followUsers($userIds);
    return $stream;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:22,代码来源:streamtest.php

示例7: getAtomFeedDocument

function getAtomFeedDocument()
{
    $filename = get_option_value('f', 'file');
    if (empty($filename)) {
        show_help();
        exit(1);
    }
    if (!file_exists($filename)) {
        throw new Exception("No such file '{$filename}'.");
    }
    if (!is_file($filename)) {
        throw new Exception("Not a regular file: '{$filename}'.");
    }
    if (!is_readable($filename)) {
        throw new Exception("File '{$filename}' not readable.");
    }
    $xml = file_get_contents($filename);
    $dom = DOMDocument::loadXML($xml);
    if ($dom->documentElement->namespaceURI != Activity::ATOM || $dom->documentElement->localName != 'feed') {
        throw new Exception("'{$filename}' is not an Atom feed.");
    }
    return $dom;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:23,代码来源:importtwitteratom.php

示例8: define

 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
$shortoptions = "e:";
$helptext = <<<END_OF_REGISTERBYEMAIL_HELP
USAGE: registerbyemail.php
Registers a new user by email address and sends a confirmation email

  -e email     Email to register

END_OF_REGISTERBYEMAIL_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$email = get_option_value('e', 'email');
$parts = explode('@', $email);
$nickname = common_nicknamize($parts[0]);
$user = User::getKV('nickname', $nickname);
if (!empty($user)) {
    $confirm = new Confirm_address();
    $confirm->user_id = $user->id;
    $confirm->address_type = 'email';
    if ($confirm->find(true)) {
        $url = common_local_url('confirmfirstemail', array('code' => $confirm->code));
        print "{$url}\n";
    } else {
        print "User not waiting for confirmation.\n";
    }
    exit;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:31,代码来源:registerbyemail.php

示例9: substr

            $is_en = substr($locale, 0, 2) == 'en';
            foreach ($languages as $language) {
                $return[] = array(isset($languages_self_list[$language]) ? $languages_self_list[$language] : $languages_list[$language] => array((isset($languages_list[$language]) ? $languages_list[$language] : $language) . ($is_en ? '' : ' - ' . $language) => $language));
            }
            if (!in_array('en', $languages) && !in_array('en_US', $languages) && !in_array('en_GB', $languages)) {
                $return[] = array('English' => array(is_eng_array('English', 'language', ' - ') => 'en_US'));
            }
            return $return;
        }
        function get_option_value($option, $default)
        {
            $value = get_option($option);
            return empty($value) ? $default : $value;
        }
        // TODO: Array for Settings.
        $options = array(array('title' => __('General'), 'id' => 'general', 'type' => 'panelstart'), array('title' => __('General'), 'type' => 'subtitle'), array('name' => is_eng_array('Language'), 'desc' => is_eng_array('If you want the system auto detect users browser language to show pages please select "Detect" option.'), 'id' => 'language', 'type' => 'select', 'options' => languages_options(), 'optgroup' => true, 'std' => defined("DCRM_LANG") ? DCRM_LANG : 'Detect'), array('name' => __('Rewrite Mod'), 'desc' => sprintf(__('<b>Elegant Mod</b> - Enable all rewrite rules, the url will show like %s.<br/><b>Normal Mod</b> - Compatible earlier than v1.7 configuration, only enbale a part of rewrite rules for HotLinks.<br/><b>Disabled</b> - This will disable all rewrite rules, so HotLinks will not work.<br/>Notice: You should update your rewrite config first if you want to use Elegant Mod.'), '<code>' . htmlspecialchars(base64_decode(DCRM_REPOURL)) . 'packages/1</code>'), 'id' => 'rewrite_mod', 'type' => 'select', 'options' => array(1 => __('Disable'), 2 => __('Normal'), 3 => __('Elegant')), 'std' => get_option_value('rewrite_mod', 2)), array('title' => __('Login Information'), 'type' => 'subtitle'), array('name' => __('Username'), 'id' => 'username', 'type' => 'text', 'attributes' => array('required' => 'required', 'minlength' => 4, 'maxlength' => 20, 'data-validation-minlength-message' => __('Username length must be between 4-20 characters!'), 'data-validation-regex-regex' => '^[0-9a-zA-Z\\_]*$', 'data-validation-regex-message' => __('Username can only use numbers, letters and underline!')), 'std' => htmlspecialchars($_SESSION['username'])), array('name' => __('New Password'), 'id' => 'pass1', 'type' => 'text', 'desc' => __('If you would like to change the password type a new one. Otherwise leave this blank.')), array('name' => __('Repeat New Password'), 'id' => 'pass2', 'type' => 'text', 'desc' => __('Type your new password again.'), 'attributes' => array('data-validation-match-match' => 'pass1', 'data-validation-match-message' => __('Your password do not match.')), 'special' => 'pass-strength-result'));
        function show_select($variable, $false_text = '', $true_text = '')
        {
            $select_array = array($_false ? $_false : 1 => $false_text ? $false_text : __('Disabled'), $_true ? $_true : 2 => $true_text ? $true_text : __('Enabled'));
            foreach ($select_array as $key => $value) {
                echo "<option value=\"{$key}\" " . ($key == $variable ? 'selected="selected"' : '') . ">{$value}</option>\n";
            }
        }
        ?>
				<h2><?php 
        _e('Preferences');
        ?>
</h2>
				<br />
				<form class="form-horizontal settingsform" method="POST" action="settings.php?action=set">
					<fieldset>
开发者ID:PONBBS,项目名称:WEIPDCRM,代码行数:31,代码来源:settings.php

示例10: common_log

                        Subscription::start($profile, $friend_profile);
                        common_log(LOG_INFO, $this->name() . ' - Subscribed ' . "{$friend_profile->nickname} to {$profile->nickname}.");
                    } catch (Exception $e) {
                        common_debug($this->name() . ' - Tried and failed subscribing ' . "{$friend_profile->nickname} to {$profile->nickname} - " . $e->getMessage());
                    }
                }
            }
        }
        return true;
    }
}
$id = null;
$debug = null;
if (have_option('i')) {
    $id = get_option_value('i');
} else {
    if (have_option('--id')) {
        $id = get_option_value('--id');
    } else {
        if (count($args) > 0) {
            $id = $args[0];
        } else {
            $id = null;
        }
    }
}
if (have_option('d') || have_option('debug')) {
    $debug = true;
}
$syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug);
$syncer->runOnce();
开发者ID:phpsource,项目名称:gnu-social,代码行数:31,代码来源:synctwitterfriends.php

示例11: Webfinger

  -w --password Password of remote user
  -y --yes      do not wait for confirmation

Remote user identity must be a Webfinger (nickname@example.com) or 
an HTTP or HTTPS URL (http://example.com/social/site/user/nickname).

END_OF_MOVEUSER_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
try {
    $user = getUser();
    $remote = get_option_value('r', 'remote');
    if (empty($remote)) {
        show_help();
        exit(1);
    }
    $password = get_option_value('w', 'password');
    if (!have_option('y', 'yes')) {
        print "WARNING: EXPERIMENTAL FEATURE! Moving accounts will delete data from the source site.\n";
        print "\n";
        print "About to PERMANENTLY move user '{$user->nickname}' to {$remote}. Are you sure? [y/N] ";
        $response = fgets(STDIN);
        if (strtolower(trim($response)) != 'y') {
            print "Aborting.\n";
            exit(0);
        }
    }
    $qm = QueueManager::get();
    $qm->enqueue(array($user, $remote, $password), 'acctmove');
} catch (Exception $e) {
    print $e->getMessage() . "\n";
    exit(1);
开发者ID:microcosmx,项目名称:experiments,代码行数:31,代码来源:moveuser.php

示例12: get_setting_array

function get_setting_array($item_id = '', $default = '', $echo = false, $offset = -1)
{
    return get_option_value($item_id, $default, $echo, true, $offset);
}
开发者ID:rinodung,项目名称:myfreetheme,代码行数:4,代码来源:spyropress-core-functions.php

示例13: get_option_value

  -k key       Key to look up; other args are ignored

ENDOFHELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$karg = get_option_value('k');
if (!empty($karg)) {
    $k = common_cache_key($karg);
} else {
    $table = get_option_value('t');
    if (empty($table)) {
        die("No table or key specified\n");
    }
    $column = get_option_value('c');
    if (empty($column)) {
        $column = 'id';
    }
    $value = get_option_value('v');
    $k = Memcached_DataObject::cacheKey($table, $column, $value);
}
print "Checking key '{$k}'...\n";
$c = common_memcache();
if (empty($c)) {
    die("Can't initialize cache object!\n");
}
$obj = $c->get($k);
if (empty($obj)) {
    print "Empty.\n";
} else {
    var_dump($obj);
    print "\n";
}
开发者ID:Br3nda,项目名称:laconica,代码行数:31,代码来源:showcache.php

示例14: init

function init($worker)
{
    Redis::setCacheServer(get_option_value($worker->config, 'resources.cache', '127.0.0.1:6379'));
    Redis::setQueueServer(get_option_value($worker->config, 'resources.queue', '127.0.0.1:6379'));
}
开发者ID:pythias,项目名称:Tarth,代码行数:5,代码来源:processor.php

示例15: get_option_value

$helptext = <<<END_OF_VERIFY_HELP
  verifycreds.php [options]
  Use an access token to verify credentials thru the api

    -o --oauth_token       access token
    -s --token_secret      access token secret

END_OF_VERIFY_HELP;
$token = null;
$token_secret = null;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('o', 'oauth_token')) {
    $token = get_option_value('oauth_token');
}
if (have_option('s', 'token_secret')) {
    $token_secret = get_option_value('s', 'token_secret');
}
if (empty($token)) {
    print "Please specify an access token.\n";
    exit(1);
}
if (empty($token_secret)) {
    print "Please specify an access token secret.\n";
    exit(1);
}
$ini = parse_ini_file("oauth.ini");
$test_consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
$endpoint = $ini['apiroot'] . '/account/verify_credentials.xml';
print "{$endpoint}\n";
$at = new OAuthToken($token, $token_secret);
$parsed = parse_url($endpoint);
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:31,代码来源:verifycreds.php


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