HomeHelpTrac

Changeset 15897 for trunk


Ignore:
Timestamp:
01/18/12 23:41:12 (4 months ago)
Author:
Alexander Trofimov
Message:

Page - refactoring, docs, cache implementation.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/inc/classes/BxDolPage.php

    r15893 r15897  
    1919 * Pages.  
    2020 * 
    21  * It allows to display pages build from studio. 
     21 * It allows to display pages build from studio.  
     22 *   
     23 * The new system has the following page features: 
     24 * - layouts: page can have any page structure, not just columns. 
     25 * - SEO: page can have own SEO options, like meta tags and meta keywords, as well as instructions for search bots. 
     26 * - cache: page can be cached on server or in client's browser. 
     27 * - visibility: page access can be controlled using member levels. 
     28 *  
     29 *  
     30 *  
     31 * @section page_create Creating the Page object: 
     32 * 
     33 * 1. add record to 'sys_objects_page' table: 
     34 * 
     35 * - object: name of the page object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing; for example: bx_profiles_view - profile view page. 
     36 * - title: title to display as page title. 
     37 * - module: the module this page belongs to. 
     38 * - layout_id: page layout to use, it is id of the record from 'sys_pages_layouts' table. 
     39 * - visibile_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example: 
     40 *      - user level id = 1 -> 2^(1-1) = 1 
     41 *      - user level id = 2 -> 2^(2-1) = 2 
     42 *      - user level id = 3 -> 2^(3-1) = 4 
     43 *      - user level id = 4 -> 2^(4-1) = 8 
     44 * - visibile_for_levels_editable: it determines if 'visibile_for_levels' field is ediable from page builder, visibility options can be overriden by custom class and shouldn't editable in this case. 
     45 * - url: the page url, if it is static page. 
     46 * - meta_description: meta description of the page. 
     47 * - meta_keywords: meta keywords of the page. 
     48 * - meta_robots: instructions for search bots. 
     49 * - cache_server: number of seconds to store cache for on the server. 
     50 * - cache_editable: it determines if cache can be edited from page builder. 
     51 * - deletable: it determines if page can be deleted from page builder. 
     52 * - override_class_name: user defined class name which is derived from BxTemplPage. 
     53 * - override_class_file: the location of the user defined class, leave it empty if class is located in system folders. 
     54 *  
     55 * Page layout are stored in 'sys_pages_layouts' table: 
     56 * - name: inner unique layout name. 
     57 * - icon: layout icon to display in page builder, it should represent basic view of the layout to help studio operator determine the layout structure. 
     58 * - title: layout name to display in page builder. 
     59 * - template: template name to use to display page with certain layout. 
     60 * - cells_number: number of areas in the layout, page blocks can be places into this areas(cells). 
     61 * To define areas in the layout they should be named as '__cell_N__', where N is cell number, starting from 1. 
     62 *  
     63 *  
     64 * 2. Add page blocks to 'sys_pages_blocks' table: 
     65 * - object: page object name this block belongs to. 
     66 * - cell_id: cell number in page layout to place block to. 
     67 * - module: module name this block belongs to. 
     68 * - title: block title. 
     69 * - designbox_id: design box to use to diplay page block, it is id of the record from 'sys_pages_blocks' table. 
     70 * - visibile_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example: 
     71 *      - user level id = 1 -> 2^(1-1) = 1 
     72 *      - user level id = 2 -> 2^(2-1) = 2 
     73 *      - user level id = 3 -> 2^(3-1) = 4 
     74 *      - user level id = 4 -> 2^(4-1) = 8 
     75 * - type: block type 
     76 *      - raw: HTML block, displayed in page builder as HTML textarea. 
     77 *      - html: HTML block, displayed in page builder as visual editor, line TinyMCE. 
     78 *      - lang: translatable language string, displayed in page builder as editable language key. 
     79 *      - image: just an image, displayed in page builder as HTML upload form. 
     80 *      - rss: RSS block, displayed in page builder as editable URL to RSS resource, along with number of displayed items. 
     81 *      - menu: menu block, displayed as menu selector. 
     82 *      - service: to display block content, the provided serice method is used. 
     83 * - content: depending on 'type' field: 
     84 *      - raw: HTML string. 
     85 *      - html: HTML string. 
     86 *      - lang: language key. 
     87 *      - image: image id in the storage. 
     88 *      - rss: URL to RSS with number of displayed items, for example: http://www.example.com/rss#4 
     89 *      - menu: menu object name. 
     90 *      - service: serialized array of service call parameters: module - module name, method - service method name, params - array of parameters. 
     91 * - deletable: is block deletable from page builder 
     92 * - copyable: is block can be copied to any other page from page builder. 
     93 * - order: block order in some cell. 
     94 *  
     95 * Block design boxes are stored in 'sys_pages_design_boxes' table: 
     96 * - id: consistent id, there are the following defines can be used in the code for each system block style: 
     97 *      - 0 - BX_DB_CONTENT_ONLY: design box with content only - no borders, no background, no caption. 
     98 *      - 1 - BX_DB_DEF: default design box with content, borders and caption. 
     99 *      - 2 - BX_DB_EMPTY: just empty design box, without anything. 
     100 *      - 3 - BX_DB_NO_CAPTION: design box with content, like BX_DB_DEF but without caption. 
     101 *      - 10 - BX_DB_PADDING_CONTENT_ONLY: design box with content only wrapped with default padding - no borders, no background, no caption; it can be used to just wrap content with default padding. 
     102 *      - 11 - BX_DB_PADDING_DEF: default design box with content wrapped with default padding, borders and caption. 
     103 *      - 13 - BX_DB_PADDING_NO_CAPTION: design box with content wrapped with default padding, like BX_DB_DEF but without caption. 
     104 * - title: block name which is displayed in studio, describes block styles. 
     105 * - template: template name to use to display page block. 
     106 * 
     107 * 
     108 * 3. Display Page. 
     109 * Use the following sample code to display page: 
     110 * @code 
     111 *     bx_import('BxDolPage'); 
     112 *     $oPage = BxDolPage::getObjectInstance('sample'); // 'sample' is 'object' field from 'sys_objects_page' table, it automatically creates instance of default or custom class by object name 
     113 *     if ($oPage) 
     114 *         echo $oPage->getCode(); // print page 
     115 * @endcode 
     116 * 
    22117 */ 
    23118 
    24 /* 
    25119 
    26 CREATE TABLE IF NOT EXISTS `sys_objects_page` ( 
    27   `id` int(11) NOT NULL AUTO_INCREMENT, 
    28   `object` varchar(32) COLLATE utf8_unicode_ci NOT NULL, 
    29   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    30   `module` varchar(32) COLLATE utf8_unicode_ci NOT NULL, 
    31   `layout_id` int(11) NOT NULL, 
    32   `visibile_for_levels` int(11) NOT NULL, 
    33   `visibile_for_levels_editable` tinyint(4) NOT NULL DEFAULT '1', 
    34   `url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    35   `meta_description` text COLLATE utf8_unicode_ci NOT NULL, 
    36   `meta_keywords` text COLLATE utf8_unicode_ci NOT NULL, 
    37   `meta_robots` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    38   `cache_server` int(11) NOT NULL, 
    39   `cache_server_params` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    40   `cache_client` int(11) NOT NULL, 
    41   `cache_editable` tinyint(4) NOT NULL, 
    42   `deletable` tinyint(1) NOT NULL, 
    43   PRIMARY KEY (`id`), 
    44   UNIQUE KEY `object` (`object`) 
    45 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; 
    46  
    47 -- -------------------------------------------------------- 
    48  
    49 CREATE TABLE IF NOT EXISTS `sys_pages_blocks` ( 
    50   `id` int(11) NOT NULL AUTO_INCREMENT, 
    51   `object` varchar(32) COLLATE utf8_unicode_ci NOT NULL, 
    52   `cell_id` int(11) NOT NULL, 
    53   `module` varchar(32) COLLATE utf8_unicode_ci NOT NULL, 
    54   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    55   `designbox_id` int(11) NOT NULL, 
    56   `visibile_for_levels` int(11) NOT NULL, 
    57   `type` enum('raw','html','lang','image','rss','menu','service') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'raw', 
    58   `content` text COLLATE utf8_unicode_ci NOT NULL, 
    59   `deletable` tinyint(4) NOT NULL, 
    60   `copyable` tinyint(4) NOT NULL, 
    61   `order` int(11) NOT NULL, 
    62   PRIMARY KEY (`id`) 
    63 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; 
    64  
    65 -- -------------------------------------------------------- 
    66  
    67 CREATE TABLE IF NOT EXISTS `sys_pages_design_boxes` ( 
    68   `id` int(11) NOT NULL, 
    69   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    70   `template` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    71   PRIMARY KEY (`id`) 
    72 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 
    73  
    74 INSERT INTO `sys_pages_design_boxes` (`id`, `title`, `template`) VALUES 
    75 (0, '_sys_designbox_0', 'designbox_0.html'), 
    76 (1, '_sys_designbox_1', 'designbox_1.html'), 
    77 (2, '_sys_designbox_2', 'designbox_2.html'), 
    78 (3, '_sys_designbox_3', 'designbox_3.html'), 
    79 (10, '_sys_designbox_10', 'designbox_10.html'), 
    80 (11, '_sys_designbox_11', 'designbox_11.html'), 
    81 (13, '_sys_designbox_13', 'designbox_13.html'); 
    82  
    83 -- -------------------------------------------------------- 
    84  
    85 CREATE TABLE IF NOT EXISTS `sys_pages_layouts` ( 
    86   `id` int(11) NOT NULL AUTO_INCREMENT, 
    87   `icon` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    88   `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    89   `template` varchar(255) COLLATE utf8_unicode_ci NOT NULL, 
    90   `cells_number` int(11) NOT NULL, 
    91   PRIMARY KEY (`id`) 
    92 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; 
    93  
    94 INSERT INTO `sys_pages_layouts` (`id`, `icon`, `title`, `template`, `cells_number`) VALUES 
    95 (1, 'layout_bar_left.png', '_sys_layout_bar_left', 'layout_bar_left.html', 2); 
    96  
    97 */ 
    98120 
    99121class BxDolPage extends BxDol { 
     
    144166    }     
    145167 
     168    /** 
     169     * Check if page block is visible. 
     170     */ 
    146171    protected function _isVisibleBlock ($a) { 
    147172        bx_import('BxDolAcl'); 
     
    149174    } 
    150175 
     176    /** 
     177     * Check if page is visible. 
     178     */ 
    151179    protected function _isVisiblePage ($a) { 
    152180        bx_import('BxDolAcl'); 
     
    154182    } 
    155183 
    156     public function getCode () { 
    157  
    158     } 
    159184} 
    160185 
  • trunk/inc/classes/BxDolTemplate.php

    r15890 r15897  
    290290            'keywords' => array(), 
    291291            'description'  => '', 
     292            'robots' => '', 
    292293            'css_name' => array(), 
    293294            'css_compiled' => array(), 
     
    406407 
    407408    /** 
     409     * Set page meta robots. 
     410     * 
     411     * @param string $s page meta robots. 
     412     */ 
     413    function setPageMetaRobots($s) { 
     414        $this->aPage['robots'] = $s; 
     415    } 
     416 
     417    /** 
    408418     * Set page content for some variable. 
    409419     * @param string $sVar name of content variable 
     
    805815            case 'page_charset': 
    806816                $sRet = 'UTF-8'; 
     817                break; 
     818            case 'page_robots': 
     819                if(!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) 
     820                    $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />'; 
    807821                break; 
    808822            case 'page_keywords': 
  • trunk/install/sql/v70.sql

    r15894 r15897  
    971971(@iCategoryId, 'sys_pb_cache_enable', 'Enable page blocks cache', '', 'checkbox', '', '', '', 23), 
    972972(@iCategoryId, 'sys_pb_cache_engine', 'Page blocks cache engine (other than File option may require custom server setup)', 'File', 'select', 'File,EAccelerator,Memcache,APC,XCache', '', '', 24), 
    973 (@iCategoryId, 'sys_mm_cache_engine', 'Member menu cache engine (other than File option may require custom server setup)', 'File', 'select', 'File,EAccelerator,Memcache,APC,XCache', '', '', 25); 
     973(@iCategoryId, 'sys_mm_cache_engine', 'Member menu cache engine (other than File option may require custom server setup)', 'File', 'select', 'File,EAccelerator,Memcache,APC,XCache', '', '', 25), 
     974(@iCategoryId, 'sys_page_cache_enable', 'Enable Page cache', '', 'checkbox', '', '', '', 26), 
     975(@iCategoryId, 'sys_page_cache_engine', 'Page cache engine (other than File option may require custom server setup)', 'File', 'select', 'File,EAccelerator,Memcache,APC,XCache', '', '', 27); 
    974976 
    975977 
     
    48304832  `meta_robots` varchar(255) NOT NULL, 
    48314833  `cache_server` int(11) NOT NULL DEFAULT '0', 
    4832   `cache_server_params` varchar(255) NOT NULL, 
    4833   `cache_client` int(11) NOT NULL DEFAULT '0', 
    48344834  `cache_editable` tinyint(4) NOT NULL DEFAULT '1', 
    48354835  `deletable` tinyint(1) NOT NULL, 
     4836  `override_class_name` varchar(255) NOT NULL, 
     4837  `override_class_file` varchar(255) NOT NULL, 
    48364838  PRIMARY KEY (`id`), 
    48374839  UNIQUE KEY `object` (`object`) 
  • trunk/samples/page.php

    r15864 r15897  
    1515$aPathInfo = pathinfo(__FILE__); 
    1616require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php'); 
    17 require_once(BX_DIRECTORY_PATH_INC . "languages.inc.php"); 
    1817require_once(BX_DIRECTORY_PATH_INC . "params.inc.php"); 
    1918require_once(BX_DIRECTORY_PATH_INC . "design.inc.php"); 
    2019 
     20bx_import('BxDolLanguages'); 
     21 
    2122$oTemplate = BxDolTemplate::getInstance(); 
    2223$oTemplate->setPageNameIndex (BX_PAGE_DEFAULT); 
    23 $oTemplate->setPageHeader ("Sample page"); 
    2424$oTemplate->setPageContent ('page_main_code', PageCompMainCode()); 
    2525$oTemplate->getPageCode(); 
     
    3333 
    3434    bx_import('BxDolPage'); 
    35     $oGrid = BxDolPage::getObjectInstance('sample'); // it automatically creates instance of default or custom class by object name 
    36     if ($oGrid) 
    37         echo $oGrid->getCode(); // print page 
     35    $oPage = BxDolPage::getObjectInstance('sample'); // it automatically creates instance of default or custom class by object name 
     36    if ($oPage) 
     37        echo $oPage->getCode(); // print page 
    3838 
    3939    return ob_get_clean(); 
  • trunk/templates/base/_header.html

    r15286 r15897  
    77    __page_description__ 
    88    __page_keywords__ 
     9    __page_robots__ 
    910 
    1011    <meta http-equiv="Content-Style-Type" content="text/css" /> 
  • trunk/templates/base/scripts/BxBasePage.php

    r15864 r15897  
    1717 
    1818    protected $_oTemplate; 
     19    protected $_oPageCacheObject = null; 
    1920 
    2021    public function __construct ($aObject, $oTemplate) { 
     
    2728    } 
    2829 
    29  
    30     public function getCode () {                 
     30    /** 
     31     * Get page code with automatic caching, adding necessary css/js files and system template vars.  
     32     * @return string. 
     33     */ 
     34    public function getCode () { 
    3135 
    3236        if (!$this->_isVisiblePage($this->_aObject)) 
    33             return MsgBox(_t('_Access denied')); 
    34  
     37            return $this->_getPageAccessDeniedMsg (); 
     38 
     39        $this->_addJsCss(); 
     40  
     41        $this->_addSysTemplateVars(); 
     42 
     43        // TODO: insert profiler call here  
     44 
     45        if (!getParam('sys_page_cache_enable') || !$this->_aObject['cache_server']) 
     46            return $this->_getPageCode(); 
     47         
     48        $oCache = $this->_getPageCacheObject(); 
     49        $sKey = $this->_getPageCacheKey(); 
     50 
     51        $mixedRet = $oCache->getData($sKey, $this->_aObject['cache_server']); 
     52 
     53        if ($mixedRet !== null) { 
     54            return $mixedRet; 
     55        } else { 
     56            $sPageCode = $this->_getPageCode(); 
     57            $oCache->setData($sKey, $sPageCode, $this->_aObject['cache_server']); 
     58        }         
     59 
     60        return $sPageCode; 
     61    } 
     62     
     63    /** 
     64     * Get page code only. 
     65     * @return string 
     66     */ 
     67    protected function _getPageCode () { 
    3568        $aVars = array (); 
    3669        $aBlocks = $this->_oQuery->getPageBlocks(); 
     
    3871            $sCell = ''; 
    3972            foreach ($aCell as $aBlock) { 
    40  
    41                 if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->beginPageBlock(_t($aBlock['title']), $aBlock['id']); 
    42  
    43                 if (!$this->_isVisibleBlock($aBlock)) 
    44                     continue; 
    45  
    46                 $sFunc = '_getBlock' . ucfirst($aBlock['type']); 
    47                 $mixedContent = $this->$sFunc($aBlock); 
    48  
    49                 if (is_array($mixedContent)) { 
    50                     // TODO: get top, bottom, content code from array 
    51                 } elseif (is_string($mixedContent)) { 
    52                     $sContentWithBox = DesignBoxContent(_t($aBlock['title']), $mixedContent, $aBlock['designbox_id']); 
    53                 } else { 
    54                     $sContentWithBox = false; 
    55                 } 
     73                $sContentWithBox = $this->_getBlockCode($aBlock); 
    5674                if ($sContentWithBox) 
    5775                    $sCell .= '<div class="bx-page-block-container" id="bx-page-block-' . $aBlock['id'] . '">' . $sContentWithBox . '</div>'; 
    58  
    59                 if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->endPageBlock($aBlock['id'], $sContentWithBox ? false : true, false ); 
    6076            } 
    6177            $aVars[$sKey] = $sCell; 
    6278        } 
    63         $this->_addJsCss(); 
    64      
     79 
    6580        return $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars); 
    6681    } 
    67      
     82 
     83    /** 
     84     * Get block code. 
     85     * @return string 
     86     */ 
     87    protected function _getBlockCode($aBlock) { 
     88        $sContentWithBox = ''; 
     89 
     90        if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->beginPageBlock(_t($aBlock['title']), $aBlock['id']); 
     91 
     92        if ($this->_isVisibleBlock($aBlock)) { 
     93            $sFunc = '_getBlock' . ucfirst($aBlock['type']); 
     94            $mixedContent = $this->$sFunc($aBlock); 
     95 
     96            if (is_array($mixedContent)) { 
     97                // TODO: get menu from array 
     98                if (isset($mixedContent['content'])) 
     99                    $sContentWithBox = DesignBoxContent(_t($aBlock['title']), $mixedContent['content'], $aBlock['designbox_id']); 
     100            } elseif (is_string($mixedContent)) { 
     101                $sContentWithBox = DesignBoxContent(_t($aBlock['title']), $mixedContent, $aBlock['designbox_id']); 
     102            } else { 
     103                $sContentWithBox = false; 
     104            } 
     105        } 
     106 
     107        if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->endPageBlock($aBlock['id'], $sContentWithBox ? false : true, false ); 
     108 
     109        return $sContentWithBox; 
     110    } 
     111 
     112    /** 
     113     * Add necessary js and css files. 
     114     */ 
    68115    protected function _addJsCss() { 
    69116        $this->_oTemplate->addCss('page_layouts.css'); 
    70117    } 
    71118 
     119    /** 
     120     * Set system template variables, like page title, meta description, meta keywords and meta robots. 
     121     */ 
     122    protected function _addSysTemplateVars () { 
     123        $sPageTitle = $this->_getPageTitle(); 
     124        if ($sPageTitle) 
     125            $this->_oTemplate->setPageHeader ($sPageTitle); 
     126    
     127        $sMetaDesc = $this->_getPageMetaDesc(); 
     128        if ($sMetaDesc) 
     129            $this->_oTemplate->setPageDescription ($sMetaDesc); 
     130 
     131        $sMetaKeywords = $this->_getPageMetaKeywords(); 
     132        if ($sMetaKeywords) 
     133            $this->_oTemplate->addPageKeywords ($sMetaKeywords); 
     134 
     135        $sMetaRobots = $this->_getPageMetaRobots(); 
     136        if ($sMetaRobots) 
     137            $this->_oTemplate->setPageMetaRobots ($sMetaRobots); 
     138    } 
     139 
     140    /** 
     141     * Get content for 'raw' block type. 
     142     * @return string 
     143     */ 
    72144    protected function _getBlockRaw ($aBlock) { 
    73145        return $aBlock['content']; 
    74146    } 
    75147 
     148    /** 
     149     * Get content for 'html' block type. 
     150     * @return string 
     151     */ 
    76152    protected function _getBlockHtml ($aBlock) { 
    77153        return $this->_getBlockRaw ($aBlock); 
    78154    } 
    79155 
     156    /** 
     157     * Get content for 'lang' block type. 
     158     * @return string 
     159     */ 
    80160    protected function _getBlockLang ($aBlock) { 
    81161        return _t(trim($aBlock['content'])); 
    82162    } 
    83163 
     164    /** 
     165     * Get content for 'image' block type. 
     166     * @return string 
     167     */ 
    84168    protected function _getBlockImage ($aBlock) { 
    85169        // TODO: 
     
    87171    } 
    88172 
     173    /** 
     174     * Get content for 'rss' block type. 
     175     * @return string 
     176     */ 
    89177    protected function _getBlockRss ($aBlock) { 
    90178        list( $sUrl, $iNum ) = explode( '#', $sContent ); 
     
    95183    } 
    96184 
     185    /** 
     186     * Get content for 'menu' block type. 
     187     * @return string 
     188     */ 
    97189    protected function _getBlockMenu ($aBlock) { 
    98190        bx_import('BxTemplMenu'); 
     
    101193    } 
    102194 
     195    /** 
     196     * Get content for 'service' block type. 
     197     * @return string 
     198     */ 
    103199    protected function _getBlockService ($aBlock) { 
    104200        $a = @unserialize($aBlock['content']); 
     
    107203        return BxDolService::call($a['module'], $a['method'], $a['params']); 
    108204    } 
     205 
     206    /** 
     207     * Get page title. 
     208     * @return string 
     209     */ 
     210    protected function _getPageTitle() { 
     211        return _t($this->_aObject['title']); 
     212    } 
     213 
     214    /** 
     215     * Get page meta description. 
     216     * @return string 
     217     */ 
     218    protected function _getPageMetaDesc() { 
     219        return _t($this->_aObject['meta_description']); 
     220    } 
     221 
     222    /** 
     223     * Get page meta keywords. 
     224     * @return string 
     225     */ 
     226    protected function _getPageMetaKeywords() { 
     227        return _t($this->_aObject['meta_keywords']); 
     228    } 
     229 
     230    /** 
     231     * Get page meta robots. 
     232     * @return string 
     233     */ 
     234    protected function _getPageMetaRobots() { 
     235        return _t($this->_aObject['meta_robots']); 
     236    } 
     237 
     238    /** 
     239     * Get access denied message HTML. 
     240     * @return string 
     241     */ 
     242    protected function _getPageAccessDeniedMsg () { 
     243        return MsgBox(_t('_Access denied')); 
     244    } 
     245 
     246 
     247    /** 
     248     * Get page cache object. 
     249     * @return cache object instance 
     250     */ 
     251    protected function _getPageCacheObject () { 
     252        if ($this->_oPageCacheObject != null) { 
     253            return $this->_oPageCacheObject; 
     254        } else { 
     255            $sEngine = getParam('sys_page_cache_engine'); 
     256            $this->_oPageCacheObject = bx_instance ('BxDolCache' . $sEngine); 
     257            if (!$this->_oPageCacheObject->isAvailable()) 
     258                $this->_oPageCacheObject = bx_instance ('BxDolCacheFile'); 
     259            return $this->_oPageCacheObject; 
     260        } 
     261    } 
     262 
     263    /** 
     264     * Get page cache key. 
     265     * @param $isPrefixOnly return key prefix only. 
     266     * @return string 
     267     */ 
     268    protected function _getPageCacheKey ($isPrefixOnly = false) { 
     269        $s = 'page_' . $this->_aObject['object'] . '_'; 
     270        if ($isPrefixOnly) 
     271            return $s; 
     272        $s .= $this->_getPageCacheParams (); 
     273        $s .= md5(BX_DOL_VERSION . BX_DOL_BUILD . BX_DOL_URL_ROOT) . '.php'; 
     274        return $s; 
     275    } 
     276 
     277    /** 
     278     * Additional cache key. In the case of dynamic page.  
     279     * For example - profile page, where each profile has own page. 
     280     * @return string 
     281     */ 
     282    protected function _getPageCacheParams () { 
     283        return ''; 
     284    } 
     285 
     286    /** 
     287     * Clean page cache. 
     288     * @param $isDelAllWithPagePrefix delete cache by prefix, it can be used for dynamic pages, like profile view, where for each profile separate cache is generated. 
     289     * @return string 
     290     */ 
     291    protected function cleanCache ($isDelAllWithPagePrefix = false) { 
     292        $oCache = $this->_getPageCacheObject (); 
     293        $sKey = $this->_getPageCacheKey($isDelAllWithPagePrefix); 
     294 
     295        if ($isDelAllWithPagePrefix) 
     296            return $oCache->removeAllByPrefix($sKey); 
     297        else 
     298            return $oCache->delData($sKey); 
     299    } 
    109300} 
    110301 
Note: See TracChangeset for help on using the changeset viewer.