Cheetah
ChWsbTemplateAdmin.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbTemplate');
9 
11 {
15  function __construct($sHomeFolder)
16  {
17  parent::__construct(CH_DIRECTORY_PATH_ROOT . $sHomeFolder . DIRECTORY_SEPARATOR, CH_WSB_URL_ROOT . $sHomeFolder . '/');
18 
19  $this->_sPrefix = 'ChWsbTemplateAdmin';
20  $this->_sInjectionsTable = 'sys_injections_admin';
21  $this->_sInjectionsCache = 'sys_injections_admin.inc';
22 
23  $this->_sCodeKey = 'askin';
24  $this->_sCode = isset($_COOKIE[$this->_sCodeKey]) && preg_match('/^[A-Za-z0-9_-]+$/', $_COOKIE[$this->_sCodeKey]) ? $_COOKIE[$this->_sCodeKey] : CH_WSB_TEMPLATE_DEFAULT_CODE;
25  $this->_sCode = isset($_GET[$this->_sCodeKey]) && preg_match('/^[A-Za-z0-9_-]+$/', $_GET[$this->_sCodeKey]) ? $_GET[$this->_sCodeKey] : $this->_sCode;
26 
27  $this->addLocationJs('system_admin_js', $this->_sRootPath . 'js/' , $this->_sRootUrl . 'js/');
28  }
29 
36  function parseSystemKey($sKey, $mixedKeyWrapperHtml = null)
37  {
39 
40  $aKeyWrappers = $this->_getKeyWrappers($mixedKeyWrapperHtml);
41 
42  $sRet = '';
43  switch( $sKey ) {
44  case 'current_version':
45  $sRet = $GLOBALS['site']['ver'] . '.' . $GLOBALS['site']['build'];
46  break;
47  case 'pre_release':
48  if($GLOBALS['site']['pre-release'] != '') {
49  $sRet = '.' . $GLOBALS['site']['pre-release'];
50  } else {
51  $sRet = '';
52  }
53  break;
54  case 'dir':
55  $a = ch_lang_info();
56  return $a['Direction'];
57  case 'page_charset':
58  $sRet = 'UTF-8';
59  break;
60  case 'page_keywords':
61  if(!empty($GLOBALS[$this->_sPrefix . 'PageKeywords']) && is_array($GLOBALS[$this->_sPrefix . 'PageKeywords']))
62  $sRet = '<meta name="keywords" content="' . process_line_output(implode(',', $GLOBALS[$this->_sPrefix . 'PageKeywords'])) . '" />';
63  break;
64  case 'page_description':
65  if(!empty($GLOBALS[$this->_sPrefix . 'PageDescription']) && is_string($GLOBALS[$this->_sPrefix . 'PageDescription']))
66  $sRet = '<meta name="description" content="' . process_line_output($GLOBALS[$this->_sPrefix . 'PageDescription']) . '" />';
67  break;
68  case 'page_header':
69  if(!empty($GLOBALS[$this->_sPrefix . 'PageTitle']))
70  $sRet = $GLOBALS[$this->_sPrefix . 'PageTitle'];
71  else if(isset($GLOBALS['_page']['header']))
72  $sRet = $GLOBALS['_page']['header'];
73 
74  $sRet = process_line_output($sRet);
75  break;
76  case 'page_header_text':
77  if(!empty($GLOBALS[$this->_sPrefix . 'PageMainBoxTitle']))
78  $sRet = process_line_output($GLOBALS[$this->_sPrefix . 'PageMainBoxTitle']);
79  else if(isset($GLOBALS['_page']['header_text']))
80  $sRet = $GLOBALS['_page']['header_text'];
81 
82  $sRet = process_line_output($sRet);
83  break;
84  case 'main_div_width':
85  if(!empty($GLOBALS[$this->_sPrefix . 'PageWidth']))
86  $sRet = process_line_output($GLOBALS[$this->_sPrefix . 'PageWidth']);
87  break;
88  case 'top_menu':
90  break;
91  case 'main_menu':
93  break;
94  case 'dol_images':
95  $sRet = $this->_processJsImages();
96  break;
97  case 'dol_lang':
98  $sRet = $this->_processJsTranslations();
99  break;
100  case 'dol_options':
101  $sRet = $this->_processJsOptions();
102  break;
103  case 'promo_code':
104  if (defined('CH_PROMO_CODE'))
105  $sRet = CH_PROMO_CODE;
106  else
107  $sRet = ' ';
108  break;
109  case 'copyright':
110  $sRet = _t( '_copyright', date('Y') ) . getVersionComment();
111  break;
112  }
113 
114  $sRet = ChWsbTemplate::processInjection($GLOBALS['_page']['name_index'], $sKey, $sRet);
115  return $sRet;
116  }
117 }
ChWsbTemplateAdmin\parseSystemKey
parseSystemKey($sKey, $mixedKeyWrapperHtml=null)
Definition: ChWsbTemplateAdmin.php:36
ChWsbTemplate
Definition: ChWsbTemplate.php:121
ChWsbTemplate\processInjection
processInjection($iPageIndex, $sKey, $sValue="")
Definition: ChWsbTemplate.php:1994
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbAdminMenu\getTopMenu
static getTopMenu()
Definition: ChWsbAdminMenu.php:10
php
ChWsbTemplate\$_sCode
$_sCode
Definition: ChWsbTemplate.php:130
CH_WSB_TEMPLATE_DEFAULT_CODE
const CH_WSB_TEMPLATE_DEFAULT_CODE
Definition: ChWsbTemplate.php:10
ChWsbTemplate\$_sCodeKey
$_sCodeKey
Definition: ChWsbTemplate.php:131
ch_lang_info
ch_lang_info()
Definition: languages.inc.php:562
$_GET
$_GET['debug']
Definition: index.php:67
getVersionComment
getVersionComment()
Definition: design.inc.php:203
ChWsbTemplate\addLocationJs
addLocationJs($sKey, $sLocationPath, $sLocationUrl)
Definition: ChWsbTemplate.php:330
CH_PROMO_CODE
const CH_PROMO_CODE
Definition: advanced_settings.php:39
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
ChWsbTemplateAdmin
Definition: ChWsbTemplateAdmin.php:11
ChWsbTemplateAdmin\__construct
__construct($sHomeFolder)
Definition: ChWsbTemplateAdmin.php:15
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbTemplate\_processJsImages
_processJsImages()
Definition: ChWsbTemplate.php:1885
ChWsbTemplate\_processJsOptions
_processJsOptions()
Definition: ChWsbTemplate.php:1872
process_line_output
process_line_output($text, $maxwordlen=100)
Definition: utils.inc.php:328
ChWsbTemplate\_getKeyWrappers
_getKeyWrappers($mixedKeyWrapperHtml)
Definition: ChWsbTemplate.php:1835
$logged
$logged['member']
Definition: activation_email.php:16
ChWsbTemplate\_processJsTranslations
_processJsTranslations()
Definition: ChWsbTemplate.php:1852
ChWsbAdminMenu\getMainMenu
static getMainMenu()
Definition: ChWsbAdminMenu.php:60
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10