/** * Adding adsense tracking * * This method will add adsense tracking code into the head */ public static function add_adsense_tracking() { $tracking_code = Yoast_GA_Options::instance()->get_tracking_code(); if (!empty($tracking_code) && Yoast_GA_Options::instance()->options['track_adsense'] == 1) { require_once dirname(GAWP_FILE) . '/premium/frontend/pages/tracking-adsense.php'; } }
/** * Initialize the premium functionality. * * This method will call specific method for initialising the admin or frontend functionality. * * It will even add the hook for default options. */ public static function init() { self::$ga_options = Yoast_GA_Options::instance()->get_options(); if (is_admin()) { self::init_admin(); } else { self::init_frontend(); } add_action('plugins_loaded', array('Yoast_GA_Premium', 'load_textdomain')); add_filter('yst_ga_default-ga-values', array('Yoast_GA_Premium', 'add_default_options'), 10, 2); }
/** * Constructor */ public function __construct() { parent::__construct(); add_action('plugins_loaded', array($this, 'init_ga')); // Only run admin_init when there is a cron jon executed. $current_page = filter_input(INPUT_GET, 'page'); // Only when current page is not 'wpseo'. if (strpos($current_page, 'wpseo') !== 0) { if ($this->is_running_cron() || $this->is_running_ajax() || strpos($current_page, 'yst_ga') === 0) { add_action('admin_init', array($this, 'init_settings')); } } }
/** * Class constructor */ public function __construct() { parent::__construct(); if (isset($this->options['tag_links_in_rss']) && $this->options['tag_links_in_rss'] == 1) { add_filter('the_permalink_rss', array($this, 'rsslinktagger'), 99); } // Check if the customer is running Universal or not (Enable in GA Settings -> Universal) if (isset($this->options['enable_universal']) && $this->options['enable_universal'] == 1) { require_once 'class-universal.php'; } else { require_once 'class-ga-js.php'; } }
/** * Class constructor */ public function __construct() { $this->options = Yoast_GA_Options::instance()->options; if (isset($this->options['tag_links_in_rss']) && $this->options['tag_links_in_rss'] == 1) { add_filter('the_permalink_rss', array($this, 'rsslinktagger'), 99); } // Check if the customer is running Universal or not (Enable in GA Settings -> Universal) if (isset($this->options['enable_universal']) && $this->options['enable_universal'] == 1) { new Yoast_GA_Universal(); } else { new Yoast_GA_JS(); } }
/** * Returns the GA tracking code * * @since 0.3 */ function get_raw_embed_code() { $options = Yoast_GA_Options::instance()->options; if (isset($options['enable_universal']) && 1 === intval($options['enable_universal'])) { $tracker = new Yoast_GA_Universal(); } else { $tracker = new Yoast_GA_JS(); } ob_start(); $tracker->tracking(); $ga_code = ob_get_clean(); return $ga_code; }
public function __construct() { $this->options = Yoast_GA_Options::instance()->options; $this->link_regex = '`<a (.*?)href=[\'\\"](.*?):/*([^\'\\"]+)[\'\\"](.*?)>(.*?)</a>`i'; add_action('wp_head', array($this, 'tracking'), 8); if ($this->options['track_outbound'] == 1) { // Check for outbound option add_filter('the_content', array($this, 'the_content'), 99); add_filter('widget_text', array($this, 'widget_content'), 99); add_filter('wp_list_bookmarks', array($this, 'widget_content'), 99); add_filter('wp_nav_menu', array($this, 'widget_content'), 99); add_filter('the_excerpt', array($this, 'the_content'), 99); add_filter('comment_text', array($this, 'comment_text'), 99); } }
public function __construct() { $this->options = Yoast_GA_Options::instance()->options; $this->link_regex = $this->get_regex(); add_action('wp_head', array($this, 'tracking'), 8); if ($this->options['track_outbound'] == 1) { // Check for outbound add_filter('the_content', array($this, 'the_content'), 99); add_filter('widget_text', array($this, 'widget_content'), 99); add_filter('wp_list_bookmarks', array($this, 'widget_content'), 99); add_filter('wp_nav_menu', array($this, 'widget_content'), 99); add_filter('the_excerpt', array($this, 'the_content'), 99); add_filter('comment_text', array($this, 'comment_text'), 99); } }
/** * Class constructor */ public function __construct() { parent::__construct(); if (isset($this->options['tag_links_in_rss']) && $this->options['tag_links_in_rss'] == 1) { add_filter('the_permalink_rss', array($this, 'rsslinktagger'), 99); } // Check if the customer is running Universal or not (Enable in GA Settings -> Universal) if (isset($this->options['enable_universal']) && $this->options['enable_universal'] == 1) { global $yoast_ga_universal; $yoast_ga_universal = new Yoast_GA_Universal(); } else { global $yoast_ga_js; $yoast_ga_js = new Yoast_GA_JS(); } }
/** * Constructor for the options */ public function __construct() { $this->options = $this->get_options(); $this->options = $this->check_options($this->options); $this->plugin_path = plugin_dir_path(GAWP_FILE); $this->plugin_url = trailingslashit(plugin_dir_url(GAWP_FILE)); if (false == $this->options) { add_option($this->option_name, $this->default_ga_values()); $this->options = $this->get_options(); } if (!isset($this->options['version']) || $this->options['version'] < GAWP_VERSION) { $this->upgrade(); } // If instance is null, create it. Prevent creating multiple instances of this class if (is_null(self::$instance)) { self::$instance = $this; } }
public function __construct() { $this->class_instance = Yoast_GA_Settings::get_instance(); $this->class_options = Yoast_GA_Options::instance(); }
/** * Delegates `get_tracking_code` to the options class * * @return null */ public function get_tracking_code() { return Yoast_GA_Options::instance()->get_tracking_code(); }
/** * Set the options of Google Analytics */ protected function __construct() { $this->options_class = Yoast_GA_Options::instance(); $this->options = $this->options_class->get_options(); }
function adm_releasechecklist_options() { if (!current_user_can('update_core')) { wp_die(__('You do not have sufficient permissions to access this page.')); } ?> <style> .valid { color:green; } .error { color:red; } </style> <div class="wrap"> <h2>Internative Checklist</h2> <div> <h4><?php _e("What does this plugin do?", 'adm-releasechecklist'); ?> </h4> <p><?php _e("This plugin checks a predefined list of Wordpress settings for correctness. If one of these settings is set incorrectly the site should not be released to the client.", 'adm-releasechecklist'); ?> </p> </div> <br style="clear:both" /> <h2>Settings</h2> <table class="form-table"> <tr valign="middle"> <th scope="row">Google Analytics code</th> <td> <?php if (!class_exists('Yoast_GA_Options')) { echo "<span class='error'>Plugin niet geïnstalleerd!</span>"; } else { global $yoast; $yoast = new Yoast_GA_Options(); $ua_code = $yoast->get_tracking_code(); if ($ua_code == "UA-000000-0") { echo "<span class='error'>Incorrecte tracking code (" . $ua_code . ")</span>"; } else { echo "<span class='valid'>Correcte tracking code (" . $ua_code . ")</span>"; } } ?> </td> </tr> <tr valign="middle"> <th scope="row">Salt & peper</th> <td> <?php if (AUTH_KEY == "put your unique phrase here") { echo "<span class='error'>Voer een unieke salt & peper in wp-config.php</span>"; } else { echo "<span class='valid'>Correct ingesteld (let op: pas deze aan als de site een kloon is)</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Website naam</th> <td> <?php $website_name = get_bloginfo('name'); if ($website_name == '[ADMIUM_SITE_TITLE]') { echo "<span class='error'>De website heeft geen correcte naam: " . $website_name . "</span>"; } else { echo "<span class='valid'>Naam van de website is: " . $website_name . "</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Website beschrijving</th> <td> <?php $website_description = get_bloginfo('description'); if ($website_description == '[ADMIUM_SITE_DESCRIPTION]') { echo "<span class='error'>De website heeft geen correcte beschrijving: " . $website_description . "</span>"; } else { echo "<span class='valid'>Beschrijving van de website is: " . $website_description . "</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Titel homepage</th> <td> <?php $originalTitle = get_the_title(get_option('page_on_front')); $seoTitle = get_post_meta(get_option('page_on_front'), '_yoast_wpseo_title', true); if (strlen($seoTitle) > 0) { $title = $seoTitle; } else { $title = $originalTitle; } if (preg_match("/Homepagina/", $title) || preg_match("/Homepage/", $title) || preg_match("/Voorpagina/", $title)) { echo "<span class='error'>Titel van homepage is mogelijk niet correct: " . $title . "</span>"; } else { echo "<span class='valid'>Titel is herschreven en lijkt correct: " . $title . "</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Wachtwoord op website</th> <td> <?php $htaccess = explode("\n", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/.htaccess")); $protected = false; foreach ($htaccess as $item) { if (trim($item) == "AuthType Basic") { $protected = true; } } if ($protected) { echo "<span class='error'>Website is beveiligd middels .htaccess verwijder onderstaand blok uit de .htaccess file bij livegang</span>"; echo "<pre>"; echo "# Password protect website (use default password file with admium / testomgeving)\n"; echo "# Remove this entire block when site is live!\n"; echo " AuthName \"Testomgeving\"\n"; echo " AuthUserFile /home/admiumdev/domains/basis.admiumdev.nl/.htpasswd/.htpasswd\n"; echo " AuthGroupFile /dev/null\n"; echo " AuthType Basic\n"; echo " require valid-user\n"; echo "# / End password protection"; echo "</pre>"; } else { echo "<span class='valid'>Website is niet beveiligd met .htaccess, is door iedereen te bezoeken</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Redirect domein naar www.</th> <td> <?php $homeURL = preg_replace("/https?:\\/\\//", "", get_option('siteurl')); $htaccess = explode("\n", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/.htaccess")); $correctRedirect = false; foreach ($htaccess as $item) { if (trim($item) == "RewriteCond %{HTTP_HOST} !^" . $homeURL . "\$ [NC]") { $correctRedirect = true; } } if (!$correctRedirect) { echo "<span class='error'>Website redirect niet correct naar ingestelde hoofddomein (" . $homeURL . "), stel dit in .htaccess</span>"; echo "<br/>"; echo "<pre>"; echo "# Domein forceren\n"; echo "RewriteCond %{HTTP_HOST} !^" . $homeURL . "\$ [NC]\n"; echo "RewriteRule ^(.*)\$ http://" . $homeURL . "/\$1 [L,R=301]"; echo "</pre>"; } else { echo "<span class='valid'>Website bevat correcte redirect naar ingestelde hoofddomein: " . $homeURL . "</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">E-mail voor beheerdoeleinden</th> <td> <?php $website_email = get_bloginfo('admin_email'); if ($website_email == '*****@*****.**') { echo "<span class='error'>E-mail gaat naar: wordpress@admium.nl pas dit aan naar adres van klant</span>"; } else { echo "<span class='valid'>E-mail gaat naar: " . $website_email . "</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Ontwikkelomgeving</th> <td> <?php $amount = 0; global $wpdb; $result = $wpdb->get_var("SELECT count(*) as `amount` FROM `wp_posts` WHERE `post_content` LIKE '%admiumdev.nl%'"); $amount += $result; $result = $wpdb->get_var("SELECT count(*) as `amount` FROM `wp_postmeta` WHERE `meta_value` LIKE '%admiumdev.nl%'"); $amount += $result; $result = $wpdb->get_var("SELECT count(*) as `amount` FROM `wp_options` WHERE `option_value` LIKE '%admiumdev.nl%'"); $amount += $result; if ($amount > 0) { echo "<span class='error'>In de content wordt gelinkt naar admiumdev.nl (draai verhuisscript)</span>"; } else { echo "<span class='valid'>Website linkt niet naar admiumdev.nl</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Post eigenaren</th> <td> <?php if (count(query_posts('author=1&order=ASC')) > 0) { echo "<span class='error'>Er bestaan blogberichten met auteur Internative (pas dit aan naar account van klant)</span>"; } else { echo "<span class='valid'>Er bestaan geen blogberichten met auteur Internative</span>"; } ?> </td> </tr> <tr valign="middle"> <th scope="row">Site indexeren door zoekmachines</th> <td> <?php if (get_option('blog_public') == 0) { echo "<span class='error'>De website wordt niet geïndexeerd door zoekmachines!</span>"; } else { echo "<span class='valid'>Zoekmachines mogen de website indexeren</span>"; } ?> </td> </tr> </table> <hr/> </div> <?php }
<?php global $yoast_ga_admin; $options_class = Yoast_GA_Options::instance(); $options = $options_class->get_options(); $tracking_code = $options_class->get_tracking_code(); echo $yoast_ga_admin->content_head(); ?> <h2 id="yoast_ga_title"><?php echo __('Google Analytics by Yoast: ', 'google-analytics-for-wordpress') . __('Dashboard', 'google-analytics-for-wordpress'); ?> <?php do_action('yst_ga_dashboard_title'); ?> </h2> <h2 class="nav-tab-wrapper" id="ga-tabs"> <a class="nav-tab" id="general-tab" href="#top#general"><?php _e('Overview', 'google-analytics-for-wordpress'); ?> </a> <a class="nav-tab" id="dimensions-tab" href="#top#dimensions"><?php _e('Reports', 'google-analytics-for-wordpress'); ?> </a> <a class="nav-tab" id="customdimensions-tab" href="#top#customdimensions"><?php _e('Custom dimension reports', 'google-analytics-for-wordpress'); ?> </a> </h2>
/** * Getting the value from the option, if it doesn't exist return empty string * * @param string $name * * @return string */ private static function get_formfield_from_options($name) { static $options; if ($options === null) { $options = Yoast_GA_Options::instance()->get_options(); } // Catch a notice if the option doesn't exist, yet return isset($options[$name]) ? $options[$name] : ''; }
public function id() { if (is_null($this->id)) { $options = Yoast_GA_Options::instance()->options; $this->id = isset($options['analytics_profile']) ? $options['analytics_profile'] : ''; } return $this->id; }
/** * Constructor */ public function __construct() { parent::__construct(); add_action('plugins_loaded', array($this, 'init_ga')); add_action('admin_init', array($this, 'init_settings')); }
/** * Test the custom code in the tracking * * @covers Yoast_GA_JS::tracking() */ public function test_custom_code() { $options_singleton = Yoast_GA_Options::instance(); $options = $options_singleton->get_options(); $options['custom_code'] = '__custom_code[\\"test\\"]'; $options_singleton->update_option($options); // create and go to post $post_id = $this->factory->post->create(); $this->go_to(get_permalink($post_id)); // Get tracking code $tracking_data = $this->class_instance->tracking(true); if (is_array($tracking_data)) { foreach ($tracking_data as $row) { if (is_array($row)) { if ($row['type'] == 'custom_code') { $this->assertEquals($row['value'], '__custom_code["test"]'); } } } } }
/** * Fetches the options */ protected function get_options() { return Yoast_GA_Options::instance()->get_options(); }
/** * Check the options check function, we need at least the current dataset * * @covers Yoast_GA_Options::check_options() */ public function test_check_options() { $options = $this->class_instance->get_options(); $new_options = $this->class_instance->check_options($options); $this->assertEquals(count($options), count($new_options)); }