本文整理汇总了PHP中Sharing_Service::get_all_services_blog方法的典型用法代码示例。如果您正苦于以下问题:PHP Sharing_Service::get_all_services_blog方法的具体用法?PHP Sharing_Service::get_all_services_blog怎么用?PHP Sharing_Service::get_all_services_blog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sharing_Service
的用法示例。
在下文中一共展示了Sharing_Service::get_all_services_blog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: management_page
public function management_page()
{
$sharer = new Sharing_Service();
$enabled = $sharer->get_blog_services();
$global = $sharer->get_global_options();
$shows = array_values(get_post_types(array('public' => true)));
array_unshift($shows, 'index');
if (false == function_exists('mb_stripos')) {
echo '<div id="message" class="updated fade"><h3>' . __('Warning! Multibyte support missing!', 'jetpack') . '</h3>';
echo "<p>" . sprintf(__('This plugin will work without it, but multibyte support is used <a href="%s">if available</a>. You may see minor problems with Tweets and other sharing services.', 'jetpack'), "http://www.php.net/manual/en/mbstring.installation.php") . '</p></div>';
}
if (isset($_GET['update']) && $_GET['update'] == 'saved') {
echo '<div class="updated"><p>' . __('Settings have been saved', 'jetpack') . '</p></div>';
}
if (!isset($global['sharing_label'])) {
$global['sharing_label'] = __('Share this:', 'jetpack');
}
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br /></div>
<h2><?php
_e('Sharing Settings', 'jetpack');
?>
</h2>
<?php
/**
* Fires at the top of the admin sharing settings screen.
*
* @since 1.6.0
*/
do_action('pre_admin_screen_sharing');
?>
<?php
if (current_user_can('manage_options')) {
?>
<div class="share_manage_options">
<h3><?php
_e('Sharing Buttons', 'jetpack');
?>
</h3>
<p><?php
_e('Add sharing buttons to your blog and allow your visitors to share posts with their friends.', 'jetpack');
?>
</p>
<div id="services-config">
<table id="available-services">
<tr>
<td class="description">
<h3><?php
_e('Available Services', 'jetpack');
?>
</h3>
<p><?php
_e("Drag and drop the services you'd like to enable into the box below.", 'jetpack');
?>
</p>
<p><a href="#TB_inline?height=395&width=600&inlineId=new-service" class="thickbox" id="add-a-new-service"><?php
_e('Add a new service', 'jetpack');
?>
</a></p>
</td>
<td class="services">
<ul class="services-available" style="height: 100px;">
<?php
foreach ($sharer->get_all_services_blog() as $id => $service) {
?>
<?php
if (!isset($enabled['all'][$id])) {
$this->output_service($id, $service);
}
?>
<?php
}
?>
</ul>
<?php
if (-1 == get_option('blog_public')) {
echo '<p><strong>' . __('Please note that your services have been restricted because your site is private.', 'jetpack') . '</strong></p>';
}
?>
<br class="clearing" />
</td>
</tr>
</table>
<table id="enabled-services">
<tr>
<td class="description">
<h3>
<?php
_e('Enabled Services', 'jetpack');
?>
<img src="<?php
echo admin_url('images/loading.gif');
?>
//.........这里部分代码省略.........
示例2: management_page
public function management_page()
{
$sharer = new Sharing_Service();
$enabled = $sharer->get_blog_services();
$global = $sharer->get_global_options();
$shows = array_values(get_post_types(array('public' => true)));
array_unshift($shows, 'index');
if (false == function_exists('mb_stripos')) {
echo '<div id="message" class="updated fade"><h3>' . __('Warning! Multibyte support missing!', 'jetpack') . '</h3>';
echo "<p>" . sprintf(__('This plugin will work without it, but multibyte support is used <a href="%s">if available</a>. You may see minor problems with Tweets and other sharing services.', 'jetpack'), "http://www.php.net/manual/en/mbstring.installation.php") . '</p></div>';
}
if (isset($_GET['update']) && $_GET['update'] == 'saved') {
echo '<div class="updated"><p>' . __('Settings have been saved', 'jetpack') . '</p></div>';
}
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"><br /></div>
<h2><?php
_e('Sharing Settings', 'jetpack');
?>
</h2>
<div id="services-config">
<table id="available-services">
<tr>
<td class="description">
<h3><?php
_e('Available Services', 'jetpack');
?>
</h3>
<p><?php
_e("Drag and drop the services you'd like to enable into the box below.", 'jetpack');
?>
</p>
<p><a href="#TB_inline?height=395&width=600&inlineId=new-service" title="<?php
echo esc_attr(__('Add a new service', 'jetpack'));
?>
" class="thickbox"><?php
_e('Add a new service', 'jetpack');
?>
</a></p>
</td>
<td class="services">
<ul class="services-available" style="height: 100px;">
<?php
foreach ($sharer->get_all_services_blog() as $id => $service) {
?>
<?php
if (!isset($enabled['all'][$id])) {
$this->output_service($id, $service);
}
?>
<?php
}
?>
</ul>
<br class="clearing" />
</td>
</tr>
</table>
<table id="enabled-services">
<tr>
<td class="description">
<h3>
<?php
_e('Enabled Services', 'jetpack');
?>
<img src="<?php
echo admin_url('images/loading.gif');
?>
" width="16" height="16" alt="loading" style="vertical-align: middle; display: none" />
</h3>
<p><?php
_e('Services dragged here will appear individually.', 'jetpack');
?>
</p>
</td>
<td class="services" id="share-drop-target">
<h2 id="drag-instructions" <?php
if (count($enabled['visible']) > 0) {
echo ' style="display: none"';
}
?>
><?php
_e('Drag and drop available services here', 'jetpack');
?>
</h2>
<ul class="services-enabled">
<?php
foreach ($enabled['visible'] as $id => $service) {
?>
<?php
$this->output_service($id, $service, true);
?>
<?php
}
?>
//.........这里部分代码省略.........
示例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