Example #1
0
 /**
  * Output filter for public clients (this filter should only apply when in frontend preview mode)
  */
 public function outputFilterPublic($content)
 {
     /**
      * Substitute constants in the output for logged in users
      * TODO: highlight in documentation!
      */
     //only when not logged in backoffice
     if (!Onxshop_Bo_Authentication::getInstance()->isAuthenticated()) {
         if ($_SESSION['client']['customer']['id'] > 0) {
             $content = preg_replace("/{{customer.first_name}}/", htmlspecialchars($_SESSION['client']['customer']['first_name']), $content);
         } else {
             //assign empty string
             $content = preg_replace("/{{customer.first_name}}/", '', $content);
         }
     }
     // translations
     if (ONXSHOP_SIMPLE_TRANSLATION_ENABLED && !ONXSHOP_IN_BACKOFFICE) {
         $locale = $_SESSION['locale'];
         $default_locale = $GLOBALS['onxshop_conf']['global']['locale'];
         if ($locale != $default_locale) {
             require_once 'models/international/international_translation.php';
             $Translation = new international_translation();
             $node_id = $_SESSION['last_item'] = $_SESSION['history'][count($_SESSION['history']) - 1]['node_id'];
             $content = $Translation->translatePage($content, $locale, $node_id);
         }
     }
     return $content;
 }