Пример #1
0
        public static function print_headlines_quota_mode_field()
        {
            $field_name = 'headlines_quota_mode';
            printf('<select id="%1$s" name="nelioab_settings[%1$s]" %2$s>', $field_name, self::get_pro_details());
            ?>
				<option value='<?php 
            echo NelioABSettings::HEADLINES_QUOTA_MODE_ALWAYS;
            ?>
'><?php 
            _e('All Pages Are Relevant for Headline Tracking', 'nelioab');
            ?>
</option>
				<option value='<?php 
            echo NelioABSettings::HEADLINES_QUOTA_MODE_ON_FRONT_PAGE;
            ?>
'<?php 
            if (NelioABSettings::get_headlines_quota_mode() == NelioABSettings::HEADLINES_QUOTA_MODE_ON_FRONT_PAGE) {
                echo ' selected="selected"';
            }
            ?>
><?php 
            _e('Only the Front Page Is Relevant for Headline Tracking', 'nelioab');
            ?>
</option>
			</select>
			<br><div class="the-descr" style="display:none;"><span <?php 
            echo self::get_pro_details('description');
            ?>
><?php 
            _e('During a Headline Test, Page Views are counted every time a tested Headline appears on a page in your website. This includes sidebars, latest posts, menus, and so on. If you want to limit the quota usage of your Headline experiments, you can now test them on the Front Page only.<br>Regardless of your setting, Headlines will replaced all over your site, so that users always see coherent headlines for your posts.', 'nelioab');
            ?>
</span></div>
			<?php 
        }
 /**
  * PHPDOC
  *
  * @param boolean $ajax PHPDOC
  *
  * @return array PHPDOC
  *
  * @since PHPDOC
  */
 public function add_list_of_applied_headlines($ajax = false)
 {
     $res = array('nelioab' => array());
     if ($ajax) {
         if (isset($ajax['nelioab'])) {
             $res = $ajax;
         } else {
             $res['result'] = $ajax;
         }
     }
     if (NelioABSettings::get_headlines_quota_mode() == NelioABSettings::HEADLINES_QUOTA_MODE_ON_FRONT_PAGE) {
         /** @var NelioABController $nelioab_controller */
         global $nelioab_controller;
         $current_post_id = $nelioab_controller->get_queried_post_id();
         $front_page_id = nelioab_get_page_on_front();
         if ($front_page_id == 0) {
             $front_page_id = NelioABController::FRONT_PAGE__YOUR_LATEST_POSTS;
         }
         if ($front_page_id != $current_post_id) {
             $this->applied_headlines = array();
         }
     }
     $headlines = array();
     foreach ($this->applied_headlines as $hl) {
         array_push($headlines, implode(':', $hl));
     }
     $headlines = implode(',', $headlines);
     $res['nelioab']['headlines'] = $headlines;
     return $res;
 }