PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
<?php function getIndex($data, $index, $default = '', $type = 'string') { $value = $default; if (isset($data->$index)) { $value = $data->$index; } elseif (is_array($data) && isset($data[ $index ])) { $value = $data[ $index ]; } if ($type == 'array') { $value = (array) $value; } elseif ($type == 'boolean') { if ($value === 'true' || $value === '1' || $value === 1 || $value === true) { $value = true; } elseif ($value === 'false' || $value === '0' || $value === 0 || $value == false) { $value = false; } else { $value = (bool) $default; } } elseif ($type == 'int') { $value = (int) $value; } return $value; } function startsWith($haystack, $needle) { $length = strlen($needle); return (substr($haystack, 0, $length) === $needle); } function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } function format($format, $args) { //print_r($args); //echo $format; //preg_match_all('/(?=\s)\{(\d+)\}(?!\s)/', $format, $matches, PREG_OFFSET_CAPTURE); preg_match_all('!\d+!', $format, $matches, PREG_OFFSET_CAPTURE); $offset = 0; //print_r($matches); foreach ($matches[0] as $data) { $i = $data[0]; if (!isset($args[$i - 1])) { continue; } $format = substr_replace($format, $args[$i - 1], $offset + $data[1], strlen($i)); //echo '<br/>'.( $data[1] ).'<br/>'; //echo '<br/>'.($offset + $data[1] ).'<br/>'; $offset += strlen($args[$i - 1]) - strlen($i); //echo '<br/>'.$format.'<br/>'; //echo $offset.'<br/>'; //print_r(@$args[$i]); } return $format; } function module($id, $data = null) { if (is_null($data)) { $json_path = Yii::app()->site->model->getFilePath('module_data', $id, '.json'); if (file_exists($json_path)) { $content = file_get_contents($json_path); $data = json_decode($content, true); } else $data = array(); } if (!is_null($data)) { $className = 'CWidget'.ucwords($data['type']); Yii::app()->controller->widget('application.widgets.modules.'.$className, array( 'page_id' => $id, 'data' => $data, )); } } function includeViewFile($name, $arr = array(), $return = false,$view_path='application.views') { // $view_path = 'site.views'; $path = Yii::getPathOfAlias($view_path); //echo $view_path; $view_file = ''; if (file_exists($path.DIRECTORY_SEPARATOR.$name.'.php')) { $view_file = $path.DIRECTORY_SEPARATOR.$name.'.php'; } else { $view_path = 'application.widgets.views.modules'; $path = Yii::getPathOfAlias($view_path); if (file_exists($path.DIRECTORY_SEPARATOR.$name.'.php')) { $view_file = $path.DIRECTORY_SEPARATOR.$name.'.php'; } } if (strlen($view_file)) { if (!$return) { if (isset($arr)) { extract($arr); } include $view_file; } else { ob_start(); if (isset($arr)) { extract($arr); } include $view_file; $content = ob_get_clean(); return $content; } } return ''; } function compileContent($content, $data, $type, $return = true) { $i = 0; $compiledCode = ''; while ($i < strlen($content)) { $char = $content[ $i ]; if ($char == '{') { ++$i; $module = ''; while ($content[$i] != '}') { $module .= $content[$i]; ++$i; } if ($type == 'news') { //echo $module.' '; $compiledCode .= renderNewsModule($module, $data['id'], true); } } elseif ($char == '}') { continue; } else { $compiledCode .= $char; } //$compiledCode .= $char; ++$i; } if (!$return) { echo $compiledCode; } else { return $compiledCode; } } function term($key, $return = true) { if ($return) { return Yii::app()->lang->t($key); } echo Yii::app()->lang->t($key); } function config($key, $default = '') { $k = $default; if (defined($key)) { $k = constant($key); } return $k; } function split_name($name) { $results = array(); $r = explode(' ', $name); $size = count($r); //check first for period, assume salutation if so if (mb_strpos($r[0], '.') === false) { $results['salutation'] = ''; $results['first'] = $r[0]; } else { $results['salutation'] = $r[0]; $results['first'] = $r[1]; } //check last for period, assume suffix if so if (mb_strpos($r[$size - 1], '.') === false) { $results['suffix'] = ''; } else { $results['suffix'] = $r[$size - 1]; } //combine remains into last $start = ($results['salutation']) ? 2 : 1; $end = ($results['suffix']) ? $size - 2 : $size - 1; $last = ''; for ($i = $start; $i <= $end; ++$i) { $last .= ' '.$r[$i]; } $results['last'] = trim($last); return $results; } function getNewsCategoriesText($item) { global $db; $cat = $item->main_category; $rs = term('TEXT_NO_CATEGORY', true); if (isset($cat)) { $rs = $cat['name']; return $rs; } return $rs; } function getNewsCommnentCount($item) { return $item->comment_count; } function getShortMonth($date) { global $language; $months_en = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $months_vi = array('T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12'); $months = $months_en; if ($language === 'vi') { $months = $months_vi; } return $months[ $date->format('n') - 1 ]; } function shuffle_assoc(&$array) { $keys = array_keys($array); shuffle($keys); foreach ($keys as $key) { $new[$key] = $array[$key]; } $array = $new; return true; } function check_password_length($value) { $length = Configuration::get('USER_REGISTER_PASSWORD_MIN_LENGTH'); if ($length === false) { $length = 0; } return strlen($value) >= $length; }
[+]
..
[+]
php-jwt
[-] Blowfish.php
[edit]
[+]
socialEmbed
[+]
mailchimp
[+]
swiftMailer
[-] CMS_Rewrite.php
[edit]
[+]
hosting
[-] general.php
[edit]
[-] ScreenShot.php
[edit]
[-] UrlManager.php
[edit]
[+]
payments
[-] Configuration.php
[edit]
[+]
twig-renderer-master
[-] Functions.php
[edit]
[+]
twig
[+]
addons
[+]
hoauth
[-] package.xml
[edit]
[-] PController.php
[edit]
[-] ETwigViewRenderer.php
[edit]
[+]
htmlpurifier
[-] Randomness.php
[edit]
[-] CSSParser.php
[edit]
[-] Mail.php
[edit]
[-] Rijndael.php
[edit]
[+]
components
[+]
rss
[-] WebApplication.php
[edit]
[-] passwordhash.php
[edit]
[-] DLDatabaseHelper.php
[edit]
[+]
Exceptions