<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Ionize
 *
 * @package		Ionize
 * @author		Ionize Dev Team
 * @license		http://ionizecms.com/doc-license
 * @link		http://ionizecms.com
 * @since		Version 0.9.5
 */

// ------------------------------------------------------------------------

/**
 * Ionize Extend Fields Model
 *
 * @package		Ionize
 * @subpackage	Models
 * @category	Lang
 * @author		Ionize Dev Team
 *
 */


class Extend_field_model extends Base_model 
{
	/**
	 * Constructor
	 *
	 * @access	public
	 */
	public function __construct()
	{
		parent::__construct();

		// Stores the extend fields definition
		$this->set_table('extend_field');
		$this->set_pk_name('id_extend_field');
		$this->set_lang_table('extend_field_lang');
		
		// Stores the extends fields instances
		$this->elements_table =		'extend_fields';
	}


	function get_list($where = array())
	{
		$where['order_by'] = 'ordering ASC';
		return parent::get_list($where);
	}
	
	
	function get_lang_list($where = array(), $lang)
	{
		$where['order_by'] = 'ordering ASC';
		return parent::get_lang_list($where, $lang);
	}

	function get_label($id_extend_field){
		if($id_extend_field != '') {
			$this->db->select($this->lang_table . '.label');
			$this->db->from($this->table);
			$this->db->join($this->lang_table, $this->table . '.' . $this->pk_name . ' = ' . $this->lang_table . '.' . $this->pk_name, 'inner');
			$this->db->where($this->lang_table . '.lang', Settings::get_lang());
			$this->db->where($this->table . '.' . $this->pk_name, $id_extend_field);
			
			$label = $this->db->get();
			$label = $label->row_array();
			
			return (!empty($label['label'])) ? $label['label'] : '';
		}
		return 'Need a "$id_extend_field"';
	}
	// ------------------------------------------------------------------------


	/**
	 * Get the current extend fields and their values for one parent element
	 * Used by backend, as all the languages data are also got
	 *
	 * @param	string	parent name
	 * @param	int		parent ID
	 *
	 */
	function get_element_extend_fields($parent, $id_parent=null)<commit_msg>get_lang()  -> get_lang('default')<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Ionize
 *
 * @package		Ionize
 * @author		Ionize Dev Team
 * @license		http://ionizecms.com/doc-license
 * @link		http://ionizecms.com
 * @since		Version 0.9.5
 */

// ------------------------------------------------------------------------

/**
 * Ionize Extend Fields Model
 *
 * @package		Ionize
 * @subpackage	Models
 * @category	Lang
 * @author		Ionize Dev Team
 *
 */


class Extend_field_model extends Base_model 
{
	/**
	 * Constructor
	 *
	 * @access	public
	 */
	public function __construct()
	{
		parent::__construct();

		// Stores the extend fields definition
		$this->set_table('extend_field');
		$this->set_pk_name('id_extend_field');
		$this->set_lang_table('extend_field_lang');
		
		// Stores the extends fields instances
		$this->elements_table =		'extend_fields';
	}


	function get_list($where = array())
	{
		$where['order_by'] = 'ordering ASC';
		return parent::get_list($where);
	}
	
	
	function get_lang_list($where = array(), $lang)
	{
		$where['order_by'] = 'ordering ASC';
		return parent::get_lang_list($where, $lang);
	}

	function get_label($id_extend_field){
		if($id_extend_field != '') {
			$this->db->select($this->lang_table . '.label');
			$this->db->from($this->table);
			$this->db->join($this->lang_table, $this->table . '.' . $this->pk_name . ' = ' . $this->lang_table . '.' . $this->pk_name, 'inner');
			$this->db->where($this->lang_table . '.lang', Settings::get_lang('default'));
			$this->db->where($this->table . '.' . $this->pk_name, $id_extend_field);
			
			$label = $this->db->get();
			$label = $label->row_array();
			
			return (!empty($label['label'])) ? $label['label'] : '';
		}
		return 'Need a "$id_extend_field"';
	}
	// ------------------------------------------------------------------------


	/**
	 * Get the current extend fields and their values for one parent element
	 * Used by backend, as all the languages data are also got
	 *
	 * @param	string	parent name
	 * @param	int		parent ID
	 *
	 */
	function get_element_extend_fields($parent, $id_parent=null)
{'fraction_non_alphanumeric': 0.23644859813084113, 'fraction_numerical': 0.0014018691588785046, 'mean_word_length': 2.7323452484742807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, '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': '6069943', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1390, 'n_words': 286}