本文整理汇总了PHP中yourls_update_option函数的典型用法代码示例。如果您正苦于以下问题:PHP yourls_update_option函数的具体用法?PHP yourls_update_option怎么用?PHP yourls_update_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yourls_update_option函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ozh_yourls_samplepage_update_option
function ozh_yourls_samplepage_update_option()
{
$in = $_POST['test_option'];
if ($in) {
// Validate test_option. ALWAYS validate and sanitize user input.
// Here, we want an integer
$in = intval($in);
// Update value in database
yourls_update_option('test_option', $in);
}
}
开发者ID:469306621,项目名称:Languages,代码行数:11,代码来源:plugin.php
示例2: gmo_domain_swap_update_option
function gmo_domain_swap_update_option()
{
$in = $_POST['domain_swap_values'];
if (!empty($in)) {
$in = preg_split('/(\\r?\\n)+/', trim($in));
array_walk($in, "gmo_domain_trim_value");
$arr = array('domains' => $in);
$json = json_encode($arr);
yourls_update_option('domain_swap_values', $json);
}
}
开发者ID:gmolop,项目名称:yourls-domain-swap,代码行数:11,代码来源:plugin.php
示例3: action_activated_plugin
/**
* Action activated_plugin
*
* @param array $args
* @throws \Exception
*/
public function action_activated_plugin(array $args)
{
list($plugin) = $args;
if (false === stripos($plugin, self::APP_NAMESPACE)) {
return;
}
$plugins = $this->db()->plugins;
$key = array_search($plugin, $plugins);
unset($plugins[$key]);
$key2 = $this->isLaemmiPlugins($plugins);
$key = false !== $key2 ? $key2 : $key;
array_splice($plugins, $key, 0, array($plugin));
yourls_update_option('active_plugins', $plugins);
}
开发者ID:laemmi,项目名称:laemmi-yourls-default-tools,代码行数:20,代码来源:Plugin.php
示例4: temp_instead_admin_page_update
function temp_instead_admin_page_update()
{
$mode = $_POST['temp_instead_mode'];
if ($mode) {
$mode = intval($mode);
if (yourls_get_option('temp_instead_mode') !== false) {
echo '<b>Redirect mode was updated successfully.</b>';
yourls_update_option('temp_instead_mode', $mode);
} else {
echo '<b>Redirect mode was stored successfully.</b>';
yourls_add_option('temp_instead_mode', $mode);
}
}
}
开发者ID:nixmomo,项目名称:302-instead,代码行数:14,代码来源:plugin.php
示例5: abdulrauf_adminreCaptcha_save_admin
function abdulrauf_adminreCaptcha_save_admin()
{
$pubkey = $_POST['abdulrauf_adminreCaptcha_public_key'];
$privkey = $_POST['abdulrauf_adminreCaptcha_private_key'];
if (yourls_get_option('abdulrauf_adminreCaptcha_pub_key') !== false) {
yourls_update_option('abdulrauf_adminreCaptcha_pub_key', $pubkey);
} else {
yourls_add_option('abdulrauf_adminreCaptcha_pub_key', $pubkey);
}
if (yourls_get_option('abdulrauf_adminreCaptcha_priv_key') !== false) {
yourls_update_option('abdulrauf_adminreCaptcha_priv_key', $privkey);
} else {
yourls_add_option('abdulrauf_adminreCaptcha_priv_key', $privkey);
}
echo "Saved";
}
开发者ID:armujahid,项目名称:Admin-reCaptcha,代码行数:16,代码来源:plugin.php
示例6: yourls_initialize_options
/**
* Initializes the option table
*
* Each yourls_update_option() returns either true on success (option updated) or false on failure (new value == old value, or
* for some reason it could not save to DB).
* Since true & true & true = 1, we cast it to boolean type to return true (or false)
*
* @since 1.7
* @return bool
*/
function yourls_initialize_options()
{
return (bool) (yourls_update_option('version', YOURLS_VERSION) & yourls_update_option('db_version', YOURLS_DB_VERSION) & yourls_update_option('next_id', 1));
}
开发者ID:Steadroy,项目名称:YOURLS,代码行数:14,代码来源:functions-install.php
示例7: yourls_deactivate_plugin
/**
* Dectivate a plugin
*
* @param string $plugin Plugin filename (full relative to plugins directory)
* @return mixed string if error or true if success
*/
function yourls_deactivate_plugin($plugin)
{
$plugin = yourls_plugin_basename($plugin);
// Check plugin is active
if (!yourls_is_active_plugin($plugin)) {
return 'Plugin not active';
}
// Deactivate the plugin
global $ydb;
$key = array_search($plugin, $ydb->plugins);
if ($key !== false) {
array_splice($ydb->plugins, $key, 1);
}
yourls_update_option('active_plugins', $ydb->plugins);
yourls_do_action('deactivated_plugin', $plugin);
yourls_do_action('deactivated_' . $plugin);
return true;
}
开发者ID:469306621,项目名称:Languages,代码行数:24,代码来源:functions-plugins.php
示例8: yourls_update_options_to_14
function yourls_update_options_to_14()
{
yourls_update_option('version', '1.4');
yourls_update_option('db_version', '200');
if (defined('YOURLS_DB_TABLE_NEXTDEC')) {
global $ydb;
$table = YOURLS_DB_TABLE_NEXTDEC;
$next_id = $ydb->get_var("SELECT `next_id` FROM `{$table}`");
yourls_update_option('next_id', $next_id);
@$ydb->query("DROP TABLE `{$table}`");
} else {
yourls_update_option('next_id', 1);
// In case someone mistakenly deleted the next_id constant or table too early
}
}
开发者ID:momoim,项目名称:momo-api,代码行数:15,代码来源:functions-upgrade.php
示例9: yourls_update_next_decimal
/**
* Update id for next link with no custom keyword
*
*/
function yourls_update_next_decimal($int = '')
{
$int = $int == '' ? yourls_get_next_decimal() + 1 : (int) $int;
$update = yourls_update_option('next_id', $int);
yourls_do_action('update_next_decimal', $int, $update);
return $update;
}
开发者ID:steenhulthin,项目名称:hult.in,代码行数:11,代码来源:functions.php
示例10: yourls_login_screen
// Regular mode
} else {
yourls_login_screen($auth);
}
die;
}
yourls_do_action('auth_successful');
/*
* The following code is a shim that helps users store passwords securely in config.php
* by storing a password hash and removing the plaintext.
*
* TODO: Remove this once real user management is implemented
*/
// Did we just fail at encrypting passwords ?
if (isset($_GET['dismiss']) && $_GET['dismiss'] == 'hasherror') {
yourls_update_option('defer_hashing_error', time() + 86400 * 7);
// now + 1 week
} else {
// Encrypt passwords that are clear text
if (!defined('YOURLS_NO_HASH_PASSWORD') && yourls_has_cleartext_passwords()) {
$hash = yourls_hash_passwords_now(YOURLS_CONFIGFILE);
if ($hash === true) {
// Hashing succesful. Remove flag from DB if any.
if (yourls_get_option('defer_hashing_error')) {
yourls_delete_option('defer_hashing_error');
}
} else {
// It failed, display message for first time or if last time was a week ago
if (time() > yourls_get_option('defer_hashing_error') or !yourls_get_option('defer_hashing_error')) {
$message = yourls_s('Could not auto-encrypt passwords. Error was: "%s".', $hash);
$message .= ' ';
开发者ID:steenhulthin,项目名称:hult.in,代码行数:31,代码来源:auth.php
示例11: yourls_create_sql_tables
/**
* Create MySQL tables. Return array( 'success' => array of success strings, 'errors' => array of error strings )
*
*/
function yourls_create_sql_tables()
{
global $ydb;
$error_msg = array();
$success_msg = array();
// Create Table Query
$create_tables = array();
$create_tables[YOURLS_DB_TABLE_URL] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_URL . '` (' . '`keyword` varchar(200) BINARY NOT NULL,' . '`url` text BINARY NOT NULL,' . '`title` text CHARACTER SET utf8,' . '`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,' . '`ip` VARCHAR(41) NOT NULL,' . '`clicks` INT(10) UNSIGNED NOT NULL,' . ' PRIMARY KEY (`keyword`),' . ' KEY `timestamp` (`timestamp`),' . ' KEY `ip` (`ip`)' . ');';
$create_tables[YOURLS_DB_TABLE_OPTIONS] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_OPTIONS . '` (' . '`option_id` bigint(20) unsigned NOT NULL auto_increment,' . '`option_name` varchar(64) NOT NULL default "",' . '`option_value` longtext NOT NULL,' . 'PRIMARY KEY (`option_id`,`option_name`),' . 'KEY `option_name` (`option_name`)' . ') AUTO_INCREMENT=1 ;';
$create_tables[YOURLS_DB_TABLE_LOG] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_LOG . '` (' . '`click_id` int(11) NOT NULL auto_increment,' . '`click_time` datetime NOT NULL,' . '`shorturl` varchar(200) BINARY NOT NULL,' . '`referrer` varchar(200) NOT NULL,' . '`user_agent` varchar(255) NOT NULL,' . '`ip_address` varchar(41) NOT NULL,' . '`country_code` char(2) NOT NULL,' . 'PRIMARY KEY (`click_id`),' . 'KEY `shorturl` (`shorturl`)' . ') AUTO_INCREMENT=1 ;';
$create_table_count = 0;
$ydb->show_errors = true;
// Create tables
foreach ($create_tables as $table_name => $table_query) {
$ydb->query($table_query);
$create_success = $ydb->query("SHOW TABLES LIKE '{$table_name}'");
if ($create_success) {
$create_table_count++;
$success_msg[] = yourls_s("Table '%s' created.", $table_name);
} else {
$error_msg[] = yourls_s("Error creating table '%s'.", $table_name);
}
}
// Insert data into tables
yourls_update_option('version', YOURLS_VERSION);
yourls_update_option('db_version', YOURLS_DB_VERSION);
yourls_update_option('next_id', 1);
// Insert sample links
yourls_insert_link_in_db('http://planetozh.com/blog/', 'ozhblog', 'planetOzh: Ozh\' blog');
yourls_insert_link_in_db('http://ozh.org/', 'ozh', 'ozh.org');
yourls_insert_link_in_db('http://yourls.org/', 'yourls', 'YOURLS: Your Own URL Shortener');
// Check results of operations
if (sizeof($create_tables) == $create_table_count) {
$success_msg[] = yourls__('YOURLS tables successfully created.');
} else {
$error_msg[] = yourls__('Error creating YOURLS tables.');
}
return array('success' => $success_msg, 'error' => $error_msg);
}
开发者ID:GasmoN,项目名称:yourls,代码行数:43,代码来源:functions-install.php
示例12: yourls_update_next_decimal
function yourls_update_next_decimal($int = '')
{
$int = $int == '' ? yourls_get_next_decimal() + 1 : (int) $int;
return yourls_update_option('next_id', $int);
}
开发者ID:momoim,项目名称:momo-api,代码行数:5,代码来源:functions.php
示例13: yourls_check_core_version
/**
* Check api.yourls.org if there's a newer version of YOURLS
*
* This function collects various stats to help us improve YOURLS. See the blog post about it:
* http://blog.yourls.org/2014/01/on-yourls-1-7-and-api-yourls-org/
* Results of requests sent to api.yourls.org are stored in option 'core_version_checks' and is an object
* with the following properties:
* - failed_attempts : number of consecutive failed attempts
* - last_attempt : time() of last attempt
* - last_result : content retrieved from api.yourls.org during previous check
* - version_checked : installed YOURLS version that was last checked
*
* @since 1.7
* @return mixed JSON data if api.yourls.org successfully requested, false otherwise
*/
function yourls_check_core_version()
{
global $ydb, $yourls_user_passwords;
$checks = yourls_get_option('core_version_checks');
// Invalidate check data when YOURLS version changes
if (is_object($checks) && YOURLS_VERSION != $checks->version_checked) {
$checks = false;
}
if (!is_object($checks)) {
$checks = new stdClass();
$checks->failed_attempts = 0;
$checks->last_attempt = 0;
$checks->last_result = '';
$checks->version_checked = YOURLS_VERSION;
}
// Config file location ('u' for '/user' or 'i' for '/includes')
$conf_loc = str_replace(YOURLS_ABSPATH, '', YOURLS_CONFIGFILE);
$conf_loc = str_replace('/config.php', '', $conf_loc);
$conf_loc = $conf_loc == '/user' ? 'u' : 'i';
// The collection of stuff to report
$stuff = array('md5' => md5(YOURLS_SITE . YOURLS_ABSPATH), 'failed_attempts' => $checks->failed_attempts, 'yourls_site' => defined('YOURLS_SITE') ? YOURLS_SITE : 'unknown', 'yourls_version' => defined('YOURLS_VERSION') ? YOURLS_VERSION : 'unknown', 'php_version' => phpversion(), 'mysql_version' => $ydb->mysql_version(), 'locale' => yourls_get_locale(), 'db_driver' => defined('YOURLS_DB_DRIVER') ? YOURLS_DB_DRIVER : 'unset', 'db_ext_pdo' => extension_loaded('pdo_mysql') ? 1 : 0, 'db_ext_mysql' => extension_loaded('mysql') ? 1 : 0, 'db_ext_mysqli' => extension_loaded('mysqli') ? 1 : 0, 'ext_curl' => extension_loaded('curl') ? 1 : 0, 'num_users' => count($yourls_user_passwords), 'config_location' => $conf_loc, 'yourls_private' => defined('YOURLS_PRIVATE') && YOURLS_PRIVATE ? 1 : 0, 'yourls_unique' => defined('YOURLS_UNIQUE_URLS') && YOURLS_UNIQUE_URLS ? 1 : 0, 'yourls_url_convert' => defined('YOURLS_URL_CONVERT') ? YOURLS_URL_CONVERT : 'unknown', 'num_active_plugins' => yourls_has_active_plugins(), 'num_pages' => defined('YOURLS_PAGEDIR') ? count((array) glob(YOURLS_PAGEDIR . '/*.php')) : 0);
$stuff = yourls_apply_filter('version_check_stuff', $stuff);
// Send it in
$url = 'http://api.yourls.org/core/version/1.0/';
if (yourls_can_http_over_ssl()) {
$url = yourls_set_url_scheme($url, 'https');
}
$req = yourls_http_post($url, array(), $stuff);
$checks->last_attempt = time();
$checks->version_checked = YOURLS_VERSION;
// Unexpected results ?
if (is_string($req) or !$req->success) {
$checks->failed_attempts = $checks->failed_attempts + 1;
yourls_update_option('core_version_checks', $checks);
return false;
}
// Parse response
$json = json_decode(trim($req->body));
if (isset($json->latest) && isset($json->zipurl)) {
// All went OK - mark this down
$checks->failed_attempts = 0;
$checks->last_result = $json;
yourls_update_option('core_version_checks', $checks);
return $json;
}
// Request returned actual result, but not what we expected
return false;
}
开发者ID:chadcumm,项目名称:YOURLS,代码行数:63,代码来源:functions-http.php
示例14: spb_recaptcha_save_admin
function spb_recaptcha_save_admin()
{
$pubkey = $_POST['spb_recaptcha_public_key'];
$privkey = $_POST['spb_recaptcha_private_key'];
$solvemediaCKey = $_POST['spb_recaptcha_solvemediaCKey'];
$solvemediaVKey = $_POST['spb_recaptcha_solvemediaVKey'];
$solvemediaHKey = $_POST['spb_recaptcha_solvemediaHKey'];
if (yourls_get_option('spb_recaptcha_pub_key') !== false) {
yourls_update_option('spb_recaptcha_pub_key', $pubkey);
} else {
yourls_add_option('spb_recaptcha_pub_key', $pubkey);
}
if (yourls_get_option('spb_recaptcha_priv_key') !== false) {
yourls_update_option('spb_recaptcha_priv_key', $privkey);
} else {
yourls_add_option('spb_recaptcha_priv_key', $privkey);
}
if (yourls_get_option('spb_recaptcha_solvemediaCKey') !== false) {
yourls_update_option('spb_recaptcha_solvemediaCKey', $solvemediaCKey);
} else {
yourls_add_option('spb_recaptcha_solvemediaCKey', $solvemediaCKey);
}
if (yourls_get_option('spb_recaptcha_solvemediaVKey') !== false) {
yourls_update_option('spb_recaptcha_solvemediaVKey', $solvemediaVKey);
} else {
yourls_add_option('spb_recaptcha_solvemediaVKey', $solvemediaVKey);
}
if (yourls_get_option('spb_recaptcha_solvemediaHKey') !== false) {
yourls_update_option('spb_recaptcha_solvemediaHKey', $solvemediaHKey);
} else {
yourls_add_option('spb_recaptcha_solvemediaHKey', $solvemediaHKey);
}
echo "Saved";
}
开发者ID:spbriggs,项目名称:recaptcha-plugin,代码行数:34,代码来源:plugin.php
示例15: yourls_maintenance_mode
function yourls_maintenance_mode($maintenance = true)
{
yourls_update_option('maintenance_mode', (bool) $maintenance);
}
开发者ID:TheProjecter,项目名称:yourls-ext,代码行数:4,代码来源:functions.php
示例16: itfs_piwik_admin_settings_update
/**
* Updates the configuration in the YOURLS database
*/
function itfs_piwik_admin_settings_update()
{
//We make sure we've received a configuration update
if (isset($_POST['piwik_config'])) {
$piwik_config = array();
/**
* There will be 2 additional modules. One for people who have donated above a certain amount and a professional version
*/
if (file_exists(dirname(__FILE__) . '/donations.php')) {
$piwik_config[SKU] = 'donations';
} else {
if (file_exists(dirname(__FILE__) . '/pro.php')) {
$piwik_config[SKU] = 'pro';
} else {
$piwik_config[SKU] = 'free';
}
}
// We sanitize each parameter.
if (is_array($_POST['piwik_config'])) {
foreach ($_POST['piwik_config'] as $k => $v) {
if ($k == 'site_id') {
$piwik_config[$k] = @intval($v);
} else {
if ($k == 'piwik_url') {
// Site URL must end with a slash. Stolen as-is from wp-piwik
if (substr($v, -1, 1) != '/' && substr($v, -10, 10) != '/index.php') {
$v .= '/';
}
$piwik_config[$k] = yourls_sanitize_url($v);
} else {
$piwik_config[$k] = yourls_sanitize_title($v);
}
}
}
try {
yourls_update_option('piwik_config', $piwik_config);
} catch (Exception $e) {
$message = "ITFS_PIWIK: Error when trying to save settings. " . $e->getMessage();
error_log($message, 0);
echo yourls_add_notice($message, 'message_error');
return false;
}
}
}
}
开发者ID:mm999,项目名称:piwik-yourls,代码行数:48,代码来源:plugin.php
注:本文中的yourls_update_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论