Exemplo n.º 1
0
 <script type="text/javascript">
  analytics.page(<?php 
echo '"' . esc_js($category) . '"';
if (!empty($name)) {
    echo ', "' . esc_js($name) . '"';
}
if (!empty($properties)) {
    echo ', ' . json_encode(Segment_Analytics_WordPress::esc_js_deep($properties));
} else {
    echo ', {}';
}
if (!empty($options)) {
    echo ', ' . json_encode(Segment_Analytics_WordPress::esc_js_deep($options));
}
?>
);
 <?php 
if ($http_event) {
    ?>
		analytics.ajaxurl = "<?php 
    echo esc_url(admin_url('admin-ajax.php'));
    ?>
",

		jQuery( document ).ready( function( $ ) {
			var data = {
				action : 'segment_unset_cookie',
				key    : '<?php 
    echo esc_js($http_event);
    ?>
',
 /**
  * Used in our activation hook to set up our default settings.
  *
  * @since  1.0.0
  *
  * @return void
  */
 public static function setup_settings()
 {
     $settings = get_option(Segment_Analytics_WordPress::get_instance()->get_option_name());
     if (!empty($settings)) {
         return;
     }
     update_option(Segment_Analytics_WordPress::get_instance()->get_option_name(), Segment_Analytics_WordPress::get_instance()->defaults);
 }
 public function setUp()
 {
     parent::setUp();
     $this->object = Segment_Analytics_WordPress::get_instance();
 }
    /**
     * [exclude_custom_post_types description]
     *
     * @todo  If no post types exist, we shouldn't show this setting at all.
     * @return [type] [description]
     */
    public static function exclude_custom_post_types()
    {
        $cpts = get_post_types(array('public' => true, '_builtin' => false), 'objects');
        $settings = Segment_Analytics_WordPress::get_instance()->get_settings();
        $name = Segment_Analytics_WordPress::get_instance()->get_option_name() . '[exclude_custom_post_types][]';
        $settings['exclude_custom_post_types'] = isset($settings['exclude_custom_post_types']) ? $settings['exclude_custom_post_types'] : array();
        foreach ($cpts as $cpt) {
            ?>
			<label for="exclude_custom_post_types_<?php 
            echo esc_attr($cpt->name);
            ?>
">
				<input name="<?php 
            echo esc_attr($name);
            ?>
" type="checkbox" id="exclude_custom_post_types_<?php 
            echo esc_attr($cpt->name);
            ?>
" value="<?php 
            echo esc_attr($cpt->name);
            ?>
" <?php 
            checked(in_array($cpt->name, (array) $settings['exclude_custom_post_types']));
            ?>
 />
				<?php 
            echo esc_html($cpt->label);
            ?>
<br />
			</label>
			<?php 
        }
        ?>
		<p class="description"><?php 
        _e('Select which, if any, custom post types to exclude tracking on.  Selecting a post type here will exclude tracking on the single and archive pages for the post type.', 'segment');
        ?>
</p>
		<?php 
    }
 public function __construct()
 {
     return parent::get_instance();
 }