示例#1
0
 public static function getLayoutPath($type, $name, $client = 'site', $layout = 'default', $viewName = null)
 {
     $defaultLayout = $layout;
     if ($client == 'site' && $viewName && !empty($viewName)) {
         $_template = TZ_Portfolio_PlusTemplate::getTemplate(true);
         $template = $_template->template;
         $params = $_template->params;
         if (strpos($layout, ':') !== false) {
             // Get the template and file name from the string
             $temp = explode(':', $layout);
             $template = $temp[0] == '_' ? $_template->template : $temp[0];
             $layout = $temp[1];
             $defaultLayout = $temp[1] ? $temp[1] : 'default';
         }
         self::$layout = $defaultLayout;
         // Build the template and base path for the layout
         $tPath = COM_TZ_PORTFOLIO_PLUS_TEMPLATE_PATH . '/' . $template . '/html/' . $params->get('layout', 'default') . '/' . $viewName . '/plg_' . $type . '_' . $name . '/' . $layout . '.php';
         $bPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/views' . '/' . $viewName . '/tmpl' . '/' . $defaultLayout . '.php';
         $dPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/views' . '/' . $viewName . '/tmpl' . '/default.php';
     } elseif ($client == 'admin') {
         $template = JFactory::getApplication()->getTemplate();
         if (strpos($layout, ':') !== false) {
             // Get the template and file name from the string
             $temp = explode(':', $layout);
             $template = $temp[0] == '_' ? $template : $temp[0];
             $layout = $temp[1];
             $defaultLayout = $temp[1] ? $temp[1] : 'default';
         }
         // Build the template and base path for the layout
         $tPath = JPATH_THEMES . '/' . $template . '/html/plg_' . $type . '_' . $name . '/' . $layout . '.php';
         $bPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/tmpl/' . $defaultLayout . '.php';
         $dPath = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . '/' . $type . '/' . $name . '/tmpl/default.php';
     }
     // If the template has a layout override use it
     if (file_exists($tPath)) {
         return $tPath;
     } elseif (file_exists($bPath)) {
         return $bPath;
     } else {
         return $dPath;
     }
 }
示例#2
0
 public function parseDocument(&$view = null)
 {
     if ($view) {
         if (isset($view->document)) {
             if ($template = TZ_Portfolio_PlusTemplate::getTemplate(true)) {
                 if (JFolder::exists(COM_TZ_PORTFOLIO_PLUS_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $template->template)) {
                     $docOptions['template'] = $template->template;
                     $docOptions['file'] = 'template.php';
                     $docOptions['params'] = $template->params;
                     $docOptions['directory'] = COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'templates';
                     // Add template.css file if it has have in template
                     if (JFile::exists(COM_TZ_PORTFOLIO_PLUS_TEMPLATE_PATH . DIRECTORY_SEPARATOR . $template->template . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'template.css')) {
                         $view->document->addStyleSheet(TZ_Portfolio_PlusUri::base(true) . '/templates/' . $template->template . '/css/template.css');
                     }
                     // Parse document of view to require template.php(in tz portfolio template) file.
                     $view->document->parse($docOptions);
                 }
                 return true;
             }
         }
         return false;
     }
     return false;
 }
示例#3
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $doc->addStyleSheet('components/com_tz_portfolio_plus/css/tzportfolioplus.min.css');
     $tmpl = $app->input->getString('tmpl');
     if ($tmpl) {
         JHtml::_('bootstrap.framework');
         JHtml::_('jquery.framework');
     }
     $user = JFactory::getUser();
     $dispatcher = JDispatcher::getInstance();
     $this->state = $this->get('State');
     $params = $this->state->get('params');
     $this->item = $this->get('Item');
     $offset = $this->state->get('list.offset');
     $related = $this->get('ItemRelated');
     // Merge article params. If this is single-article view, menu params override article params
     // Otherwise, article params override menu item params
     $this->params = $this->state->get('params');
     $active = $app->getMenu()->getActive();
     $temp = clone $this->params;
     $tempR = clone $this->params;
     JPluginHelper::importPlugin('content');
     TZ_Portfolio_PlusPluginHelper::importPlugin('mediatype');
     TZ_Portfolio_PlusPluginHelper::importPlugin('content');
     if ($this->item->id && $params->get('show_tags', 1)) {
         $this->listTags = TZ_Portfolio_PlusFrontHelperTags::getTagsByArticleId($this->item->id, array('orderby' => 'm.contentid', 'menuActive' => $params->get('menu_active', 'auto')));
     }
     $mediatypes = array();
     if ($results = $dispatcher->trigger('onAddMediaType')) {
         foreach ($results as $result) {
             if (isset($result->special) && $result->special) {
                 $mediatypes[] = $result->value;
             }
         }
     }
     if ($tmpl) {
         $tmpl = '&tmpl=' . $tmpl;
     }
     if ($params->get('tz_use_lightbox', 0) && !$tmpl) {
         $tmpl = '&tmpl=component';
     }
     $this->print = $app->input->getBool('print');
     $this->user = $user;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Create a shortcut for $item.
     $item =& $this->item;
     // Get second categories
     $second_categories = TZ_Portfolio_PlusFrontHelperCategories::getCategoriesByArticleId($item->id, array('main' => false, 'reverse_contentid' => false));
     $item->second_categories = $second_categories;
     // Add router helpers.
     $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
     $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid;
     $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
     // TODO: Change based on shownoauth
     $item->readmore_link = null;
     // Check to see which parameters should take priority
     if ($active) {
         $currentLink = $active->link;
         // If the current view is the active item and an article view for this article, then the menu item params take priority
         if (strpos($currentLink, 'view=article') && strpos($currentLink, '&id=' . (string) $item->id)) {
             // $item->params are the article params, $temp are the menu item params
             // Merge so that the menu item params take priority
             $item->params->merge($temp);
             // Load layout from active query (in case it is an alternative menu item)
             if (isset($active->query['layout'])) {
                 $this->setLayout($active->query['layout']);
             }
         } else {
             // Current view is not a single article, so the article params take priority here
             // Merge the menu item params with the article params so that the article params take priority
             $temp->merge($item->params);
             $item->params = $temp;
             // Check for alternative layouts (since we are not in a single-article menu item)
             // Single-article menu item layout takes priority over alt layout for an article
             if ($layout = $item->params->get('article_layout')) {
                 $this->setLayout($layout);
             }
         }
     } else {
         // Merge so that article params take priority
         $temp->merge($item->params);
         $item->params = $temp;
         // Check for alternative layouts (since we are not in a single-article menu item)
         // Single-article menu item layout takes priority over alt layout for an article
         if ($layout = $item->params->get('article_layout')) {
             $this->setLayout($layout);
         }
     }
     $item->params->set('show_cat_icons', $item->params->get('show_icons'));
     // Create "link" and "fullLink" for article object
     $tmpl = null;
     if ($item->params->get('tz_use_lightbox', 0)) {
         $tmpl = '&tmpl=component';
     }
     $config = JFactory::getConfig();
     $ssl = -1;
     if ($config->get('force_ssl')) {
         $ssl = 1;
     }
     $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid) . $tmpl, true, $ssl);
     $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catid), true, $ssl);
     $item->parent_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->parent_slug));
     $item->category_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getCategoryRoute($item->catslug));
     $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->created_by, $params->get('user_menu_active', 'auto')));
     $url = JURI::getInstance()->toString();
     $this->assign('linkCurrent', $url);
     // Check the view access to the article (the model has already computed the values).
     if ($item->params->get('access-view') != true && ($item->params->get('show_noauth') != true && $user->get('guest'))) {
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return;
     }
     //
     // Process the content plugins.
     //
     $dispatcher->trigger('onAlwaysLoadDocument', array('com_tz_portfolio_plus.portfolio'));
     $dispatcher->trigger('onLoadData', array('com_tz_portfolio_plus.portfolio', $this->item, $params));
     if ($item->params->get('show_intro', 1)) {
         $item->text = $item->introtext . ' ' . $item->fulltext;
     } elseif ($item->fulltext) {
         $item->text = $item->fulltext;
     } else {
         $item->text = $item->introtext;
     }
     if ($item->params->get('show_intro', 1)) {
         $text = $item->introtext . ' ' . $item->fulltext;
     } elseif ($item->fulltext) {
         $text = $item->fulltext;
     } else {
         $text = $item->introtext;
     }
     if ($item->introtext && !empty($item->introtext)) {
         $item->text = $item->introtext;
         $results = $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $item->introtext = $item->text;
     }
     if ($item->fulltext && !empty($item->fulltext)) {
         $item->text = $item->fulltext;
         $results = $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
         $item->fulltext = $item->text;
     }
     $item->text = $text;
     $results = $dispatcher->trigger('onContentPrepare', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
     $item->event = new stdClass();
     $results = $dispatcher->trigger('onContentAfterTitle', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
     $item->event->afterDisplayTitle = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
     $item->event->beforeDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentAfterDisplay', array('com_tz_portfolio_plus.article', &$item, &$this->params, $offset));
     $item->event->afterDisplayContent = trim(implode("\n", $results));
     // Trigger portfolio's plugin
     $results = $dispatcher->trigger('onContentDisplayCommentCount', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
     $item->event->contentDisplayCommentCountCount = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentDisplayVote', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
     $item->event->contentDisplayVote = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onBeforeDisplayAdditionInfo', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
     $item->event->beforeDisplayAdditionInfo = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onAfterDisplayAdditionInfo', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
     $item->event->afterDisplayAdditionInfo = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentDisplayMediaType', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
     $item->event->onContentDisplayMediaType = trim(implode("\n", $results));
     if ($template = TZ_Portfolio_PlusTemplate::getTemplate(true)) {
         $tplparams = $template->params;
         if (!$tplparams->get('use_single_layout_builder', 1)) {
             $results = $dispatcher->trigger('onContentDisplayArticleView', array('com_tz_portfolio_plus.article', &$item, &$item->params, $offset));
             $item->event->contentDisplayArticleView = trim(implode("\n", $results));
         }
     }
     // Increment the hit counter of the article.
     if (!$this->params->get('intro_only') && $offset == 0) {
         $model = $this->getModel();
         $model->hit();
     }
     foreach ($related as $i => &$itemR) {
         $itemR->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($itemR->slug, $itemR->catid) . $tmpl);
         $media = $itemR->media;
         $registry = new JRegistry();
         $registry->loadString($media);
         $media = $registry->toObject();
         $itemR->media = $media;
         $itemR->event = new stdClass();
         $results = $dispatcher->trigger('onContentDisplayMediaType', array('com_tz_portfolio_plus.article', &$itemR, &$item->params, $offset, 'related'));
         if ($itemR) {
             $itemR->event->onContentDisplayMediaType = trim(implode("\n", $results));
             $itemR->mediatypes = $mediatypes;
         } else {
             unset($related[$i]);
         }
     }
     $this->itemsRelated = $related;
     // Get article's extrafields
     JLoader::import('extrafields', COM_TZ_PORTFOLIO_PLUS_SITE_HELPERS_PATH);
     $extraFields = TZ_Portfolio_PlusFrontHelperExtraFields::getExtraFields($this->item, $params);
     $this->item->extrafields = $extraFields;
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     $this->generateLayout($item, $params, $dispatcher);
     parent::display($tpl);
 }
示例#4
0
 public function display($cachable = false, $urlparams = array())
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = $this->input->get('addon_view', $this->default_view);
     $viewLayout = $this->input->get('addon_layout', 'default', 'string');
     if ($view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout))) {
         //            $coreViews  = array('article', 'categories', 'date', 'form', 'portfolio', 'tags', 'users');
         if ($addon = $this->addon) {
             $plugin_path = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . $addon->type . DIRECTORY_SEPARATOR . $addon->name;
             // Create template path of tz_portfolio_plus
             $template = TZ_Portfolio_PlusTemplate::getTemplate(true);
             $tplparams = $template->params;
             // Create default template of tz_portfolio_plus
             $defaultPath = null;
             $tpath = null;
             //                if(!in_array($viewName, $coreViews)){
             //                    $viewName   = null;
             //                }
             if (isset($template->home_path) && $template->home_path) {
                 $defaultPath = $template->home_path . DIRECTORY_SEPARATOR . ($viewName ? $viewName . DIRECTORY_SEPARATOR : '') . 'plg_' . $addon->type . '_' . $addon->name;
             }
             if (isset($template->base_path) && $template->base_path) {
                 $tpath = $template->base_path . DIRECTORY_SEPARATOR . ($viewName ? $viewName . DIRECTORY_SEPARATOR : '') . 'plg_' . $addon->type . '_' . $addon->name;
             }
             $vpaths = $view->get('_path');
             $vpaths = $vpaths['template'];
             $view->set('_path', array('template' => array()));
             $plgVPath = $plugin_path . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $viewName . DIRECTORY_SEPARATOR . 'tmpl';
             if (!in_array($plgVPath, $vpaths)) {
                 $view->addTemplatePath($plgVPath);
             }
             // Create template path from template site
             $_template = JFactory::getApplication()->getTemplate();
             $jPathSite = JPATH_SITE . '/templates/' . $_template . '/html/com_tz_portfolio_plus/' . $viewName . '/plg_' . $addon->type . '_' . $addon->name;
             if ($tplparams->get('override_html_template_site', 0)) {
                 // Add default template path
                 if ($defaultPath && !in_array($defaultPath, $vpaths)) {
                     $view->addTemplatePath($defaultPath);
                 }
                 // Add template path which chosen in menu
                 if ($tpath && !in_array($tpath, $vpaths)) {
                     $view->addTemplatePath($tpath);
                 }
                 if (!in_array($jPathSite, $vpaths)) {
                     $view->addTemplatePath($jPathSite);
                 }
             } else {
                 // Add template path from template site
                 if (!in_array($jPathSite, $vpaths)) {
                     $view->addTemplatePath($jPathSite);
                 }
                 // Add default template path
                 if ($defaultPath && !in_array($defaultPath, $vpaths)) {
                     $view->addTemplatePath($defaultPath);
                 }
                 // Add template path which chosen in menu
                 if ($tpath && !in_array($tpath, $vpaths)) {
                     $view->addTemplatePath($tpath);
                 }
             }
         }
     }
     $view->setLayout($viewLayout);
     // Get/Create the model
     if ($model = $this->getModel($viewName)) {
         if ($this->addon) {
             $model->set('addon', $this->addon);
         }
         if ($this->article) {
             $model->set('article', $this->article);
         }
         if ($this->trigger_params) {
             $model->set('trigger_params', $this->trigger_params);
         }
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     $view->document = $document;
     $conf = JFactory::getConfig();
     // Display the view
     if ($cachable && $viewType != 'feed' && $conf->get('caching') >= 1) {
         $option = $this->input->get('option');
         $cache = JFactory::getCache($option, 'addon_view');
         if (is_array($urlparams)) {
             $app = JFactory::getApplication();
             if (!empty($app->registeredurlparams)) {
                 $registeredurlparams = $app->registeredurlparams;
             } else {
                 $registeredurlparams = new stdClass();
             }
             foreach ($urlparams as $key => $value) {
                 // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}.
                 $registeredurlparams->{$key} = $value;
             }
             $app->registeredurlparams = $registeredurlparams;
         }
         $cache->get($view, 'display');
     } else {
         $view->display();
     }
     return $this;
 }
示例#5
0
 protected function _generateLayout(&$article, &$params, JEventDispatcher $dispatcher)
 {
     if ($template = TZ_Portfolio_PlusTemplate::getTemplate(true)) {
         $theme = $template;
         $html = null;
         if ($theme) {
             if ($tplParams = $theme->layout) {
                 foreach ($tplParams as $tplItems) {
                     $rows = null;
                     $background = null;
                     $color = null;
                     $margin = null;
                     $padding = null;
                     $childRows = array();
                     $rowName = null;
                     if (isset($tplItems->name) && $tplItems->name) {
                         $rowName = JApplication::stringURLSafe($tplItems->name);
                     }
                     if ($tplItems && isset($tplItems->children)) {
                         foreach ($tplItems->children as $children) {
                             $html = null;
                             if ($children->type && $children->type != 'none') {
                                 if (in_array($children->type, $this->core_types)) {
                                     $html = $this->loadTemplate($children->type);
                                 } else {
                                     $plugin = $children->type;
                                     $layout = null;
                                     if (strpos($children->type, ':') != false) {
                                         list($plugin, $layout) = explode(':', $children->type);
                                     }
                                     if ($plugin_obj = TZ_Portfolio_PlusPluginHelper::getPlugin('content', $plugin)) {
                                         $className = 'PlgTZ_Portfolio_PlusContent' . ucfirst($plugin);
                                         if (!class_exists($className)) {
                                             TZ_Portfolio_PlusPluginHelper::importPlugin('content', $plugin);
                                         }
                                         if (class_exists($className)) {
                                             $registry = new JRegistry($plugin_obj->params);
                                             $plgClass = new $className($dispatcher, array('type' => $plugin_obj->type, 'name' => $plugin_obj->name, 'params' => $registry));
                                             if (method_exists($plgClass, 'onContentDisplayArticleView')) {
                                                 $html = $plgClass->onContentDisplayArticleView('com_tz_portfolio_plus.' . $this->getName(), $this->item, $this->item->params, $this->state->get('list.offset'), $layout);
                                             }
                                         }
                                         if (is_array($html)) {
                                             $html = implode("\n", $html);
                                         }
                                     }
                                 }
                                 $html = trim($html);
                             }
                             if (!empty($html) || (!empty($children->children) and is_array($children->children))) {
                                 if (!empty($children->{"col-lg"}) || !empty($children->{"col-md"}) || !empty($children->{"col-sm"}) || !empty($children->{"col-xs"}) || !empty($children->{"col-lg-offset"}) || !empty($children->{"col-md-offset"}) || !empty($children->{"col-sm-offset"}) || !empty($children->{"col-xs-offset"}) || !empty($children->{"customclass"}) || $children->responsiveclass) {
                                     $childRows[] = '<div class="' . (!empty($children->{"col-lg"}) ? 'col-lg-' . $children->{"col-lg"} : '') . (!empty($children->{"col-md"}) ? ' col-md-' . $children->{"col-md"} : '') . (!empty($children->{"col-sm"}) ? ' col-sm-' . $children->{"col-sm"} : '') . (!empty($children->{"col-xs"}) ? ' col-xs-' . $children->{"col-xs"} : '') . (!empty($children->{"col-lg-offset"}) ? ' col-lg-offset-' . $children->{"col-lg-offset"} : '') . (!empty($children->{"col-md-offset"}) ? ' col-md-offset-' . $children->{"col-md-offset"} : '') . (!empty($children->{"col-sm-offset"}) ? ' col-sm-offset-' . $children->{"col-sm-offset"} : '') . (!empty($children->{"col-xs-offset"}) ? ' col-xs-offset-' . $children->{"col-xs-offset"} : '') . (!empty($children->{"customclass"}) ? ' ' . $children->{"customclass"} : '') . ($children->responsiveclass ? ' ' . $children->responsiveclass : '') . '">';
                                 }
                                 $childRows[] = $html;
                                 if (!empty($children->children) and is_array($children->children)) {
                                     $this->_childrenLayout($childRows, $children, $article, $params, $dispatcher);
                                 }
                                 if (!empty($children->{"col-lg"}) || !empty($children->{"col-md"}) || !empty($children->{"col-sm"}) || !empty($children->{"col-xs"}) || !empty($children->{"col-lg-offset"}) || !empty($children->{"col-md-offset"}) || !empty($children->{"col-sm-offset"}) || !empty($children->{"col-xs-offset"}) || !empty($children->{"customclass"}) || $children->responsiveclass) {
                                     $childRows[] = '</div>';
                                     // Close col tag
                                 }
                             }
                         }
                     }
                     if (count($childRows)) {
                         if (isset($tplItems->backgroundcolor) && $tplItems->backgroundcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($tplItems->backgroundcolor))) {
                             $background = 'background: ' . $tplItems->backgroundcolor . ';';
                         }
                         if (isset($tplItems->textcolor) && $tplItems->textcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($tplItems->textcolor))) {
                             $color = 'color: ' . $tplItems->textcolor . ';';
                         }
                         if (isset($tplItems->margin) && !empty($tplItems->margin)) {
                             $margin = 'margin: ' . $tplItems->margin . ';';
                         }
                         if (isset($tplItems->padding) && !empty($tplItems->padding)) {
                             $padding = 'padding: ' . $tplItems->padding . ';';
                         }
                         if ($background || $color || $margin || $padding) {
                             $this->document->addStyleDeclaration('
                                 #tz-portfolio-template-' . ($rowName ? $rowName : '') . '{
                                     ' . $background . $color . $margin . $padding . '
                                 }
                             ');
                         }
                         if (isset($tplItems->linkcolor) && $tplItems->linkcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($tplItems->linkcolor))) {
                             $this->document->addStyleDeclaration('
                             #tz-portfolio-template-' . ($rowName ? $rowName : '') . ' a{
                                 color: ' . $tplItems->linkcolor . ';
                             }
                         ');
                         }
                         if (isset($tplItems->linkhovercolor) && $tplItems->linkhovercolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($tplItems->linkhovercolor))) {
                             $this->document->addStyleDeclaration('
                             #tz-portfolio-template-' . ($rowName ? $rowName : '') . ' a:hover{
                                 color: ' . $tplItems->linkhovercolor . ';
                             }
                         ');
                         }
                         $rows[] = '<div id="tz-portfolio-template-' . ($rowName ? $rowName : '') . '"' . ' class="' . ($tplItems->{"class"} ? ' ' . $tplItems->{"class"} : '') . (isset($tplItems->responsive) && $tplItems->responsive ? ' ' . $tplItems->responsive : '') . '">';
                         if (isset($tplItems->containertype) && $tplItems->containertype) {
                             $rows[] = '<div class="' . $tplItems->containertype . '">';
                         }
                         $rows[] = '<div class="row">';
                         $rows = array_merge($rows, $childRows);
                         if (isset($tplItems->containertype) && $tplItems->containertype) {
                             $rows[] = '</div>';
                         }
                         $rows[] = '</div>';
                         $rows[] = '</div>';
                     }
                     if ($rows) {
                         $this->generateLayout .= implode("\n", $rows);
                     }
                 }
             }
         }
     }
 }