<commit_before><?php
/**
 * 
 * Contains functions for basic web capabilities such as reading
 * variables from the URL (safely), setting/getting cookies and config
 * options.
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2013
 * Language: PHP
 * Filename: core_web.php
 * 
 */

/**
 * Include the config file
 */
include GNAT_ROOT.'/config/class_config.php';
include GNAT_ROOT.'/classes/class_varGetter.php';
include GNAT_ROOT.'/classes/class_session.php';
include GNAT_ROOT.'/classes/class_lock.php';
include GNAT_ROOT.'/lib/core_extension.php';
include GNAT_ROOT.'/classes/class_article.php';
include GNAT_ROOT.'/classes/class_urlHandler.php';

/**
* Checks to see if the preferred file exists, and if it does
* returns it, otherwise it returns the secondary file, which ideally
* should be a file (like an error page) that is guaranteed to exist.
* 
* @param $preferred (string): the preferred page to include
* 
* 
*/
function pullContent($preferred, $sectionUri='/', $articleUri='/' ){

	$i = 0;
	$article = new article( "", $sectionUri, $articleUri );

	while ( $i < count($preferred) && $article->getType() == "none" ){

		if ( !strpos( $preferred[$i], '.' ) ){

			$file = $preferred[$i];

		}
		else{
			$file = substr( $preferred[$i], 0, strpos( $preferred[$i], '.')-1);
		}

		$article = new article( $file, $sectionUri, $articleUri );<commit_msg>pullContent now supports non-array arguments<commit_after><?php
/**
 * 
 * Contains functions for basic web capabilities such as reading
 * variables from the URL (safely), setting/getting cookies and config
 * options.
 * @author <NAME> <<EMAIL>>
 * @copyright Nate Levesque 2013
 * Language: PHP
 * Filename: core_web.php
 * 
 */

/**
 * Include the config file
 */
include GNAT_ROOT.'/config/class_config.php';
include GNAT_ROOT.'/classes/class_varGetter.php';
include GNAT_ROOT.'/classes/class_session.php';
include GNAT_ROOT.'/classes/class_lock.php';
include GNAT_ROOT.'/lib/core_extension.php';
include GNAT_ROOT.'/classes/class_article.php';
include GNAT_ROOT.'/classes/class_urlHandler.php';

/**
* Checks to see if the preferred file exists, and if it does
* returns it, otherwise it returns the secondary file, which ideally
* should be a file (like an error page) that is guaranteed to exist.
* 
* @param $preferred (string): the preferred page to include
* 
* 
*/
function pullContent($preferred, $sectionUri='/', $articleUri='/' ){

	if ( ! is_array($preferred ) ){
		$to = array();
		$to[] = $preferred;
		$preferred = $to;
	}

	$i = 0;
	$article = new article( "", $sectionUri, $articleUri );

	while ( $i < count($preferred) && $article->getType() == "none" ){

		if ( !strpos( $preferred[$i], '.' ) ){

			$file = $preferred[$i];

		}
		else{
			$file = substr( $preferred[$i], 0, strpos( $preferred[$i], '.')-1);
		}

		$article = new article( $file, $sectionUri, $articleUri );
{'fraction_non_alphanumeric': 0.16153846153846155, 'fraction_numerical': 0.0048951048951048955, 'mean_word_length': 4.259191176470588, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, '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': '81595', 'n_tokens_mistral': 1002, 'n_tokens_neox': 935, 'n_words': 265}