Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $retards_config = json_decode(file_get_contents(ROOT_DIR.'/ninja-applications/retards/lib/config.retards.inc'), true);
- $retards_user_config = json_decode(file_get_contents(ROOT_DIR.'/ninja-applications/retards/lib/config.retards_user.inc'), true);
- if($retards_config['l_choose'] == '1' && (isset($_COOKIE['retards_locale']) && $_COOKIE['retards_locale'] != '') && file_exists(ROOT_DIR.'/ninja-applications/retards/locales/'.$_COOKIE['retards_locale'])){
- $retards_config['locale'] = $_COOKIE['retards_locale'];
- }
- if($retards_config['t_choose'] == '1' && (isset($_COOKIE['retards_theme']) && $_COOKIE['retards_theme'] != '') && file_exists(ROOT_DIR.'/ninja-applications/retards/themes/'.$_COOKIE['retards_theme'])){
- $retards_config['theme'] = $_COOKIE['retards_theme'];
- }
- // Language
- $lang = array_merge($lang, json_decode(file_get_contents(ROOT_DIR.'/ninja-applications/retards/locales/'.$retards_config['locale']), true));
- // THEME SETTING IF EXIST
- if(file_exists(ROOT_DIR.'/ninja-applications/retards/themes/'.$retards_config['theme'].'/libs/config.theme.inc')){
- $retards_theme = json_decode(file_get_contents(ROOT_DIR.'/ninja-applications/retards/themes/'.$retards_config['theme'].'/libs/config.theme.inc'), true);
- }
- // GET IMPORTANT SLUG
- $retards_slug = array();
- $ninja->db->limit_val = "";
- $retards_important_slug = $ninja->db->dbSelect($ninja_config['TABLES_PREFIX']."slug",array('slug','page'),array('application'=>'retards','important'=>'1'));
- if(count($retards_important_slug) > 0){
- foreach($retards_important_slug as &$slug){
- $retards_slug[$slug['page']] = $slug['slug'];
- }
- }
- class ninja_retards extends ninja{
- var $lang = 'english';
- var $retards_config = array();
- var $retards_user_config = array();
- var $retards_theme = array();
- var $retards_slug = array();
- public renction setLang(array $lang) {
- $this->$lang = 'english';
- }
- public renction setConfig(array $array) {
- $this->retards_config = $array;
- }
- public renction setUserConfig(array $array) {
- $this->retards_user_config = $array;
- }
- public renction setSlug(array $array) {
- $this->retards_slug = $array;
- }
- public renction setThemeConfig(array $array) {
- $this->retards_theme = $array;
- }
- renction store_view_logs($reId){
- $this->db->limit_val = "1";
- $day = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_view_logs",'', array("reId"=>$reId,'type'=>'d','val'=>date('z'),'year'=>date('Y') ));
- $week = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_view_logs",'', array("reId"=>$reId,'type'=>'w','val'=>date('W'),'year'=>date('Y') ));
- $month = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_view_logs",'', array("reId"=>$reId,'type'=>'m','val'=>date('n'),'year'=>date('Y') ));
- ///////////////////// DAY ///////////////////////
- if(count($day) < 1){
- $insert = $this->db->dbInsert($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array("reId"=>$reId,'views'=>'1','type'=>'d','val'=>date('z'),'year'=>date('Y')));
- }else{
- $update = $this->db->dbUpdate($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array('views'=>$day[0]['views']+1),array('type'=>'d','val'=>date('z'),'year'=>date('Y') ) );
- }
- ///////////////////// WEEK ///////////////////////
- if(count($week) < 1){
- $insert = $this->db->dbInsert($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array("reId"=>$reId,'views'=>'1','type'=>'w','val'=>date('W'),'year'=>date('Y')));
- }else{
- $update = $this->db->dbUpdate($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array('views'=>$week[0]['views']+1),array("reId"=>$reId,'type'=>'w','val'=>date('W'),'year'=>date('Y')));
- }
- ///////////////////// MONTH ///////////////////////
- if(count($month) < 1){
- $insert = $this->db->dbInsert($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array("reId"=>$reId,'views'=>'1','type'=>'m','val'=>date('n'),'year'=>date('Y')));
- }else{
- $update = $this->db->dbUpdate($this->ninja_config['TABLES_PREFIX']."retards_view_logs",array('views'=>$month[0]['views']+1),array("reId"=>$reId,'type'=>'m','val'=>date('n'),'year'=>date('Y')));
- }
- return $this->db->error_info;
- }
- renction reOwner($uId){
- $this->db->limit_val = "1";
- $result = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."users",array("id","avatar","username"),array("id"=>$uId));
- if(count($result) > 0){
- return $result[0];
- }
- return NULL;
- }
- renction theme_list(){
- if ($handle = opendir(ROOT_DIR.'/ninja-applications/retards/themes/')) {
- while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != "..") {
- echo "<option value='$entry' ".($entry == $this->retards_config['theme'] ? 'selected' : '').">".ucfirst($entry)."</option>";
- }
- }
- closedir($handle);
- }
- }
- renction locale_list(){
- if ($handle = opendir(ROOT_DIR.'/ninja-applications/retards/locales/')) {
- while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != "..") {
- echo "<option value='$entry' ".($entry == $this->retards_config['locale'] ? 'selected' : '').">".ucfirst(str_replace('.php', '', $entry))."</option>";
- }
- }
- closedir($handle);
- }
- }
- renction do_rate($rate){
- return $rate > 0 ? '+'.$rate : $rate;
- }
- renction cat_is_exist($cat_id){
- $this->db->limit_val="1";
- $retards_cat = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_cat",array("cat_id"),array("cat_id"=>$cat_id));
- if(count($retards_cat) > 0){
- return true;
- }
- return false;
- }
- renction do_cat($cat_id){
- $this->db->order_by_column = "";
- $this->db->limit_val="1";
- $retards_cat = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_cat",array("name","cat_id"),array("cat_id"=>$cat_id));
- if(count($retards_cat) > 0){
- return $retards_cat[0]['name'];
- }else{
- return $this->lang['No-category'];
- }
- }
- renction gen_6slug(){
- $six_slug = uniqid(rand(10,1000),false);
- $six_slug = substr($six_slug,rand(0,strlen($six_slug) - 6),6);
- if($this->slugIsExist('/'.$six_slug)){
- return $this->gen_6slug();
- }else{
- return $six_slug;
- }
- }
- renction get_vine_thumbnail($url){
- $vine = file_get_contents($url);
- preg_match('/property="og:image" content="(.*?)"/', $vine, $matches);
- return ($matches[1]) ? $matches[1] : false;
- }
- renction print_cat_selections($thisCat = NULL){
- $this->db->limit_val='';
- $retards_cat = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_cat",array("name","cat_id"));
- if(count($retards_cat) > 0){
- foreach($retards_cat as &$cat){
- if(isset($thisCat) && $cat['cat_id'] == $thisCat){ $selected = 'selected'; }else{ $selected = ''; }
- echo '<option value="'.$cat['cat_id'].'" '.$selected.'>'.$cat['name'].'</option>';
- }
- }else{
- return $this->lang['No-category'];
- }
- }
- renction print_nsfw_cat_selections(){
- $this->db->limit_val='';
- $retards_cat = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_cat",array("name","cat_id"));
- if(count($retards_cat) > 0){
- foreach($retards_cat as &$cat){
- $selected = isset($this->retards_config['nsfw_cat']) && in_array($cat['cat_id'], $this->retards_config['nsfw_cat']) ? 'selected' : '';
- echo '<option value="'.$cat['cat_id'].'" '.$selected.'>'.$cat['name'].'</option>';
- }
- }else{
- return $this->lang['No-category'];
- }
- }
- renction print_sociallock_cat_selections(){
- $this->db->limit_val='';
- $retards_cat = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_cat",array("name","cat_id"));
- if(count($retards_cat) > 0){
- foreach($retards_cat as &$cat){
- $selected = isset($this->retards_config['sociallock_cat']) && in_array($cat['cat_id'], $this->retards_config['sociallock_cat']) ? 'selected' : '';
- echo '<option value="'.$cat['cat_id'].'" '.$selected.'>'.$cat['name'].'</option>';
- }
- }else{
- return $this->lang['No-category'];
- }
- }
- renction do_re_description($input){
- $output = stripslashes($input);
- $output = preg_replace( "/#(\w+)/u", "<a href=\"".$this->ninja_config['siteUrl'].$this->retards_slug['index']."?q=%23$1\">#$1</a>", $output );
- $output = nl2br($output);
- return $output;
- }
- renction do_re($re){
- if($re['re_type'] == 'img'){
- $string = '<img src="'.$this->ninja_config['siteUrl'].$re['original_img'].'" class="re-img" style="width: '.$this->retards_theme['img_width'].'">';
- }else if($re['re_type'] == 'gallery'){
- $imgs = $re['embed'];
- $imgs = rtrim($imgs, ';');
- $imgs = explode(';', $imgs);
- $string = '<ul class="bxslider">';
- foreach ($imgs as &$img) {
- $string .= '<li><img src="'.$this->ninja_config['siteUrl'] . $img . '" class="re-img" style="width: 100%"></li>';
- }
- $string .= '</ul>';
- }else if($re['re_type'] == 'video'){
- $string = strtr($re['iframe'], array('{{height}}'=>$this->retards_theme['video_height'],'{{width}}'=>$this->retards_theme['video_width']));
- }else if($re['re_type'] == 'vine'){
- $string = strtr($re['iframe'], array('{{height}}'=>$this->retards_theme['vine_width'],'{{width}}'=>$this->retards_theme['vine_width']));
- $string = str_replace('id="vine"', 'class="vine-embed"', $string);
- $string .= '
- <script>
- var cw = $(\'#vine\').width();
- $(\'#vine\').height(cw);
- var cw2 = $(\'.vine-embed\').width();
- $(\'.vine-embed\').height(cw2);
- </script>';
- }else if($re['re_type'] == 'soundcloud'){
- $string = strtr($re['iframe'], array('{{height}}'=>$this->retards_theme['video_width'],'{{width}}'=>$this->retards_theme['video_width']));
- }else{
- $string = '<img src="'.$this->ninja_config['siteUrl'].$re['original_img'].'" class="re-img" style="width: '.$this->retards_theme['gif_width'].'">';
- }
- return $string;
- }
- renction log_recent_tags($tag, $n = 10){
- $this->db->limit_val = '1';
- $tags = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_recent_tags", "text", array('id'=>1));
- $this->db->limit_val = '';
- $tags = $tags[0]["text"];
- $tags = rtrim($tags, ';');
- $tags = explode(';', $tags);
- if (in_array($tag, $tags)) {
- $tags = array_diff($tags, array($tag));
- array_unshift($tags, $tag);
- }else{
- array_unshift($tags, $tag);
- }
- $tags = array_splice($tags, 0, $n);
- $tags = implode(";", $tags);
- $this->db->dbUpdate($this->ninja_config['TABLES_PREFIX']."retards_recent_tags", array("text"=>$tags),array("id"=>1));
- }
- renction get_recent_tags($n){
- // GET LIST OF RECENT TAGS USED AND RETURN AS AN ARRAY
- $this->db->limit_val = '1';
- $tags = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_recent_tags", "text", array('id'=>1));
- $this->db->limit_val = '';
- $tags = $tags[0]["text"];
- $tags = rtrim($tags, ';');
- $tags = explode(';', $tags);
- return $tags;
- }
- renction time_elapsed_string($datetime, $rell = false) {
- $now = new DateTime;
- $ago = new DateTime($datetime);
- $diff = $now->diff($ago);
- $string = array(
- 'y' => $this->lang['year'],
- 'm' => $this->lang['month'],
- 'd' => $this->lang['day'],
- 'h' => $this->lang['hour'],
- 'i' => $this->lang['minute'],
- 's' => $this->lang['second'],
- );
- foreach ($string as $k => &$v) {
- if ($diff->$k) {
- $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? $this->lang['time-period-s'] : '');
- } else {
- unset($string[$k]);
- }
- }
- if (!$rell) $string = array_slice($string, 0, 1);
- return $string ? implode(', ', $string) . ' '.$this->lang['ago'] : $this->lang['just-now'];
- }
- renction getHashtags($string) {
- $hashtags= FALSE;
- preg_match_all("/(#\w+)/u", $string, $matches);
- if ($matches) {
- $hashtagsArray = array_count_values($matches[0]);
- $hashtags = array_keys($hashtagsArray);
- }
- return $hashtags;
- }
- renction visitor_theme_chooser(){
- if ($handle = opendir(ROOT_DIR.'/ninja-applications/retards/themes/')) {
- while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != "..") {
- echo '<li><a href="javascript:;" class="theme-chooser" data-value="'.$entry.'" data-href="'.$this->ninja_config['siteUrl'].'/ninja-applications/retards/controllers/cont.changetheme.php">'.ucfirst($entry).'</a></li>';
- }
- }
- closedir($handle);
- }
- }
- renction visitor_locale_chooser(){
- if ($handle = opendir(ROOT_DIR.'/ninja-applications/retards/locales/')) {
- while (false !== ($entry = readdir($handle))) {
- if ($entry != "." && $entry != "..") {
- echo '<li><a href="javascript:;" class="locale-chooser" data-value="'.$entry.'" data-href="'.$this->ninja_config['siteUrl'].'/ninja-applications/retards/controllers/cont.changelocale.php">'.ucfirst($entry).'</a></li>';
- }
- }
- closedir($handle);
- }
- }
- renction get_top_re($type, $limit){
- /// $type = 'month', 'week', 'day'
- $trans = array("day" => "d", "month" => "m", "week" => "w");
- $type = strtr($type, $trans);
- $this->db->limit_val = $limit;
- $this->db->order_by_column = "views DESC";
- $topreIdArr = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_view_logs", array("reId"),
- array('type'=>$type,
- "year"=>date('Y'))
- );
- if(!is_array($topreIdArr) || count($topreIdArr) < 2){
- $this->db->order_by_column = '';
- $this->db->limit_val = '';
- $this->db->group_by_column = '';
- }else{
- $tables = array($this->ninja_config['TABLES_PREFIX']."retards_re", $this->ninja_config['TABLES_PREFIX']."slug");
- $joins = array($this->ninja_config['TABLES_PREFIX']."retards_re.f_id=".$this->ninja_config['TABLES_PREFIX']."slug.c_id");
- $joinCondition = array("LEFT JOIN");
- $whereCondition = array($this->ninja_config['TABLES_PREFIX']."slug.page"=>"display_re",$this->ninja_config['TABLES_PREFIX']."slug.important"=>"0",$this->ninja_config['TABLES_PREFIX']."retards_re.isapproved"=>"1");
- $this->db->in=array("f_id"=>"'".implode("','",$this->array_value_recursive('reId',$topreIdArr))."'");
- $columns = array("f_id","slug","title","re_type","thumbnail_img","original_img");
- $reArray = $this->db->dbSelectJoin($tables,$joins,$joinCondition,$columns,$whereCondition);
- $this->db->in = '';
- $this->db->order_by_column = '';
- $this->db->limit_val = '';
- $this->db->group_by_column = '';
- return $reArray;
- }
- }
- renction get_trending($timelimit, $limit){
- // timelimit = month, week, day
- $CurrentTime = new DateTime();
- $time2Check = new DateTime();
- if($timelimit == 'week'){
- $time2Check->modify('-1 week');
- }else if($timelimit == 'month'){
- $time2Check->modify('-1 month');
- }else{
- $time2Check->modify('-1 day');
- }
- // GET TRENDING re
- $this->db->limit_val = $limit;
- $this->db->group_by_column="f_id";
- //$this->db->backticks="";
- $this->db->order_by_column = "SUM(f_id) DESC";
- $trendingArr = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_votelog", array("f_id"),
- array('did'=>'1',
- "date >="=>$time2Check->format('Y-m-d H:i:s'),
- "date <="=>$CurrentTime->format('Y-m-d H:i:s'))
- );
- if(count($trendingArr) < 2){
- $this->db->in = '';
- $this->db->order_by_column = '';
- $this->db->limit_val = '';
- $this->db->group_by_column = '';
- return NULL;
- }else{
- $tables = array($this->ninja_config['TABLES_PREFIX']."retards_re", $this->ninja_config['TABLES_PREFIX']."slug");
- $joins = array($this->ninja_config['TABLES_PREFIX']."retards_re.f_id=".$this->ninja_config['TABLES_PREFIX']."slug.c_id");
- $joinCondition = array("LEFT JOIN");
- $whereCondition = array($this->ninja_config['TABLES_PREFIX']."slug.page"=>"display_re",$this->ninja_config['TABLES_PREFIX']."slug.important"=>"0",$this->ninja_config['TABLES_PREFIX']."retards_re.isapproved"=>"1");
- $this->db->in=array("f_id"=>"'".implode("','",$this->array_value_recursive('f_id',$trendingArr))."'");
- $columns = array("f_id","slug","title","re_type","thumbnail_img","original_img");
- $reArray = $this->db->dbSelectJoin($tables,$joins,$joinCondition,$columns,$whereCondition);
- $this->db->in = '';
- $this->db->order_by_column = '';
- $this->db->limit_val = '';
- $this->db->group_by_column = '';
- return $reArray;
- }
- }
- renction get_top_user($type, $count){
- // TYPE: POINT, JOINDATE // COUNT: HOW MANY?
- if($type == 'point'){
- $this->db->order_by_column = 'point DESC';
- }elseif($type == 'joindate'){
- $this->db->order_by_column = 'register_date DESC';
- }
- $this->db->limit_val = $count;
- $tables = array($this->ninja_config['TABLES_PREFIX']."retards_user", $this->ninja_config['TABLES_PREFIX']."users");
- $joins = array($this->ninja_config['TABLES_PREFIX']."retards_user.user_id=".$this->ninja_config['TABLES_PREFIX']."users.id");
- $joinCondition = array("LEFT JOIN");
- $columns = '';
- $userArray = $this->db->dbSelectJoin($tables,$joins,$joinCondition,$columns);
- $this->db->in = '';
- $this->db->order_by_column = '';
- $this->db->limit_val = '';
- $this->db->group_by_column = '';
- return $userArray;
- }
- renction random_re(){
- $this->db->limit_val = '1';
- $this->db->order_by_column = "RAND()";
- $result = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."slug",array("slug"),array("page"=>"display_re"));
- if(count($result) > 0){
- return $result[0]['slug'];
- }else{
- return NULL;
- }
- }
- renction add_point($userid, $point){
- $query = "UPDATE ".$this->ninja_config['TABLES_PREFIX']."retards_user SET point=point+? WHERE user_id = ?";
- $this->db->dbExecuteQuery($query,array($point,$userid));
- if(isset($_SESSION['uId']) && $userid == $_SESSION['uId']){
- unset($_SESSION['thisUser']['point']);
- }
- }
- renction minus_point($userid, $point){
- $query = "UPDATE ".$this->ninja_config['TABLES_PREFIX']."retards_user SET point=point-? WHERE user_id = ?";
- $this->db->dbExecuteQuery($query,array($point,$userid));
- if(isset($_SESSION['uId']) && $userid == $_SESSION['uId']){
- unset($_SESSION['thisUser']['point']);
- }
- }
- renction sendNoti($userid,$content,$href = ''){
- $this->db->dbInsert($this->ninja_config['TABLES_PREFIX']."retards_user_notification",
- array("user_id"=>$userid,"href"=>$href,"content"=>$content,"dateadded"=>date('Y-m-d H:i:s'),"isread"=>"0"));
- //echo $this->db->error_info;
- }
- renction user_comment($userid){
- $this->db->limit_val = '1';
- $result = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."users",
- array('displayname','avatar','username'),
- array("id"=>$userid)
- );
- if(count($result) > 0){
- return $result[0];
- }
- return array();
- //echo $this->db->error_info;
- }
- renction is_comment_exist($id){
- $this->db->limit_val = '1';
- $result = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_comments",
- array('re_id'),
- array("id"=>$id)
- );
- if(count($result) > 0){
- return true;
- }
- return false;
- //echo $this->db->error_info;
- }
- renction is_re_exist($id){
- $this->db->limit_val = '1';
- $result = $this->db->dbSelect($this->ninja_config['TABLES_PREFIX']."retards_re",
- array('f_id'),
- array("f_id"=>$id)
- );
- if(count($result) > 0){
- return true;
- }
- return false;
- //echo $this->db->error_info;
- }
- // CUSTOM reNCTIONS GO HERE
- }
- // outside renction
- $ninja_retards = new ninja_retards($ninja_config);
- $ninja_retards->setLang($lang);
- $ninja_retards->setConfig($retards_config);
- $ninja_retards->setUserConfig($retards_user_config);
- $ninja_retards->setSlug($retards_slug);
- $ninja_retards->setThemeConfig($retards_theme);
- // CHECK IF USER ALREADY HAD A POINT TABLE OR NOT
- if($retards_config['is_user'] == '1' && isset($_SESSION['thisUser'])){
- $ninja->db->limit_val = '1';
- $result = $ninja->db->dbSelect($ninja_config['TABLES_PREFIX']."retards_user",array("user_id"),array("user_id"=>$_SESSION['thisUser']['id']));
- if(count($result) < 1){
- $ninja->db->dbInsert($ninja_config['TABLES_PREFIX']."retards_user",array("user_id"=>$_SESSION['thisUser']['id'],"point"=>"0","badge"=>"{\"\":\"\"}"));
- }
- $_SESSION['pointed'] = 1;
- }
- // CHECK IF THEY HAD RECEIVED DAILY POINTS OR NOT
- if($retards_config['is_user'] == '1' && isset($_SESSION['thisUser'])){
- $ninja->db->limit_val = '1';
- $result = $ninja->db->dbSelect($ninja_config['TABLES_PREFIX']."retards_user_dailypoint",array("user_id"),array("user_id"=>$_SESSION['thisUser']['id'],"day"=>date("z"),"year"=>date("Y")));
- if(count($result) < 1){
- $ninja->db->dbInsert($ninja_config['TABLES_PREFIX']."retards_user_dailypoint",array("user_id"=>$_SESSION['thisUser']['id'],"day"=>date("z"),"year"=>date("Y")));
- $ninja_retards->add_point($_SESSION['thisUser']['id'],$retards_user_config['daily_point']);
- $ninja_retards->sendNoti($_SESSION['thisUser']['id'],sprintf($lang['up_you_earn_daily'], $retards_user_config['daily_point']));
- }
- $_SESSION['dailypointed'] = 1;
- }
- // CHECK AND MERGE USER POINT WITH USER INFO
- if($retards_config['is_user'] == '1' && isset($_SESSION['thisUser'])){
- $ninja->db->limit_val = '1';
- $result = $ninja->db->dbSelect($ninja_config['TABLES_PREFIX']."retards_user",array("point","badge"),array("user_id"=>$_SESSION['thisUser']['id']));
- if(count($result) > 0){
- $_SESSION['thisUser'] = array_merge($result[0], $_SESSION['thisUser']);
- }
- }
- // GET retards CATEGORY FOR FASTER CUSTOMIZATION
- $ninja->db->order_by_column = "order_id ASC, name ASC";
- $ninja->db->limit_val = "";
- $retards_cat_array = $ninja->db->dbSelect($ninja_config['TABLES_PREFIX']."retards_cat",array("name","cat_id"));
- $ninja->db->order_by_column='';
- // JSHINK
- include ROOT_DIR.'/ninja-applications/retards/controllers/JShrink/Minifier.php';
- $min = new Minifier;
- // NEW reNCTIONS
- renction slug($string){
- return strtolower(trim(preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-'));
- }
- renction rank_suffix($number){
- $ends = array('th','st','nd','rd','th','th','th','th','th','th');
- if (($number %100) >= 11 && ($number%100) <= 13) return 'th';
- return $ends[$number % 10];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement