function ztjalali_admin_message() { if (current_user_can('activate_plugins')) { $Message = sprintf(__('WP Jalali successful installed. please check %soptions%s', 'ztjalali'), '<a href="' . menu_page_url('ztjalali_admin_page', FALSE) . '">', '</a>'); echo '<div class="updated ztjalali-notice notice is-dismissible"><p>' . $Message . '</p></div>'; } }
function test_menu_page_url() { $current_user = get_current_user_id(); wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); update_option( 'siteurl', 'http://example.com' ); // add some pages add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' ); add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' ); add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' ); add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' ); add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' ); add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' ); add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' ); $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings'; $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools'; $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle'; $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page'; $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2'; $expected['not_registered'] = ''; $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces'; $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&page=testpages'; foreach ($expected as $name => $value) { $this->assertEquals( $value, menu_page_url( $name, false ) ); } wp_set_current_user( $current_user ); }
/** * The layout metabox for the 404 page. * * @since 1.5.0 */ public function layout_box() { $layout = esc_attr($this->get_field_value('genesis_layout')); ?> <div class="genesis-layout-selector"> <p><input type="radio" name="<?php echo $this->get_field_name('genesis_layout'); ?> " class="default-layout" id="default-layout" value="" <?php checked($layout, ''); ?> /> <label class="default" for="default-layout"><?php printf(__('Default Layout set in <a href="%s">Theme Settings</a>', 'genesis'), menu_page_url('genesis', 0)); ?> </label></p> <p><?php genesis_layout_selector(array('name' => $this->get_field_name('genesis_layout'), 'selected' => $layout, 'type' => 'site')); ?> </p> </div> <br class="clear" /> <?php }
function redirect() { $redirect = '<script type="text/javascript">'; $redirect .= 'window.location = "' . menu_page_url(WPWSL_GENERAL_PAGE, false) . '"'; $redirect .= '</script>'; echo $redirect; }
public function dashboard_widget() { $projectId = 0; if (empty($this->gadwp->config->options['ga_dash_token'])) { echo '<p>' . __("This plugin needs an authorization:", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Authorize Plugin", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>'; return; } if (current_user_can('manage_options')) { if ($this->gadwp->config->options['ga_dash_tableid_jail']) { $projectId = $this->gadwp->config->options['ga_dash_tableid_jail']; } else { echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>'; return; } } else { if ($this->gadwp->config->options['ga_dash_tableid_jail']) { $projectId = $this->gadwp->config->options['ga_dash_tableid_jail']; } else { echo '<p>' . __("An admin should asign a default Google Analytics Profile.", 'google-analytics-dashboard-for-wp') . '</p><form action="' . menu_page_url('gadash_settings', false) . '" method="POST">' . get_submit_button(__("Select Domain", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>'; return; } } if (!$projectId) { echo '<p>' . __("Something went wrong while retrieving property data. You need to create and properly configure a Google Analytics account:", 'google-analytics-dashboard-for-wp') . '</p> <form action="https://deconf.com/how-to-set-up-google-analytics-on-your-website/" method="POST">' . get_submit_button(__("Find out more!", 'google-analytics-dashboard-for-wp'), 'secondary') . '</form>'; return; } ?> <div id="gadwp-window-1"></div> <?php }
protected function _getAdminAuthUrl() { $betterAnalyticsOptions = get_option('better_analytics'); if (@$betterAnalyticsOptions['api']['use_own']) { return menu_page_url('better-analytics_auth', false); } else { return $this->_credentials['auth_url']; } }
static function query($params, $request_type = 'query') { $ooyala_video = Ooyala_Video::init(); if (empty($ooyala_video->partner_code) || empty($ooyala_video->partner_code)) { return new WP_Error('no_api_codes', sprintf(__('Please set your API codes in the <a href="%s" target="_blank">Ooyala Video</a> Settings page'), menu_page_url('ooyalavideo_options', false))); } else { return OoyalaBacklotAPI::send_request($request_type, $params); } }
public static function get_url() { $url = menu_page_url('instant-articles-wizard', false); // Needed when calling from ajax if (!$url) { $url = get_option('instant-articles-wizard-url'); } return $url; }
public function wpht_plugin_action_links($links, $file) { if (untrailingslashit(plugins_url('', $file)) != untrailingslashit(plugins_url('', __FILE__))) { return $links; } $settings_link = '<a href="' . menu_page_url('wpht', false) . '">' . esc_html(__('Settings', 'wpht')) . '</a>'; array_unshift($links, $settings_link); return $links; }
function init_admin() { global $pagenow; if ('themes.php' == $pagenow && isset($_GET['activated'])) { //op_post_types(); //flush_rewrite_rules(); wp_redirect(menu_page_url(OP_SN . ($this->installed ? op_get_option('blog_enabled') == 'Y' ? '' : '-setup-wizard' : ''), false)); } }
public function admin_init() { if (isset($_REQUEST['notice'])) { if (check_admin_referer('message_sample')) { set_transient('wp-admin-notice-sample', $_REQUEST['notice'], 10); wp_safe_redirect(menu_page_url(__FILE__, false)); } } }
function wpcf7_admin_url($args = array()) { $defaults = array('page' => 'wpcf7'); $args = wp_parse_args($args, $defaults); $url = menu_page_url($args['page'], false); unset($args['page']); $url = add_query_arg($args, $url); return esc_url_raw($url); }
function display() { ?> <div class="wrap"> <h2>Ashuwp-导入/导出</h2> <?php if (isset($_REQUEST['imported']) && 'true' === $_REQUEST['imported']) { echo '<div id="message" class="updated"><p><strong>设置数据导入成功。</strong></p></div>'; } elseif (isset($_REQUEST['error']) && 'true' === $_REQUEST['error']) { echo '<div id="message" class="error"><p><strong>导入失败,请重试。</strong></p></div>'; } ?> <table class="form-table"> <tbody> <tr> <th scope="row"><b>导入设置选项数据</p></th> <td> <p>请上传一个.json格式的数据文件(数据文件应该是从ashuwp_framework框架中导出的),请勿上传其它文件</p> <p> <form enctype="multipart/form-data" method="post" action="<?php echo menu_page_url('ashupw_import', 0); ?> "> <?php wp_nonce_field('ashuwp_import', 'ashuwp_import'); ?> <input type="file" id="ashuwp_import_upload" name="ashuwp_import_upload" size="25" /> <?php submit_button('Upload File and Import', 'primary', 'upload'); ?> </form> </p> </td> </tr> <tr> <th scope="row"><b>导出设置选项数据</b></th> <td> <p>点击下载设置数据文件,下载的数据包含整个ashuwp_framework框架建立的设置页面的所有数据,不包括文章自定义字段和分类自定义字段数据。</p> <p> <form method="post" action="<?php echo menu_page_url('ashupw_import', 0); ?> "> <?php wp_nonce_field('ashuwp_export', 'ashuwp_export'); submit_button('Download Export File', 'primary', 'download'); ?> </form> </p> </td> </tr> </tbody> </table> </div> <?php }
/** * Display nag for Scribe SEO Copywriting tool. */ function genesis_scribe_nag() { if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'seo-settings') { return; } if (class_exists('Ecordia') || get_option('genesis-scribe-nag-disabled')) { return; } printf('<div class="updated" style="overflow: hidden;"><p class="alignleft">Have you tried our Scribe SEO software? Do keyword research, content optimization, and link building without leaving WordPress. <b>Genesis owners save over 50% using the promo code FIRST when you sign up</b>. <a href="%s" target="_blank">Click here for more info</a>.</p> <p class="alignright"><a href="%s">Dismiss</a></p></div>', 'http://scribeseo.com/genesis-owners-only', add_query_arg('dismiss-scribe', 'true', menu_page_url('seo-settings', false))); }
function wpcf7_admin_url($args = array()) { wpcf7_deprecated_function(__FUNCTION__, '3.2', 'admin_url()'); $defaults = array('page' => 'wpcf7'); $args = wp_parse_args($args, $defaults); $url = menu_page_url($args['page'], false); unset($args['page']); $url = add_query_arg($args, $url); return esc_url_raw($url); }
function easy_repeater_make_parent_node($wp_admin_bar) { global $er_menu_name_slug; $args = array('id' => 'easy_repeater_top', 'title' => '<span class="ab-icon2"></span>' . $er_menu_name_slug, 'parent' => false, 'href' => menu_page_url('easy-repeater', false)); $args2 = array('id' => 'easy_repeater_sub', 'title' => __('repeater options', 'easy-repeater'), 'parent' => false, 'href' => menu_page_url('easy-repeater-main-options', false), 'parent' => 'easy_repeater_top'); $args3 = array('id' => 'easy_repeater_sub2', 'title' => __('documentation', 'easy-repeater'), 'parent' => false, 'href' => 'http://mohamedshokry.com/easy-repeater/documentation.html', 'parent' => 'easy_repeater_top'); $wp_admin_bar->add_node($args); $wp_admin_bar->add_node($args2); $wp_admin_bar->add_node($args3); }
private function menu_page_url($args = '') { $args = wp_parse_args($args, array()); $url = menu_page_url('wpcf7-integration', false); $url = add_query_arg(array('service' => 'recaptcha'), $url); if (!empty($args)) { $url = add_query_arg($args, $url); } return $url; }
function brightcove_settings_notice() { global $bcGlobalVariables; if ($bcGlobalVariables['defaultSet'] == false) { if (current_user_can('manage_options')) { echo "<div class='error'><p>You have not entered your settings for the Brightcove Plugin. Please set them up at <a href='" . menu_page_url('brightcove_menu', false) . "'>Brightcove Settings</a></p></div>"; } else { echo "<div class='error'><p> You have not set up your defaults for the Brightcove plugin. Please contact your site administrator to set these defaults.</p></div>"; } } }
function add_admin_bar_node() { global $wp_admin_bar; // Leave all titles empty: they will be filled by AJAX $wp_admin_bar->add_node(apply_filters('vip-scanner-admin-bar-node', array('id' => 'vip-scanner', 'title' => '', 'parent' => 'top-secondary', 'href' => add_query_arg(array('vip-scanner-review-type' => urlencode($this->get_default_review_type())), menu_page_url('vip-scanner', false)), 'meta' => array('title' => esc_html__('Go to VIP Scanner to see all code issues.', 'vip-scanner'))))); $wp_admin_bar->add_node(array('id' => "vip-scanner-theme", 'title' => '', 'parent' => 'vip-scanner')); $wp_admin_bar->add_node(array('id' => "vip-scanner-review", 'title' => '', 'parent' => 'vip-scanner')); foreach ($this->report_levels as $level) { $wp_admin_bar->add_node(apply_filters("vip-scanner-admin-bar-node-{$level}", array('id' => "vip-scanner-{$level}", 'title' => '', 'parent' => 'vip-scanner'))); } }
function create_menu() { extract($this->group, EXTR_OVERWRITE); $this->page = add_submenu_page($menu_location, $page_title, $menu_title, 'manage_options', "kc-settings-{$prefix}", array($this, 'settings_page')); $this->url = menu_page_url("kc-settings-{$prefix}", false); kcSettings::add_page($this->page); add_action("load-{$this->page}", array($this, 'load_actions'), 99); if ($display == 'metabox') { require_once dirname(__FILE__) . '/plugin-metabox.php'; $this->metabox = new kcSettings_plugin_metabox($this); } }
/** * show settings link on plugins page * * @return GF_Tooltips */ public function quick_link($links, $file) { static $this_plugin; if (!$this_plugin) { $this_plugin = GFT_BASE; } // check to make sure we are on the correct plugin if ($file == $this_plugin) { $settings_link = '<a href="' . menu_page_url('gf-tooltips', 0) . '">Settings</a>'; array_unshift($links, $settings_link); } return $links; }
/** * This function redirects the user to an admin page, and adds query args * to the URL string for alerts, etc. * * @since 1.6 */ function genesis_admin_redirect($page, $query_args = array()) { if (!$page) { return; } $url = menu_page_url($page, false); foreach ((array) $query_args as $key => $value) { if (isset($key) && isset($value)) { $url = add_query_arg($key, $value, $url); } } wp_redirect(esc_url_raw($url)); }
/** * @since 1.2.1 * */ function wpa_check_profile_selection($type, $message = '') { if (!get_option("pt_webprofile")) { if ($message == '') { echo '<div class="error"><p>' . __($type . ' Dashboard can\'t be loaded until your select your website profile <a href="' . menu_page_url('analytify-settings', false) . '&tab=profile">here</a> ', 'wp-analytify') . '</p></div>'; } else { echo $message; } return true; } else { return false; } }
/** * This function redirects the user to an admin page, and adds query args * to the URL string for alerts, etc. * * This is just a temporary function, until WordPress fixes add_query_arg(), * or Genesis 1.8 is released, whichever comes first. * */ function apl_admin_redirect($page, $query_args = array()) { if (!$page) { return; } $url = html_entity_decode(menu_page_url($page, 0)); foreach ((array) $query_args as $key => $value) { if (isset($key) && isset($value)) { $url = add_query_arg($key, $value, $url); } } wp_redirect(esc_url_raw($url)); }
function bfox_blog_admin_add_action_link($links, $file) { if ('biblefox-for-wordpress/biblefox.php' != $file) { return $links; } if (!is_multisite() || get_site_option('bfox-ms-allow-blog-options')) { array_unshift($links, '<a href="' . menu_page_url('bfox-blog-settings', false) . '">' . __('Settings', 'bfox') . '</a>'); } if (is_multisite()) { array_unshift($links, '<a href="' . menu_page_url('bfox-ms', false) . '">' . __('Network Settings', 'bfox') . '</a>'); } return $links; }
/** * Redirect the user to an admin page, and add query args to the URL string for alerts, etc. * * @since 1.6.0 * * @param string $page Menu slug. * @param array $query_args Optional. Associative array of query string arguments (key => value). Default is an empty array. * * @return null Return early if first argument is falsy. */ function genesis_admin_redirect($page, array $query_args = array()) { if (!$page) { return; } $url = html_entity_decode(menu_page_url($page, 0)); foreach ((array) $query_args as $key => $value) { if (empty($key) && empty($value)) { unset($query_args[$key]); } } $url = add_query_arg($query_args, $url); wp_redirect(esc_url_raw($url)); }
public function admin_init() { if (isset($_POST[$this->nonce]) && $_POST[$this->nonce]) { if (check_admin_referer($this->options, $this->nonce)) { if (isset($_POST[$this->options])) { $options = $_POST[$this->options]; update_option($this->options, $options); } else { update_option($this->options, ''); } wp_safe_redirect(menu_page_url($this->domain, false)); } } }
private function check_menu($allow = 'allow') { $url = get_option('siteurl', true); do_action('admin_menu'); $expected = array('formidable' => $url . '/wp-admin/admin.php?page=formidable'); foreach ($expected as $name => $value) { $menu_page = menu_page_url($name, false); if ($allow == 'allow') { $this->assertEquals($value, $menu_page); } else { $this->assertNotEquals($value, $menu_page); } } }
function form($instance) { $title = !empty($instance['title']) ? esc_attr($instance['title']) : esc_attr('Popular Right Now', 'better-analytics'); $number = isset($instance['number']) ? absint($instance['number']) : 5; $betterAnalyticsOptions = get_option('better_analytics'); if (!DigitalPointBetterAnalytics_Base_Public::getInstance()->getTokens() || !$betterAnalyticsOptions['api']['profile']) { echo '<p>' . sprintf(esc_html__('No Linked Google Analytics Account (API access required for this widget). You can link one in the %1$sBetter Analytics API settings%2$s.', 'better-analytics'), '<a href="' . esc_url(menu_page_url('better-analytics', false) . '#top#api') . '">', '</a>') . '</p>'; } ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Title:'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /></p> <p><label for="<?php echo $this->get_field_id('number'); ?> "><?php esc_html_e('Number of URLs to show:', 'better-analytics'); ?> </label> <input id="<?php echo $this->get_field_id('number'); ?> " name="<?php echo $this->get_field_name('number'); ?> " type="text" value="<?php echo $number; ?> " size="3" /></p> <?php }
/** * Builds the plugin submenu page. * * @access public */ public function build_page() { $ids = isset($_GET['ids']) ? sanitize_text_field($_GET['ids']) : null; if (!$ids) { wp_safe_redirect(esc_url_raw(menu_page_url($this->plugin_slug . '_index', false))); exit; } // Populate $articles array with a set of valid posts $articles = array(); foreach (explode('.', $ids) as $id) { if ($post = get_post(absint($id))) { $articles[] = $post; } } require_once plugin_dir_path(__FILE__) . 'partials/page_bulk_export.php'; }