<commit_before><?php defined('SYSPATH') or die('No direct script access.');

class Model_Link extends ORM {
	//protected $_table_name = 'links';
	
	public function rules() 
	{
		return array();
		return array(
		'short' => array(
			array('not_empty'),
			array('min_length', array(':value', 4)),
			array('max_length', array(':value', 64)),
		),
		'full' => array(
			array('not_empty'),
			array('min_length', array(':value', 0)),
			array('max_length', array(':value', 2048)),
		),
		'parent' => array(
			array('not_empty'),
			array('min_length', array(':value', 4)),
			array('max_length', array(':value', 64)),
		),
		);
	}
	
	public function expand($tweet) 
	{
		return preg_replace_callback('/http:\/\/t\.co\/\w+/',array(get_class($this),'getURL'),$tweet);
	}
	
	public function getURL($short) 
	{
		return $this->where('short','=',$short[0])->find()->full;
	}

} // End Link<commit_msg>now showing uncached t.co links<commit_after><?php defined('SYSPATH') or die('No direct script access.');

class Model_Link extends ORM {
	//protected $_table_name = 'links';
	
	public function rules() 
	{
		return array();
		return array(
		'short' => array(
			array('not_empty'),
			array('min_length', array(':value', 4)),
			array('max_length', array(':value', 64)),
		),
		'full' => array(
			array('not_empty'),
			array('min_length', array(':value', 0)),
			array('max_length', array(':value', 2048)),
		),
		'parent' => array(
			array('not_empty'),
			array('min_length', array(':value', 4)),
			array('max_length', array(':value', 64)),
		),
		);
	}
	
	public function expand($tweet) 
	{
		return preg_replace_callback('/http:\/\/t\.co\/\w+/',array(get_class($this),'getURL'),$tweet);
	}
	
	public function getURL($short) 
	{
		$link = $this->where('short','=',$short[0])->find()->full;
		if(!$link) $link = $short[0];
		return $link;
	}

} // End Link
{'fraction_non_alphanumeric': 0.228617536309844, 'fraction_numerical': 0.013448090371167294, 'mean_word_length': 4.360230547550432, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '7467039', 'n_tokens_mistral': 759, 'n_tokens_neox': 662, 'n_words': 128}