<commit_before><?php

namespace Locomotive\Chimplet;

use Locomotive\WordPress\Facade as WP;

/**
 * File: Chimplet Feed Campaign Management
 *
 * @package Locomotive\Chimplet
 */

/**
 * Class: Chimplet Feed
 *
 * @version 2015-02-13
 * @since   0.0.0 (2015-02-07)
 */

class Feed extends Base {

	/**
	 * @var WP     $wp           WordPress Facade
	 * @var array  $frequencies  Available frequencies from MailChimp
	 */

	public $wp;
	public $frequencies;


	/**
	 * Constructor
	 *
	 * Prepares actions and filters for commodity methods.
	 *
	 * @access public
	 * @param  WP  $wp  The WordPress Facade
	 */

	public function __construct( WP $wp = null )
	{
		$this->wp = ( $wp instanceof WP ? $wp : new WP );

		$this->frequencies = [ 'monthly', 'weekly', 'daily' ];

		$this->wp->add_action( 'init',             [ $this, 'init' ], 10 );
		$this->wp->add_action( 'pre_get_posts',    [ $this, 'pre_get_posts' ], 10 );

		$this->wp->add_filter( 'get_wp_title_rss', [ $this, 'wp_title_rss' ], 10, 2 );

		if ( $this->get_option( 'mailchimp.campaigns.schedule.frequency' ) ) {
			$this->wp->add_action( 'template_redirect', [ $this, 'render_feed' ], 1 );
		}
	}

	/**
	 * Register a rewrite endpoint for the RSS feed
	 */

	public function init()
	{
		$freq_regex = implode( '|', $this->frequencies );

		add_rewrite_tag( '%chimplet_schedule%', "({$freq_regex})" );
		add_rewrite_rule( "chimplet/{$freq_regex}/?$", 'index.php?chimplet_schedule=$matches[1]', 'top' );
	}

	/**
	 * Filter returned posts for the RSS campaign
	 *
	 * @param $query<commit_msg>Fixed typo with rewrite rule [ci skip]<commit_after><?php

namespace Locomotive\Chimplet;

use Locomotive\WordPress\Facade as WP;

/**
 * File: Chimplet Feed Campaign Management
 *
 * @package Locomotive\Chimplet
 */

/**
 * Class: Chimplet Feed
 *
 * @version 2015-02-13
 * @since   0.0.0 (2015-02-07)
 */

class Feed extends Base {

	/**
	 * @var WP     $wp           WordPress Facade
	 * @var array  $frequencies  Available frequencies from MailChimp
	 */

	public $wp;
	public $frequencies;


	/**
	 * Constructor
	 *
	 * Prepares actions and filters for commodity methods.
	 *
	 * @access public
	 * @param  WP  $wp  The WordPress Facade
	 */

	public function __construct( WP $wp = null )
	{
		$this->wp = ( $wp instanceof WP ? $wp : new WP );

		$this->frequencies = [ 'monthly', 'weekly', 'daily' ];

		$this->wp->add_action( 'init',             [ $this, 'init' ], 10 );
		$this->wp->add_action( 'pre_get_posts',    [ $this, 'pre_get_posts' ], 10 );

		$this->wp->add_filter( 'get_wp_title_rss', [ $this, 'wp_title_rss' ], 10, 2 );

		if ( $this->get_option( 'mailchimp.campaigns.schedule.frequency' ) ) {
			$this->wp->add_action( 'template_redirect', [ $this, 'render_feed' ], 1 );
		}
	}

	/**
	 * Register a rewrite endpoint for the RSS feed
	 */

	public function init()
	{
		$freq_regex = implode( '|', $this->frequencies );

		add_rewrite_tag( '%chimplet_schedule%', "({$freq_regex})" );
		add_rewrite_rule( "chimplet/({$freq_regex})/?$", 'index.php?chimplet_schedule=$matches[1]', 'top' );
	}

	/**
	 * Filter returned posts for the RSS campaign
	 *
	 * @param $query
{'fraction_non_alphanumeric': 0.16693214399490283, 'fraction_numerical': 0.017840076457470534, 'mean_word_length': 3.2837653478854025, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5178373', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1109, 'n_words': 263}