<commit_before><?php
/**
 * Copyright © <NAME> All rights reserved.
 * See license file for more info.
 */


Class Frontend_Controller_Action {

	/**
	 *	Block
	 */
	public $blocks = array();

	/**
	 *	CSS
	 */
	public $css = array();

	/**
	 *	Javascript
	 */
	public $js = array();

	/**
	 *	Path to Blocks
	 */
	public $paths = array();

	/**
	 *	Path to CSS
	 */
	public $pathCss = array();

	/**
	 *	Main Block
	 */
	public $mainBlock = "";

	/**
	 *	Page Title
	 */
	public $pageTitle = "LexiPHP Framework";

	/**
	 *	Load defaults [Deprecated]
	 */
	public function setDefault() {
		$this->linkCss("http://fonts.googleapis.com/icon?family=Material+Icons");
		$this->setCss("default/materialize");
		$this->setCss("default/style");
		$this->setJs("default/jquery-2.1.1.min");
		$this->setJs("default/materialize");
		$this->setJs("default/init");
	}

	/**
	 *	Get Child Block
	 *	@var string $child
	 *	@return $blocks
	 */
	public function getChildBlock( $child ) {
		$key = explode("/", $child);
		$path = Core::$paths[0] . $key[0] . DS . "view" . DS . "blocks" . DS . $key[1] . ".phtml";
		if( file_exists($path) ) {
			return include $path;
		}
		return false;
	}

	/**
	 *	Get Images
	 *	@var string $image
	 *	@return string $image
	 */
	public function getImage( $image ) {
		$img = explode("/", $image);
		$baseUrl = Core::getSingleton("system/config")->getBaseUrl();
		foreach( Core::$skinPath as $path ) {
			$imagePath = $path . $img[0] . DS . "images" . DS . $img[1];
			if( file_exists($imagePath) ) {
				$imagePath = str_replace(BP . DS, $baseUrl, $imagePath);
				return $imagePath;
			}
		}
	}

	/**
	 *	load the resources from theme
	 */
	public function loadThemeResource() {
		$theme = Core::getSingleton("system/kernel")->getConfig("theme");
		if( isset($theme["css"]) ) {
			foreach( $theme["css"] as $css ) {
				$this->setCss( $css );
			}
		}

		if( isset($theme["js"]) ) {
			foreach( $theme["js"] as $js ) {
				$this->setJs( $js );
			}
		}
		return;
	}

	/**
	 *	Set CSS [new Update]
	 */
	public function setCss($varCss) {
		$varCss = explode(BS, $varCss);
		$config = Core::getSingleton("system/config");
		$paths = $config->getSkinPath();
		$baseurl = $config->getBaseUrl();
		foreach($paths as $cssPath) {
			$fileLoc = BP . DS . "skin" . DS . $cssPath . DS . $varCss[0] . DS . "css" . DS . $varCss[1] . ".css";
			if(file_exists($fileLoc)) {
				$this->css[] = "<link rel='stylesheet' href='" . $baseurl . "skin" . BS . $cssPath . BS . $varCss[0] . BS . "css" . BS . $varCss[1] . ".css'>";			
			}
		}
	}

	/**
	 *	Set JS [New Update]
	 */
	public function setJs($varJs) {
		$varJs = explode(BS, $varJs);
		$config = Core::getSingleton("system/config");
		$paths = $config->getSkinPath();
		$baseurl = $config->getBaseUrl();
		foreach($paths as $jsPaths) {
			$fileLoc = BP . DS . "skin" . DS . $jsPaths . DS . $varJs[0] . DS . "js" . DS . $varJs[1] . ".js";
			if( strpos( $fileLoc, US ) !== false ) {
				$fileLoc = str_replace(US, DS, $fileLoc);
				$varJs[1] = str_replace(US, DS, $varJs[1]);
			}
			if(file_exists($fileLoc)) {
				$this->js[] = "<script src='" . $baseurl . "skin" . BS . $jsPaths . BS . $varJs[0] . BS . "js" . BS . $varJs[1] . ".js'></script>";
			}
		}
	}

	/**
	 * Set CSS [Deprecated]
	 */
	// public function setBaseCss($varCss) {
	// 	$varCss = explode(BS, $varCss);
	// 	$dir = Core::getSingleton("system/config")->loadConfigFile()->frontend->directory;
	// 	$sysConfig = Core::getSingleton("system/config")->loadConfigFile();
	// 	$baseurl = $sysConfig->system->url;
	// 	$this->css[] = "<link rel='stylesheet' href='" . $baseurl . $dir->skin . BS . $dir->base . BS . $varCss[0] . BS . $dir->css . BS . $varCss[1] . ".css'>";
	// }
<commit_msg>removed: code to avoid problems with some web hosting<commit_after><?php
/**
 * Copyright © <NAME> All rights reserved.
 * See license file for more info.
 */


Class Frontend_Controller_Action {

	/**
	 *	Block
	 */
	public $blocks = array();

	/**
	 *	CSS
	 */
	public $css = array();

	/**
	 *	Javascript
	 */
	public $js = array();

	/**
	 *	Path to Blocks
	 */
	public $paths = array();

	/**
	 *	Path to CSS
	 */
	public $pathCss = array();

	/**
	 *	Main Block
	 */
	public $mainBlock = "";

	/**
	 *	Page Title
	 */
	public $pageTitle = "LexiPHP Framework";

	/**
	 *	Load defaults [Deprecated]
	 */
	public function setDefault() {
		$this->linkCss("http://fonts.googleapis.com/icon?family=Material+Icons");
		$this->setCss("default/materialize");
		$this->setCss("default/style");
		$this->setJs("default/jquery-2.1.1.min");
		$this->setJs("default/materialize");
		$this->setJs("default/init");
	}

	/**
	 *	Get Child Block
	 *	@var string $child
	 *	@return $blocks
	 */
	public function getChildBlock( $child ) {
		$key = explode("/", $child);
		$path = Core::$paths[0] . $key[0] . DS . "view" . DS . "blocks" . DS . $key[1] . ".phtml";
		if( file_exists($path) ) {
			return include $path;
		}
		return false;
	}

	/**
	 *	Get Images
	 *	@var string $image
	 *	@return string $image
	 */
	public function getImage( $image ) {
		$img = explode("/", $image);
		$baseUrl = Core::getSingleton("system/config")->getBaseUrl();
		foreach( Core::$skinPath as $path ) {
			$imagePath = $path . $img[0] . DS . "images" . DS . $img[1];
			if( file_exists($imagePath) ) {
				$imagePath = str_replace(BP . DS, $baseUrl, $imagePath);
				return $imagePath;
			}
		}
	}

	/**
	 *	load the resources from theme
	 */
	public function loadThemeResource() {
		$theme = Core::getSingleton("system/kernel")->getConfig("theme");
		if( isset($theme["css"]) ) {
			foreach( $theme["css"] as $css ) {
				$this->setCss( $css );
			}
		}

		if( isset($theme["js"]) ) {
			foreach( $theme["js"] as $js ) {
				$this->setJs( $js );
			}
		}
		return;
	}

	/**
	 *	Set CSS [new Update]
	 */
	public function setCss($varCss) {
		$varCss = explode(BS, $varCss);
		$config = Core::getSingleton("system/config");
		$paths = $config->getSkinPath();
		$baseurl = $config->getBaseUrl();
		foreach($paths as $cssPath) {
			$fileLoc = BP . DS . "skin" . DS . $cssPath . DS . $varCss[0] . DS . "css" . DS . $varCss[1] . ".css";
			if(file_exists($fileLoc)) {
				$this->css[] = "<link rel='stylesheet' href='" . $baseurl . "skin" . BS . $cssPath . BS . $varCss[0] . BS . "css" . BS . $varCss[1] . ".css'>";			
			}
		}
	}

	/**
	 *	Set JS [New Update]
	 */
	public function setJs($varJs) {
		$varJs = explode(BS, $varJs);
		$config = Core::getSingleton("system/config");
		$paths = $config->getSkinPath();
		$baseurl = $config->getBaseUrl();
		foreach($paths as $jsPaths) {
			$fileLoc = BP . DS . "skin" . DS . $jsPaths . DS . $varJs[0] . DS . "js" . DS . $varJs[1] . ".js";
			// if( strpos( $fileLoc, US ) !== false ) {
			// 	$fileLoc = str_replace(US, DS, $fileLoc);
			// 	$varJs[1] = str_replace(US, DS, $varJs[1]);
			// }
			if(file_exists($fileLoc)) {
				$this->js[] = "<script src='" . $baseurl . "skin" . BS . $jsPaths . BS . $varJs[0] . BS . "js" . BS . $varJs[1] . ".js'></script>";
			}
		}
	}

	/**
	 * Set CSS [Deprecated]
	 */
	// public function setBaseCss($varCss) {
	// 	$varCss = explode(BS, $varCss);
	// 	$dir = Core::getSingleton("system/config")->loadConfigFile()->frontend->directory;
	// 	$sysConfig = Core::getSingleton("system/config")->loadConfigFile();
	// 	$baseurl = $sysConfig->system->url;
	// 	$this->css[] = "<link rel='stylesheet' href='" . $baseurl . $dir->skin . BS . $dir->base . BS . $varCss[0] . BS . $dir->css . BS . $varCss[1] . ".css'>";
	// }

{'fraction_non_alphanumeric': 0.22012830793905372, 'fraction_numerical': 0.005346164127238706, 'mean_word_length': 2.8711846870150026, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 65, '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': '3944155', 'n_tokens_mistral': 3136, 'n_tokens_neox': 2852, 'n_words': 598}