本文整理匯總了PHP中AtD_get_setting函數的典型用法代碼示例。如果您正苦於以下問題:PHP AtD_get_setting函數的具體用法?PHP AtD_get_setting怎麽用?PHP AtD_get_setting使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AtD_get_setting函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: AtD_redirect_call
function AtD_redirect_call()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = trim(file_get_contents('php://input'));
}
$url = $_GET['url'];
$service = apply_filters('atd_service_domain', 'service.afterthedeadline.com');
if (defined('WPLANG')) {
if (strpos(WPLANG, 'pt') !== false) {
$service = 'pt.service.afterthedeadline.com';
} else {
if (strpos(WPLANG, 'de') !== false) {
$service = 'de.service.afterthedeadline.com';
} else {
if (strpos(WPLANG, 'es') !== false) {
$service = 'es.service.afterthedeadline.com';
} else {
if (strpos(WPLANG, 'fr') !== false) {
$service = 'fr.service.afterthedeadline.com';
}
}
}
}
}
$user = wp_get_current_user();
$guess = strcmp(AtD_get_setting($user->ID, 'AtD_guess_lang'), "true") == 0 ? "true" : "false";
$data = AtD_http_post($postText . "&guess={$guess}", defined('ATD_HOST') ? ATD_HOST : $service, $url, defined('ATD_PORT') ? ATD_PORT : 80);
header('Content-Type: text/xml');
if (!empty($data[1])) {
echo $data[1];
}
die;
}
示例2: AtD_redirect_call
function AtD_redirect_call()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = trim(file_get_contents('php://input'));
}
check_admin_referer('proxy_atd');
$url = $_GET['url'];
/**
* Change the AtD service domain.
*
* @module after-the-deadline
*
* @since 1.2.3
*
* @param string $var The URL for AtD service domain, default is service.afterthedeadline.com.
*/
$service = apply_filters('atd_service_domain', 'service.afterthedeadline.com');
$user = wp_get_current_user();
$atd_lang = get_locale();
// If we're on WPCOM, this function should be available.
if (function_exists('get_user_lang_code')) {
$atd_lang = get_user_lang_code($user->ID);
}
if (!empty($atd_lang)) {
if (strpos($atd_lang, 'pt') !== false) {
$service = 'pt.service.afterthedeadline.com';
} else {
if (strpos($atd_lang, 'de') !== false) {
$service = 'de.service.afterthedeadline.com';
} else {
if (strpos($atd_lang, 'es') !== false) {
$service = 'es.service.afterthedeadline.com';
} else {
if (strpos($atd_lang, 'fr') !== false) {
$service = 'fr.service.afterthedeadline.com';
}
}
}
}
}
$guess = strcmp(AtD_get_setting($user->ID, 'AtD_guess_lang'), "true") == 0 ? "true" : "false";
$data = AtD_http_post($postText . "&guess={$guess}", defined('ATD_HOST') ? ATD_HOST : $service, $url, defined('ATD_PORT') ? ATD_PORT : 80);
header('Content-Type: text/xml');
if (!empty($data[1])) {
echo $data[1];
}
die;
}
示例3: AtD_display_unignore_form
function AtD_display_unignore_form()
{
if (!AtD_is_allowed()) {
return;
}
$user = wp_get_current_user();
if (!$user || $user->ID == 0) {
return;
}
$ignores = AtD_get_setting($user->ID, 'AtD_ignored_phrases');
?>
<script>
function atd_show_phrases( ignored )
{
var element = jQuery( '#atd_ignores' ),
items = [],
delLink;
ignored.sort();
element.empty();
for ( var i = 0; i < ignored.length; i++ ) {
if ( ignored[i].length > 0 ) {
delLink = jQuery( '<span id="atd_' + i + '"> </span>' );
delLink
.text( delLink.text() + ignored[i] )
.prepend( jQuery( '<a class="ntdelbutton">X</a>' ).data( 'ignored', ignored[i] ) );
element.append( delLink ).append( '<br />' );
}
}
}
function atd_unignore( phrase ) {
/* get the ignored values and remove the unwanted phrase */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
ignored = jQuery.map(ignored, function(value, index) { return value == phrase ? null : value; });
jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
/* show a nifty message to the user */
jQuery( '#AtD_message' ).show();
}
function atd_ignore () {
/* get the ignored values and update the hidden field */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
jQuery.map(jQuery( '#AtD_add_ignore' ).val().split(/,\s*/g), function(value, index) { ignored.push(value); });
jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
jQuery( '#AtD_add_ignore' ).val('');
/* show that nifteroo messaroo to the useroo */
jQuery( '#AtD_message' ).show();
}
function atd_ignore_init() {
jQuery( '#AtD_message' ).hide();
jQuery( '#atd_ignores' ).delegate( 'a', 'click', function() {
atd_unignore( jQuery(this).data( 'ignored' ) );
return false;
} );
atd_show_phrases( jQuery( '#AtD_ignored_phrases' ).val().split( /,/g ) );
}
/* document.ready() does not execute in IE6 unless it's at the bottom of the page. oi! */
if (navigator.appName == 'Microsoft Internet Explorer')
setTimeout( atd_ignore_init, 2500 );
else
jQuery( document ).ready( atd_ignore_init );
</script>
<input type="hidden" name="AtD_ignored_phrases" id="AtD_ignored_phrases" value="<?php
echo esc_attr($ignores);
?>
">
<p style="font-weight: bold"><?php
_e('Ignored Phrases', 'jetpack');
?>
</font>
<p><?php
_e('Identify words and phrases to ignore while proofreading your posts and pages:', 'jetpack');
?>
</p>
<p><input type="text" id="AtD_add_ignore" name="AtD_add_ignore"> <input type="button" value="<?php
_e('Add', 'jetpack');
?>
" onclick="javascript:atd_ignore()"></p>
<div class="tagchecklist" id="atd_ignores"></div>
<div class="plugin-update-tr" id="AtD_message" style="display: none">
<div class="update-message"><strong><?php
//.........這裏部分代碼省略.........
示例4: AtD_get_options
function AtD_get_options($user_id, $name)
{
$options_raw = AtD_get_setting($user_id, $name, 'single');
$options = array();
$options['name'] = $name;
if ($options_raw) {
foreach (explode(',', $options_raw) as $option) {
$options[$option] = 1;
}
}
return $options;
}
示例5: AtD_load_submit_check_javascripts
function AtD_load_submit_check_javascripts()
{
global $pagenow;
$user = wp_get_current_user();
if (!$user || $user->ID == 0) {
return;
}
if (AtD_should_load_on_page()) {
$atd_check_when = AtD_get_setting($user->ID, 'AtD_check_when');
if (!empty($atd_check_when)) {
$check_when = array();
/* Set up the options in json */
foreach (explode(',', $atd_check_when) as $option) {
$check_when[$option] = true;
}
echo '<script type="text/javascript">' . "\n";
echo 'AtD_check_when = ' . json_encode((object) $check_when) . ";\n";
echo '</script>' . "\n";
}
}
}
示例6: prepare_options_for_response
/**
* Remove 'validate_callback' item from options available for module.
* Fetch current option value and add to array of module options.
* Prepare values of module options that need special handling, like those saved in wpcom.
*
* @since 4.3.0
*
* @param string $module Module slug.
* @return array
*/
public static function prepare_options_for_response($module = '')
{
$options = self::get_module_available_options($module);
if (!is_array($options) || empty($options)) {
return $options;
}
foreach ($options as $key => $value) {
if (isset($options[$key]['validate_callback'])) {
unset($options[$key]['validate_callback']);
}
$default_value = isset($options[$key]['default']) ? $options[$key]['default'] : '';
$current_value = get_option($key, $default_value);
$options[$key]['current_value'] = self::cast_value($current_value, $options[$key]);
}
// Some modules need special treatment.
switch ($module) {
case 'monitor':
// Status of user notifications
$options['monitor_receive_notifications']['current_value'] = self::cast_value(self::get_remote_value('monitor', 'monitor_receive_notifications'), $options['monitor_receive_notifications']);
break;
case 'post-by-email':
// Email address
$options['post_by_email_address']['current_value'] = self::cast_value(self::get_remote_value('post-by-email', 'post_by_email_address'), $options['post_by_email_address']);
break;
case 'protect':
// Protect
$options['jetpack_protect_key']['current_value'] = get_site_option('jetpack_protect_key', false);
if (!function_exists('jetpack_protect_format_whitelist')) {
@(include JETPACK__PLUGIN_DIR . 'modules/protect/shared-functions.php');
}
$options['jetpack_protect_global_whitelist']['current_value'] = jetpack_protect_format_whitelist();
break;
case 'related-posts':
// It's local, but it must be broken apart since it's saved as an array.
$options = self::split_options($options, Jetpack_Options::get_option('relatedposts'));
break;
case 'verification-tools':
// It's local, but it must be broken apart since it's saved as an array.
$options = self::split_options($options, get_option('verification_services_codes'));
break;
case 'sharedaddy':
// It's local, but it must be broken apart since it's saved as an array.
if (!class_exists('Sharing_Service') && !@(include JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php')) {
break;
}
$sharer = new Sharing_Service();
$options = self::split_options($options, $sharer->get_global_options());
$options['sharing_services']['current_value'] = $sharer->get_blog_services();
break;
case 'site-icon':
// Return site icon ID and URL to make it more complete.
$options['site_icon_id']['current_value'] = Jetpack_Options::get_option('site_icon_id');
if (!function_exists('jetpack_site_icon_url')) {
@(include JETPACK__PLUGIN_DIR . 'modules/site-icon/site-icon-functions.php');
}
$options['site_icon_url']['current_value'] = jetpack_site_icon_url();
break;
case 'after-the-deadline':
if (!function_exists('AtD_get_options')) {
@(include JETPACK__PLUGIN_DIR . 'modules/after-the-deadline.php');
}
$atd_options = array_merge(AtD_get_options(get_current_user_id(), 'AtD_options'), AtD_get_options(get_current_user_id(), 'AtD_check_when'));
unset($atd_options['name']);
foreach ($atd_options as $key => $value) {
$options[$key]['current_value'] = self::cast_value($value, $options[$key]);
}
$atd_options = AtD_get_options(get_current_user_id(), 'AtD_guess_lang');
$options['guess_lang']['current_value'] = self::cast_value(isset($atd_options['true']), $options['guess_lang']);
$options['ignored_phrases']['current_value'] = AtD_get_setting(get_current_user_id(), 'AtD_ignored_phrases');
unset($options['unignore_phrase']);
break;
case 'minileven':
$options['wp_mobile_excerpt']['current_value'] = 1 === intval($options['wp_mobile_excerpt']['current_value']) ? 'enabled' : 'disabled';
$options['wp_mobile_featured_images']['current_value'] = 1 === intval($options['wp_mobile_featured_images']['current_value']) ? 'enabled' : 'disabled';
break;
case 'stats':
// It's local, but it must be broken apart since it's saved as an array.
if (!function_exists('stats_get_options')) {
@(include JETPACK__PLUGIN_DIR . 'modules/stats.php');
}
$options = self::split_options($options, stats_get_options());
break;
}
return $options;
}
示例7: AtD_display_unignore_form
function AtD_display_unignore_form()
{
$user = wp_get_current_user();
if (!$user || $user->ID == 0) {
return;
}
$ignores = AtD_get_setting($user->ID, 'AtD_ignored_phrases');
?>
<script>
function atd_show_phrases( ignored )
{
var element = jQuery( '#atd_ignores' ).get( 0 );
var items = new Array();
ignored.sort();
for ( var i = 0; i < ignored.length; i++ ) {
if ( ignored[i].length > 0 )
items.push( '<span id="atd_' + i + '"><a class="ntdelbutton" href="javascript:atd_unignore(\'' + ignored[i].replace("'", "\\'") + '\')">X</a> ' + ignored[i] + '</span>' );
}
element.innerHTML = items.length >= 1 ? items.join("<br>") : '';
}
function atd_unignore( phrase, eid ) {
/* get the ignored values and remove the unwanted phrase */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
ignored = jQuery.map(ignored, function(value, index) { return value == phrase ? null : value; });
jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
/* show a nifty message to the user */
jQuery( '#AtD_message' ).show();
}
function atd_ignore () {
/* get the ignored values and update the hidden field */
var ignored = jQuery( '#AtD_ignored_phrases' ).val().split( /,/g );
jQuery.map(jQuery( '#AtD_add_ignore' ).val().split(/,\s*/g), function(value, index) { ignored.push(value); });
jQuery( '#AtD_ignored_phrases' ).val( ignored.join(',') );
/* update the UI */
atd_show_phrases( ignored );
jQuery( '#AtD_add_ignore' ).val('');
/* show that nifteroo messaroo to the useroo */
jQuery( '#AtD_message' ).show();
}
function atd_ignore_init() {
jQuery( '#AtD_message' ).hide();
atd_show_phrases( jQuery( '#AtD_ignored_phrases' ).val().split( /,/g ) );
}
/* document.ready() does not execute in IE6 unless it's at the bottom of the page. oi! */
if (navigator.appName == 'Microsoft Internet Explorer')
setTimeout( atd_ignore_init, 2500 );
else
jQuery( document ).ready( atd_ignore_init );
</script>
<input type="hidden" name="AtD_ignored_phrases" id="AtD_ignored_phrases" value="<?php
echo $ignores;
?>
">
<p style="font-weight: bold"><?php
_e('Ignored Phrases', 'after-the-deadline');
?>
</font>
<p><?php
_e('Identify words and phrases to ignore while proofreading your posts and pages:', 'after-the-deadline');
?>
</p>
<p><input type="text" id="AtD_add_ignore" name="AtD_add_ignore"> <input type="button" value="<?php
_e('Add', 'after-the-deadline');
?>
" onclick="javascript:atd_ignore()"></p>
<div class="tagchecklist" id="atd_ignores"></div>
<div class="plugin-update-tr" id="AtD_message" style="display: none">
<div class="update-message"><strong><?php
_e('Be sure to click "Update Profile" at the bottom of the screen to save your changes.', 'after-the-deadline');
?>
</strong></div>
</div>
</td>
</tr>
</table>
<?php
}
示例8: update_data
//.........這裏部分代碼省略.........
case 'Diacritical Marks':
case 'Double Negative':
case 'Hidden Verbs':
case 'Jargon Language':
case 'Passive voice':
case 'Phrases to Avoid':
case 'Redundant Expression':
case 'guess_lang':
if (in_array($option, array('onpublish', 'onupdate'))) {
$atd_option = 'AtD_check_when';
} elseif ('guess_lang' == $option) {
$atd_option = 'AtD_guess_lang';
$option = 'true';
} else {
$atd_option = 'AtD_options';
}
$user_id = get_current_user_id();
$grouped_options_current = AtD_get_options($user_id, $atd_option);
unset($grouped_options_current['name']);
$grouped_options = $grouped_options_current;
if ($value && !isset($grouped_options[$option])) {
$grouped_options[$option] = $value;
} elseif (!$value && isset($grouped_options[$option])) {
unset($grouped_options[$option]);
}
// If option value was the same, consider it done, otherwise try to update it.
$options_to_save = implode(',', array_keys($grouped_options));
$updated = $grouped_options != $grouped_options_current ? AtD_update_setting($user_id, $atd_option, $options_to_save) : true;
break;
case 'ignored_phrases':
case 'unignore_phrase':
$user_id = get_current_user_id();
$atd_option = 'AtD_ignored_phrases';
$grouped_options = $grouped_options_current = explode(',', AtD_get_setting($user_id, $atd_option));
if ('ignored_phrases' == $option) {
$grouped_options = explode(',', $value);
} else {
$index = array_search($value, $grouped_options);
if (false !== $index) {
unset($grouped_options[$index]);
$grouped_options = array_values($grouped_options);
}
}
$ignored_phrases = implode(',', array_filter(array_map('strip_tags', $grouped_options)));
$updated = $grouped_options != $grouped_options_current ? AtD_update_setting($user_id, $atd_option, $ignored_phrases) : true;
break;
case 'admin_bar':
case 'roles':
case 'count_roles':
case 'blog_id':
case 'do_not_track':
case 'hide_smile':
case 'version':
$grouped_options = $grouped_options_current = (array) get_option('stats_options');
$grouped_options[$option] = $value;
// If option value was the same, consider it done.
$updated = $grouped_options_current != $grouped_options ? update_option('stats_options', $grouped_options) : true;
break;
case Jetpack_Core_Json_Api_Endpoints::holiday_snow_option_name():
$updated = get_option($option) != $value ? update_option($option, (bool) $value ? 'letitsnow' : '') : true;
break;
case 'wp_mobile_featured_images':
case 'wp_mobile_excerpt':
$value = 'enabled' === $value ? '1' : '0';
// break intentionally omitted
// break intentionally omitted
示例9: AtD_load_submit_check_javascripts
function AtD_load_submit_check_javascripts()
{
global $pagenow;
$user = wp_get_current_user();
if (!$user || $user->ID == 0) {
return;
}
if (AtD_should_load_on_page()) {
$atd_check_when = AtD_get_setting($user->ID, 'AtD_check_when');
if ($atd_check_when) {
$check_when = '';
/* Set up the options in json */
foreach (explode(',', $atd_check_when) as $option) {
$check_when .= ($check_when ? ', ' : '') . $option . ': true';
}
echo '<script type="text/javascript">' . "\n";
echo 'AtD_check_when = { ' . $check_when . ' };' . "\n";
echo '</script>' . "\n";
}
}
}