本文整理汇总了PHP中SJB_System::executeFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_System::executeFunction方法的具体用法?PHP SJB_System::executeFunction怎么用?PHP SJB_System::executeFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_System
的用法示例。
在下文中一共展示了SJB_System::executeFunction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPage
/**
*
* @param SJB_PageConfig $page_config
*/
public static function getPage($page_config)
{
SJB_System::setPageTitle($page_config->getPageTitle());
SJB_System::setGlobalTemplateVariable('user_page_uri', $page_config->getPageUri());
SJB_System::setPageKeywords($page_config->getPageKeywords());
SJB_System::setPageDescription($page_config->getPageDescription());
if ($page_config->getMainContentFunction() == 'add_listing') {
$passed_parameters_via_uri = SJB_Request::getVar('passed_parameters_via_uri', false);
if ($passed_parameters_via_uri) {
$passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
if (isset($passed_parameters_via_uri[2])) {
$page_config->setMainContentFunction('add_listing_step');
}
}
}
$maincontent = SJB_System::executeFunction($page_config->getMainContentModule(), $page_config->getMainContentFunction(), $page_config->getParameters(), $page_config->getPageUri());
if ($page_config->hasRawOutput()) {
return $maincontent;
}
$page_templates_set_name = SJB_System::getSystemSettings('PAGE_TEMPLATES_MODULE_NAME');
$template_supplier = new SJB_TemplateSupplier($page_templates_set_name);
$tp = new SJB_TemplateProcessor($template_supplier);
// assign 'highlight_templates' variable to main or index template
if (SJB_Settings::getSettingByName('highlight_templates') == 1 && SJB_Request::getVar('admin_mode', false, 'COOKIE')) {
$tp->assign('highlight_templates', true);
}
if ($errors = SJB_Error::getErrorContent()) {
SJB_FlashMessages::getInstance()->addWarning($errors);
}
$tp->assign('MAIN_CONTENT', $maincontent);
$tp->registerGlobalVariables();
$tp->assign('sjb_version', SJB_System::getSystemSettings('SJB_VERSION'));
$template = $page_config->getPageTemplate();
$template_supplier->addContainerTemplate($template);
if (SJB_Request::isAjax()) {
$template = SJB_System::getSettingByName('default_page_template_by_http');
} elseif (SJB_FormBuilderManager::getIfBuilderModeIsSet()) {
$template = 'index_b.tpl';
} else {
if (empty($template)) {
$template = SJB_Settings::getSettingByName('DEFAULT_PAGE_TEMPLATE');
}
}
return $tp->fetch($template);
}
示例2: execute
public function execute()
{
$template_processor = SJB_System::getTemplateProcessor();
$template_editor = new SJB_TemplateEditor();
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : "";
if (!$template_editor->doesModuleTemplateExists(SJB_System::getSystemSettings('STARTUP_MODULE'), $template_name)) {
$template_name = '';
}
if (!empty($template_name)) {
$menu_path = array(array('reference' => "?", 'name' => 'Page Templates'), array('name' => $template_name, 'reference' => ""));
$template_processor->assign("navigation", $menu_path);
$template_processor->assign("title", "Page Template: {$template_name}");
$template_processor->display('navigation_menu.tpl');
echo SJB_System::executeFunction("template_manager", "edit_template", array('module_name' => System::getSystemSettings('STARTUP_MODULE')));
} else {
$menu_path = array(array('reference' => "", 'name' => 'Page Templates'));
$template_processor->assign("navigation", $menu_path);
$template_processor->assign("title", 'Page Templates');
$template_processor->display('navigation_menu.tpl');
echo SJB_System::executeFunction("template_manager", "page_template_list");
}
}
示例3: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$module_name = SJB_Request::getVar('module_name', "", 'GET');
$template_name = SJB_Request::getVar('template_name', "", 'GET');
// не работало с юзерской
if (empty($template_name)) {
$template_name = SJB_Request::getVar('template_name', '');
}
if (empty($module_name)) {
$module_name = SJB_Request::getVar('module_name', '');
}
$theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
$template_editor = new SJB_TemplateEditor();
$simple_view = SJB_Request::getVar('simple_view');
if (!$template_editor->doesModuleExists($module_name)) {
$tp->assign('ERROR', "MODULE_DOES_NOT_EXIST");
} else {
if (!$template_editor->doesModuleTemplateExists($module_name, $template_name)) {
$tp->assign('ERROR', "TEMPLATE_DOES_NOT_EXIST");
} else {
if (isset($_REQUEST['action'])) {
$content = SJB_Request::getVar('template_content');
if ($content) {
if (SJB_System::getSystemSettings("isDemo")) {
$tp->assign('ERROR', 'NOT_ALLOWED_IN_DEMO');
} elseif (SJB_System::getIfTrialModeIsOn() && SJB_HelperFunctions::findSmartyRestrictedTagsInContent($tp, $content)) {
$tp->assign('ERROR', 'Php tags are not allowed');
} else {
$result = $template_editor->saveTemplate($template_name, $module_name, $theme, $content);
// if ajax request to save
if ($simple_view) {
if ($result) {
echo '<p class="message">Template saved successfully. </p>';
} else {
echo "ERROR WHILE SAVE TEMPLATE";
}
exit;
}
if ($_REQUEST['action'] == "save_template") {
SJB_HelperFunctions::redirect("?module_name=" . $module_name);
}
}
}
}
echo SJB_System::executeFunction('template_manager', 'add_template');
$modules = $template_editor->getModuleWithTemplatesList();
$tp->assign('module_name', $module_name);
$tp->assign('template_name', $template_name);
$tp->assign('theme', $theme);
$tp->assign('display_name', $modules[$module_name]['display_name']);
$tp->assign('template_display_name', $template_name);
$path_to_template = SJB_TemplatePathManager::getAbsoluteTemplatePath($theme, $module_name, $template_name);
if (!file_exists($path_to_template)) {
$theme = SJB_System::getSystemSettings('SYSTEM_TEMPLATE_DIR');
}
if (false === ($template_content = $template_editor->loadTemplate($template_name, $module_name, $theme))) {
$tp->assign('ERROR', "CANNOT_FETCH_TEMPLATE");
} else {
if (!$template_editor->isTemplateWriteable($module_name, $theme, $template_name) && !SJB_System::getSystemSettings("isDemo")) {
$tp->assign('ERROR', "TEMPLATE_IS_NOT_WRITEABLE");
} else {
$tp->assign('template_content', $template_content);
}
}
$list_modules = SJB_System::getModulesUserList();
$list_functions = array();
$list_params = array();
foreach ($list_modules as $module) {
$functions = SJB_System::getFunctionsUserList($module);
foreach ($functions as $keyF => $func) {
$list_functions[$module][$keyF] = $func;
$params = SJB_System::getParamsList($module, $func);
if (isset($params[0])) {
foreach ($params as $keyP => $param) {
$list_params[$module][$func][$keyP] = $param;
}
}
}
}
$tp->assign('LIST_MODULES', $list_modules);
$tp->assign('LIST_FUNCTIONS', $list_functions);
$tp->assign('LIST_PARAMS', $list_params);
}
}
if ($simple_view) {
$tp->display('edit_template_simple.tpl');
} else {
header('X-XSS-Protection: 0');
$tp->display('edit_template.tpl');
}
}
示例4: execute
public function execute()
{
$errors = array();
$tp = SJB_System::getTemplateProcessor();
$i18n = SJB_I18N::getInstance();
$lang = $i18n->getLanguageData($i18n->getCurrentLanguage());
$langId = $lang['id'];
// Category SID incoming as part of URL.
$categoryId = SJB_Request::getVar("category_sid");
if (isset($_REQUEST['passed_parameters_via_uri'])) {
$passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
$categoryId = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : null;
}
if ($categoryId && $categoryId != 'category') {
$article = false;
if (is_null($categoryId)) {
$errors['ITEM_SID_IS_EMPTY'] = 1;
} else {
$article = SJB_NewsManager::getActiveItemBySID($categoryId);
}
if (!$article) {
$errors['ARTICLE_NOT_EXISTS'] = 1;
echo SJB_System::executeFunction('static_content', 'show_static_content', array('pageid' => '404'));
return;
}
$tp->assign('article', $article);
$template = 'article_details.tpl';
} else {
$categoryId = isset($passed_parameters_via_uri[1]) ? $passed_parameters_via_uri[1] : null;
// other params in query string
$searchText = SJB_Request::getVar('search_text', false);
$current_page = SJB_Request::getVar('page', 1);
$itemsPerPage = 10;
$action = SJB_Request::getVar('action');
if ($action == 'search') {
// COUNT FOR SEARCH ACTION
$totalNews = SJB_NewsManager::getAllNewsCountBySearchText($searchText, $langId, true);
} else {
$totalNews = SJB_NewsManager::getAllNewsCount($categoryId, $langId, true);
}
$pages = ceil($totalNews / $itemsPerPage);
if ($pages == 0) {
$pages = 1;
}
if ($current_page > $pages) {
$current_page = $pages;
}
if ($action == 'search') {
// GET ARTICLES FOR SEARCH ACTION
if ($totalNews == 0) {
$articles = array();
} else {
$articles = SJB_NewsManager::searchArticles($searchText, $langId, true);
}
} else {
$articles = SJB_NewsManager::getNewsByPage($current_page, $itemsPerPage, $categoryId, $langId, true);
}
$tp->assign('searchText', $searchText);
$tp->assign('current_page', $current_page);
$tp->assign('pages', $pages);
$tp->assign('articles', $articles);
$categories = SJB_NewsManager::getCategories($langId);
$countOfNotEmptyCategories = 0;
foreach ($categories as $category) {
if ($category['count'] > 0) {
$countOfNotEmptyCategories++;
}
}
$showCategoriesBlock = false;
if ($countOfNotEmptyCategories > 1) {
$showCategoriesBlock = true;
}
$tp->assign('show_categories_block', $showCategoriesBlock);
$tp->assign('categories', $categories);
$tp->assign('current_category_sid', $categoryId);
$template = 'articles_list.tpl';
}
$tp->display($template);
}
示例5: module
function module($params)
{
$name = isset($params['name']) ? $params['name'] : '';
$function = isset($params['function']) ? $params['function'] : '';
unset($params['name']);
unset($params['function']);
if (empty($name) || empty($function)) {
return '<!-- Either module or function is not specified in call to {module ..} -->';
}
return SJB_System::executeFunction($name, $function, $params);
}
示例6: runTaskScheduler
//.........这里部分代码省略.........
$productInfo = SJB_ProductsManager::getProductInfoBySID($contractInfo['product_sid']);
$userInfo = SJB_UserManager::getUserInfoBySID($contractInfo['user_sid']);
$serializedExtraInfo = unserialize($contractInfo['serialized_extra_info']);
if (!empty($serializedExtraInfo['featured_profile']) && !empty($userInfo['featured'])) {
$contracts = SJB_ContractManager::getAllContractsInfoByUserSID($userInfo['sid']);
$isFeatured = 0;
foreach ($contracts as $contract) {
if ($contract['id'] != $contractExpiredID) {
$serializedExtraInfo = unserialize($contract['serialized_extra_info']);
if (!empty($serializedExtraInfo['featured'])) {
$isFeatured = 1;
}
}
}
if (!$isFeatured) {
SJB_UserManager::removeFromFeaturedBySID($userInfo['sid']);
}
}
if (SJB_UserNotificationsManager::isUserNotifiedOnContractExpiration($contractInfo['user_sid'])) {
SJB_Notifications::sendUserContractExpiredLetter($userInfo, $contractInfo, $productInfo);
}
// notify admin
SJB_AdminNotifications::sendAdminUserContractExpiredLetter($userInfo['sid'], $contractInfo, $productInfo);
SJB_ContractManager::deleteContract($contractExpiredID, $contractInfo['user_sid']);
}
//////////////////////// Send remind notifications about expiration of contracts
// 1. get user sids and days count of 'remind subscription notification' setting = 1 from user_notifications table
// 2. foreach user:
// - get contracts with that expiration remind date
// - check every contract sid in DB table of sended. If sended - remove from send list
// - send notification with contracts to user
// - write contract sid in DB table of sended contract notifications
$notificationData = SJB_UserNotificationsManager::getUsersAndDaysOnSubscriptionExpirationRemind();
foreach ($notificationData as $elem) {
$userSID = $elem['user_sid'];
$days = $elem['days'];
$contractSIDs = SJB_ContractManager::getContractsIDByDaysLeftToExpired($userSID, $days);
if (empty($contractSIDs)) {
continue;
}
$contractsInfo = array();
// check contracts sended
foreach ($contractSIDs as $key => $sid) {
if (SJB_ContractManager::isContractNotificationSended($sid)) {
unset($contractSIDs[$key]);
continue;
}
$info = SJB_ContractManager::getInfo($sid);
$info['extra_info'] = !empty($info['serialized_extra_info']) ? unserialize($info['serialized_extra_info']) : '';
$contractsInfo[$sid] = $info;
}
if (!empty($contractsInfo)) {
// now only unsended contracts we have in array
// send contract notification
foreach ($contractSIDs as $sid) {
SJB_Notifications::sendRemindSubscriptionExpirationLetter($userSID, $contractsInfo[$sid], $days);
}
// write contract id in DB table of sended contract notifications
SJB_ContractManager::saveContractIDAsSendedNotificationsTable($contractSIDs);
}
}
// delete applications with no employer and job seeker
$emptyApplications = SJB_DB::query('SELECT `id` FROM `applications` WHERE `show_js` = 0 AND `show_emp` = 0');
foreach ($emptyApplications as $application) {
SJB_Applications::remove($application['id']);
}
// NEWS
$expiredNews = SJB_NewsManager::getExpiredNews();
foreach ($expiredNews as $article) {
SJB_NewsManager::deactivateItemBySID($article['sid']);
}
// LISTING XML IMPORT
SJB_XmlImport::runImport();
// UPDATE PAGES WITH FUNCTION EQUAL BROWSE(e.g. /browse-by-city/)
SJB_BrowseDBManager::rebuildBrowses();
//-------------------sitemap generator--------------------//
SJB_System::executeFunction('miscellaneous', 'sitemap_generator');
// CLEAR `error_log` TABLE
$errorLogLifetime = SJB_System::getSettingByName('error_log_lifetime');
$lifeTime = strtotime("-{$errorLogLifetime} days");
if ($lifeTime > 0) {
SJB_DB::query('DELETE FROM `error_log` WHERE `date` < ?t', $lifeTime);
}
SJB_Settings::updateSetting('task_scheduler_last_executed_date', $this->currentDate);
$this->tp->assign('expired_listings_id', $listingsExpiredID);
$this->tp->assign('deactivated_listings_id', $listingsDeactivatedID);
$this->tp->assign('expired_contracts_id', $contractsExpiredID);
$this->tp->assign('notified_saved_searches_id', $this->notifiedSavedSearchesSID);
$schedulerLog = $this->tp->fetch('task_scheduler_log.tpl');
SJB_HelperFunctions::writeCronLogFile('task_scheduler.log', $schedulerLog);
SJB_DB::query('INSERT INTO `task_scheduler_log`
(`last_executed_date`, `notifieds_sent`, `expired_listings`, `expired_contracts`, `log_text`)
VALUES ( NOW(), ?n, ?n, ?n, ?s)', count($this->notifiedSavedSearchesSID), count($listingsExpiredID), count($contractsExpiredID), $schedulerLog);
SJB_System::getModuleManager()->executeFunction('social', 'linkedin');
SJB_System::getModuleManager()->executeFunction('social', 'facebook');
SJB_System::getModuleManager()->executeFunction('classifieds', 'linkedin');
SJB_System::getModuleManager()->executeFunction('classifieds', 'facebook');
SJB_System::getModuleManager()->executeFunction('classifieds', 'twitter');
SJB_Event::dispatch('task_scheduler_run');
}
示例7: execute
//.........这里部分代码省略.........
foreach ($themes as $theme) {
$destination = $compiled_templates_dir . $access_type . "/" . $theme;
$result = $tp->deleteCacheBySpecifiedPath($destination);
if (is_array($result)) {
$error = $result;
}
}
}
}
// actions
if (!empty($action)) {
$theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
// TODO: !!!!если редактируется с юзерской части , то проверить есть ли тэмплэйт в теме , если нет , брать с _system
switch ($action) {
case 'delete':
$template_editor->deleteTemplate($template_name, $module_name, $theme);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $module_name);
break;
case 'edit':
case 'add':
if (SJB_Request::getVar('templ_module') && SJB_Request::getVar('templ_name')) {
$newTemplName = trim(SJB_Request::getVar('templ_name'));
$newModuleName = SJB_Request::getVar('templ_module');
if (!$template_editor->isTemplateNameValid($newTemplName)) {
$error[] = 'NOT_VALID_FILENAME_FORMAT';
}
if (!$template_editor->doesModuleExists($newModuleName)) {
$error[] = 'MODULE_ERROR';
}
if (empty($error)) {
if ('edit' == $action) {
if ($template_editor->moveTemplate(SJB_Request::getVar('templ_name_or'), SJB_Request::getVar('templ_module_or'), $theme, $newModuleName, $newTemplName)) {
if ($form_submitted == 'save_template') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName);
exit;
} else {
$error[] = 'CANT_MOVE_FILE';
}
} else {
if ($template_editor->createTemplate($theme, $newModuleName, $newTemplName, $error)) {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName);
}
$error[] = 'CANT_CREATE_FILE';
}
}
}
break;
default:
break;
}
}
// не работало в юзерской
if (empty($template_name)) {
$template_name = SJB_Request::getVar('template_name', '');
}
if (empty($module_name)) {
$module_name = SJB_Request::getVar('module_name', '');
}
// edittemplate
if (!empty($template_name) && !empty($module_name)) {
$menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => "?module_name={$module_name}", 'name' => $modules[$module_name]['display_name']), array('name' => $template_name, 'reference' => ''));
$tp->assign('navigation', $menu_path);
$tp->assign('errors', $error);
$tp->assign('title', 'Edit Templates: ' . $modules[$module_name]['display_name'] . ' / Template: ' . $template_name);
$tp->assign('show_clear_cache_setting', false);
$tp->assign('show_highlight_setting', false);
if (!$simple_view) {
$tp->display('navigation_menu.tpl');
}
echo SJB_System::executeFunction('template_manager', 'edit_template');
} else {
if (!empty($module_name)) {
$menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => '', 'name' => $modules[$module_name]['display_name']));
$tp->assign('navigation', $menu_path);
$tp->assign('title', 'Edit Templates');
$tp->assign('errors', $error);
$tp->assign('show_clear_cache_setting', false);
$tp->assign('show_highlight_setting', false);
if (!$simple_view) {
$tp->display('navigation_menu.tpl');
}
echo SJB_System::executeFunction('template_manager', 'template_list');
} else {
$menu_path = array(array('reference' => '', 'name' => 'Edit Templates'));
$tp->assign('navigation', $menu_path);
$tp->assign('title', 'Edit Templates');
$tp->assign('show_clear_cache_setting', true);
$tp->assign('show_highlight_setting', true);
$tp->assign('result', $result);
$tp->assign('errors', $error);
if (!$simple_view) {
$tp->display('navigation_menu.tpl');
}
echo SJB_System::executeFunction('template_manager', 'add_template');
echo SJB_System::executeFunction('template_manager', 'module_list');
}
}
}