本文整理汇总了PHP中Manager::usePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::usePath方法的具体用法?PHP Manager::usePath怎么用?PHP Manager::usePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::usePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFile
public function renderFile()
{
//Send Content-Type
$sCharset = Settings::getSetting('encoding', 'browser', 'utf-8');
if ($this->sType === ResourceIncluder::RESOURCE_TYPE_CSS) {
header("Content-Type: text/css;charset={$sCharset}");
} else {
if ($this->sType === ResourceIncluder::RESOURCE_TYPE_JS) {
header("Content-Type: text/javascript;charset={$sCharset}");
}
}
//Find consolidated resources
$aKeys = array();
while (Manager::hasNextPathItem()) {
$aKeys[] = Manager::usePath();
}
$sKey = 'consolidated-output-' . $this->sType . '-' . implode('|', $aKeys);
$oCachingStrategy = clone CachingStrategy::fromConfig('file');
$oCache = new Cache($sKey, 'resource', $oCachingStrategy);
$oItemCachingStrategy = clone $oCachingStrategy;
$oItemCachingStrategy->init(array('key_encode' => null));
$oCache->sendCacheControlHeaders();
if (!$oCache->entryExists(false)) {
foreach ($aKeys as $sItemKey) {
$oItemCache = new Cache($sItemKey, DIRNAME_PRELOAD, $oItemCachingStrategy);
if (!$oItemCache->entryExists(false)) {
throw new Exception("Consolidated resource {$sItemKey} does not exist.");
}
$oCache->setContents($oItemCache->getContentsAsString() . "\n", false, true);
}
}
$oCache->sendCacheControlHeaders();
$oCache->passContents(true);
}
示例2: __construct
public function __construct()
{
try {
$this->oRootPage = PagePeer::getRootPage();
} catch (Exception $e) {
$this->oRootPage = self::initializeRootPage();
}
$this->oTreeWidget = new TreeWidgetModule();
$this->oTreeWidget->setDelegate($this);
$this->oTreeWidget->setSetting('init_dnd', true);
$oInitialPage = null;
if (Manager::hasNextPathItem()) {
$oInitialPage = PageQuery::create()->findPk(Manager::usePath());
if ($oInitialPage !== null) {
Session::getSession()->setAttribute('persistent_page_id', $oInitialPage->getId());
}
} else {
if (Session::getSession()->hasAttribute('persistent_page_id')) {
$oInitialPage = PageQuery::create()->findPk(Session::getSession()->getAttribute('persistent_page_id'));
}
}
if ($oInitialPage === null) {
$oInitialPage = $this->oRootPage;
}
$this->addResourceParameter(ResourceIncluder::RESOURCE_TYPE_JS, 'tree_session', $this->oTreeWidget->getSessionKey());
$this->addResourceParameter(ResourceIncluder::RESOURCE_TYPE_JS, 'initial_page_id', $oInitialPage->getId());
$this->addResourceParameter(ResourceIncluder::RESOURCE_TYPE_JS, 'initial_page_tree_left', $oInitialPage->getTreeLeft());
$oResourceIncluder = ResourceIncluder::defaultIncluder();
$oResourceIncluder->addResource('admin/template.css', null, null, array(), ResourceIncluder::PRIORITY_NORMAL, null, true);
}
示例3: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$sBase = Manager::usePath();
$iId = Manager::usePath();
// Base path "newsletter" > display newsletter
if ($sBase === 'newsletter') {
$iId = is_numeric($sBase) ? $sBase : $iId;
$this->oNewsletter = NewsletterQuery::create()->findPk($iId);
if ($this->oNewsletter === null) {
throw new Exception('No such newsletter exists');
}
} else {
if ($sBase === 'mailing') {
$this->oMailing = NewsletterMailingQuery::create()->findPk($iId);
if ($this->oMailing === null) {
throw new Exception('No such mailing exists');
}
$this->oNewsletter = $this->oMailing->getNewsletter();
} elseif (is_numeric($sBase)) {
$this->oNewsletter = NewsletterQuery::create()->findPk($sBase);
}
}
// Throw exception if no newsletter is found
if ($this->oNewsletter === null) {
throw new Exception('Error in DisplayNewsletterFileModule::__construct(): No such newsletter exists');
}
// Optional handling of authentication
FilterModule::getFilters()->handleNewsletterDisplayRequested($this->oNewsletter);
}
示例4: renderFile
public function renderFile()
{
$bCleanup = Manager::usePath() === self::DO_CLEANUP;
$aReferences = ReferenceQuery::create()->find();
self::checkReferences($aReferences, $bCleanup);
if (count(self::$REFERENCES_WITHOUT_FROM) === 0 && count(self::$REFERENCES_WITHOUT_TO) === 0) {
if (!$bCleanup) {
print TranslationPeer::getString('test_references.references_are_ok', null, null, array('count' => count($aReferences)));
} else {
print TranslationPeer::getString('test_references.wrong_references_removed');
print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references'), 'FileManager')), TranslationPeer::getString('test_references.test_again')));
}
} else {
if (count(self::$REFERENCES_WITHOUT_FROM) > 0) {
print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_FROM) . TranslationPeer::getString('test_references.loose_from_references_found'));
foreach (self::$REFERENCES_WITHOUT_FROM as $oReference) {
print TagWriter::quickTag('p', array(), $oReference->getFromModelName() . '/' . $oReference->getFromId());
}
}
if (count(self::$REFERENCES_WITHOUT_TO) > 0) {
print TagWriter::quickTag('p', array(), count(self::$REFERENCES_WITHOUT_TO) . TranslationPeer::getString('test_references.loose_to_references_found'));
foreach (self::$REFERENCES_WITHOUT_TO as $oReference) {
print TagWriter::quickTag('p', array(), $oReference->getToModelName() . '/' . $oReference->getToId());
}
}
print TagWriter::quickTag('p', array(), TagWriter::quickTag('a', array('href' => LinkUtil::link(array('test_references', self::DO_CLEANUP), 'FileManager')), TranslationPeer::getString('test_references.remove_loose_ends')));
}
}
示例5: redirectToLanguage
public static function redirectToLanguage($sLanguageId = null)
{
if ($sLanguageId == null) {
$sLanguageId = Session::language();
}
$oLanguage = LanguageQuery::language($sLanguageId)->findOne();
$sLanguageInPathId = null;
if (Manager::hasNextPathItem()) {
$oLanguageInPath = LanguageQuery::language(Manager::peekNextPathItem(), true)->findOne();
if ($oLanguageInPath && $oLanguageInPath->getIsActive()) {
Manager::usePath();
$sLanguageInPathId = $oLanguageInPath->getId();
}
}
$sManager = Manager::getManagerClassNormalized(null);
if ($sManager::shouldIncludeLanguageInLink()) {
if ($sLanguageInPathId === $sLanguageId) {
return;
}
} else {
if ($sLanguageInPathId === null) {
//Did not include language in link and should not
return;
}
}
self::redirectToManager(Manager::getRequestPath(), $sManager, array(), $oLanguage);
}
示例6: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$this->aLibraryName = Manager::usePath();
$this->aVersion = Manager::usePath();
$sExtension = Manager::usePath();
$this->bUseCompression = $sExtension === 'min.js';
}
示例7: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$this->sResourceType = Manager::usePath();
if (!in_array($this->sResourceType, self::$RESOURCE_TYPES)) {
throw new Exception("Error in " . __METHOD__ . ": Resource type {$this->sResourceType} not allowed");
}
$this->sModuleName = Manager::usePath();
$this->sModuleType = $this->getModuleType();
}
示例8: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$this->sLicense = Manager::usePath();
if (!isset(DocumentPeer::$LICENSES[$this->sLicense])) {
throw new Exception("License invalid: " . $this->sLicense);
}
$aLicenseInfo = DocumentPeer::$LICENSES[$this->sLicense];
if (!isset($aLicenseInfo['image'])) {
throw new Exception("No Image for license: " . $this->sLicense);
}
$this->sURL = $aLicenseInfo['image'];
}
示例9: __construct
public function __construct()
{
parent::__construct();
SanityCheck::basicCheck();
$this->sModuleName = Manager::usePath();
$this->oResourceIncluder = ResourceIncluder::defaultIncluder();
if (isset($_REQUEST[self::CONTENT_LANGUAGE_SESSION_KEY])) {
self::setContentLanguage($_REQUEST[self::CONTENT_LANGUAGE_SESSION_KEY]);
}
if (Session::getSession()->isAuthenticated() && Session::getSession()->getUser()->getIsBackendLoginEnabled()) {
$oUser = Session::getSession()->getUser();
Session::getSession()->setLanguage(Session::getSession()->getUser()->getLanguageId());
if (isset($_REQUEST['preview']) || !$oUser->getIsAdminLoginEnabled()) {
LinkUtil::redirect(LinkUtil::link(@$_REQUEST['preview'], 'PreviewManager'));
}
}
}
示例10: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$sSessionKey = Manager::usePath();
$this->oListWidget = Session::getSession()->getArrayAttributeValueForKey(WidgetModule::WIDGET_SESSION_KEY, $sSessionKey);
if ($this->oListWidget === null) {
throw new Exception('Invalid list widget session key: ' . $sSessionKey);
}
$this->sWidgetType = $this->oListWidget->getModuleName();
if ($this->oListWidget->getDelegate() instanceof WidgetModule) {
$this->sWidgetType = $this->oListWidget->getDelegate()->getModuleName();
} else {
if ($this->oListWidget->getDelegate() instanceof CriteriaListWidgetDelegate) {
$this->sWidgetType = $this->oListWidget->getDelegate()->getModelName();
}
}
}
示例11: __construct
public function __construct($aRequestPath, $sLanguageId = null, $bSkipSecret = false)
{
parent::__construct($aRequestPath);
if ($sLanguageId === null) {
$this->sLanguageId = Manager::usePath();
if ($this->sLanguageId === null) {
throw new Exception('No language given');
}
} else {
$this->sLanguageId = $sLanguageId;
}
if (!$bSkipSecret) {
if (!isset($_REQUEST['secret']) || $_REQUEST['secret'] !== Settings::getSetting('full_text_search', 'update_secret', null)) {
throw new Exception('Not Authorized');
}
}
$this->aIndexPaths = array();
}
示例12: __construct
public function __construct($aRequestPath, Page $oJournalPage = null, $aJournalIds = null)
{
if ($aRequestPath === false) {
$this->oJournalPage = $oJournalPage;
$this->aJournalIds = $aJournalIds;
} else {
parent::__construct($aRequestPath);
Manager::usePath();
//the “journal” bit
$this->oJournalPage = PagePeer::getRootPage()->getPageOfType('journal');
$sLanguageId = Manager::usePath();
if (LanguagePeer::languageIsActive($sLanguageId)) {
Session::getSession()->setLanguage($sLanguageId);
}
}
header("Content-Type: application/rss+xml;charset=" . Settings::getSetting('encoding', 'db', 'utf-8'));
RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
}
示例13: contentAction
private function contentAction()
{
$sLanguageId = Manager::usePath();
$sDocumentationKey = Manager::usePath();
$sPartKey = Manager::usePath();
RichtextUtil::$USE_ABSOLUTE_LINKS = LinkUtil::isSSL();
if ($sPartKey) {
$oPart = DocumentationPartQuery::create()->filterByLanguageId($sLanguageId)->filterByKeys($sDocumentationKey, $sPartKey)->findOne();
if (!$oPart) {
if ($sPartKey === self::TUTORIAL_KEY) {
return TranslationPeer::getString('wns.documentation.video_tutorial', $sLanguageId, "Tutorial");
}
return null;
}
return RichtextUtil::parseStorageForFrontendOutput($oPart->getBody())->render();
} else {
$oDocumentation = DocumentationQuery::create()->filterByLanguageId($sLanguageId)->filterByKey($sDocumentationKey)->findOne();
if (!$oDocumentation) {
return null;
}
$sHtmlOutput = RichtextUtil::parseStorageForFrontendOutput($oDocumentation->getDescription())->render();
$aParts = $oDocumentation->getDocumentationPartsOrdered();
if (count($aParts) > 0) {
$sHtmlOutput .= '<ul class="documentation_parts">';
foreach ($aParts as $i => $oPart) {
$sHtmlOutput .= TagWriter::quickTag('li', array(), self::addPartLink($oPart));
}
$sHtmlOutput .= '</ul>';
}
$bDisplayVideo = false;
if ($bDisplayVideo && $oDocumentation->getYoutubeUrl()) {
$sHtmlOutput .= $this->embedVideo($oDocumentation->getYoutubeUrl());
}
return $sHtmlOutput;
}
}
示例14: getJSON
private function getJSON(&$aRequest)
{
if ($this->sAction === 'destroy') {
foreach ($aRequest['session_key'] as $sSessionKey) {
Session::getSession()->setArrayAttributeValueForKey(WidgetModule::WIDGET_SESSION_KEY, $sSessionKey, null);
}
return;
}
$sWidgetClass = WidgetModule::getClassNameByName($this->sWidgetType);
$bIsPersistent = $sWidgetClass::isPersistent();
if (!$bIsPersistent) {
// Close session early on readonly calls
Session::close();
}
if ($this->sAction == 'widgetInformation') {
$aInformation = array();
$sWidgetClass::includeResources();
$aInformation['resources'] = ResourceIncluder::defaultIncluder()->getIncludes()->render();
$aInformation['methods'] = $sWidgetClass::getCustomMethods();
$aInformation['is_singleton'] = $sWidgetClass::isSingleton();
$aInformation['is_persistent'] = $bIsPersistent;
return $aInformation;
}
if ($this->sAction == 'staticMethodCall') {
$this->checkPermissions($sWidgetClass);
$sMethodName = isset($aRequest['method']) ? $aRequest['method'] : Manager::usePath();
if (!method_exists($sWidgetClass, $sMethodName)) {
throw new LocalizedException('wns.file.widget_json.method_does_not_exist', array('method' => $sMethodName, 'widget' => $sWidgetClass));
}
return array("result" => call_user_func_array(array($sWidgetClass, $sMethodName), isset($aRequest['method_parameters']) ? $aRequest['method_parameters'] : array()));
}
$aInstanceArgs = array(@$aRequest['session_key']);
if (isset($aRequest['instance_args'])) {
$aInstanceArgs = $aRequest['instance_args'];
}
$aNewArgs = array_merge(array($this->sWidgetType), $aInstanceArgs);
$oWidget = call_user_func_array(array('WidgetModule', 'getWidget'), $aNewArgs);
if ($this->sAction === 'instanciateWidget') {
$this->checkPermissions($sWidgetClass);
$aInformation = array();
$aInformation['session_id'] = $oWidget->getSessionKey();
$oWidgetContents = $oWidget->doWidget();
if ($oWidgetContents instanceof Template) {
$oWidgetContents = $oWidgetContents->render();
}
$aInformation['content'] = $oWidgetContents;
$aInformation['is_new'] = $oWidget->isNew();
$aInformation['initial_settings'] = $oWidget->allSettings();
return $aInformation;
}
if ($this->sAction === 'methodCall') {
$this->checkPermissions($sWidgetClass);
$sMethodName = isset($aRequest['method']) ? $aRequest['method'] : Manager::usePath();
if (!method_exists($oWidget, $sMethodName)) {
throw new LocalizedException('wns.file.widget_json.method_does_not_exist', array('method' => $sMethodName, 'widget' => $oWidget->getName()));
}
return array("result" => call_user_func_array(array($oWidget, $sMethodName), isset($aRequest['method_parameters']) ? $aRequest['method_parameters'] : array()));
}
}
示例15: __construct
public function __construct($aRequestPath)
{
parent::__construct($aRequestPath);
$this->oJournalComment = JournalCommentQuery::create()->findHash(Manager::usePath());
$this->sAction = Manager::usePath();
}