function translate($lang = 'ru') { $config = App; $content = ob_get_contents(); ob_end_clean(); if (self::$active) { self::$locale = self::getAppLocale($lang); preg_match_all(LOCALE_TEMPLATE, $content, $mathes); if (sizeof($mathes[1]) > 0) { foreach ($mathes[1] as $word) { if (array_key_exists($word, self::$locale)) { $content = str_replace(sprintf(LOCALE_TEMPLATE_CHANGE, $word), self::$locale[$word], $content); } } } } if (($selector = Request::post('html_element')) || ($selector = Request::get('html_element'))) { Load::dependence('simple_html_dom'); $html = str_get_html($content); $elements = $html->find($selector); if (sizeof($elements) > 0) { echo $elements[0]->innertext; } else { echo $content; } } else { echo $content; } }
static function sessionSet() { Load::dependence('nodatabase'); $nodatabase = Load::$dependences['nodatabase']; $nodatabase->create('sessions'); self::$session_id = md5(self::ip()); self::createSession(); }
public static function run($event, $data = array(), $iso = 'ru') { $eventList = self::getEventList(); if (!$eventList[$event]) { return false; } $model = connectionNotificationModel::create(); $notification = $model->getEvent($event); Load::dependence('smarty'); $smarty = Load::$dependences['smarty']; foreach ($data as $key => $value) { $smarty->assign($key, $value); } foreach ($notification as $item) { $to = $smarty->fetch('string:' . $item['to']); $title = $smarty->fetch('string:' . $item[$iso]['title']); $content = $smarty->fetch('string:' . $item[$iso]['content']); $headers = "Content-type: text/html; charset=utf-8 \r\n"; $headers .= "From: " . Settings::getValue('admin_email_name', 'connection') . " <" . Settings::getValue('admin_email', 'connection') . ">\r\n"; mail($to, $title, $content, $headers); } }
function __get($name) { return Load::dependence($name); }
static function loadDependences($app_dir) { $file = String::glue($app_dir, DS, APP_CONFIG_DIR, DS, 'dependence.php'); if (File::exist($file)) { $array = (include $file); foreach ($array as $value) { Load::dependence($value); } } }
public function getView() { Load::dependence('smarty'); return Load::dependence('smarty'); }