Exemple #1
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // create mailer support
     $system_mailer = new ContactForm_SystemMailer($this->language);
     $smtp_mailer = new ContactForm_SmtpMailer($this->language);
     $this->registerMailer('system', $system_mailer);
     $this->registerMailer('smtp', $smtp_mailer);
     // configure SMTP mailer
     $smtp_mailer->set_server($this->settings['smtp_server'], $this->settings['smtp_port'], $this->settings['use_ssl']);
     if ($this->settings['smtp_authenticate']) {
         $smtp_mailer->set_credentials($this->settings['smtp_username'], $this->settings['smtp_password']);
     }
     // register backend
     if ($section == 'backend' && class_exists('backend')) {
         $backend = backend::getInstance();
         $contact_menu = new backend_MenuItem($this->getLanguageConstant('menu_contact'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', $level = 5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_forms'), url_GetFromFilePath($this->path . 'images/forms.svg'), window_Open('contact_forms', 600, $this->getLanguageConstant('title_forms_manage'), true, true, backend_UrlMake($this->name, 'forms_manage')), $level = 5));
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_manage_templates'), url_GetFromFilePath($this->path . 'images/templates.svg'), window_Open('contact_form_templates', 550, $this->getLanguageConstant('title_templates_manage'), true, true, backend_UrlMake($this->name, 'templates_manage')), $level = 5));
         $contact_menu->addSeparator(5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('contact_form_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings_show')), $level = 5));
         $contact_menu->addSeparator(5);
         $contact_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_submissions'), url_GetFromFilePath($this->path . 'images/submissions.svg'), window_Open('contact_form_submissions', 650, $this->getLanguageConstant('title_submissions'), true, true, backend_UrlMake($this->name, 'submissions')), $level = 5));
         $backend->addMenu($this->name, $contact_menu);
         // add backend support script
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/backend.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
     if (class_exists('collection') && $section != 'backend') {
         $collection = collection::getInstance();
         $collection->includeScript(collection::DIALOG);
         $collection->includeScript(collection::COMMUNICATOR);
     }
     if (class_exists('head_tag') && $section != 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/contact_form.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/contact_form.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
 }
Exemple #2
0
 /**
  * Constructor
  *
  * @return backend
  */
 protected function __construct()
 {
     global $section, $language;
     parent::__construct(__FILE__);
     // create events
     Events::register('backend', 'user-create');
     Events::register('backend', 'user-change');
     Events::register('backend', 'user-delete');
     Events::register('backend', 'user-password-change');
     // load CSS and JScript
     if (class_exists('head_tag') && $section == 'backend') {
         $head_tag = head_tag::getInstance();
         $collection = collection::getInstance();
         $collection->includeScript(collection::JQUERY);
         $collection->includeScript(collection::JQUERY_EVENT_DRAG);
         $collection->includeScript(collection::WINDOW_SYSTEM);
         if ($_SESSION['logged']) {
             $collection->includeScript(collection::JQUERY_EXTENSIONS);
             $collection->includeScript(collection::NOTEBOOK);
             $collection->includeScript(collection::SHOWDOWN);
             $collection->includeScript(collection::TOOLBAR);
         }
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/backend.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
     }
     // add admin level menus
     if ($section == 'backend') {
         $system_menu = new backend_MenuItem($this->getLanguageConstant('menu_system'), url_GetFromFilePath($this->path . 'images/icons/16/system.svg'), 'javascript:void(0);', $level = 1);
         $system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_modules'), url_GetFromFilePath($this->path . 'images/icons/16/modules.svg'), window_Open('system_modules', 610, $this->getLanguageConstant('title_modules'), true, false, backend_UrlMake($this->name, 'modules')), $level = 10));
         $system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_users'), url_GetFromFilePath($this->path . 'images/icons/16/users.svg'), window_Open('system_users', 690, $this->getLanguageConstant('title_users_manager'), true, false, backend_UrlMake($this->name, 'users')), $level = 10));
         $system_menu->addSeparator(10);
         $system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_change_password'), url_GetFromFilePath($this->path . 'images/icons/16/change_password.svg'), window_Open('change_password_window', 350, $this->getLanguageConstant('title_change_password'), true, false, backend_UrlMake($this->name, 'change_password')), $level = 1));
         $system_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_logout'), url_GetFromFilePath($this->path . 'images/icons/16/logout.svg'), window_Open('logout_window', 350, $this->getLanguageConstant('title_logout'), true, false, backend_UrlMake($this->name, 'logout')), $level = 1));
         $this->addMenu($this->name, $system_menu);
     }
 }
Exemple #3
0
 /** 
  * Method called by the page module to add elements before printing
  */
 public function addElements()
 {
     global $section, $db_use, $optimize_code, $url_rewrite;
     $head_tag = head_tag::getInstance();
     $collection = collection::getInstance();
     $language_handler = MainLanguageHandler::getInstance();
     $default_language = $language_handler->getDefaultLanguage();
     $language_list = $language_handler->getLanguages(false);
     // add base url tag
     $head_tag->addTag('base', array('href' => _BASEURL));
     // add mobile menu script
     if (_MOBILE_VERSION && !in_array('mobile_menu', $this->omit_elements)) {
         $collection->includeScript(collection::MOBILE_MENU);
     }
     // content meta tags
     if (!in_array('content_type', $this->omit_elements)) {
         $head_tag->addTag('meta', array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'));
     }
     if (!in_array('viewport', $this->omit_elements) && _MOBILE_VERSION) {
         $head_tag->addTag('meta', array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0'));
     }
     if (!in_array('language', $this->omit_elements) && _STANDARD == 'html401') {
         $head_tag->addTag('meta', array('http-equiv' => 'Content-Language', 'content' => join(', ', $language_list)));
     }
     // add other languages if required
     if (count($language_list) > 1 && $url_rewrite && class_exists('language_menu')) {
         language_menu::getInstance()->addMeta();
     }
     // robot tags
     $head_tag->addTag('meta', array('name' => 'robots', 'content' => 'index, follow'));
     $head_tag->addTag('meta', array('name' => 'googlebot', 'content' => 'index, follow'));
     $head_tag->addTag('meta', array('name' => 'rating', 'content' => 'general'));
     if ($section != 'backend' && $section != 'backend_module' && $db_use) {
         // google analytics
         if (!empty($this->settings['analytics'])) {
             $head_tag->addGoogleAnalytics($this->settings['analytics'], $this->settings['analytics_domain'], $this->settings['analytics_version']);
         }
         // google website optimizer
         if (!empty($this->settings['optimizer'])) {
             $head_tag->addGoogleSiteOptimizer($this->settings['optimizer'], $this->settings['optimizer_key'], $this->optimizer_page, $this->optimizer_show_control);
         }
         // google webmaster tools
         if (!empty($this->settings['wm_tools'])) {
             $head_tag->addTag('meta', array('name' => 'google-site-verification', 'content' => $this->settings['wm_tools']));
         }
         // bing webmaster tools
         if (!empty($this->settings['bing_wm_tools'])) {
             $head_tag->addTag('meta', array('name' => 'msvalidate.01', 'content' => $this->settings['bing_wm_tools']));
         }
         // page description
         if ($db_use) {
             if (!is_null($this->page_description)) {
                 $value = $this->page_description;
             } else {
                 $value = $this->settings['description'];
             }
         }
         $head_tag->addTag('meta', array('name' => 'description', 'content' => $value));
     }
     // copyright
     if (!in_array('copyright', $this->omit_elements) && _STANDARD == 'html401') {
         $copyright = MainLanguageHandler::getInstance()->getText('copyright');
         $copyright = strip_tags($copyright);
         $head_tag->addTag('meta', array('name' => 'copyright', 'content' => $copyright));
     }
     // favicon
     if (file_exists(_BASEPATH . '/images/favicon.png')) {
         // regular, single size favicon
         $icon_files = array('16x16' => _BASEPATH . '/images/favicon.png');
     } else {
         if (file_exists(_BASEPATH . '/images/favicon')) {
             $icon_sizes = array(16, 32, 64);
             $icon_files = array();
             foreach ($icon_sizes as $size) {
                 $file_name = _BASEPATH . '/images/favicon/' . $size . '.png';
                 if (file_exists($file_name)) {
                     $icon_files[$size . 'x' . $size] = $file_name;
                 }
             }
         } else {
             $icon_files = array('16x16' => _BASEPATH . '/images/default_icon/16.png', '32x32' => _BASEPATH . '/images/default_icon/32.png', '64x64' => _BASEPATH . '/images/default_icon/64.png');
         }
     }
     foreach ($icon_files as $sizes => $icon) {
         $head_tag->addTag('link', array('rel' => 'icon', 'type' => 'image/png', 'sizes' => $sizes, 'href' => url_GetFromFilePath($icon)));
     }
     // add default styles and script if they exists
     $collection->includeScript(collection::JQUERY);
     if ($section != 'backend') {
         $styles = array();
         $less_style = null;
         // prepare list of files without extensions
         if (_DESKTOP_VERSION) {
             $styles = array('/styles/common.css', '/styles/main.css', '/styles/header.css', '/styles/content.css', '/styles/footer.css');
             $less_style = '/styles/main.less';
         } else {
             $styles = array('/styles/common.css', '/styles/main.css', '/styles/header_mobile.css', '/styles/content_mobile.css', '/styles/footer_mobile.css');
             $less_style = '/styles/main_mobile.less';
         }
         // include styles
         foreach ($styles as $style) {
             // check for css files
             if (file_exists(_BASEPATH . $style)) {
                 $head_tag->addTag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => url_GetFromFilePath(_BASEPATH . $style)));
             }
         }
         // add main less file if it exists
         if (file_exists(_BASEPATH . $less_style)) {
             $head_tag->addTag('link', array('rel' => 'stylesheet/less', 'type' => 'text/css', 'href' => url_GetFromFilePath(_BASEPATH . $less_style)));
             if (!$optimize_code) {
                 $collection->includeScript(collection::LESS);
             }
         }
         // add main javascript
         if (file_exists(_BASEPATH . '/scripts/main.js')) {
             $head_tag->addTag('script', array('type' => 'text/javascript', 'src' => url_GetFromFilePath(_BASEPATH . '/scripts/main.js')));
         }
     }
 }
Exemple #4
0
 /**
  * Parse loaded template
  *
  * @param integer $level Current level of parsing
  * @param array $tags Leave blank, used for recursion
  * @param boolean $parent_block If parent tag is block element
  */
 public function parse($tags = array())
 {
     global $section, $action, $language, $template_path, $system_template_path;
     if (!$this->active && empty($tags)) {
         return;
     }
     // get language handler for later
     $language_handler = MainLanguageHandler::getInstance();
     // take the tag list for parsing
     $tag_array = empty($tags) ? $this->engine->document->tagChildren : $tags;
     // start parsing tags
     $count = count($tag_array);
     for ($i = 0; $i < $count; $i++) {
         $tag = $tag_array[$i];
         // if tag has eval set
         if (isset($tag->tagAttrs['cms:eval']) || isset($tag->tagAttrs['eval'])) {
             // get evaluation values
             if (isset($tag->tagAttrs['eval'])) {
                 $value = $tag->tagAttrs['eval'];
             } else {
                 $value = $tag->tagAttrs['cms:eval'];
             }
             $eval_params = explode(',', $value);
             foreach ($eval_params as $param) {
                 // prepare module includes for evaluation
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs[$param];
                 $tag->tagAttrs[$param] = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
             }
             // unset param
             unset($tag->tagAttrs['cms:eval']);
         }
         if (isset($tag->tagAttrs['cms:optional'])) {
             // get evaluation values
             $optional_params = explode(',', $tag->tagAttrs['cms:optional']);
             foreach ($optional_params as $param) {
                 // prepare module includes for evaluation
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs[$param];
                 $value = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
                 if ($value == false) {
                     unset($tag->tagAttrs[$param]);
                 } else {
                     $tag->tagAttrs[$param] = $value;
                 }
             }
             // unset param
             unset($tag->tagAttrs['cms:optional']);
         }
         // implement tooltip
         if (isset($tag->tagAttrs['cms:tooltip'])) {
             if (!is_null($this->module)) {
                 $value = $this->module->getLanguageConstant($tag->tagAttrs['cms:tooltip']);
             } else {
                 $value = $language_handler->getText($tag->tagAttrs['cms:tooltip']);
             }
             $tag->tagAttrs['data-tooltip'] = $value;
             unset($tag->tagAttrs['cms:tooltip']);
         }
         // implement constants
         if (isset($tag->tagAttrs['cms:constant'])) {
             $params = explode(',', $tag->tagAttrs['cms:constant']);
             if (count($params) > 0) {
                 foreach ($params as $param) {
                     if (!is_null($this->module)) {
                         $tag->tagAttrs[$param] = $this->module->getLanguageConstant($tag->tagAttrs[$param]);
                     } else {
                         $tag->tagAttrs[$param] = $language_handler->getText($tag->tagAttrs[$param]);
                     }
                 }
             }
             unset($tag->tagAttrs['cms:constant']);
         }
         // check if specified tag shouldn't be cached
         $skip_cache = false;
         if (isset($tag->tagAttrs['skip_cache'])) {
             // unset param
             unset($tag->tagAttrs['skip_cache']);
             // get cache handler
             $cache = CacheHandler::getInstance();
             // only if current URL is being cached, we start dirty area
             if ($cache->isCaching()) {
                 $cache->startDirtyArea();
                 $skip_cache = true;
                 // reconstruct template for cache,
                 // ugly but we are not doing it a lot
                 $data = $this->getDataForCache($tag);
                 $cache->setCacheForDirtyArea($data);
             }
         }
         // now parse the tag
         switch ($tag->tagName) {
             // handle tag used for setting session variable
             case '_session':
             case 'cms:session':
                 $name = $tag->tagAttrs['name'];
                 // allow setting referral only once per seesion
                 if (isset($tag->tagAttrs['once'])) {
                     $only_once = in_array($tag->tagAttrs['once'], array(1, 'yes'));
                 } else {
                     $only_once = false;
                 }
                 $should_set = $only_once && !isset($_SESSION[$name]) || !$only_once;
                 // store value
                 if (!in_array($name, $this->protected_variables) && $should_set) {
                     $_SESSION[$name] = $tag->tagAttrs['value'];
                 }
                 break;
                 // transfer control to module
             // transfer control to module
             case '_module':
             case 'cms:module':
                 if (class_exists($tag->tagAttrs['name'])) {
                     $module = call_user_func(array($tag->tagAttrs['name'], 'getInstance'));
                     $module->transferControl($tag->tagAttrs, $tag->tagChildren);
                 }
                 break;
                 // load other template
             // load other template
             case '_template':
             case 'cms:template':
                 $file = $tag->tagAttrs['file'];
                 $path = key_exists('path', $tag->tagAttrs) ? $tag->tagAttrs['path'] : '';
                 if (!is_null($this->module)) {
                     $path = preg_replace('/^%module%/i', $this->module->path, $path);
                     $path = preg_replace('/^%templates%/i', $template_path, $path);
                 }
                 $new = new TemplateHandler($file, $path);
                 $new->setLocalParams($this->params);
                 $new->parse();
                 break;
                 // raw text copy
             // raw text copy
             case '_raw':
             case 'cms:raw':
                 if (key_exists('file', $tag->tagAttrs)) {
                     // if file attribute is specified
                     $file = $tag->tagAttrs['file'];
                     $path = key_exists('path', $tag->tagAttrs) ? $tag->tagAttrs['path'] : $template_path;
                     $text = file_get_contents($path . $file);
                 } elseif (key_exists('text', $tag->tagAttrs)) {
                     // if text attribute is specified
                     $text = $tag->tagAttrs['text'];
                 } else {
                     // in any other case we display data inside tag
                     $text = $tag->tagData;
                 }
                 echo $text;
                 break;
                 // multi language constants
             // multi language constants
             case '_text':
             case 'cms:text':
                 $constant = $tag->tagAttrs['constant'];
                 $language = key_exists('language', $tag->tagAttrs) ? $tag->tagAttrs['language'] : $language;
                 $text = "";
                 // check if constant is module based
                 if (key_exists('module', $tag->tagAttrs)) {
                     if (class_exists($tag->tagAttrs['module'])) {
                         $module = call_user_func(array($tag->tagAttrs['module'], 'getInstance'));
                         $text = $module->getLanguageConstant($constant, $language);
                     }
                 } else {
                     // use default language handler
                     $text = MainLanguageHandler::getInstance()->getText($constant, $language);
                 }
                 echo $text;
                 break;
                 // support for markdown
             // support for markdown
             case 'cms:markdown':
                 $char_count = isset($tag->tagAttrs['chars']) ? fix_id($tag->tagAttrs['chars']) : null;
                 $end_with = isset($tag->tagAttrs['end_with']) ? fix_id($tag->tagAttrs['end_with']) : null;
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 $multilanguage = isset($tag->tagAttrs['multilanguage']) ? $tag->tagAttrs['multilanguage'] == 'yes' : false;
                 // get content for parsing
                 if (is_null($name)) {
                     $content = $tag->tagData;
                 }
                 $content = $multilanguage ? $this->params[$name][$language] : $this->params[$name];
                 // convert to HTML
                 $content = Markdown($content);
                 // limit words if specified
                 if (!is_null($char_count)) {
                     if (is_null($end_with)) {
                         $content = limit_words($content, $char_count);
                     } else {
                         $content = limit_words($content, $char_count, $end_with);
                     }
                 }
                 echo $content;
                 break;
                 // call section specific data
             // call section specific data
             case '_section_data':
             case 'cms:section_data':
                 if (!is_null($this->module)) {
                     $file = $this->module->getSectionFile($section, $action, $language);
                     $new = new TemplateHandler(basename($file), dirname($file) . '/');
                     $new->setLocalParams($this->params);
                     $new->setMappedModule($this->module);
                     $new->parse();
                 } else {
                     // log error
                     trigger_error('Mapped module is not loaded! File: ' . $this->file, E_USER_WARNING);
                 }
                 break;
                 // print multilanguage data
             // print multilanguage data
             case '_language_data':
             case 'cms:language_data':
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 if (!isset($this->params[$name]) || !is_array($this->params[$name]) || is_null($name)) {
                     break;
                 }
                 $template = new TemplateHandler('language_data.xml', $system_template_path);
                 $template->setMappedModule($this->module);
                 foreach ($this->params[$name] as $lang => $data) {
                     $params = array('param' => $name, 'language' => $lang, 'data' => $data);
                     $template->restoreXML();
                     $template->setLocalParams($params);
                     $template->parse();
                 }
                 break;
                 // replace tag data string with matching params
             // replace tag data string with matching params
             case '_replace':
             case 'cms:replace':
                 $pool = isset($tag->tagAttrs['param']) ? $this->params[$tag->tagAttrs['param']] : $this->params;
                 $keys = array_keys($pool);
                 $values = array_values($pool);
                 foreach ($keys as $i => $key) {
                     $keys[$i] = "%{$key}%";
                 }
                 // we can't replact string with array, only matching data types
                 foreach ($values as $i => $value) {
                     if (is_array($value)) {
                         unset($keys[$i]);
                         unset($values[$i]);
                     }
                 }
                 echo str_replace($keys, $values, $tag->tagData);
                 break;
                 // conditional tag
             // conditional tag
             case '_if':
             case 'cms:if':
                 $settings = !is_null($this->module) ? $this->module->settings : array();
                 $params = $this->params;
                 $condition = true;
                 // check if section is specified and matches
                 if (isset($tag->tagAttrs['section'])) {
                     $condition &= $tag->tagAttrs['section'] == $section;
                 }
                 // check if action is specified and matches
                 if (isset($tag->tagAttrs['action'])) {
                     $condition &= $tag->tagAttrs['action'] == $action;
                 }
                 // check custom condition
                 if (isset($tag->tagAttrs['condition'])) {
                     $to_eval = $tag->tagAttrs['condition'];
                     $eval_result = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';') == true;
                     $condition &= $eval_result;
                 }
                 // parse children
                 if ($condition) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for desktop version
             // conditional tag parsed for desktop version
             case 'cms:desktop':
                 if (_DESKTOP_VERSION) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for mobile version
             // conditional tag parsed for mobile version
             case 'cms:mobile':
                 if (_MOBILE_VERSION) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for users that are logged in
             // conditional tag parsed for users that are logged in
             case 'cms:user':
                 if ($_SESSION['logged']) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for guests
             // conditional tag parsed for guests
             case 'cms:guest':
                 if (!$_SESSION['logged']) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // variable
             // variable
             case '_var':
             case 'cms:var':
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs['name'];
                 echo eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
                 break;
                 // support for script tag
             // support for script tag
             case 'cms:script':
                 if (class_exists('head_tag')) {
                     $head_tag = head_tag::getInstance();
                     $head_tag->addTag('script', $tag->tagAttrs);
                 }
                 break;
                 // support for collection module
             // support for collection module
             case 'cms:collection':
                 if (array_key_exists('include', $tag->tagAttrs) && class_exists('collection')) {
                     $scripts = fix_chars(explode(',', $tag->tagAttrs['include']));
                     $collection = collection::getInstance();
                     $collection->includeScript($scripts);
                 }
                 break;
                 // support for link tag
             // support for link tag
             case 'cms:link':
                 if (class_exists('head_tag')) {
                     $head_tag = head_tag::getInstance();
                     $head_tag->addTag('link', $tag->tagAttrs);
                 }
                 break;
                 // support for parameter based choice
             // support for parameter based choice
             case 'cms:choice':
                 $param_value = null;
                 if (array_key_exists('param', $tag->tagAttrs)) {
                     // grap param value from GET or POST parameters
                     $param_name = fix_chars($tag->tagAttrs['param']);
                     $param_value = isset($_REQUEST[$param_name]) ? fix_chars($_REQUEST[$param_name]) : null;
                 } else {
                     if (array_key_exists('value', $tag->tagAttrs)) {
                         // use param value specified
                         $param_value = fix_chars($tag->tagAttrs['value']);
                     }
                 }
                 // parse only option
                 foreach ($tag->tagChildren as $option) {
                     if (!$option->tagName == 'option') {
                         continue;
                     }
                     $option_value = isset($option->tagAttrs['value']) ? $option->tagAttrs['value'] : null;
                     $option_default = isset($option->tagAttrs['default']) ? $option->tagAttrs['default'] == 1 : false;
                     // values match or option is default, parse its content
                     if ($option_value == $param_value || $option_default) {
                         $this->parse($option->tagChildren);
                         break;
                     }
                 }
                 break;
                 // default action for parser, draw tag
             // default action for parser, draw tag
             default:
                 if (in_array($tag->tagName, array_keys($this->handlers))) {
                     // custom tag handler is set...
                     $handle = $this->handlers[$tag->tagName];
                     $obj = $handle['object'];
                     $function = $handle['function'];
                     $obj->{$function}($tag->tagAttrs, $tag->tagChildren);
                 } else {
                     // default tag handler
                     echo '<' . $tag->tagName . $this->getTagParams($tag->tagAttrs) . '>';
                     if (count($tag->tagChildren) > 0) {
                         $this->parse($tag->tagChildren);
                     }
                     if (count($tag->tagData) > 0) {
                         echo $tag->tagData;
                     }
                     $close_tag = $this->close_all_tags ? true : !in_array($tag->tagName, $this->tags_without_end);
                     if ($close_tag) {
                         echo '</' . $tag->tagName . '>';
                     }
                 }
                 break;
         }
         // end cache dirty area if initialized
         if ($skip_cache) {
             $cache->endDirtyArea();
         }
     }
 }
Exemple #5
0
 /**
  * Include buyer information and checkout form scripts.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function includeScripts($tag_params, $children)
 {
     if (!class_exists('head_tag')) {
         return;
     }
     $head_tag = head_tag::getInstance();
     $collection = collection::getInstance();
     $collection->includeScript(collection::DIALOG);
     $collection->includeScript(collection::PAGE_CONTROL);
     $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/checkout.js'), 'type' => 'text/javascript'));
 }