public function onAdminMenu() { GooglePublisherPluginUtils::checkAdminRights(); global $wp_version; // Admin menu contains an iframe showing publisherplugin.google.com. // The iframe can communicate with the main page through window.postMessage // API, these are managed in admin.js. $parameters = array(); $parameters['site'] = get_home_url(); $parameters['siteId'] = $this->configuration->getSiteId(); $parameters['adminUrl'] = admin_url(self::ADMIN_PAGE_LOCATION); $parameters['version'] = $this->plugin_version; $parameters['wp_version'] = $wp_version; $parameters['hl'] = get_locale(); $show_get_started = $this->show_get_started; $start_url = self::PUBLISHER_PLUGIN_FRONTEND_URL . '/start?' . http_build_query($parameters); $iframe_url = self::PUBLISHER_PLUGIN_FRONTEND_URL . '?' . http_build_query($parameters); $javascript_url = plugins_url('js/admin.js?ver=' . filter_var($this->plugin_version, FILTER_SANITIZE_STRING), __FILE__); $environment = $this->getEnvironmentData(); $cmsCommandNonce = wp_create_nonce(self::CMS_COMMAND_ACTION); include 'AdminTemplate.php'; }
/** * Runs an action requested through URL or POST parameters. * * @param string $action The action to run. */ public function runAction($action) { switch ($action) { case self::ACTION_PREVIEW: add_filter('show_admin_bar', '__return_false'); break; case self::ACTION_VERIFY: $this->admin->setShowGetStarted(false); break; case self::CMS_COMMAND_ACTION: echo esc_html($this->handleCmsCommandAction()); GooglePublisherPluginUtils::dieSilently(); break; } }
/** * Determines the current page type. This should be called after WordPress * has initialized wp_query. */ public function determineCurrentPageType() { if (!isset($this->current_page_type)) { $this->current_page_type = GooglePublisherPluginUtils::getWordPressPageType(); } }
/** * Determines the current page details. This should be called after WordPress * has initialized wp_query. */ public function determineCurrentPageDetails() { if (!isset($this->current_page_type)) { $this->current_page_type = GooglePublisherPluginUtils::getWordPressPageType(); } if (!isset($this->exclude_ads)) { $this->exclude_ads = GooglePublisherPluginUtils::getExcludeAds(); } }