本文整理汇总了PHP中Jetpack::admin_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::admin_url方法的具体用法?PHP Jetpack::admin_url怎么用?PHP Jetpack::admin_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::admin_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: client_authorize
/**
* Authorizations
*/
function client_authorize()
{
$data = stripslashes_deep($_GET);
$data['auth_type'] = 'client';
$role = Jetpack::translate_current_user_to_role();
$redirect = isset($data['redirect']) ? esc_url_raw((string) $data['redirect']) : '';
$this->check_admin_referer("jetpack-authorize_{$role}_{$redirect}");
$result = $this->authorize($data);
if (is_wp_error($result)) {
Jetpack::state('error', $result->get_error_code());
}
if (wp_validate_redirect($redirect)) {
$this->wp_safe_redirect($redirect);
} else {
$this->wp_safe_redirect(Jetpack::admin_url());
}
/**
* Fires after the Jetpack client is authorized to communicate with WordPress.com.
*
* @since 4.2.0
*
* @param int Jetpack Blog ID.
*/
do_action('jetpack_client_authorized', Jetpack_Options::get_option('id'));
$this->do_exit();
}
示例2: jetpack_add_settings_sub_nav_item
/**
* If user is allowed to see the Jetpack Admin, add Settings sub-link.
*
* @since 4.3.0
*/
function jetpack_add_settings_sub_nav_item()
{
if ((Jetpack::is_development_mode() || Jetpack::is_active()) && current_user_can('jetpack_admin_page')) {
global $submenu;
$submenu['jetpack'][] = array(__('Settings', 'jetpack'), 'jetpack_admin_page', Jetpack::admin_url('page=jetpack#/settings'));
}
}
示例3: jetpack_configuration_load
public function jetpack_configuration_load()
{
if (Jetpack::is_user_connected() && !self::is_active()) {
Jetpack::deactivate_module($this->module);
Jetpack::state('message', 'module_deactivated');
wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
die;
}
if (!empty($_POST['action']) && $_POST['action'] == 'monitor-save') {
check_admin_referer('monitor-settings');
$this->update_option_receive_jetpack_monitor_notification(isset($_POST['receive_jetpack_monitor_notification']));
Jetpack::state('message', 'module_configured');
wp_safe_redirect(Jetpack::module_configuration_url($this->module));
}
}
示例4: jetpack_monitor_toggle
/**
* Module Name: Monitor
* Module Description: Jetpack Monitor will keep tabs on your site, and alert you the moment that downtime is detected.
* Sort Order: 55
* First Introduced: 2.6
* Requires Connection: Yes
* Auto Activate: No
*/
function jetpack_monitor_toggle()
{
$jetpack = Jetpack::init();
if (!$jetpack->current_user_is_connection_owner()) {
Jetpack::state('module', 'monitor');
Jetpack::state('error', 'master_user_required');
// Technically this call to `wp_safe_redirect` is not required because
// `Jetpack::activate_module` already sets up a redirect. However, this
// might not stay the case forever so it's clearer to do it here as well.
wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
die;
}
$jetpack->sync->register('noop');
if (false !== strpos(current_filter(), 'jetpack_activate_module_')) {
Jetpack::check_privacy(__FILE__);
}
}
示例5: client_authorize
/**
* Authorizations
*/
function client_authorize()
{
$data = stripslashes_deep($_GET);
$data['auth_type'] = 'client';
$jetpack = $this->get_jetpack();
$role = $jetpack->translate_current_user_to_role();
$redirect = isset($data['redirect']) ? esc_url_raw((string) $data['redirect']) : '';
$this->check_admin_referer("jetpack-authorize_{$role}_{$redirect}");
$result = $this->authorize($data);
if (is_wp_error($result)) {
Jetpack::state('error', $result->get_error_code());
}
if (wp_validate_redirect($redirect)) {
$this->wp_safe_redirect($redirect);
} else {
$this->wp_safe_redirect(Jetpack::admin_url());
}
$this->do_exit();
}
示例6: no_credentials_admin_notice
function no_credentials_admin_notice()
{
$disable_url = wp_nonce_url(Jetpack::admin_url('action=deactivate&module=wpcc'), 'jetpack_deactivate-wpcc');
?>
<div id="wpcc-needs-config" class="updated">
<p class="alignright"><a href="<?php
echo esc_url($disable_url);
?>
"><?php
_e('Close', 'jetpack');
?>
</a></p>
<p><?php
printf(__('<strong>Almost done.</strong> Before WordPress.com Connect can finish activating, you\'ll need to <a href="%s">register your website as an application on WordPress.com</a>', 'jetpack'), esc_url(admin_url('options-general.php#wpcc-sign-on-section')));
?>
</p>
</div>
<?php
}
示例7: dashboard_widget_connect_to_wpcom
public function dashboard_widget_connect_to_wpcom()
{
?>
<div class="wpcom-connect">
<h3><?php
esc_html_e('Boost traffic, enhance security, and improve performance.', 'jetpack');
?>
</h3>
<p><?php
esc_html_e('Jetpack connects your site to WordPress.com to give you traffic and customization tools, enhanced security, speed boosts, and more.', 'jetpack');
?>
</p>
<div class="actions">
<a href="<?php
echo $this->build_connect_url();
?>
" class="button button-jetpack">
<?php
esc_html_e('Connect to WordPress.com', 'jetpack');
?>
</a>
<?php
if (current_user_can('activate_plugins')) {
?>
<small><a href="<?php
echo esc_url(wp_nonce_url(Jetpack::admin_url('jetpack-notice=dismiss'), 'jetpack-deactivate'));
?>
">
<?php
esc_html_e('or, deactivate Jetpack', 'jetpack');
?>
</a></small>
<?php
}
?>
</div>
</div>
<?php
}
示例8: state
/**
* State is passed via cookies from one request to the next, but never to subsequent requests.
* SET: state( $key, $value );
* GET: $value = state( $key );
*
* @param string $key
* @param string $value
* @param bool $restate private
*/
public static function state($key = null, $value = null, $restate = false)
{
static $state = array();
static $path, $domain;
if (!isset($path)) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$admin_url = Jetpack::admin_url();
$bits = parse_url($admin_url);
if (is_array($bits)) {
$path = isset($bits['path']) ? dirname($bits['path']) : null;
$domain = isset($bits['host']) ? $bits['host'] : null;
} else {
$path = $domain = null;
}
}
// Extract state from cookies and delete cookies
if (isset($_COOKIE['jetpackState']) && is_array($_COOKIE['jetpackState'])) {
$yum = $_COOKIE['jetpackState'];
unset($_COOKIE['jetpackState']);
foreach ($yum as $k => $v) {
if (strlen($v)) {
$state[$k] = $v;
}
setcookie("jetpackState[{$k}]", false, 0, $path, $domain);
}
}
if ($restate) {
foreach ($state as $k => $v) {
setcookie("jetpackState[{$k}]", $v, 0, $path, $domain);
}
return;
}
// Get a state variable
if (isset($key) && !isset($value)) {
if (array_key_exists($key, $state)) {
return $state[$key];
}
return null;
}
// Set a state variable
if (isset($key) && isset($value)) {
if (is_array($value) && isset($value[0])) {
$value = $value[0];
}
$state[$key] = $value;
setcookie("jetpackState[{$key}]", $value, 0, $path, $domain);
}
}
示例9: dashboard_widget_footer
public static function dashboard_widget_footer()
{
?>
<footer>
<div class="protect">
<?php
if (Jetpack::is_module_active('protect')) {
?>
<h3><?php
echo number_format_i18n(get_site_option('jetpack_protect_blocked_attempts', 0));
?>
</h3>
<p><?php
echo esc_html_x('Blocked malicious login attempts', '{#} Blocked malicious login attempts -- number is on a prior line, text is a caption.', 'jetpack');
?>
</p>
<?php
} elseif (current_user_can('jetpack_activate_modules') && !self::is_development_mode()) {
?>
<a href="<?php
echo esc_url(wp_nonce_url(Jetpack::admin_url(array('action' => 'activate', 'module' => 'protect')), 'jetpack_activate-protect'));
?>
" class="button button-jetpack" title="<?php
esc_attr_e('Protect helps to keep you secure from brute-force login attacks.', 'jetpack');
?>
">
<?php
esc_html_e('Activate Protect', 'jetpack');
?>
</a>
<?php
} else {
?>
<?php
esc_html_e('Protect is inactive.', 'jetpack');
?>
<?php
}
?>
</div>
<div class="akismet">
<?php
if (is_plugin_active('akismet/akismet.php')) {
?>
<h3><?php
echo number_format_i18n(get_option('akismet_spam_count', 0));
?>
</h3>
<p><?php
echo esc_html_x('Spam comments blocked by Akismet.', '{#} Spam comments blocked by Akismet -- number is on a prior line, text is a caption.', 'jetpack');
?>
</p>
<?php
} elseif (current_user_can('activate_plugins') && !is_wp_error(validate_plugin('akismet/akismet.php'))) {
?>
<a href="<?php
echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'activate', 'plugin' => 'akismet/akismet.php'), admin_url('plugins.php')), 'activate-plugin_akismet/akismet.php'));
?>
" class="button button-jetpack">
<?php
esc_html_e('Activate Akismet', 'jetpack');
?>
</a>
<?php
} else {
?>
<p><a href="<?php
echo esc_url('https://akismet.com/?utm_source=jetpack&utm_medium=link&utm_campaign=Jetpack%20Dashboard%20Widget%20Footer%20Link');
?>
"><?php
esc_html_e('Akismet can help to keep your blog safe from spam!', 'jetpack');
?>
</a></p>
<?php
}
?>
</div>
<?php
if (!current_user_can('edit_posts') && self::is_user_connected()) {
?>
<div style="width: 100%; text-align: center; padding-top: 20px; clear: both;"><a class="button" title="<?php
esc_attr_e('Unlink your account from WordPress.com', 'jetpack');
?>
" href="<?php
echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'unlink', 'redirect' => 'sub-unlink'), admin_url('index.php')), 'jetpack-unlink'));
?>
"><?php
esc_html_e('Unlink your account from WordPress.com', 'jetpack');
?>
</a></div>
<?php
}
?>
</footer>
<?php
//.........这里部分代码省略.........
示例10: admin_jetpack_manage_notice
public function admin_jetpack_manage_notice()
{
$dismissed = get_site_option('jetpack_dismissed_protect_multisite_banner');
if ($dismissed) {
return;
}
$referer = '&_wp_http_referer=' . add_query_arg('_wp_http_referer', null);
$opt_out_url = wp_nonce_url(Jetpack::admin_url('jetpack-notice=jetpack-protect-multisite-opt-out' . $referer), 'jetpack_protect_multisite_banner_opt_out');
?>
<div id="message" class="updated jetpack-message jp-banner is-opt-in protect-error" style="display:block !important;">
<a class="jp-banner__dismiss" href="<?php
echo esc_url($opt_out_url);
?>
" title="<?php
esc_attr_e('Dismiss this notice.', 'jetpack');
?>
"></a>
<div class="jp-banner__content">
<h4><?php
esc_html_e('Protect cannot keep your site secure.', 'jetpack');
?>
</h4>
<p><?php
printf(__('Thanks for activating Protect! To start protecting your site, please network activate Jetpack on your Multisite installation and activate Protect on your primary site. Due to the way logins are handled on WordPress Multisite, Jetpack must be network-enabled in order for Protect to work properly. <a href="%s" target="_blank">Learn More</a>', 'jetpack'), 'http://jetpack.me/support/multisite-protect');
?>
</p>
</div>
<div class="jp-banner__action-container is-opt-in">
<a href="<?php
echo network_admin_url('plugins.php');
?>
" class="jp-banner__button" id="wpcom-connect"><?php
_e('View Network Admin', 'jetpack');
?>
</a>
</div>
</div>
<?php
}
示例11: _e
<?php
if (!Jetpack::is_staging_site()) {
?>
<h2><?php
_e('Disconnecting Jetpack', 'jetpack');
?>
</h2>
<p><?php
_e('Before you completely disconnect Jetpack is there anything we can do to help?', 'jetpack');
?>
</p>
<a class="button" id="confirm-disconnect" title="<?php
esc_attr_e('Disconnect Jetpack', 'jetpack');
?>
" href="<?php
echo wp_nonce_url(Jetpack::admin_url('action=disconnect'), 'jetpack-disconnect');
?>
"><?php
_e('Confirm Disconnect', 'jetpack');
?>
</a>
<a class="button primary" id="support-no-disconnect" target="_blank" title="<?php
esc_attr_e('Jetpack Support', 'jetpack');
?>
" href="http://jetpack.me/contact-support/"><?php
esc_html_e('I Need Support', 'jetpack');
?>
</a>
<?php
} else {
?>
示例12: authorize
function authorize()
{
$data = stripslashes_deep($_GET);
$args = array();
$redirect = isset($data['redirect']) ? esc_url_raw((string) $data['redirect']) : '';
$jetpack_unique_connection = Jetpack_Options::get_option('unique_connection');
// Checking if site has been active/connected previously before recording unique connection
if (!$jetpack_unique_connection) {
// jetpack_unique_connection option has never been set
$jetpack_unique_connection = array('connected' => 0, 'disconnected' => 0);
update_option('jetpack_unique_connection', $jetpack_unique_connection);
//track unique connection
$jetpack = Jetpack::init();
$jetpack->stat('connections', 'unique-connection');
$jetpack->do_stats('server_side');
}
// increment number of times connected
$jetpack_unique_connection['connected'] += 1;
Jetpack_Options::update_option('unique_connection', $jetpack_unique_connection);
do {
$jetpack = $this->get_jetpack();
$role = $jetpack->translate_current_user_to_role();
if (!$role) {
Jetpack::state('error', 'no_role');
break;
}
$cap = $jetpack->translate_role_to_cap($role);
if (!$cap) {
Jetpack::state('error', 'no_cap');
break;
}
$this->check_admin_referer("jetpack-authorize_{$role}_{$redirect}");
if (!empty($data['error'])) {
Jetpack::state('error', $data['error']);
break;
}
if (empty($data['state'])) {
Jetpack::state('error', 'no_state');
break;
}
if (!ctype_digit($data['state'])) {
Jetpack::state('error', 'invalid_state');
break;
}
$current_user_id = get_current_user_id();
if ($current_user_id != $data['state']) {
Jetpack::state('error', 'wrong_state');
break;
}
if (empty($data['code'])) {
Jetpack::state('error', 'no_code');
break;
}
$token = $this->get_token($data);
if (is_wp_error($token)) {
if ($error = $token->get_error_code()) {
Jetpack::state('error', $error);
} else {
Jetpack::state('error', 'invalid_token');
}
Jetpack::state('error_description', $token->get_error_message());
break;
}
if (!$token) {
Jetpack::state('error', 'no_token');
break;
}
$is_master_user = !Jetpack::is_active();
Jetpack::update_user_token($current_user_id, sprintf('%s.%d', $token, $current_user_id), $is_master_user);
if ($is_master_user) {
Jetpack::state('message', 'authorized');
} else {
Jetpack::state('message', 'linked');
// Don't activate anything since we are just connecting a user.
break;
}
if ($active_modules = Jetpack_Options::get_option('active_modules')) {
Jetpack_Options::delete_option('active_modules');
Jetpack::activate_default_modules(999, 1, $active_modules);
} else {
Jetpack::activate_default_modules();
}
// Sync all registers options and constants
do_action('jetpack_sync_all_registered_options');
// Start nonce cleaner
wp_clear_scheduled_hook('jetpack_clean_nonces');
wp_schedule_event(time(), 'hourly', 'jetpack_clean_nonces');
} while (false);
if (wp_validate_redirect($redirect)) {
$this->wp_safe_redirect($redirect);
} else {
$this->wp_safe_redirect(Jetpack::admin_url());
}
$this->do_exit();
}
示例13: confirm
?>
" onclick="return confirm('<?php
echo htmlspecialchars(__('Are you sure you want to disconnect from WordPress.com?', 'jetpack'), ENT_QUOTES);
?>
');"><?php
esc_html_e('Disconnect from WordPress.com', 'jetpack');
?>
</a>
<?php
}
?>
<?php
if ($is_active && $is_user_connected && !$is_master_user) {
?>
<a href="<?php
echo wp_nonce_url(Jetpack::admin_url('action=unlink'), 'jetpack-unlink');
?>
"><?php
esc_html_e('Unlink your user account', 'jetpack');
?>
</a>
<?php
}
?>
</div>
</nav><!-- .secondary -->
</div><!-- .footer -->
<div class="modal" aria-labelledby="modal-label">
<header>
示例14: esc_html_e
<nav class="secondary nav-horizontal">
<div class="secondary-footer">
<a href="http://jetpack.me">Jetpack <?php
echo JETPACK__VERSION;
?>
</a>
<a href="http://wordpress.com/tos/"><?php
esc_html_e('Terms', 'jetpack');
?>
</a>
<a href="http://automattic.com/privacy/"><?php
esc_html_e('Privacy', 'jetpack');
?>
</a>
<a href="<?php
echo esc_url(Jetpack::admin_url('page=jetpack-debugger'));
?>
" title="<?php
esc_attr_e('Test your site’s compatibility with Jetpack.', 'jetpack');
?>
"><?php
_e('Debug', 'jetpack');
?>
</a>
<a href="http://jetpack.me/contact-support/" title="<?php
esc_attr_e('Contact the Jetpack Happiness Squad.', 'jetpack');
?>
"><?php
_e('Support', 'jetpack');
?>
</a>
示例15: esc_html_e
" target="_blank" class="jp-button--settings"><?php
esc_html_e('Feedback', 'jetpack');
?>
</a>
</li>
<?php
}
// End if connected or dev mode and is admin
?>
<?php
if (Jetpack::is_active() && !Jetpack::is_development_mode()) {
?>
<li class="jetpack-modules">
<a href="<?php
echo Jetpack::admin_url('page=my_jetpack');
?>
" class="jp-button--settings <?php
if ('my_jetpack' == $current) {
echo 'current';
}
?>
"><?php
esc_html_e('My Jetpack', 'jetpack');
?>
</a>
</li>
<?php
}
?>
</ul>