本文整理汇总了PHP中Social::settings_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::settings_url方法的具体用法?PHP Social::settings_url怎么用?PHP Social::settings_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Social
的用法示例。
在下文中一共展示了Social::settings_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deauthorized
/**
* Checks to see if the broadcasting account has been deauthorized.
*
* @param bool $check_invalid_key
* @return bool
*/
public function deauthorized($check_invalid_key = FALSE)
{
$body = $this->body();
if (isset($body->result) and $body->result == 'error' and isset($body->response) and $this->_service->deauthorized($body->response, $check_invalid_key)) {
if ($this->_account->personal()) {
$url = Social::settings_url(array(), true);
} else {
$url = Social::settings_url();
}
$deauthorized = get_option('social_deauthorized', array());
if (!isset($deauthorized[$this->_service->key()])) {
$deauthorized[$this->_service->key()] = array();
}
$deauthorized[$this->_service->key()][$this->_account->id()] = sprintf(__('Unable to publish to %s with account %s. Please <a href="%">re-authorize</a> this account.', 'social'), esc_html($this->_service->title()), esc_html($this->_account->name()), esc_url($url));
update_option('social_deauthorized', $deauthorized);
Social::log('Removing deauthorized account: :account', array('account' => print_r($this->_account)));
$this->_service->remove_account($this->_account)->save();
return true;
}
return false;
}
示例2: admin_notices
/**
* Handles the display of different messages for admin notices.
*
* @wp-action admin_notices
* @action admin_notices
*/
public function admin_notices()
{
if (current_user_can('manage_options') or current_user_can('publish_posts')) {
// Upgrade notice
if (version_compare(Social::option('installed_version'), Social::$version, '<')) {
$message = sprintf(__('Social is shiny and new! Please <a href="%s">verify and save your settings</a> to complete the upgrade.', 'social'), esc_url(Social::settings_url()));
echo '<div class="error"><p>' . $message . '</p></div>';
}
$suppress_no_accounts_notice = get_user_meta(get_current_user_id(), 'social_suppress_no_accounts_notice', true);
if (!$this->_enabled and (!isset($_GET['page']) or $_GET['page'] != basename(SOCIAL_FILE)) and empty($suppress_no_accounts_notice)) {
$dismiss = sprintf(__('<a href="%s" class="social_dismiss">[Dismiss]</a>', 'social'), esc_url(admin_url('options-general.php?social_controller=settings&social_action=suppress_no_accounts_notice')));
$message = sprintf(__('To start using Social, please <a href="%s">add an account</a>.', 'social'), esc_url(Social::settings_url()));
echo '<div class="error"><p>' . $message . ' ' . $dismiss . '</p></div>';
}
if (isset($_GET['page']) and $_GET['page'] == basename(SOCIAL_FILE)) {
// CRON Lock
if (Social::option('cron_lock_error') !== null) {
$upload_dir = wp_upload_dir();
if (is_writeable(Social::$plugins_path) or isset($upload_dir['basedir']) and is_writeable($upload_dir['basedir'])) {
delete_option('social_cron_lock_error');
} else {
if (isset($upload_dir['basedir'])) {
$message = sprintf(__('Social requires that either %s or %s be writable for CRON jobs.', 'social'), esc_html(Social::$plugins_path), esc_html($upload_dir['basedir']));
} else {
$message = sprintf(__('Social requires that %s is writable for CRON jobs.', 'social'), esc_html(Social::$plugins_path));
}
echo '<div class="error"><p>' . esc_html($message) . '</p></div>';
}
}
// Enable notice?
$suppress_enable_notice = get_user_meta(get_current_user_id(), 'social_suppress_enable_notice', true);
if (empty($suppress_enable_notice)) {
$message = __('When you enable Social, users will be created when they log in with Facebook or Twitter to comment. These users are created without a role and will be prevented from accessing the admin side of WordPress until an administrator edits the user to give them a role.', 'social');
$dismiss = sprintf(__('<a href="%s" class="social_dismiss">[Dismiss]</a>', 'social'), esc_url(admin_url('options-general.php?social_controller=settings&social_action=suppress_enable_notice')));
echo '<div class="updated"><p>' . $message . ' ' . $dismiss . '</p></div>';
}
}
// Log write error
$error = Social::option('log_write_error');
if ($error == '1') {
echo '<div class="error"><p>' . sprintf(__('%s needs to be writable for Social\'s logging. <a href="%" class="social_dismiss">[Dismiss]</a>', 'social'), esc_html(Social::$plugins_path), esc_url(admin_url('options-general.php?social_controller=settings&social_action=clear_log_write_error'))) . '</p></div>';
}
}
// Deauthed accounts
$deauthed = Social::option('deauthed');
if (!empty($deauthed)) {
foreach ($deauthed as $service => $data) {
foreach ($data as $id => $message) {
$dismiss = sprintf(__('<a href="%s" class="%s">[Dismiss]</a>', 'social'), esc_url(admin_url('options-general.php?social_controller=settings&social_action=clear_deauth&id=' . $id . '&service=' . $service)), 'social_dismiss');
echo '<div class="error"><p>' . esc_html($message) . ' ' . $dismiss . '</p></div>';
}
}
}
// Errored broadcasting?
global $post;
if (isset($post->ID)) {
$error_accounts = get_post_meta($post->ID, '_social_broadcast_error', true);
if (!empty($error_accounts)) {
$message = Social_View::factory('wp-admin/post/broadcast/error/notice', array('social' => $this, 'accounts' => $error_accounts, 'post' => $post));
echo '<div class="error" id="social-broadcast-error">' . $message . '</div>';
delete_post_meta($post->ID, '_social_broadcast_error');
}
}
// 2.0 Upgrade?
$upgrade_2_0 = get_user_meta(get_current_user_id(), 'social_2.0_upgrade', true);
if (!empty($upgrade_2_0)) {
if (current_user_can('manage_options')) {
$output = __('Social needs to re-authorize your Facebook account(s). Please re-connect your <a href="%s">global</a> and <a href="%s">personal</a> accounts.', 'social');
$output = sprintf($output, esc_url(Social::settings_url()), esc_url(admin_url('profile.php#social-accounts')));
} else {
$output = __('Social needs to re-authorize your Facebook account(s).. Please re-connect your <a href="%s">personal</a> accounts.', 'social');
$output = sprintf($output, esc_url(admin_url('profile.php#social-networks')));
}
$dismiss = sprintf(__('<a href="%s" class="%s">[Dismiss]</a>', 'social'), esc_url(admin_url('options-general.php?social_controller=settings&social_action=clear_2_0_upgrade')), 'social_dismiss');
echo '<div class="error"><p>' . $output . ' ' . $dismiss . '</p></div>';
}
}
示例3: action_disconnect
/**
* Disconnects an account.
*
* @return void
*/
public function action_disconnect()
{
$id = $this->request->query('id');
$service_key = $this->request->query('service');
$personal = false;
if (defined('IS_PROFILE_PAGE')) {
Social::log('Disconnecting a personal account #:id', array('id' => $id));
$personal = true;
} else {
Social::log('Disconnecting a universal account #:id', array('id' => $id));
}
$this->social->service($service_key)->disconnect($id);
$this->social->remove_from_default_accounts($service_key, $id);
// Flush the cache
wp_cache_delete('services', 'social');
if (is_admin()) {
wp_redirect(Social::settings_url(array(), $personal));
} else {
wp_logout();
wp_redirect($this->request->query('redirect_to'));
}
exit;
}
示例4: __
echo '<h4>' . __('Possible fixes:', 'social') . '</h4><ul class="social-posting-errors">';
}
if ($total_deauthed) {
echo '<li>';
if ($total_deauthed == 1) {
$key = array_keys($deauthed);
$key = explode('-', $key[0]);
$service = $social->service($key[0])->title();
if (current_user_can('manage_options')) {
echo sprintf(__('To reauthorize the deauthorized %s account above, please edit your <a href="%s">global accounts</a> or your <a href="%s">personal accounts</a>.', 'social'), esc_html($service), esc_url(Social::settings_url()), esc_url(admin_url('profile.php#social-accounts')));
} else {
echo sprintf(__('To reauthorize the deauthorized %s account above, please edit your <a href="%s">personal accounts</a>.', 'social'), esc_html($service), esc_url(admin_url('profile.php#social-accounts')));
}
} else {
if (current_user_can('manage_options')) {
echo sprintf(__('To reauthorize the deauthorized accounts above, please edit your <a href="%s">global accounts</a> or your <a href="%s">personal accounts</a>.', 'social'), esc_url(Social::settings_url()), esc_url(admin_url('profile.php#social-accounts')));
} else {
echo sprintf(__('To reauthorize the deauthorized account above, please edit your <a href="%s">personal accounts</a>.', 'social'), esc_url(admin_url('profile.php#social-accounts')));
}
}
echo '</li>';
}
if (count($types)) {
foreach ($types as $type => $total) {
switch ($type) {
case 'limit_reached':
echo '<li>' . __('It is possible you have reached your broadcast limit, please try to broadcast again in an hour.', 'social') . '</li>';
break;
case 'duplicate_status':
echo '<li>' . __('It is possible you have broadcasted a duplicate message, please tweak your content a little and try again.', 'social') . '</li>';
break;
示例5: disconnect_url
/**
* Returns the disconnect URL.
*
* @static
*
* @param object $account
* @param bool $is_admin
* @param string $before
* @param string $after
*
* @return string
*/
public function disconnect_url($account, $is_admin = false, $before = '', $after = '')
{
$params = array('social_controller' => 'auth', 'social_action' => 'disconnect', 'id' => $account->id(), 'service' => $this->_key);
if ($is_admin) {
$personal = defined('IS_PROFILE_PAGE');
$url = Social::settings_url($params, $personal);
} else {
$params['redirect_to'] = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : $_SERVER['REQUEST_URI'];
foreach ($params as $key => $value) {
$params[$key] = urlencode($value);
}
$url = add_query_arg($params, home_url());
}
return $url;
}
示例6: action_index
/**
* Handles the request for Social's settings.
*
* @return void
*/
public function action_index()
{
if ($this->request->post('submit')) {
Social::option('broadcast_format', $this->request->post('social_broadcast_format'));
Social::option('comment_broadcast_format', $this->request->post('social_comment_broadcast_format'));
Social::option('debug', $this->request->post('social_debug'));
if (!Social::option('debug')) {
delete_option('social_log_write_error');
}
if (isset($_POST['social_broadcast_by_default'])) {
Social::option('broadcast_by_default', $_POST['social_broadcast_by_default']);
} else {
delete_option('social_broadcast_by_default');
}
if (isset($_POST['social_aggregate_comments'])) {
Social::option('aggregate_comments', $_POST['social_aggregate_comments']);
} else {
delete_option('social_aggregate_comments');
}
// Store the default accounts
$accounts = array();
if (is_array($this->request->post('social_default_accounts'))) {
foreach ($this->request->post('social_default_accounts') as $account) {
$account = explode('|', $account);
$accounts[$account[0]][] = $account[1];
}
}
$accounts = apply_filters('social_settings_default_accounts', $accounts, $this);
if (count($accounts)) {
Social::option('default_accounts', $accounts);
} else {
delete_option('social_default_accounts');
}
// API accounts
if ($this->request->post('social_api_accounts')) {
Social::option('social_api_accounts', $this->request->post('social_api_accounts'));
}
// System CRON
if ($this->request->post('social_cron') !== null) {
Social::option('cron', $this->request->post('social_cron'));
// Unschedule the CRONs
if ($this->request->post('social_cron') != '1' and ($timestamp = wp_next_scheduled('socialcron15init')) !== false) {
wp_unschedule_event($timestamp, 'socialcron15init');
}
}
if (isset($_POST['social_enabled_post_types'])) {
Social::option('enabled_post_types', array_keys($_POST['social_enabled_post_types'], 1));
}
// Disable Social's comment display feature
if (isset($_POST['social_use_standard_comments'])) {
Social::option('use_standard_comments', '1');
} else {
delete_option('social_use_standard_comments');
}
// Disable Social's broadcast feature
if (isset($_POST['social_disable_broadcasting'])) {
Social::option('disable_broadcasting', '1');
} else {
delete_option('social_disable_broadcasting');
}
do_action('social_settings_save', $this);
wp_redirect(Social::settings_url(array('saved' => 'true')));
exit;
}
$accounts = array();
foreach ($this->social->services() as $key => $service) {
if (!isset($accounts[$key])) {
$accounts[$key] = array();
}
foreach ($service->accounts() as $account) {
if ($account->universal()) {
$accounts[$key][] = $account->id();
}
}
}
echo Social_View::factory('wp-admin/options', array('services' => $this->social->services(), 'accounts' => $accounts, 'defaults' => Social::option('default_accounts')));
}
示例7: count
$total_deauthed = count($deauthed);
if ($total_deauthed or count($types)) {
echo __('Possible fixes:', 'social') . "\n\n";
}
if ($total_deauthed) {
if ($total_deauthed == 1) {
$key = array_keys($deauthed);
$key = explode('-', $key[0]);
$service = $social->service($key[0])->title();
$message = __('To reauthorize the deauthorized %s account above, please login and edit your accounts.', 'social');
} else {
$message = __('To reauthorize the deauthorized accounts above, please login and edit your accounts.', 'social');
}
$message .= "\n " . __('Personal accounts:', 'social') . ' ' . admin_url('profile.php#social-accounts');
if (current_user_can('manage_options')) {
$message .= "\n " . __('Global accounts:', 'social') . ' ' . Social::settings_url();
}
echo '- ' . $message . "\n";
}
if (count($types)) {
foreach ($types as $type => $total) {
switch ($type) {
case 'limit_reached':
$message = __('It is possible you have reached your broadcast limit, please try to broadcast again in an hour.', 'social');
break;
case 'duplicate_status':
$message = __('It is possible you have broadcasted a duplicate message, please tweak your content a little and try again.', 'social');
break;
default:
$message = __('Social was not successful in broadcasting this post (perhaps the service is down?), please try broadcasting again. If you receive this message repeatedly, you can try the support forums.', 'social') . ' ' . __('Support forums:', 'social') . ' http://wordpress.org/tags/social?forum_id=10';
break;