<commit_before><?php
/**
 * @files This file contains functions used throughout Fabriq applications
 * @author <NAME>
 * --
 * Copyright (c)2010, Ralivue.com
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Ralivue.com nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Ralivue.com BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --
 */

abstract class Fabriq {
  private static $cssqueue = array();
  private static $jsqueue = array();
  private static $title;
  private static $render = 'layout';
  private static $layout = 'application';
  private static $controller;
  private static $rendercontroller;
  private static $action;
  private static $renderaction;
  
  /**
   * Adds a stylesheet to the CSS queue for stylesheet includes
   * @param string $stylesheet
   * @param string $media
   * @param string $path
   */
  public function add_css($stylesheet, $media = 'screen', $path = 'public/stylesheets/') {
  	self::$cssqueue[] = array('css' => $stylesheet, 'media' => $media, 'path' => $path);
  }
  
  /**
   * Public getter for $cssqueue
   * @return array
   */
  public function cssqueue() {
    return self::$cssqueue;
  }
  
  /**
   * Adds a JavaScript file to the JavaScript queue for JavaScript includes
   * @param string $javascript
   * @param string $path
   * @param string $ext
   */
  public function add_js($javascript, $path = 'public/javascripts/', $ext = '.js') {
  	self::$jsqueue[] = array('js' => $javascript, 'path' => $path, 'ext' => $ext);
  }
  
  /**
   * Public getter for $jsqueue
   * @return array
   */
  public function jsqueue() {
    return self::$jsqueue;
  }
  
  /**
   * Creates a link to another page in the application
   * @param string $linktext
   * @param string $controller
   * @param string $action
   * @param array $queries
   * @param boolean $blank
   */
  public function link_to($linktext, $controller, $action = NULL, $queries = false, $blank = false, $title = NULL) {
  	global $_FAPP;
  	
    echo "<a href=\"";
  	if (!$_FAPP['cleanurls']) {
		  echo "index.php?q=";
  	} else {
  	  echo $_FAPP['apppath'];
  	}
		echo "{$controller}";
		if ($action != NULL) {
			echo "/{$action}";
		}
		if ($queries != false) {
			foreach($queries as $key => $val) {
				echo "/{$val}";
			}
		}
		echo "\"";
		if ($blank) {
			echo " target=\"_blank\"";
		}
		echo " title=\"";
		if ($title) {
			echo strip_tags($title);
		} else {
		  echo strip_tags($linktext);
		}
		
		echo "\">{$linktext}</a>";
  }
  
  /**
   * Includes the specified model
   * @param string $model
   */
  public function model($model) {
  	require_once("app/models/{$model}.model.php");
  }
  
  /**
   * page title getter/setter
   * if NULL, return the page title
   * @param string $title
   * @return string
   */
  public function title ($title = NULL) {
    if ($title != NULL) {
      self::$title = strip_tags($title);
    } else {
      return self::$title;
    }
  }
  
  /**<commit_msg>Fixed typing error in Fabriq::title() in /core/Fabriq.class.php<commit_after><?php
/**
 * @files This file contains functions used throughout Fabriq applications
 * @author <NAME>
 * --
 * Copyright (c)2010, Ralivue.com
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Ralivue.com nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Ralivue.com BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --
 */

abstract class Fabriq {
  private static $cssqueue = array();
  private static $jsqueue = array();
  private static $title;
  private static $render = 'layout';
  private static $layout = 'application';
  private static $controller;
  private static $rendercontroller;
  private static $action;
  private static $renderaction;
  
  /**
   * Adds a stylesheet to the CSS queue for stylesheet includes
   * @param string $stylesheet
   * @param string $media
   * @param string $path
   */
  public function add_css($stylesheet, $media = 'screen', $path = 'public/stylesheets/') {
  	self::$cssqueue[] = array('css' => $stylesheet, 'media' => $media, 'path' => $path);
  }
  
  /**
   * Public getter for $cssqueue
   * @return array
   */
  public function cssqueue() {
    return self::$cssqueue;
  }
  
  /**
   * Adds a JavaScript file to the JavaScript queue for JavaScript includes
   * @param string $javascript
   * @param string $path
   * @param string $ext
   */
  public function add_js($javascript, $path = 'public/javascripts/', $ext = '.js') {
  	self::$jsqueue[] = array('js' => $javascript, 'path' => $path, 'ext' => $ext);
  }
  
  /**
   * Public getter for $jsqueue
   * @return array
   */
  public function jsqueue() {
    return self::$jsqueue;
  }
  
  /**
   * Creates a link to another page in the application
   * @param string $linktext
   * @param string $controller
   * @param string $action
   * @param array $queries
   * @param boolean $blank
   */
  public function link_to($linktext, $controller, $action = NULL, $queries = false, $blank = false, $title = NULL) {
  	global $_FAPP;
  	
    echo "<a href=\"";
  	if (!$_FAPP['cleanurls']) {
		  echo "index.php?q=";
  	} else {
  	  echo $_FAPP['apppath'];
  	}
		echo "{$controller}";
		if ($action != NULL) {
			echo "/{$action}";
		}
		if ($queries != false) {
			foreach($queries as $key => $val) {
				echo "/{$val}";
			}
		}
		echo "\"";
		if ($blank) {
			echo " target=\"_blank\"";
		}
		echo " title=\"";
		if ($title) {
			echo strip_tags($title);
		} else {
		  echo strip_tags($linktext);
		}
		
		echo "\">{$linktext}</a>";
  }
  
  /**
   * Includes the specified model
   * @param string $model
   */
  public function model($model) {
  	require_once("app/models/{$model}.model.php");
  }
  
  /**
   * page title getter/setter
   * if NULL, return the page title
   * @param string $title
   * @return string
   */
  public function title($title = NULL) {
    if ($title != NULL) {
      self::$title = strip_tags($title);
    } else {
      return self::$title;
    }
  }
  
  /**
{'fraction_non_alphanumeric': 0.11918840579710145, 'fraction_numerical': 0.0009275362318840579, 'mean_word_length': 3.1671497584541064, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '3059964', 'n_tokens_mistral': 2656, 'n_tokens_neox': 2498, 'n_words': 939}