本文整理汇总了PHP中erLhcoreClassSystem类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassSystem类的具体用法?PHP erLhcoreClassSystem怎么用?PHP erLhcoreClassSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _make_url_embed_image
public static function _make_url_embed_image($matches)
{
$in = $matches[1];
$in = trim($in);
$error = false;
$forumImage = false;
$in = str_replace(' ', '%20', $in);
$inline = ')';
$scheme = '[a-z\\d+\\-.]';
// generated with regex generation file in the develop folder
$exp_url = "[a-z]{$scheme}*:/{2}(?:(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@|]+|%[\\dA-F]{2})+|[0-9.]+|\\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\\])(?::\\d*)?(?:/(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@|]+|%[\\dA-F]{2})*)*(?:\\?(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@/?|]+|%[\\dA-F]{2})*)?(?:\\#(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@/?|]+|%[\\dA-F]{2})*)?";
$inline = ')';
$www_url = "www\\.(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@|]+|%[\\dA-F]{2})+(?::\\d*)?(?:/(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@|]+|%[\\dA-F]{2})*)*(?:\\?(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@/?|]+|%[\\dA-F]{2})*)?(?:\\#(?:[a-z0-9\\-._~!\$&'({$inline}*+,;=:@/?|]+|%[\\dA-F]{2})*)?";
// Localy uploaded photo
$instance = erLhcoreClassSystem::instance();
$instance->wwwDir();
if (preg_match('#^' . $instance->wwwDir() . '/var/forum/[a-zA-Z0-9_\\-.\\/\\\\]*$#i', $in)) {
$forumImage = true;
// Checking urls
} elseif (!preg_match('#^' . $exp_url . '$#i', $in) && !preg_match('#^' . $www_url . '$#i', $in)) {
return '[img]' . $in . '[/img]';
}
// Try to cope with a common user error... not specifying a protocol but only a subdomain
if ($forumImage == false && !preg_match('#^[a-z0-9]+://#i', $in)) {
$in = 'http://' . $in;
}
return "<div class=\"img_embed\"><img src=\"" . htmlspecialchars($in) . "\" alt=\"\" /></div>";
}
示例2: __get
public function __get($variable)
{
switch ($variable) {
case 'data':
$this->data = unserialize($this->value);
return $this->data;
break;
case 'data_value':
$this->data_value = $this->data;
return $this->data_value;
break;
case 'current_value':
switch ($this->type) {
case self::SITE_ACCESS_PARAM_ON:
$this->current_value = null;
if ($this->value != '') {
$this->current_value = isset($this->data[erLhcoreClassSystem::instance()->SiteAccess]) ? $this->data[erLhcoreClassSystem::instance()->SiteAccess] : null;
}
return $this->current_value;
break;
case self::SITE_ACCESS_PARAM_OFF:
$this->current_value = $this->value;
return $this->current_value;
break;
default:
break;
}
$this->data = unserialize($this->value);
return $this->data;
break;
default:
break;
}
}
示例3: getDirLanguage
/**
* This function should be used then value can be override by siteAccess
* or user language has influence to returned value
*
* */
public function getDirLanguage($attribute = 'dir_language')
{
$value = null;
if ($this->hasSetting('site', $attribute)) {
$value = $this->getSetting('site', $attribute);
}
$siteAccess = erLhcoreClassSystem::instance()->SiteAccess;
if ($siteAccess == 'site_admin') {
$valueOverride = $this->getSetting('site_access_options', $siteAccess);
if (key_exists($attribute, $valueOverride)) {
// User has not changed default site access language. So just return current value.
if (erLhcoreClassModelUserSetting::getSetting('user_language', $valueOverride['locale']) == $valueOverride['locale']) {
return $valueOverride[$attribute];
} else {
// User has changed default siteaccess language, we need to check does ltr or rtl matches
foreach ($this->getSetting('site', 'available_site_access') as $siteaccess) {
// Loop untill we find our locate siteaccess and check it's language direction
$siteAccessOptions = $this->getSetting('site_access_options', $siteaccess);
if ($siteAccessOptions['locale'] == erLhcoreClassModelUserSetting::getSetting('user_language', $valueOverride['locale'])) {
return $siteAccessOptions[$attribute];
}
}
}
}
} else {
$value = $this->getOverrideValue('site', $attribute);
}
return $value;
}
示例4: __get
public function __get($param)
{
switch ($param) {
case 'name_support':
return trim($this->name . ' ' . $this->surname);
break;
case 'user_groups_id':
$userGroups = erLhcoreClassModelGroupUser::getList(array('filter' => array('user_id' => $this->id)));
$this->user_groups_id = array();
if (!empty($userGroups)) {
foreach ($userGroups as $userGroup) {
$this->user_groups_id[] = $userGroup->group_id;
}
}
return $this->user_groups_id;
break;
case 'lastactivity':
$db = ezcDbInstance::get();
$stmt = $db->prepare('SELECT last_activity FROM lh_userdep WHERE user_id = :user_id LIMIT 1');
$stmt->bindValue(':user_id', $this->id, PDO::PARAM_INT);
$stmt->execute();
$this->lastactivity = (int) $stmt->fetchColumn();
return $this->lastactivity;
break;
case 'has_photo':
return $this->filename != '';
break;
case 'photo_path':
$this->photo_path = ($this->filepath != '' ? erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir()) . '/' . $this->filepath . $this->filename;
return $this->photo_path;
break;
case 'file_path_server':
return $this->filepath . $this->filename;
break;
case 'lastactivity_front':
$this->lastactivity_front = '';
if ($this->lastactivity > 0) {
$this->lastactivity_front = date(erLhcoreClassModule::$dateDateHourFormat);
}
return $this->lastactivity_front;
break;
case 'lastactivity_ago':
$this->lastactivity_ago = '';
if ($this->lastactivity > 0) {
$periods = array("s.", "m.", "h.", "d.", "w.", "m.", "y.", "dec.");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10");
$difference = time() - $this->lastactivity;
for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) {
$difference /= $lengths[$j];
}
$difference = round($difference);
$this->lastactivity_ago = "{$difference} {$periods[$j]}";
}
return $this->lastactivity_ago;
break;
default:
break;
}
}
示例5: __get
public function __get($var)
{
switch ($var) {
case 'has_file':
return $this->has_file = $this->file_name != '';
break;
case 'file_path_server':
return $this->file_path_server = 'var/' . $this->file_path . $this->file_name;
break;
case 'file_path_dir':
return $this->file_path_server = 'var/' . $this->file_path;
break;
case 'pdftoimg_path':
return $this->pdftoimg_path = 'var/' . $this->file_path . 'img/';
break;
case 'pdf_file_path_server':
return $this->pdf_file_path_server = 'var/' . $this->file_path . $this->pdf_file;
break;
case 'file_name_upload_pdf':
$nameParts = explode('.', $this->file_name_upload);
array_pop($nameParts);
return $this->file_name_upload_pdf = implode('.', $nameParts) . '.pdf';
break;
case 'pages_pdf':
$this->pages_pdf = array();
if ($this->pages_pdf_count) {
$links = array();
$i = 1;
while ($i <= $this->pages_pdf_count) {
$links[] = $this->pdftoimg_path . $this->id . '-' . $i . '.png';
$i++;
}
$this->pages_pdf = $links;
}
return $this->pages_pdf;
break;
case 'pdftoimg_url_path':
return $this->pdftoimg_url_path = erLhcoreClassSystem::instance()->wwwDir() . '/var/' . $this->file_path . 'img/';
break;
case 'pages_pdf_url':
$this->pages_pdf_url = array();
if ($this->pages_pdf_count) {
$baseDir = erLhcoreClassSystem::instance()->wwwDir();
foreach ($this->pages_pdf as $img) {
$this->pages_pdf_url[] = $baseDir . '/' . $img;
}
}
return $this->pages_pdf_url;
break;
case 'book_data':
return array('baseImagesDesgin' => erLhcoreClassDesign::design('images/BookReader/images') . '/', 'baseImg' => $this->id . '-', 'numLeafs' => $this->pages_pdf_count, 'bookTitle' => $this->name, 'urlPath' => $this->pdftoimg_url_path);
break;
default:
break;
}
}
示例6: setChatLanguages
/**
* Set's chat language
*
* Detects chats languages, operator and visitor and translates recent chat messages
*
* @param erLhcoreClassModelChat $chat
*
* @param string $visitorLanguage | Optional
*
* @param string $operatorLanguage | Optional
*
* @return void || Exception
* */
public static function setChatLanguages(erLhcoreClassModelChat $chat, $visitorLanguage, $operatorLanguage)
{
$originalLanguages = array('chat_locale' => $chat->chat_locale, 'chat_locale_to' => $chat->chat_locale_to);
$supportedLanguages = self::getSupportedLanguages(true);
$db = ezcDbInstance::get();
$data = array();
if (key_exists($visitorLanguage, $supportedLanguages)) {
$chat->chat_locale = $data['chat_locale'] = $visitorLanguage;
} else {
// We take few first messages from visitor and try to detect language
$stmt = $db->prepare('SELECT msg FROM lh_msg WHERE chat_id = :chat_id AND user_id = 0 ORDER BY id ASC LIMIT 3 OFFSET 0');
$stmt->bindValue(':chat_id', $chat->id);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_COLUMN);
foreach ($rows as &$row) {
$row = preg_replace('#\\[translation\\](.*?)\\[/translation\\]#is', '', $row);
}
$msgText = substr(implode("\n", $rows), 0, 500);
$languageCode = self::detectLanguage($msgText);
$chat->chat_locale = $data['chat_locale'] = $languageCode;
}
if (key_exists($operatorLanguage, $supportedLanguages)) {
$chat->chat_locale_to = $data['chat_locale_to'] = $operatorLanguage;
} else {
// We need to detect opetator language, basically we just take back office language and try to find a match
$languageCode = substr(erLhcoreClassSystem::instance()->Language, 0, 2);
if (key_exists($languageCode, $supportedLanguages)) {
$chat->chat_locale_to = $data['chat_locale_to'] = $languageCode;
} else {
throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'We could not detect operator language'));
}
}
if ($chat->chat_locale == $chat->chat_locale_to) {
throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/translation', 'Detected operator and visitor languages matches, please choose languages manually'));
}
// Because chat data can be already be changed we modify just required fields
$stmt = $db->prepare('UPDATE lh_chat SET chat_locale_to = :chat_locale_to, chat_locale =:chat_locale WHERE id = :chat_id');
$stmt->bindValue(':chat_id', $chat->id, PDO::PARAM_INT);
$stmt->bindValue(':chat_locale_to', $data['chat_locale_to'], PDO::PARAM_STR);
$stmt->bindValue(':chat_locale', $data['chat_locale'], PDO::PARAM_STR);
$stmt->execute();
// We have to translate only if our languages are different
if ($originalLanguages['chat_locale'] != $chat->chat_locale || $originalLanguages['chat_locale_to'] != $chat->chat_locale_to) {
// And now we can translate all chat messages
self::translateChatMessages($chat);
}
return $data;
}
示例7: createCustomer
public static function createCustomer($instance)
{
$originalSiteAccess = erLhcoreClassSystem::instance()->SiteAccess;
if ($instance->locale != '') {
erLhcoreClassSystem::instance()->setSiteAccessByLocale($instance->locale);
}
$password = erLhcoreClassModelForgotPassword::randomPassword(10);
$chat_box_hash = erLhcoreClassModelForgotPassword::randomPassword(10);
$searchArray = array('{email_replace}', '{password_hash}', '{export_hash_chats}', '{chat_box_hash}', '{chat_box_hash_length}');
$cfg = erConfigClassLhConfig::getInstance();
$replaceArray = array($instance->email, sha1($password . $cfg->getSetting('site', 'secrethash') . sha1($password)), erLhcoreClassModelForgotPassword::randomPassword(10), $chat_box_hash, strlen($chat_box_hash));
$db = ezcDbInstance::get();
self::deleteDatabase($instance->id);
self::createDatabase($instance->id);
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . $instance->id);
$sql = file_get_contents('extension/instance/doc/db_3.sql');
$sql = str_replace($searchArray, $replaceArray, $sql);
$db->query($sql);
$dbPostUpdate = ltrim(erLhcoreClassDesign::design('db_post_update/db.sql'), '/');
if (file_exists($dbPostUpdate)) {
$db->query(file_get_contents($dbPostUpdate));
}
// Insert default user language
if ($instance->locale != '') {
$stm = $db->prepare("INSERT INTO `lh_users_setting` (`user_id`, `identifier`, `value`) VALUES (1,'user_language',:value)");
$stm->bindValue(':value', $instance->locale);
$stm->execute();
} else {
$stm = $db->prepare("INSERT INTO `lh_users_setting` (`user_id`, `identifier`, `value`) VALUES (1,'user_language',:value)");
$stm->bindValue(':value', 'en_EN');
$stm->execute();
}
$tpl = erLhcoreClassTemplate::getInstance('lhinstance/email.tpl.php');
$tpl->setArray(array('instance' => $instance, 'email' => $instance->email, 'password' => $password));
$mail = new PHPMailer();
$mail->CharSet = 'UTF-8';
$mail->Sender = $mail->From = $cfg->getSetting('site', 'seller_mail');
$mail->FromName = $cfg->getSetting('site', 'seller_title');
$mail->Subject = $cfg->getSetting('site', 'seller_title');
$mail->AddReplyTo($cfg->getSetting('site', 'seller_mail'), $cfg->getSetting('site', 'seller_title'));
$mail->Body = $tpl->fetch();
$mail->AddAddress($instance->email);
erLhcoreClassChatMail::setupSMTP($mail);
$mail->Send();
$mail->ClearAddresses();
// Dispatch event for listeners
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.registered.created', array('instance' => $instance));
$db->query('USE ' . $cfg->getSetting('db', 'database'));
// Activate instance
$sql = "UPDATE lhc_instance_client SET status = 1 WHERE id = {$instance->id}";
$db->query($sql);
if ($instance->locale != '') {
erLhcoreClassSystem::instance()->setSiteAccess($originalSiteAccess);
}
}
示例8: array
if ($form->hasValidData('module') && $form->module != '') {
$input->module = $form->module;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Please enter module name');
}
if ($form->hasValidData('view') && $form->view != '') {
$input->view = $form->view;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Please enter view name');
}
if (empty($Errors)) {
erLhcoreClassSiteaccessGenerator::updateSiteAccess($input);
// Clean cache
$CacheManager = erConfigClassLhCacheConfig::getInstance();
$CacheManager->expireCache();
// Redirect for change to take effect
erLhcoreClassModule::redirect('system/languages', '/(updated)/true/(sa)/' . $input->siteaccess);
exit;
} else {
$tpl->set('errors', $Errors);
}
}
}
$cfgSite = erConfigClassLhConfig::getInstance();
$tpl->set('locales', $cfgSite->getSetting('site', 'available_site_access'));
$tpl->set('current_site_access', erLhcoreClassSystem::instance()->SiteAccess);
$tpl->set('input', $input);
$tpl->set('currentUser', $currentUser);
$tpl->set('tab', $tab);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Languages configuration')));
示例9: closeChatCallback
public static function closeChatCallback($chat, $operator = false)
{
$extensions = erConfigClassLhConfig::getInstance()->getSetting('site', 'extensions');
$instance = erLhcoreClassSystem::instance();
foreach ($extensions as $ext) {
$callbackFile = $instance->SiteDir . '/extension/' . $ext . '/callbacks/close_chat.php';
if (file_exists($callbackFile)) {
include $callbackFile;
}
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.close', array('chat' => &$chat, 'user_data' => $operator));
if (($dep = $chat->department) !== false && $dep->inform_close == 1) {
erLhcoreClassChatMail::informChatClosed($chat, $operator);
}
}
示例10: processProActiveInvitation
public static function processProActiveInvitation(erLhcoreClassModelChatOnlineUser &$item, $params = array())
{
$referrer = self::getHost($item->referrer);
$session = erLhcoreClassAbstract::getSession();
$appendTag = '';
$q = $session->createFindQuery('erLhAbstractModelProactiveChatInvitation');
if (isset($params['tag']) && $params['tag'] != '') {
$appendTag = 'AND (' . $q->expr->eq('tag', $q->bindValue($params['tag'])) . ' OR tag = \'\')';
} else {
$appendTag = 'AND (tag = \'\')';
}
$q->where($q->expr->lte('time_on_site', $q->bindValue($item->time_on_site)) . ' AND ' . $q->expr->lte('pageviews', $q->bindValue($item->pages_count)) . '
AND (' . $q->expr->eq('siteaccess', $q->bindValue(erLhcoreClassSystem::instance()->SiteAccess)) . ' OR siteaccess = \'\')
AND (' . $q->expr->eq('identifier', $q->bindValue($item->identifier)) . ' OR identifier = \'\')
' . $appendTag . '
AND (' . $q->expr->eq('dep_id', $q->bindValue($item->dep_id)) . ' OR dep_id = 0)
AND (' . $q->expr->like($session->database->quote(trim($referrer)), 'concat(referrer,\'%\')') . ' OR referrer = \'\')')->orderBy('position ASC')->limit(1);
$messagesToUser = $session->find($q);
if (!empty($messagesToUser)) {
$message = array_shift($messagesToUser);
// Use default message if first time visit or returning message is empty
if ($item->total_visits == 1 || $message->message_returning == '') {
$item->operator_message = $message->message;
} else {
if ($item->chat !== false && $item->chat->nick != '') {
$nick = $item->chat->nick;
} elseif ($message->message_returning_nick != '') {
$nick = $message->message_returning_nick;
} else {
$nick = '';
}
$item->operator_message = str_replace('{nick}', $nick, $message->message_returning);
}
$item->operator_user_proactive = $message->operator_name;
$item->invitation_id = $message->id;
$item->invitation_seen_count = 0;
$item->requires_email = $message->requires_email;
$item->requires_username = $message->requires_username;
$item->requires_phone = $message->requires_phone;
$item->invitation_count++;
$item->store_chat = true;
$item->invitation_assigned = true;
$item->last_visit = time();
if ($message->show_random_operator == 1) {
$item->operator_user_id = erLhcoreClassChat::getRandomOnlineUserID(array('operators' => explode(',', trim($message->operator_ids))));
}
$message->executed_times += 1;
$message->updateThis();
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('onlineuser.proactive_triggered', array('message' => &$message, 'ou' => &$item));
}
}
示例11: processAutoResponder
public static function processAutoResponder(erLhcoreClassModelChat $chat)
{
$session = erLhcoreClassAbstract::getSession();
$q = $session->createFindQuery('erLhAbstractModelAutoResponder');
$q->where('(' . $q->expr->eq('siteaccess', $q->bindValue(erLhcoreClassSystem::instance()->SiteAccess)) . ' OR siteaccess = \'\') AND (' . $q->expr->eq('dep_id', $q->bindValue($chat->dep_id)) . ' OR dep_id = 0)')->orderBy('position ASC')->limit(1);
$messagesToUser = $session->find($q);
if (!empty($messagesToUser)) {
$message = array_shift($messagesToUser);
return $message;
}
return false;
}
示例12: flush
// Redirect user
erLhcoreClassModule::redirect('chat/chatwidgetchat', '/' . $chat->id . '/' . $chat->hash . $modeAppend . '/(cstarted)/online_chat_started_cb');
flush();
session_write_close();
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_started', array('chat' => &$chat));
exit;
}
} else {
// Show errors only if user is not switching form mode and not swithing language
if ($Params['user_parameters_unordered']['switchform'] != 'true' && !isset($_POST['switchLang'])) {
$tpl->set('errors', $Errors);
} elseif (isset($_POST['switchLang'])) {
$Result['additional_post_message'] = 'lhc_lang:' . erLhcoreClassSystem::instance()->WWWDirLang;
}
}
}
$tpl->set('start_data_fields', $startDataFields);
$definition = array('name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'value' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY), 'type' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'size' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'req' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'sh' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY), 'hattr' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY));
$form = new ezcInputForm(INPUT_GET, $definition);
if ($form->hasValidData('name') && !empty($form->name)) {
$inputData->name_items = $form->name;
}
if ($form->hasValidData('value') && !empty($form->value)) {
$inputData->value_items = $form->value;
}
if ($form->hasValidData('hattr') && !empty($form->hattr)) {
$inputData->hattr = $form->hattr;
}
示例13: foreach
<form action="<?php
echo erLhcoreClassDesign::baseurl('system/languages');
?>
" method="post">
<?php
include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
?>
<div class="form-group">
<label><?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/languages', 'Language');
?>
</label>
<select name="language" class="form-control">
<?php
$userLanguage = erLhcoreClassModelUserSetting::getSetting('user_language', erLhcoreClassSystem::instance()->Language);
foreach (erLhcoreClassSiteaccessGenerator::getLanguages() as $language) {
?>
<option value="<?php
echo $language['locale'];
?>
" <?php
$userLanguage == $language['locale'] ? print 'selected="selected"' : '';
?>
><?php
echo $language['locale'];
?>
</option>
<?php
}
?>
示例14: fetch
/**
* Open, parse, and return the template file.
*
* @param $file string the template file name
*/
function fetch($fileTemplate = null)
{
$instance = erLhcoreClassSystem::instance();
$port = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 80;
if (!$fileTemplate) {
$fileTemplate = $this->file;
}
if ($this->cacheEnabled == true && key_exists(md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port), $this->cacheTemplates)) {
try {
return $this->fetchExecute($this->cacheTemplates[md5($fileTemplate . $instance->WWWDirLang . $instance->Language . $port)]);
} catch (Exception $e) {
}
}
$cfg = erConfigClassLhConfig::getInstance();
$file = erLhcoreClassDesign::designtpl($fileTemplate);
if ($this->templatecompile == true) {
$contentFile = php_strip_whitespace($file);
// Compile templates - 3 level of inclusions
for ($i = 0; $i < 9; $i++) {
$Matches = array();
preg_match_all('/<\\?php(\\s*)include_once\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[2] as $key => $Match) {
$contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
}
//Compile templates inclusions first level.
$Matches = array();
preg_match_all('/<\\?php(\\s*)include\\(erLhcoreClassDesign::designtpl\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[2] as $key => $Match) {
$contentFile = str_replace($Matches[0][$key], php_strip_whitespace(erLhcoreClassDesign::designtpl($Match)), $contentFile);
}
}
//Compile image css paths. Etc..
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::design\\(\'([a-zA-Z0-9-\\.-\\/\\_]+)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $Match) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::design($Match), $contentFile);
}
//Compile translations, pure translations
$Matches = array();
preg_match_all('/<\\?php echo erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $TranslateContent) {
$contentFile = str_replace($Matches[0][$key], erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]), $contentFile);
}
//Translations used in logical conditions
$Matches = array();
preg_match_all('/erTranslationClassLhTranslation::getInstance\\(\\)->getTranslation\\(\'(.*?)\',\'(.*?)\'\\)/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $TranslateContent) {
$contentFile = str_replace($Matches[0][$key], '\'' . erTranslationClassLhTranslation::getInstance()->getTranslation($TranslateContent, $Matches[2][$key]) . '\'', $contentFile);
}
// Compile url addresses
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurl\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')), $contentFile);
}
// Compile url direct addresses
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurldirect\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')), $contentFile);
}
// Compile url direct addresses
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::baseurlsite\\(\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::baseurlsite(), $contentFile);
}
// Compile css url addresses
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::designCSS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designCSS(trim($UrlAddress, '\'')), $contentFile);
}
// Compile css url addresses
$Matches = array();
preg_match_all('/<\\?php echo erLhcoreClassDesign::designJS\\((.*?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], erLhcoreClassDesign::designJS(trim($UrlAddress, '\'')), $contentFile);
}
// Compile url addresses in logical operations
$Matches = array();
preg_match_all('/erLhcoreClassDesign::baseurl\\((.*?)\\)/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurl(trim($UrlAddress, '\'')) . '\'', $contentFile);
}
// Compile url addresses in logical operations
$Matches = array();
preg_match_all('/erLhcoreClassDesign::baseurldirect\\((.*?)\\)/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
$contentFile = str_replace($Matches[0][$key], '\'' . erLhcoreClassDesign::baseurldirect(trim($UrlAddress, '\'')) . '\'', $contentFile);
}
// Compile config settings, direct output
$Matches = array();
preg_match_all('/<\\?php echo erConfigClassLhConfig::getInstance\\(\\)->getSetting\\((\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?),(\\s?)\'([a-zA-Z0-9-\\.-\\/\\_]+)\'(\\s?)\\)(.*?)\\?\\>/i', $contentFile, $Matches);
foreach ($Matches[1] as $key => $UrlAddress) {
//.........这里部分代码省略.........
示例15: dirname
{
ezcBase::autoload($className);
}
ezcBase::addClassRepository(dirname(__FILE__) . '/', dirname(__FILE__) . '/lib/autoloads');
$input = new ezcConsoleInput();
$helpOption = $input->registerOption(new ezcConsoleOption('s', 'siteaccess', ezcConsoleInput::TYPE_STRING));
$cronjobPartOption = $input->registerOption(new ezcConsoleOption('c', 'cronjob', ezcConsoleInput::TYPE_STRING));
$cronjobPathOption = $input->registerOption(new ezcConsoleOption('p', 'path', ezcConsoleInput::TYPE_STRING));
$extensionPartOption = $input->registerOption(new ezcConsoleOption('e', 'extension', ezcConsoleInput::TYPE_STRING));
try {
$input->process();
} catch (ezcConsoleOptionException $e) {
die($e->getMessage());
}
ezcBaseInit::setCallback('ezcInitDatabaseInstance', 'erLhcoreClassLazyDatabaseConfiguration');
$instance = erLhcoreClassSystem::instance();
$instance->SiteAccess = $helpOption->value;
$instance->SiteDir = dirname(__FILE__) . '/';
$cfgSite = erConfigClassLhConfig::getInstance();
$defaultSiteAccess = $cfgSite->getSetting('site', 'default_site_access');
$optionsSiteAccess = $cfgSite->getSetting('site_access_options', $helpOption->value);
$instance->Language = $optionsSiteAccess['locale'];
$instance->ThemeSite = $optionsSiteAccess['theme'];
$instance->WWWDirLang = '/' . $helpOption->value;
// php cron.php -s site_admin -c cron/workflow
// php cron.php -s site_admin -e customstatus -c cron/customcron
if ($extensionPartOption->value) {
include_once 'extension/' . $extensionPartOption->value . '/modules/lh' . $cronjobPartOption->value . '.php';
} else {
include_once 'modules/lh' . $cronjobPartOption->value . '.php';
}