Пример #1
0
 /**
  * @param        $pluginName
  * @param        $group
  * @param string $layout
  * @return mixed
  * @author Valérie Isaksen
  */
 public function getTemplatePath($pluginName, $group, $layout = 'default')
 {
     $layoutPath = vmPlugin::_getLayoutPath($pluginName, 'vm' . $group, $layout);
     return str_replace(DS . $layout . '.php', '', $layoutPath);
 }
Пример #2
0
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout_name = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     static $theme;
     if (empty($theme)) {
         include JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'onepage.cfg.php';
         $theme = $selected_template;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     $layout = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout_name);
     jimport('joomla.filesystem.file');
     $psType = strtolower($psType);
     $psType = JFile::makeSafe($psType);
     $isset = false;
     //echo  JPATH_SITE.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_onepage'.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR.'overrides'.DIRECTORY_SEPARATOR.$psType.DIRECTORY_SEPARATOR.$name.DIRECTORY_SEPARATOR.$layout_name.'.php';
     if (file_exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php')) {
         $name = JFile::makeSafe($name);
         $layout_name = JFile::makeSafe($layout_name);
         $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php';
         $isset = true;
     } else {
         if (file_exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php')) {
             $isset = true;
             $name = JFile::makeSafe($name);
             $layout_name = JFile::makeSafe($layout_name);
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $layout_name . '.php';
         }
     }
     if (!$isset) {
         if (strpos($layout, 'payment_form') !== false) {
             if (strpos($layout, 'klarna') !== false) {
                 $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'klarna' . DIRECTORY_SEPARATOR . 'payment_form.php';
             }
         }
     }
     if (is_array($viewData)) {
         if (!empty($viewData['paymnentForm']) && $viewData['paymentForm'] == '#paymentForm') {
             $viewData['paymnentForm'] = '#adminForm';
         }
     }
     if (!$isset) {
         if (strpos($layout, 'javascript') !== false && $name == 'stripe') {
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'stripe' . DIRECTORY_SEPARATOR . 'javascript.php';
         }
     }
     if (strpos($layout, 'display_payment') !== false) {
         if (strpos($layout, 'ddmandate') !== false) {
             $layout = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'overrides' . DIRECTORY_SEPARATOR . $psType . DIRECTORY_SEPARATOR . 'ddmandate' . DIRECTORY_SEPARATOR . 'payment_form.php';
         }
     }
     if (!file_exists($layout)) {
         //JFactory::getApplication()->enqueueMessage('Layout not found: '.$layout);
     } else {
         ob_start();
         include $layout;
         $html = ob_get_clean();
         return $html;
     }
 }
Пример #3
0
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     $layout = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout);
     ob_start();
     include $layout;
     return ob_get_clean();
 }
 /**
  * Get the path to a layout for a type
  *
  * @param   string  $type  The name of the type
  * @param   string  $layout  The name of the type layout. If alternative
  *                           layout, in the form template:filename.
  * @param   array   $viewData  The data you want to use in the layout
  *                           can be an object/array/string... to reuse in the template
  * @return  string  The path to the type layout
  * original from libraries\joomla\application\module\helper.php
  * @since   11.1
  * @author Patrick Kohl, Valérie Isaksen
  */
 public function renderByLayout($layout = 'default', $viewData = NULL, $name = NULL, $psType = NULL)
 {
     if ($name === NULL) {
         $name = $this->_name;
     }
     if ($psType === NULL) {
         $psType = $this->_psType;
     }
     if (!($file = vmPlugin::_getLayoutPath($name, 'vm' . $psType, $layout))) {
         JError::raiseNotice(100, $layout . ' not found ');
         return;
     }
     ob_start();
     include $file;
     return ob_get_clean();
 }