Exemplo n.º 1
0
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     if (preg_match('~(^athlete/widget_banner_category)~', $type)) {
         $params['text'] = str_replace("\r\n", '\\n', $params['text']);
     }
     return parent::getWidgetDeclaration($type, $params, $asIs);
 }
Exemplo n.º 2
0
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     if (preg_match('~(^ves_blog/widget_latest)~', $type)) {
         $params['latestmod_desc'] = base64_encode($params['latestmod_desc']);
     }
     return parent::getWidgetDeclaration($type, $params, $asIs);
 }
Exemplo n.º 3
0
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     if (preg_match('~(^ves_tabshome/widget_tab)~', $type)) {
         $params['pretext'] = base64_encode($params['pretext']);
     }
     return parent::getWidgetDeclaration($type, $params, $asIs);
 }
Exemplo n.º 4
0
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     $field_pattern = array("pretext", "shortcode", "html", "raw_html", "content", "latestmod_desc", "custom_css");
     $widget_types = array("ves_base/widget_accordionbg");
     foreach ($params as $k => $v) {
         if (in_array($k, $field_pattern) || preg_match("/^content_(.*)/", $k) || preg_match("/^header_(.*)/", $k) && in_array($type, $widget_types)) {
             $params[$k] = base64_encode($params[$k]);
         }
     }
     return parent::getWidgetDeclaration($type, $params, $asIs);
 }
Exemplo n.º 5
0
 /**
  * Return widget presentation code in WYSIWYG editor
  *
  * @param string $type Widget Type
  * @param array $params Pre-configured Widget Params
  * @param bool $asIs Return result as widget directive(true) or as placeholder image(false)
  * @return string Widget directive ready to parse
  */
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     $html = parent::getWidgetDeclaration($type, $params, $asIs);
     if (preg_match('/id="([^"]*)"/i', $html, $idMatch) && preg_match('/src="([^"]*)"/i', $html, $srcMatch)) {
         $params = base64_decode(strtr($idMatch[1], ':_-', '+/='));
         $params = str_replace('{{widget', '', $params);
         $params = str_replace('}}', '', $params);
         $image = Mage::getModel('SwiftOtter_Widget/Image')->init($type, $params);
         $html = str_replace($srcMatch[0], sprintf('src="%s"', $image->getPath(true)), $html);
     }
     return $html;
 }
Exemplo n.º 6
0
 /**
  * Return widget presentation code in WYSIWYG editor
  *
  * @param string $type Widget Type
  * @param array $params Pre-configured Widget Params
  * @param bool $asIs Return result as widget directive(true) or as placeholder image(false)
  * @return string Widget directive ready to parse
  */
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     if ($type != 'tabs/group') {
         for ($i = 1; $i <= 10; $i++) {
             if (isset($params['title_' . $i]) && is_array($params['title_' . $i])) {
                 unset($params['title_' . $i]);
             }
         }
         return parent::getWidgetDeclaration($type, $params, $asIs);
     }
     $directive = '{{widget type="' . $type . '"';
     foreach ($params as $name => $value) {
         // Retrieve default option value if pre-configured
         if (is_array($value)) {
             if ($type == 'tabs/group') {
                 if (implode('', $value)) {
                     $value = base64_encode(serialize($value));
                 } else {
                     $value = '';
                 }
             } else {
                 $value = implode(',', $value);
             }
         } elseif (trim($value) == '') {
             $widget = $this->getConfigAsObject($type);
             $parameters = $widget->getParameters();
             if (isset($parameters[$name]) && is_object($parameters[$name])) {
                 $value = $parameters[$name]->getValue();
             }
         }
         if ($value) {
             $directive .= sprintf(' %s="%s"', $name, $value);
         }
     }
     $directive .= '}}';
     if ($asIs) {
         return $directive;
     }
     $config = Mage::getSingleton('widget/widget_config');
     $imageName = str_replace('/', '__', $type) . '.gif';
     if (is_file($config->getPlaceholderImagesBaseDir() . DS . $imageName)) {
         $image = $config->getPlaceholderImagesBaseUrl() . $imageName;
     } else {
         $image = $config->getPlaceholderImagesBaseUrl() . 'default.gif';
     }
     $html = sprintf('<img id="%s" src="%s" title="%s">', $this->_idEncode($directive), $image, Mage::helper('core')->urlEscape($directive));
     return $html;
 }
Exemplo n.º 7
0
 /**
  * Return widget presentation code in WYSIWYG editor
  *
  * @param string $type Widget Type
  * @param array $params Pre-configured Widget Params
  * @param bool $asIs Return result as widget directive(true) or as placeholder image(false)
  * @return string Widget directive ready to parse
  */
 public function getWidgetDeclaration($type, $params = array(), $asIs = true)
 {
     if (!in_array($type, array('slideshow/create'))) {
         return parent::getWidgetDeclaration($type, $params, $asIs);
     }
     $directive = '{{widget type="' . $type . '"';
     $helper = Mage::helper('slideshow');
     foreach ($params as $name => $value) {
         // Retrieve default option value if pre-configured
         if ($type == 'slideshow/create') {
             if ((strstr($name, 'text') && !in_array($name, array('textmouseover', 'texteffect', 'textsync')) || strstr($name, 'url')) && trim($value) != '') {
                 $value = $helper->html_encode($value);
             }
         }
         if (is_array($value)) {
             $value = implode(',', $value);
         } elseif (trim($value) == '') {
             $widget = $this->getConfigAsObject($type);
             $parameters = $widget->getParameters();
             if (isset($parameters[$name]) && is_object($parameters[$name])) {
                 $value = $parameters[$name]->getValue();
             }
         }
         if ($value) {
             $directive .= sprintf(' %s="%s"', $name, $value);
         }
     }
     $directive .= '}}';
     if ($asIs) {
         return $directive;
     }
     $config = Mage::getSingleton('widget/widget_config');
     $imageName = str_replace('/', '__', $type) . '.gif';
     if (is_file($config->getPlaceholderImagesBaseDir() . DS . $imageName)) {
         $image = $config->getPlaceholderImagesBaseUrl() . $imageName;
     } else {
         $image = $config->getPlaceholderImagesBaseUrl() . 'default.gif';
     }
     $html = sprintf('<img id="%s" src="%s" title="%s">', $this->_idEncode($directive), $image, Mage::helper('core')->urlEscape($directive));
     return $html;
 }