Beispiel #1
0
 /**
  * Replace JSN EasySlider Syntax.
  *
  * @param   string   $context  The context of the content being passed to the plugin.
  * @param   mixed    &$row     An object with a "text" property or the string to be cloaked.
  * @param   mixed    &$params  Additional parameters. See {@see PlgContentEmailcloak()}.
  * @param   integer  $page     Optional page number. Unused. Defaults to zero.
  *
  * @return  boolean	True on success.
  */
 public function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     // Don't run this plugin when the area is admin
     if ($this->_application->isAdmin()) {
         return;
     }
     // Don't run this plugin when the content is being indexed
     if ($context == 'com_finder.indexer') {
         return true;
     }
     $objJSNEasySliderRender = new JSNEasySliderRender();
     if (!empty($article->text)) {
         // Find all instances of plugin and put in $matches for loadposition
         preg_match_all('/\\{jsn_easyslider (.*)\\/\\}/U', $article->text, $matches, PREG_SET_ORDER);
         // No matches, skip this
         if (count($matches)) {
             foreach ($matches as $index => $match) {
                 $matcheslist = explode(' ', $match[1]);
                 $tmpSliderID = explode('=', $matcheslist[1]);
                 $sliderID = trim($tmpSliderID[1]);
                 if (isset($sliderID)) {
                     $output = $objJSNEasySliderRender->render($sliderID, true);
                     $article->text = @preg_replace("|{$match['0']}|", addcslashes($output, '\\$'), $article->text, 1);
                 }
                 // We should replace only first occurrence in order to allow positions with the same name to regenerate their content:
             }
         }
         return true;
     }
 }
 public static function render(&$params)
 {
     $objJSNEasySliderRender = new JSNEasySliderRender();
     $sliderID = $params->get('slider_id');
     if (is_numeric($sliderID)) {
         echo $objJSNEasySliderRender->render($sliderID, true);
     }
 }
Beispiel #3
0
 /**
  * DEFINE setting options of shortcode
  *
  * @return type
  */
 public function element_shortcode($atts = null, $content = null)
 {
     $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts);
     extract($arr_params);
     if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyslider")) {
         $html_element = JText::_('JSN_PAGEBUILDER_ELEMENT_EASYSLIDER_MSG_INSTALL_EASYSLIDER_AND_ENABLE');
         return $this->element_wrapper($html_element, $arr_params);
     }
     $easySliderId = (int) $arr_params['easyslider_id'];
     /** @var JSNEasySliderRender $objJSNEasySliderRender */
     $objJSNEasySliderRender = new JSNEasySliderRender();
     $html = $objJSNEasySliderRender->render($easySliderId, true);
     return $this->element_wrapper($html, $arr_params);
 }