当前位置: 首页>>代码示例>>PHP>>正文


PHP PageModel类代码示例

本文整理汇总了PHP中PageModel的典型用法代码示例。如果您正苦于以下问题:PHP PageModel类的具体用法?PHP PageModel怎么用?PHP PageModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PageModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Gdn_Dispatcher_BeforeBlockDetect_Handler

 /**
  * If the Garden.PrivateCommunity config setting is enabled,
  * then bypass the sign-in redirection and let the Basic Pages
  * view permission logic handle the redirection for
  * pages requested by guests.
  *
  * @param $Sender Gdn_Dispatcher
  */
 public function Gdn_Dispatcher_BeforeBlockDetect_Handler($Sender)
 {
     if (C('Garden.PrivateCommunity', false)) {
         $BlockExceptions =& $Sender->EventArguments['BlockExceptions'];
         $PathRequest = Gdn::Request()->Path();
         $PageModel = new PageModel();
         // Handle path requests that match "page/urlcode"
         $PathMatch = 'page/';
         if (substr($PathRequest, 0, strlen($PathMatch)) === $PathMatch) {
             $Page = $PageModel->GetByUrlCode(substr($PathRequest, strlen($PathMatch), strlen($PathRequest)));
             // Only bypass Garden.PrivateCommunity redirection if custom page view permission is enabled.
             if (isset($Page->ViewPermission) && (bool) $Page->ViewPermission) {
                 $BlockExceptions['/^page(\\/.*)?$/'] = Gdn_Dispatcher::BLOCK_NEVER;
             }
         } else {
             if (!strstr($PathRequest, '/')) {
                 // NOTE: Increases overhead every time the Dispatch method is called.
                 //       There is room for optimization to be done here.
                 //
                 // Handle path requests which don't contain a forward slash
                 // because the request could possibly be for a page with
                 // a path of "urlcode"
                 $Page = $PageModel->GetByUrlCode($PathRequest);
                 // Only bypass Garden.PrivateCommunity redirection if custom page view permission is enabled.
                 if (isset($Page->ViewPermission) && (bool) $Page->ViewPermission) {
                     $BlockExceptions['/^' . $PathRequest . '(\\/.*)?$/'] = Gdn_Dispatcher::BLOCK_NEVER;
                 }
             }
         }
     }
 }
开发者ID:oMadMartigaNo,项目名称:readjust-forum,代码行数:39,代码来源:class.hooks.php

示例2: generate

 /**
  * Redirect to an internal page
  * @param \PageModel $objPage
  */
 public function generate($objPage)
 {
     // Forward to the jumpTo or first published page
     if ($objPage->jumpTo) {
         /** @var \PageModel $objNextPage */
         $objNextPage = $objPage->getRelated('jumpTo');
     } else {
         $objNextPage = \PageModel::findFirstPublishedRegularByPid($objPage->id);
     }
     // Forward page does not exist
     if ($objNextPage === null) {
         header('HTTP/1.1 404 Not Found');
         $this->log('Forward page ID "' . $objPage->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
         die_nicely('be_no_forward', 'Forward page not found');
     }
     $strForceLang = null;
     // Check the target page language (see #4706)
     if (\Config::get('addLanguageToUrl')) {
         $objNextPage->loadDetails();
         // see #3983
         $strForceLang = $objNextPage->language;
     }
     $strGet = '';
     $strQuery = \Environment::get('queryString');
     $arrQuery = array();
     // Extract the query string keys (see #5867)
     if ($strQuery != '') {
         $arrChunks = explode('&', $strQuery);
         foreach ($arrChunks as $strChunk) {
             list($k, ) = explode('=', $strChunk, 2);
             $arrQuery[] = $k;
         }
     }
     // Add $_GET parameters
     if (!empty($_GET)) {
         foreach (array_keys($_GET) as $key) {
             if (\Config::get('disableAlias') && $key == 'id') {
                 continue;
             }
             if (\Config::get('addLanguageToUrl') && $key == 'language') {
                 continue;
             }
             // Ignore the query string parameters (see #5867)
             if (in_array($key, $arrQuery)) {
                 continue;
             }
             // Ignore the auto_item parameter (see #5886)
             if ($key == 'auto_item') {
                 $strGet .= '/' . \Input::get($key);
             } else {
                 $strGet .= '/' . $key . '/' . \Input::get($key);
             }
         }
     }
     // Append the query string (see #5867)
     if ($strQuery != '') {
         $strQuery = '?' . $strQuery;
     }
     $this->redirect($this->generateFrontendUrl($objNextPage->row(), $strGet, $strForceLang) . $strQuery, $objPage->redirect == 'temporary' ? 302 : 301);
 }
开发者ID:Jobu,项目名称:core,代码行数:64,代码来源:PageForward.php

示例3: indexAction

 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new PageModel();
     header('HTTP/1.0 Not Found');
     $fc->setBody($model->render('404.php', TEMPLATE));
 }
开发者ID:OzoneRPC,项目名称:mvc.ozone.project,代码行数:7,代码来源:NotFoundController.php

示例4: aboutAction

 /**
  * действие для странички о нас - About
  *
  * @param Request $request
  * @return int
  */
 public function aboutAction(Request $request)
 {
     $model = new PageModel();
     $text = $model->getById(2);
     $args = array('text' => $text);
     return $this->render('about', $args);
 }
开发者ID:vorobeyDjack,项目名称:php_training_project,代码行数:13,代码来源:IndexController.php

示例5: Page

 public function Page($Reference)
 {
     $PageModel = new PageModel();
     $Page = $PageModel->GetFullID($Reference);
     if (!$Page) {
         throw NotFoundException();
     }
     $this->Page = $Page;
     if ($this->Head) {
         SetMetaTags($Page, $this);
         if ($Page->CustomCss) {
             $CustomCss = "\n" . $Page->CustomCss;
             if (!StringBeginsWith(trim($CustomCss), '<style', True)) {
                 $CustomCss = Wrap($CustomCss, 'style', array('type' => 'text/css'));
             }
             $this->Head->AddString($CustomCss);
         }
         if ($Page->CustomJs) {
             $CustomJs = $Page->CustomJs;
             if (!StringBeginsWith(trim($CustomJs), '<script', True)) {
                 $CustomJs = Wrap($CustomJs, 'script', array('type' => 'text/javascript'));
             }
             $this->Head->AddString($CustomJs);
         }
     }
     if ($Page->SectionID) {
         $this->Section = BuildNode($Page, 'Section');
         $this->SectionID = $Page->SectionID;
         CandyHooks::AddModules($this, $this->Section);
     }
     $this->FireEvent('ContentPage');
     if ($Page->View) {
         $this->View = $this->FetchViewLocation($this->View, False, False, False);
     }
     if (!$this->View) {
         $this->View = $this->FetchViewLocation('view', 'page', '', False);
         if (!$this->View) {
             $this->View = 'default';
         }
     }
     $this->Title($Page->Title);
     $this->SetData('Content', $Page, True);
     $this->EventArguments['Format'] =& $Page->Format;
     $this->EventArguments['Body'] =& $Page->Body;
     $this->FireEvent('BeforeBodyFormat');
     $this->ContentBodyHtml = Gdn_Format::To($Page->Body, $Page->Format);
     $Doc = PqDocument($this->ContentBodyHtml);
     $Header = $Doc->Find('h1');
     $CountH1 = count($Header);
     if ($CountH1 == 0) {
         $this->SetData('Headline', Gdn_Format::Text($Page->Title));
     } elseif ($CountH1 == 1) {
         $this->SetData('Headline', $Header->Text());
         $Header->Remove();
         $this->ContentBodyHtml = $Doc->Html();
     }
     //
     $this->AddModule('PageInfoModule');
     $this->Render();
 }
开发者ID:unlight,项目名称:Candy,代码行数:60,代码来源:class.contentcontroller.php

示例6: pageAction

 public function pageAction(Request $request)
 {
     $pageModel = new PageModel();
     $pageText = $pageModel->getById($request->get('id'));
     $log = $this->render('log');
     $args = array('text' => array($pageText), 'id' => $request->get('id'), 'log' => $log);
     return $this->render('page', $args);
 }
开发者ID:artemkuchma,项目名称:PHP_academy_site1,代码行数:8,代码来源:IndexController.php

示例7: updatePage

 public function updatePage(PageModel $page, $oldurl)
 {
     $this->connect();
     $oldurl = '"' . $this->db->real_escape_string($oldurl) . '"';
     $url = '"' . $this->db->real_escape_string($page->getPageURL()) . '"';
     $title = '"' . $this->db->real_escape_string($page->getPageTitle()) . '"';
     $content = '"' . $this->db->real_escape_string($page->getPageContent()) . '"';
     //MySqli Insert Query
     $update_row = $this->db->query("UPDATE " . self::$table . " SET url={$url} ,title={$title}, content={$content} WHERE url={$oldurl}");
     if ($update_row) {
         return $update_row;
     } else {
         return $this->db->error;
     }
 }
开发者ID:JesperHolmstrom,项目名称:EasyCMS,代码行数:15,代码来源:PageDAL.php

示例8: generate

 /**
  * Generate an error 403 page
  * @param integer
  * @param object
  */
 public function generate($pageId, $objRootPage = null)
 {
     // Add a log entry
     $this->log('Access to page ID "' . $pageId . '" denied', 'PageError403 generate()', TL_ERROR);
     // Use the given root page object if available (thanks to Andreas Schempp)
     if ($objRootPage === null) {
         $objRootPage = $this->getRootPageFromUrl();
     } else {
         $objRootPage = \PageModel::findPublishedById(is_integer($objRootPage) ? $objRootPage : $objRootPage->id);
     }
     // Look for an error_403 page
     $obj403 = \PageModel::find403ByPid($objRootPage->id);
     // Die if there is no page at all
     if ($obj403 === null) {
         header('HTTP/1.1 403 Forbidden');
         die('Forbidden');
     }
     // Generate the error page
     if (!$obj403->autoforward || !$obj403->jumpTo) {
         global $objPage;
         $objPage = $this->getPageDetails($obj403);
         $objHandler = new $GLOBALS['TL_PTY']['regular']();
         header('HTTP/1.1 403 Forbidden');
         $objHandler->generate($objPage);
         exit;
     }
     // Forward to another page
     $objNextPage = \PageModel::findPublishedById($obj403->jumpTo);
     if ($objNextPage === null) {
         header('HTTP/1.1 403 Forbidden');
         $this->log('Forward page ID "' . $obj403->jumpTo . '" does not exist', 'PageError403 generate()', TL_ERROR);
         die('Forward page not found');
     }
     $this->redirect($this->generateFrontendUrl($objNextPage->row(), null, $objRootPage->language), $obj403->redirect == 'temporary' ? 302 : 301);
 }
开发者ID:rburch,项目名称:core,代码行数:40,代码来源:PageError403.php

示例9: checkPermissionForProtectedHomeDirs

 public static function checkPermissionForProtectedHomeDirs($strFile)
 {
     $strUuid = \Config::get('protectedHomeDirRoot');
     if (!$strFile) {
         return;
     }
     if ($strUuid && ($strProtectedHomeDirRootPath = \HeimrichHannot\HastePlus\Files::getPathFromUuid($strUuid)) !== null) {
         // check only if path inside the protected root dir
         if (StringUtil::startsWith($strFile, $strProtectedHomeDirRootPath)) {
             if (FE_USER_LOGGED_IN) {
                 if (($objFrontendUser = \FrontendUser::getInstance()) !== null) {
                     if (\Config::get('allowAccessByMemberId') && $objFrontendUser->assignProtectedDir && $objFrontendUser->protectedHomeDir) {
                         $strProtectedHomeDirMemberRootPath = Files::getPathFromUuid($objFrontendUser->protectedHomeDir);
                         // fe user id = dir owner member id
                         if (StringUtil::startsWith($strFile, $strProtectedHomeDirMemberRootPath)) {
                             return;
                         }
                     }
                     if (\Config::get('allowAccessByMemberGroups')) {
                         $arrAllowedGroups = deserialize(\Config::get('allowedMemberGroups'), true);
                         if (array_intersect(deserialize($objFrontendUser->groups, true), $arrAllowedGroups)) {
                             return;
                         }
                     }
                 }
             }
             $intNoAccessPage = \Config::get('jumpToNoAccess');
             if ($intNoAccessPage && ($objPageJumpTo = \PageModel::findByPk($intNoAccessPage)) !== null) {
                 \Controller::redirect(\Controller::generateFrontendUrl($objPageJumpTo->row()));
             } else {
                 die($GLOBALS['TL_LANG']['MSC']['noAccessDownload']);
             }
         }
     }
 }
开发者ID:heimrichhannot,项目名称:contao-protected_homedirs,代码行数:35,代码来源:ProtectedHomeDirs.php

示例10: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     // Set the trail and level
     if ($this->defineRoot && $this->rootPage > 0) {
         $trail = array($this->rootPage);
         $level = 0;
     } else {
         $trail = $objPage->trail;
         $level = $this->levelOffset > 0 ? $this->levelOffset : 0;
     }
     $lang = null;
     $host = null;
     // Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
     if ($this->defineRoot && $this->rootPage > 0) {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
 }
开发者ID:rheintechnology,项目名称:core,代码行数:34,代码来源:ModuleNavigation.php

示例11: loadStoreDetails

 /**
  * @deprecated
  */
 public static function loadStoreDetails(array $arrStore, $jumpTo = null)
 {
     //load country names
     //@todo load only once. not every time.
     $arrCountryNames = \System::getCountries();
     //full localized country name
     //@todo rename country to countrycode in database
     $arrStore['countrycode'] = $arrStore['country'];
     $arrStore['country'] = $arrCountryNames[$arrStore['countrycode']];
     // generate jump to
     if ($jumpTo) {
         if (($objLocation = \PageModel::findByPk($jumpTo)) !== null) {
             //@todo language parameter
             $strStoreKey = !$GLOBALS['TL_CONFIG']['useAutoItem'] ? '/store/' : '/';
             $strStoreValue = $arrStore['alias'];
             $arrStore['href'] = \Controller::generateFrontendUrl($objLocation->row(), $strStoreKey . $strStoreValue);
         }
     }
     // opening times
     $arrStore['opening_times'] = deserialize($arrStore['opening_times']);
     // store logo
     //@todo change size and properties in module
     if ($arrStore['logo']) {
         if (($objLogo = \FilesModel::findByUuid($arrStore['logo'])) !== null) {
             $arrLogo = $objLogo->row();
             $arrMeta = deserialize($arrLogo['meta']);
             $arrLogo['meta'] = $arrMeta[$GLOBALS['TL_LANGUAGE']];
             $arrStore['logo'] = $arrLogo;
         } else {
             $arrStore['logo'] = null;
         }
     }
     return $arrStore;
 }
开发者ID:pedal123,项目名称:anyStores,代码行数:37,代码来源:AnyStores.php

示例12: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $intList = $this->athletes_group;
     $objMembers = $this->Database->prepare("SELECT * FROM tl_athlete WHERE published=1 AND pid=? ORDER BY sorting")->execute($intList);
     //$objMembers = \MembersModel;
     // Return if no Members were found
     if (!$objMembers->numRows) {
         return;
     }
     $strLink = '';
     // Generate a jumpTo link
     if ($this->jumpTo > 0) {
         $objJump = \PageModel::findByPk($this->jumpTo);
         if ($objJump !== null) {
             $strLink = $this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s');
         }
     }
     $arrMembers = array();
     // Generate Members
     while ($objMembers->next()) {
         $strPhoto = '';
         $objPhoto = \FilesModel::findByPk($objMembers->photo);
         // Add photo image
         if ($objPhoto !== null) {
             $strPhoto = \Image::getHtml(\Image::get($objPhoto->path, '140', '187', 'center_center'));
         }
         $arrMembers[] = array('name' => $objMembers->name, 'family' => $objMembers->family, 'post' => $objMembers->post, 'joined' => $objMembers->joined, 'photo' => $strPhoto, 'link' => strlen($strLink) ? sprintf($strLink, $objMembers->alias) : '');
     }
     $this->Template->members = $arrMembers;
 }
开发者ID:respinar,项目名称:contao-athletes,代码行数:33,代码来源:ModuleAthleteList.php

示例13: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $arrJumpTo = array();
     $arrNewsletter = array();
     $objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
     if ($objNewsletter !== null) {
         while ($objNewsletter->next()) {
             if (($objTarget = $objNewsletter->getRelated('pid')) === null || !$objTarget->jumpTo) {
                 continue;
             }
             if (!isset($arrJumpTo[$objTarget->jumpTo])) {
                 $objJumpTo = \PageModel::findPublishedById($objTarget->jumpTo);
                 if ($objJumpTo !== null) {
                     $arrJumpTo[$objTarget->jumpTo] = $this->generateFrontendUrl($objJumpTo->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s');
                 } else {
                     $arrJumpTo[$objTarget->jumpTo] = null;
                 }
             }
             $strUrl = $arrJumpTo[$objTarget->jumpTo];
             if ($strUrl === null) {
                 continue;
             }
             $strAlias = $objNewsletter->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $objNewsletter->alias : $objNewsletter->id;
             $arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => strip_insert_tags($objNewsletter->subject), 'href' => sprintf($strUrl, $strAlias), 'date' => $this->parseDate($objPage->dateFormat, $objNewsletter->date), 'datim' => $this->parseDate($objPage->datimFormat, $objNewsletter->date), 'time' => $this->parseDate($objPage->timeFormat, $objNewsletter->date), 'channel' => $objNewsletter->channel);
         }
     }
     $this->Template->newsletters = $arrNewsletter;
 }
开发者ID:rikaix,项目名称:core,代码行数:32,代码来源:ModuleNewsletterList.php

示例14: __get

 /**
  * Get config value from transformed arrData and add logic to modify the value here
  * @param $strKey
  *
  * @return mixed|string
  */
 public function __get($strKey)
 {
     $varValue = $this->arrData[$strKey];
     switch ($strKey) {
         case 'strAction':
             if ($varValue && ($objActionPage = \PageModel::findWithDetails($varValue)) !== null) {
                 $varValue = \Controller::generateFrontendUrl($objActionPage->row(), null, null, true);
             } else {
                 $varValue = Url::removeQueryString(array('file'), \Environment::get('uri'));
                 // remove all query parameters within ajax request
                 if (Ajax::isRelated(Form::FORMHYBRID_NAME) !== false) {
                     $varValue = AjaxAction::removeAjaxParametersFromUrl($varValue);
                 }
             }
             // async form
             if ($this->async) {
                 $varValue = AjaxAction::generateUrl(Form::FORMHYBRID_NAME, 'asyncFormSubmit');
             }
             // add hash
             if ($this->addHashToAction) {
                 $varValue .= '#' . ($this->customHash ?: $this->strFormId);
             }
             break;
         case 'arrDefaultValues':
             $varValue = FormHelper::getAssocMultiColumnWizardList($varValue, 'field');
             break;
     }
     return $varValue;
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:35,代码来源:FormConfiguration.php

示例15: collectPageImages

 /**
  * Collect the images from page
  * @param object
  * @param object
  */
 public function collectPageImages($objPage, $objLayout)
 {
     if (!$objLayout->socialImages) {
         return;
     }
     // Initialize the array
     if (!is_array($GLOBALS['SOCIAL_IMAGES'])) {
         $GLOBALS['SOCIAL_IMAGES'] = array();
     }
     // Add the current page image
     if ($objPage->socialImage && ($objImage = \FilesModel::findByUuid($objPage->socialImage)) !== null && is_file(TL_ROOT . '/' . $objImage->path)) {
         array_unshift($GLOBALS['SOCIAL_IMAGES'], $objImage->path);
     } else {
         $objTrail = \PageModel::findParentsById($objPage->id);
         if ($objTrail !== null) {
             while ($objTrail->next()) {
                 // Add the image
                 if ($objTrail->socialImage && ($objImage = \FilesModel::findByUuid($objTrail->socialImage)) !== null && is_file(TL_ROOT . '/' . $objImage->path)) {
                     array_unshift($GLOBALS['SOCIAL_IMAGES'], $objImage->path);
                     break;
                 }
             }
         }
     }
 }
开发者ID:codefog,项目名称:contao-social_images,代码行数:30,代码来源:SocialImages.php


注:本文中的PageModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。