本文整理汇总了PHP中Sharing_Service::delete_service方法的典型用法代码示例。如果您正苦于以下问题:PHP Sharing_Service::delete_service方法的具体用法?PHP Sharing_Service::delete_service怎么用?PHP Sharing_Service::delete_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sharing_Service
的用法示例。
在下文中一共展示了Sharing_Service::delete_service方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_delete_service
public function ajax_delete_service()
{
if (isset($_POST['_wpnonce']) && isset($_POST['service']) && wp_verify_nonce($_POST['_wpnonce'], 'sharing-options_' . $_POST['service'])) {
$sharer = new Sharing_Service();
$sharer->delete_service($_POST['service']);
}
}
示例2: update_data
//.........这里部分代码省略.........
$grouped_options = $grouped_options_current = (array) get_option('verification_services_codes');
$grouped_options[$option] = $value;
// If option value was the same, consider it done.
$updated = $grouped_options_current != $grouped_options ? update_option('verification_services_codes', $grouped_options) : true;
break;
case 'sharing_services':
if (!class_exists('Sharing_Service') && !@(include JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php')) {
break;
}
$sharer = new Sharing_Service();
// If option value was the same, consider it done.
$updated = $value != $sharer->get_blog_services() ? $sharer->set_blog_services($value['visible'], $value['hidden']) : true;
break;
case 'button_style':
case 'sharing_label':
case 'show':
if (!class_exists('Sharing_Service') && !@(include JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php')) {
break;
}
$sharer = new Sharing_Service();
$grouped_options = $sharer->get_global_options();
$grouped_options[$option] = $value;
$updated = $sharer->set_global_options($grouped_options);
break;
case 'custom':
if (!class_exists('Sharing_Service') && !@(include JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php')) {
break;
}
$sharer = new Sharing_Service();
$updated = $sharer->new_service(stripslashes($value['sharing_name']), stripslashes($value['sharing_url']), stripslashes($value['sharing_icon']));
// Return new custom service
$response[$option] = $updated;
break;
case 'sharing_delete_service':
if (!class_exists('Sharing_Service') && !@(include JETPACK__PLUGIN_DIR . 'modules/sharedaddy/sharing-service.php')) {
break;
}
$sharer = new Sharing_Service();
$updated = $sharer->delete_service($value);
break;
case 'jetpack-twitter-cards-site-tag':
$value = trim(ltrim(strip_tags($value), '@'));
$updated = get_option($option) !== $value ? update_option($option, $value) : true;
break;
case 'onpublish':
case 'onupdate':
case 'Bias Language':
case 'Cliches':
case 'Complex Expression':
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();
示例3: callback
public function callback($path = '', $blog_id = 0, $button_id = 0)
{
// Validate request
$blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
if (is_wp_error($blog_id)) {
return $blog_id;
}
if (!current_user_can('manage_options')) {
return new WP_Error('forbidden', 'You do not have the capability to manage sharing buttons for this site', 403);
} else {
if (!class_exists('Sharing_Service') || !class_exists('Sharing_Source') || method_exists('Jetpack', 'is_module_active') && !Jetpack::is_module_active('sharedaddy')) {
return new WP_Error('missing_jetpack_module', 'The Sharing module must be activated in order to use this endpoint', 400);
}
}
// Find existing button
$ss = new Sharing_Service();
$all_buttons = $ss->get_all_services_blog();
if (!array_key_exists($button_id, $all_buttons)) {
// Button doesn't exist
return new WP_Error('not_found', 'The specified sharing button was not found', 404);
}
// Verify button is custom
if (!is_a($all_buttons[$button_id], 'Share_Custom')) {
return new WP_error('invalid_request', 'Only custom sharing buttons can be deleted', 400);
}
$success = $ss->delete_service($button_id);
return array('ID' => $button_id, 'success' => $success);
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:28,代码来源:class.wpcom-json-api-sharing-buttons-endpoint.php
示例4: update_module
//.........这里部分代码省略.........
case 'show_thumbnails':
$grouped_options = $grouped_options_current = Jetpack_Options::get_option('relatedposts');
$grouped_options[$option] = $value;
// If option value was the same, consider it done.
$updated = $grouped_options_current != $grouped_options ? Jetpack_Options::update_option('relatedposts', $grouped_options) : true;
break;
case 'google':
case 'bing':
case 'pinterest':
$grouped_options = $grouped_options_current = get_option('verification_services_codes');
$grouped_options[$option] = $value;
// If option value was the same, consider it done.
$updated = $grouped_options_current != $grouped_options ? update_option('verification_services_codes', $grouped_options) : true;
break;
case 'sharing_services':
$sharer = new Sharing_Service();
// If option value was the same, consider it done.
$updated = $value != $sharer->get_blog_services() ? $sharer->set_blog_services($value['visible'], $value['hidden']) : true;
break;
case 'button_style':
case 'sharing_label':
case 'show':
$sharer = new Sharing_Service();
$grouped_options = $sharer->get_global_options();
$grouped_options[$option] = $value;
$updated = $sharer->set_global_options($grouped_options);
break;
case 'custom':
$sharer = new Sharing_Service();
$updated = $sharer->new_service(stripslashes($value['sharing_name']), stripslashes($value['sharing_url']), stripslashes($value['sharing_icon']));
// Return new custom service
$response[$option] = $updated;
break;
case 'sharing_delete_service':
$sharer = new Sharing_Service();
$updated = $sharer->delete_service($value);
break;
case 'jetpack-twitter-cards-site-tag':
$value = trim(ltrim(strip_tags($value), '@'));
$updated = get_option($option) !== $value ? update_option($option, $value) : true;
break;
case 'onpublish':
case 'onupdate':
case 'Bias Language':
case 'Cliches':
case 'Complex Expression':
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;