本文整理汇总了PHP中SJB_Request::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_Request::getInstance方法的具体用法?PHP SJB_Request::getInstance怎么用?PHP SJB_Request::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_Request
的用法示例。
在下文中一共展示了SJB_Request::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$pageConfig = SJB_Request::getInstance()->page_config;
$tp = SJB_System::getTemplateProcessor();
if (isset($this->params['ERROR'])) {
$tp->assign('ERROR', $this->params['ERROR']);
} else {
if (SJB_UserManager::isUserLoggedIn()) {
$tp->assign('ERROR', 'ACCESS_DENIED');
} else {
$tp->assign('ERROR', 'NOT_LOGIN');
}
}
$tp->assign('page_function', $pageConfig->function);
$tp->display('../miscellaneous/error.tpl');
}
示例2: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$display_form = new SJB_Form();
$display_form->registerTags($tp);
$errors = array();
$criteria_saver = new SJB_ListingCriteriaSaver('MyListings');
$listingSID = SJB_Request::getVar("listing_id");
if (isset($_REQUEST['passed_parameters_via_uri'])) {
$passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
$listingSID = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : null;
}
$template = SJB_Request::getVar('display_template', 'display_listing.tpl');
if (is_null($listingSID)) {
$errors['UNDEFINED_LISTING_ID'] = true;
} elseif (is_null($listing = SJB_ListingManager::getObjectBySID($listingSID))) {
$errors['WRONG_LISTING_ID_SPECIFIED'] = true;
} elseif (!$listing->isActive() && $listing->getUserSID() != SJB_UserManager::getCurrentUserSID()) {
$errors['LISTING_IS_NOT_ACTIVE'] = true;
} else {
$listing->addPicturesProperty();
if ($listing->getUserSID() != SJB_UserManager::getCurrentUserSID()) {
$errors['NOT_OWNER'] = true;
}
$display_form = new SJB_Form($listing);
$display_form->registerTags($tp);
$form_fields = $display_form->getFormFieldsInfo();
$listingOwner = SJB_UserManager::getObjectBySID($listing->user_sid);
// listing preview @author still
$listingTypeSID = $listing->getListingTypeSID();
$listingTypeID = SJB_ListingTypeManager::getListingTypeIDBySID($listingTypeSID);
if (SJB_Request::getInstance()->page_config->uri == '/' . strtolower($listingTypeID) . '-preview/') {
if (!empty($_SERVER['HTTP_REFERER']) && (stristr($_SERVER['HTTP_REFERER'], 'edit-' . $listingTypeID) || stristr($_SERVER['HTTP_REFERER'], 'clone-job'))) {
$tp->assign('referer', $_SERVER['HTTP_REFERER']);
} else {
$lastPage = SJB_PostingPagesManager::getPagesByListingTypeSID($listingTypeSID);
$lastPage = array_pop($lastPage);
$tp->assign('referer', SJB_System::getSystemSettings('SITE_URL') . '/add-listing/' . $listingTypeID . '/' . $lastPage['page_id'] . '/' . $listing->getSID());
}
$tp->assign('checkouted', SJB_ListingManager::isListingCheckOuted($listing->getSID()));
$tp->assign('contract_id', $listing->contractID);
}
$listingStructure = SJB_ListingManager::createTemplateStructureForListing($listing, array('comments', 'ratings'));
$filename = SJB_Request::getVar('filename', false);
if ($filename) {
SJB_UploadFileManager::openFile($filename, $listingSID);
$errors['NO_SUCH_FILE'] = true;
}
$prev_and_next_listing_id = $criteria_saver->getPreviousAndNextObjectID($listingSID);
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$tp->assign('METADATA', array('listing' => $metaDataProvider->getMetaData($listingStructure['METADATA']), 'form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields)));
$comments = '';
$comments_total = '';
if (SJB_Settings::getSettingByName('show_comments') == '1') {
$comments = SJB_CommentManager::getEnabledCommentsToListing($listingSID);
$comments_total = count($comments);
}
$tp->assign('show_rates', SJB_Settings::getSettingByName('show_rates'));
$tp->assign('show_comments', SJB_Settings::getSettingByName('show_comments'));
$tp->assign('comments', $comments);
$tp->assign('comments_total', $comments_total);
$tp->assign('listing_id', $listingSID);
$tp->assign('form_fields', $form_fields);
$tp->assign('video_fields', SJB_HelperFunctions::takeMediaFields($form_fields));
$tp->filterThenAssign("listing", $listingStructure);
$tp->assign('prev_next_ids', $prev_and_next_listing_id);
$tp->assign('preview_listing_sid', SJB_Request::getVar('preview_listing_sid'));
$tp->assign('listingOwner', $listingOwner);
if (SJB_Request::getVar('action', false) == 'download_pdf_version') {
$formBuilder = SJB_FormBuilderManager::getFormBuilder(SJB_FormBuilderManager::FORM_BUILDER_TYPE_PDF, SJB_Array::getPath($listingStructure, 'type/id'));
$formBuilder->setChargedTemplateProcessor($tp);
$tpl = 'resume_to_pdf.tpl';
$filename = $listingStructure['user']['FirstName'] . ' ' . $listingStructure['user']['LastName'] . '_' . $listingStructure['Title'] . '.pdf';
try {
$tp->assign('myListing', 1);
$html = $tp->fetch($tpl);
$html = preg_replace('/<div[^>]*>/', '', $html);
$html = str_replace('</div>', '', $html);
SJB_HelperFunctions::html2pdf($html, $filename, str_replace('http://', '', SJB_HelperFunctions::getSiteUrl()));
exit;
} catch (Exception $e) {
SJB_Error::writeToLog($e->getMessage());
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/my-resume-details/' . $listingSID . '/?error=TCPDF_ERROR');
}
} else {
$formBuilder = SJB_FormBuilderManager::getFormBuilder(SJB_FormBuilderManager::FORM_BUILDER_TYPE_DISPLAY, SJB_Array::getPath($listingStructure, 'type/id'));
$formBuilder->setChargedTemplateProcessor($tp);
}
}
$search_criteria_structure = $criteria_saver->createTemplateStructureForCriteria();
$tp->filterThenAssign('search_criteria', $search_criteria_structure);
$tp->assign('errors', $errors);
$tp->assign('myListing', true);
$tp->display($template);
}
示例3: executeFunction
/**
* Execute module function
*
* This function will execute function of the module
* If function does not exists, it will display error message
*
* @param string $module_name name of the module
* @param string $function_name function's name
* @param array $parameters_override _REQUEST parameters to rewrite
*/
function executeFunction($module_name, $function_name, $parameters_override = array(), $pageID = false)
{
if (SJB_Users_CookiePreferences::isModuleDisabled($function_name)) {
return;
}
ob_start();
if ($this->isFunctionAccessible($module_name, $function_name)) {
$script_filename = $this->getFunctionScriptFilename($module_name, $function_name);
if ($script_filename != null && is_readable($script_filename)) {
$adminAccessType = SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE');
$this->prepareFunctionEnvironment($parameters_override);
$this->pushExecutionStack($module_name, $function_name);
$function = $this->getFunction($function_name, $module_name, $parameters_override);
// permissions checking
if (!$function->isAccessible()) {
if ($adminAccessType && SJB_SubAdmin::admin_authed()) {
$function = $this->getFunction('function_is_not_accessible_for_subadmin', 'miscellaneous');
} else {
$function = $this->getFunction('function_is_not_accessible', 'miscellaneous');
}
SJB_Request::getInstance()->setPageTemplate('index.tpl');
}
if (SJB_Profiler::getInstance()->isProfilerEnable()) {
SJB_DB::setFunctionInfo($function_name, $module_name);
$startTime = microtime(true);
$function->execute();
$spendTime = microtime(true) - $startTime;
$spendTime = number_format($spendTime, 8);
SJB_Profiler::getInstance()->gatherFunctionInfo($module_name, $function_name, $spendTime);
} else {
$function->execute();
}
if (SJB_FlashMessages::getInstance()->isErrors()) {
$errors = SJB_FlashMessages::getInstance()->getErrorsAndRemove();
$function = $this->getFunctionForErrors($errors);
if ($function) {
ob_clean();
$function->execute();
SJB_Request::getInstance()->setPageTemplate('index.tpl');
}
}
$this->popExecutionStack();
$this->restoreEnvironment();
} else {
return "<!-- Either wrong module/function or function script file does not exist for {$module_name}, {$function_name} -->";
}
} else {
return "<!-- No such function or function is not accessible for {$module_name}, {$function_name} -->";
}
return ob_get_clean();
}
示例4: microtime
<?php
$timeBegin = microtime(true);
error_reporting(-1);
ini_set('display_errors', 'on');
define('PATH_TO_SYSTEM_CLASS', '../system/core/System.php');
$DEBUG = array();
$PATH_BASE = str_replace('/admin', '', dirname(__FILE__));
require_once PATH_TO_SYSTEM_CLASS;
define('SJB_BASE_DIR', realpath(dirname(__FILE__) . "/..") . '/');
SJB_System::loadSystemSettings('../system/admin-config/DefaultSettings.php');
SJB_System::loadSystemSettings('../config.php');
$GLOBALS['system_settings']['USER_SITE_URL'] = $GLOBALS['system_settings']['SITE_URL'];
$GLOBALS['system_settings']['SITE_URL'] = $GLOBALS['system_settings']['ADMIN_SITE_URL'];
// load installed SJB version info
SJB_System::setGlobalTemplateVariable('version', SJB_System::getSystemSettings('version'));
SJB_System::boot();
SJB_System::init();
if (SJB_Profiler::getInstance()->isProfilerEnable()) {
SJB_Profiler::getInstance()->setStartTime($timeBegin);
}
// bind send notification emails if listing deactivated/deleted
SJB_Event::handle('listingDeactivated', array('SJB_Notifications', 'notifyOnUserListingDeactivated'));
SJB_Event::handle('beforeListingDelete', array('SJB_Notifications', 'notifyOnUserListingDeleted'));
// bind send notification emails if user deactivated/deleted
SJB_Event::handle('onBeforeUserDelete', array('SJB_Notifications', 'notifyOnUserDeleted'));
SJB_Event::handle('onBeforeUserDeactivate', array('SJB_Notifications', 'notifyOnUserDeactivated'));
SJB_Request::getInstance()->execute();
SJB_HelperFunctions::debugInfoPrint();