Bladeren bron

Ticket #834 - point 2.

AntonLV 9 jaren geleden
bovenliggende
commit
13828f253f

+ 2 - 5
inc/classes/BxDolEmailTemplates.php

@@ -68,11 +68,8 @@ class BxDolEmailTemplates extends BxDolFactory implements iBxDolSingleton
         $this->aDefaultKeys = array(
         	'site_url' => BX_DOL_URL_ROOT,
         	'site_name' => getParam('site_title'),
-            'about_us' => BxDolTemplate::getInstance()->parseHtmlByName('bx_a.html', array(
-                'href' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=about'),
-				'title' => bx_html_attribute($sAboutUs),
-                'bx_repeat:attrs' => array(),
-                'content' => $sAboutUs
+            'about_us' => BxDolTemplate::getInstance()->parseLink(BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=about'), $sAboutUs, array(
+				'title' => $sAboutUs 
             ))
         );
 

+ 66 - 0
inc/classes/BxDolTemplate.php

@@ -1278,6 +1278,72 @@ class BxDolTemplate extends BxDolFactory implements iBxDolSingleton
 
         return $sRet;
     }
+    /**
+     * 
+     * Parse tag <A>
+     * @param string $sLink link URL
+     * @param string $sContent link content
+     * @param array $aAttrs an array of key => value pairs
+     */
+    function parseLink($sLink, $sContent, $aAttrs = array())
+    {
+        $sTemplate = '<a href="__link__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a>';
+
+        $aTmplVarsAttrs = array();
+        foreach($aAttrs as $sKey => $sValue)
+            $aTmplVarsAttrs[] = array('key' => $sKey, 'value' => bx_html_attribute($sValue));
+
+        return $this->parseHtmlByContent($sTemplate, array(
+            'link' => $sLink,
+            'content' => $sContent,
+            'bx_repeat:attrs' => $aTmplVarsAttrs
+        ));
+    }
+    /**
+     * 
+     * Parse tag <IMG>
+     * @param string $sLink URL to image source 
+     * @param array $aAttrs an array of key => value pairs
+     */
+    function parseImage($sLink, $aAttrs = array())
+    {
+        $sTemplate = '<img src="__link__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs> />';
+
+        $aTmplVarsAttrs = array();
+        foreach($aAttrs as $sKey => $sValue)
+            $aTmplVarsAttrs[] = array('key' => $sKey, 'value' => bx_html_attribute($sValue));
+
+        return $this->parseHtmlByContent($sTemplate, array(
+            'link' => $sLink,
+            'bx_repeat:attrs' => $aTmplVarsAttrs
+        ));
+    }
+
+    /**
+     * 
+     * Parse font based icon in <I> tag
+     * @param string $sName font icon name
+     * @param array $aAttrs an array of key => value pairs
+     */
+    function parseIcon($sName, $aAttrs = array())
+    {
+        $sTemplate = '<i class="sys-icon __name__"  <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>></i>';
+
+        if(!empty($aAttrs['class'])) {
+            $sName .= ' ' . $aAttrs['class'];
+            unset($aAttrs['class']);
+        }
+
+        $aTmplVarsAttrs = array();
+        foreach($aAttrs as $sKey => $sValue)
+            $aTmplVarsAttrs[] = array('key' => $sKey, 'value' => bx_html_attribute($sValue));
+
+        return $this->parseHtmlByContent($sTemplate, array(
+            'name' => $sName,
+            'bx_repeat:attrs' => $aTmplVarsAttrs
+        ));
+    }
+
     function getCacheFilePrefix($sType)
     {
     	$sResult = '';

+ 3 - 7
modules/boonex/forum/classes/BxForumGridCategories.php

@@ -158,14 +158,10 @@ class BxForumGridCategories extends BxTemplStudioGrid
 
 	protected function _getCellVisibleForLevels($mixedValue, $sKey, $aField, $aRow)
     {
-        $mixedValue = $this->_oTemplate->parseHtmlByName('bx_a.html', array(
-            'href' => 'javascript:void(0)',
+        $mixedValue = $this->_oTemplate->parseLink('javascript:void(0)', BxDolStudioUtils::getVisibilityTitle($aRow['visible_for_levels']), array(
             'title' => _t('_bx_forum_grid_txt_manage_visibility'),
-            'bx_repeat:attrs' => array(
-                array('key' => 'bx_grid_action_single', 'value' => 'show_to'),
-                array('key' => 'bx_grid_action_data', 'value' => $aRow['category'])
-            ),
-            'content' => BxDolStudioUtils::getVisibilityTitle($aRow['visible_for_levels'])
+            'bx_grid_action_single' => 'show_to',
+            'bx_grid_action_data' => $aRow['category']
         ));
 
         return parent::_getCellDefault ($mixedValue, $sKey, $aField, $aRow);

+ 3 - 5
modules/boonex/sites/classes/BxSitesGridBrowse.php

@@ -112,11 +112,9 @@ class BxSitesGridBrowse extends BxTemplGrid
 
     protected function _getCellDomain ($mixedValue, $sKey, $aField, $aRow)
     {
-        $mixedValue = $this->_oTemplate->parseHtmlByName('bx_a.html', array(
-            'href' => BX_DOL_URL_ROOT . $this->_oPermalinks->permalink('page.php?i=site-view&id=' . $aRow['id']),
-            'title' => _t('_bx_sites_grid_browse_lnk_title_domain'),
-            'bx_repeat:attrs' => array(),
-            'content' => $this->_oModule->getDomain($mixedValue),
+        $sLink = BX_DOL_URL_ROOT . $this->_oPermalinks->permalink('page.php?i=site-view&id=' . $aRow['id']);
+        $mixedValue = $this->_oTemplate->parseLink($sLink, $this->_oModule->getDomain($mixedValue), array(
+            'title' => _t('_bx_sites_grid_browse_lnk_title_domain')
         ));
 
         return parent::_getCellDefault ($mixedValue, $sKey, $aField, $aRow);

+ 3 - 7
modules/boonex/sites/classes/BxSitesGridOverview.php

@@ -205,14 +205,10 @@ class BxSitesGridOverview extends BxTemplGrid
 
         $sStatus = _t('_bx_sites_txt_status_' . $this->_aAccount['status']);
         if(in_array($sAction, array(BX_SITES_ACCOUNT_STATUS_UNCONFIRMED, BX_SITES_ACCOUNT_STATUS_PENDING, BX_SITES_ACCOUNT_STATUS_ACTIVE, BX_SITES_ACCOUNT_STATUS_CANCELED, BX_SITES_ACCOUNT_STATUS_SUSPENDED))) {
-            $sStatus = $this->_oModule->_oTemplate->parseHtmlByName('bx_a.html', array(
-                'href' => 'javascript:void(0)',
+            $sStatus = $this->_oModule->_oTemplate->parseLink('javascript:void(0)', $sStatus, array(
                 'title' => _t('_bx_sites_grid_overview_btn_' . $sAction),
-                'bx_repeat:attrs' => array(
-                    array('key' => 'bx_grid_action_independent', 'value' => $sAction),
-                    array('key' => 'bx_grid_action_data', 'value' => $this->_aAccount['id'])
-                ),
-                'content' => $sStatus,
+            	'bx_grid_action_independent' => $sAction,
+                'bx_grid_action_data' => $this->_aAccount['id']
             ));
         }
 

+ 2 - 6
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -650,13 +650,9 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
             return '';
 
         $iCounter = (int)$oCmts->getCommentsCount();
-        return  $this->_oTemplate->parseHtmlByName('bx_a.html', array(
-            'href' => 'javascript:void(0)',
+        return  $this->_oTemplate->parseLink('javascript:void(0)', $iCounter > 0 ? $iCounter : '', array(
             'title' => _t('_bx_timeline_menu_item_title_item_comment'),
-            'bx_repeat:attrs' => array(
-                array('key' => 'onclick', 'value' => "javascript:" . $this->_oConfig->getJsObject('view') . ".commentItem(this, '" . $sSystem . "', " . $iObjectId . ")")
-            ),
-            'content' => $iCounter > 0 ? $iCounter : ''
+        	'onclick' => "javascript:" . $this->_oConfig->getJsObject('view') . ".commentItem(this, '" . $sSystem . "', " . $iObjectId . ")" 
         ));
     }
 

+ 44 - 92
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -306,13 +306,11 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         $iYearNow = date('Y', time());
         return $this->parseHtmlByName('back.html', array(
-            'style_prefix' => $sStylePrefix,
-            'href' => 'javascript:void(0)',
-            'title' => _t('_bx_timeline_txt_jump_to_n_year', $iYearNow),
-            'bx_repeat:attrs' => array(
-                array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.changeTimeline(this, 0)')
-            ),
-            'content' => _t('_bx_timeline_txt_jump_to_recent')
+        	'style_prefix' => $sStylePrefix,
+            'content' => $this->parseLink('javascript:void(0)', _t('_bx_timeline_txt_jump_to_recent'), array(
+                'title' => _t('_bx_timeline_txt_jump_to_n_year', $iYearNow),
+        		'onclick' => 'javascript:' . $sJsObject . '.changeTimeline(this, 0)'
+            ))
         ));
     }
 
@@ -330,13 +328,9 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if(!empty($iYearMin)) {
             $iYearMax = date('Y', time()) - 1;
             for($i = $iYearMax; $i >= $iYearMin; $i--)
-                $sYears .= ($i != $iYearSel ? $this->parseHtmlByName('bx_a.html', array(
-                    'href' => 'javascript:void(0)',
+                $sYears .= ($i != $iYearSel ? $this->parseLink('javascript:void(0)', $i, array(
                     'title' => _t('_bx_timeline_txt_jump_to_n_year', $i),
-                    'bx_repeat:attrs' => array(
-                        array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.changeTimeline(this, ' . $i . ')')
-                    ),
-                    'content' => $i
+                    'onclick' => 'javascript:' . $sJsObject . '.changeTimeline(this, ' . $i . ')'
                 )) : $i) . ', ';
 
             $sYears = substr($sYears, 0, -2);
@@ -425,11 +419,13 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 		else
 			$sClass .= $bShowDoRepostAsButton || $bShowDoRepostAsButtonSmall ? ' bx-btn-disabled' : ' ' . $sStylePrefixRepost . 'disabled';
 
-		$aOnClickAttrs = array();
+		$aOnClickAttrs = array(
+			'title' => _t('_bx_timeline_txt_do_repost')
+		);
 		if(!empty($sClass))
-			$aOnClickAttrs[] = array('key' => 'class', 'value' => $sClass);
+			$aOnClickAttrs['class'] = $sClass;
 		if(!empty($sOnClick))
-			$aOnClickAttrs[] = array('key' => 'onclick', 'value' => $sOnClick);
+			$aOnClickAttrs['onclick'] = $sOnClick;
 
 		$sDoRepost = '';
         if($bShowDoRepostIcon)
@@ -443,12 +439,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'html_id' => $this->_oConfig->getHtmlIds('repost', 'main') . $aReposted['id'],
             'class' => ($bShowDoRepostAsButton ? $sStylePrefixRepost . 'button' : '') . ($bShowDoRepostAsButtonSmall ? $sStylePrefixRepost . 'button-small' : ''),
             'count' => $aReposted['reposts'],
-            'do_repost' => $this->parseHtmlByName('bx_a.html', array(
-	            'href' => 'javascript:void(0)',
-	            'title' => _t('_bx_timeline_txt_do_repost'),
-	            'bx_repeat:attrs' => $aOnClickAttrs,
-	            'content' => $sDoRepost
-	        )),
+            'do_repost' => $this->parseLink('javascript:void(0)', $sDoRepost, $aOnClickAttrs),
             'bx_if:show_counter' => array(
                 'condition' => $bShowCounter,
                 'content' => array(
@@ -478,15 +469,11 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if($bShowDoRepostAsButton)
             $sClass .= ' bx-btn-height';
 
-        return $this->parseHtmlByName('repost_counter.html', array(
-            'href' => 'javascript:void(0)',
+        return $this->parseLink('javascript:void(0)', !empty($aEvent['reposts']) && (int)$aEvent['reposts'] > 0 ? $aEvent['reposts'] : '', array(
+        	'id' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id'],
+        	'class' => $sClass,
             'title' => _t('_bx_timeline_txt_reposted_by'),
-            'bx_repeat:attrs' => array(
-                array('key' => 'id', 'value' => $this->_oConfig->getHtmlIds('repost', 'counter') . $aEvent['id']),
-                array('key' => 'class', 'value' => $sClass),
-                array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')')
-            ),
-            'content' => !empty($aEvent['reposts']) && (int)$aEvent['reposts'] > 0 ? $aEvent['reposts'] : ''
+        	'onclick' => 'javascript:' . $sJsObject . '.toggleByPopup(this, ' . $aEvent['id'] . ')'
         ));
     }
 
@@ -592,23 +579,21 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             $bTmplVarsEmbed = true;
             $aTmplVarsEmbed = array(
                 'style_prefix' => $sStylePrefix,
-            	'embed' => $this->parseHtmlByName('bx_a.html', array(
-            		'href' => $aLink['url'],
-            		'title' => bx_html_attribute($aLink['title']),
-            		'bx_repeat:attrs' => array(
-                        array('key' => 'class', 'value' => 'bx-link')
-                    ),
-            		'content' => $aLink['title'],
+            	'embed' => $this->parseLink($aLink['url'], $aLink['title'], array(
+            		'class' => 'bx-link',
+            		'title' => $aLink['title']
             	))
             );
         }
         else {
-            $aLinkAttrs = array();
+            $aLinkAttrs = array(
+            	'title' => bx_html_attribute($aLink['title'])
+            );
             if(!$this->_oConfig->isEqualUrls(BX_DOL_URL_ROOT, $aLink['url'])) {
-                $aLinkAttrs[] = array('key' => 'target', 'value' => '_blank');
+                $aLinkAttrs['target'] = '_blank';
     
                 if($this->_oDb->getParam('sys_add_nofollow') == 'on')
-            	    $aLinkAttrs[] = array('key' => 'rel', 'value' => 'nofollow');
+            	    $aLinkAttrs['rel'] = 'nofollow';
             }
 
             $sThumbnail = "";
@@ -625,12 +610,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             		)
             	),
     			'url' => $aLink['url'],
-            	'link' => $this->parseHtmlByName('bx_a.html', array(
-            		'href' => $aLink['url'],
-            		'title' => bx_html_attribute($aLink['title']),
-            		'bx_repeat:attrs' => $aLinkAttrs,
-            		'content' => $aLink['title'],
-            	))
+            	'link' => $this->parseLink($aLink['url'], $aLink['title'], $aLinkAttrs)
             );
         }
 
@@ -838,20 +818,14 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         //--- Process Text ---//
         $sUrl = isset($aContent['url']) ? bx_html_attribute($aContent['url']) : '';
-        $sTitle = $sTitleAttr = '';
-        if(isset($aContent['title'])) {
+        $sTitle = '';
+        if(isset($aContent['title']))
             $sTitle = bx_process_output($aContent['title']);
-            $sTitleAttr = bx_html_attribute($aContent['title']);
-        }
 
         if(!empty($sUrl) && !empty($sTitle))
-            $sTitle = $this->parseHtmlByName('bx_a.html', array(
-                'href' => $sUrl,
-                'title' => $sTitleAttr,
-                'bx_repeat:attrs' => array(
-                    array('key' => 'class', 'value' => $sStylePrefix . '-title')
-                ),
-                'content' => $sTitle
+            $sTitle = $this->parseLink($sUrl, $sTitle, array(
+            	'class' => $sStylePrefix . '-title',
+                'title' => $sTitle
             ));
 
         $sText = isset($aContent['text']) ? $aContent['text'] : '';
@@ -892,23 +866,21 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                     $bTmplVarsEmbed = true;
                     $aTmplVarsEmbed = array(
                         'style_prefix' => $sStylePrefix,
-                    	'embed' => $this->parseHtmlByName('bx_a.html', array(
-                    		'href' => $aLink['url'],
-                    		'title' => bx_html_attribute($aLink['title']),
-                    		'bx_repeat:attrs' => array(
-                                array('key' => 'class', 'value' => 'bx-link')
-                            ),
-                    		'content' => $aLink['title'],
+                    	'embed' => $this->parseLink($aLink['url'], $aLink['title'], array(
+                    		'class' => 'bx-link',
+                    		'title' => $aLink['title']
                     	))
                     );
                 }
                 else {
-                    $aLinkAttrs = array();
+                    $aLinkAttrs = array(
+                    	'title' => $aLink['title']
+                    );
                     if(!$this->_oConfig->isEqualUrls(BX_DOL_URL_ROOT, $aLink['url'])) {
-                        $aLinkAttrs[] = array('key' => 'target', 'value' => '_blank');
+                        $aLinkAttrs['target'] = '_blank';
     
                         if($bAddNofollow)
-                    	    $aLinkAttrs[] = array('key' => 'rel', 'value' => 'nofollow');
+                    	    $aLinkAttrs['rel'] = 'nofollow';
                     }
 
                     $aTmplVarsEmbed = array(
@@ -919,12 +891,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                     			'thumbnail' => $aLink['thumbnail']
                     		)
                     	),
-                    	'link' => $this->parseHtmlByName('bx_a.html', array(
-    		        		'href' => $aLink['url'],
-    		        		'title' => $aLink['title'],
-    		        		'bx_repeat:attrs' => $aLinkAttrs,
-    		        		'content' => $aLink['title'],
-    		        	)),
+                    	'link' => $this->parseLink($aLink['url'], $aLink['title'], $aLinkAttrs),
                         'bx_if:show_text' => array(
                             'condition' => !empty($aLink['text']),
                             'content' => array(
@@ -964,14 +931,9 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 if(!empty($sImage) && (isset($aImage['url']) || isset($aImage['onclick']))) {
                     $aAttrs = array();
                     if(isset($aImage['onclick']))
-                        $aAttrs[] = array('key' => 'onclick', 'value' => $aImage['onclick']);
+                        $aAttrs['onclick'] = $aImage['onclick'];
 
-                    $sImage = $this->parseHtmlByName('bx_a.html', array(
-                        'href' => isset($aImage['url']) ? $aImage['url'] : 'javascript:void(0)',
-                        'title' => '',
-                        'bx_repeat:attrs' => $aAttrs,
-                        'content' => $sImage
-                    ));
+                    $sImage = $this->parseLink(isset($aImage['url']) ? $aImage['url'] : 'javascript:void(0)', $sImage, $aAttrs);
                 }
 
                 $aTmplVarsImages[] = array(
@@ -1050,20 +1012,10 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
     	$aContent = &$aEvent['content'];
         $sStylePrefix = $this->_oConfig->getPrefix('style');
 
-        $sOwnerLink = $this->parseHtmlByName('bx_a.html', array(
-            'href' => $aContent['owner_url'],
-            'title' => '',
-            'bx_repeat:attrs' => array(),
-            'content' => $aContent['owner_name']
-        ));
+        $sOwnerLink = $this->parseLink($aContent['owner_url'], $aContent['owner_name']);
 
         $sSample = _t($aContent['sample']);
-        $sSampleLink = empty($aContent['url']) ? $sSample : $this->parseHtmlByName('bx_a.html', array(
-            'href' => $aContent['url'],
-            'title' => '',
-            'bx_repeat:attrs' => array(),
-            'content' => $sSample
-        ));
+        $sSampleLink = empty($aContent['url']) ? $sSample : $this->parseLink($aContent['url'], $sSample);
 
         $sTitle = _t('_bx_timeline_txt_reposted', $sOwnerLink, $sSampleLink);
         $sText = $this->_getContent($aContent['parse_type'], $aEvent);

+ 1 - 3
modules/boonex/timeline/template/back.html

@@ -1,3 +1 @@
-<div class="__style_prefix__-back bx-def-margin-sec-bottom">
-	<bx_include_auto:bx_a.html />
-</div>
+<div class="__style_prefix__-back bx-def-margin-sec-bottom">__content__</div>

+ 0 - 1
modules/boonex/timeline/template/repost_counter.html

@@ -1 +0,0 @@
-<bx_include_auto:bx_a.html />

+ 0 - 1
template/favorite_counter.html

@@ -1 +0,0 @@
-<bx_include_auto:bx_a.html />

+ 0 - 1
template/favorite_do_favorite.html

@@ -1 +0,0 @@
-<a id="__html_id__" class="__style_prefix__-do-favorite __class__" href="javascript:void(0)" <bx_if:show_onclick>onclick="javascript:__onclick__"</bx_if:show_onclick> title="__title__">__do_favorite__</a>

+ 0 - 1
template/feature_do_feature.html

@@ -1 +0,0 @@
-<a id="__html_id__" class="__style_prefix__-do-feature __class__" href="javascript:void(0)" <bx_if:show_onclick>onclick="javascript:__onclick__"</bx_if:show_onclick> title="__title__">__do_feature__</a>

+ 14 - 26
template/scripts/BxBaseFavorite.php

@@ -12,6 +12,8 @@
  */
 class BxBaseFavorite extends BxDolFavorite
 {
+    protected static $_sTmplContentDoFavoriteLabel;
+
     protected $_bCssJsAdded;
 
 	protected $_sJsObjClass;
@@ -22,9 +24,6 @@ class BxBaseFavorite extends BxDolFavorite
 
     protected $_aElementDefaults;
 
-    protected $_sTmplNameCounter;
-    protected $_sTmplNameDoFavorite;
-
     public function __construct($sSystem, $iId, $iInit = 1, $oTemplate = false)
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
@@ -51,8 +50,8 @@ class BxBaseFavorite extends BxDolFavorite
 			'show_counter' => true
         );
 
-        $this->_sTmplNameCounter = 'favorite_counter.html';
-        $this->_sTmplNameDoFavorite = 'favorite_do_favorite.html';
+        if(empty(self::$_sTmplContentDoFavoriteLabel))
+            self::$_sTmplContentDoFavoriteLabel = $this->_oTemplate->getHtml('favorite_do_favorite_label.html');
     }
 
     public function addCssJs($bDynamicMode = false)
@@ -115,15 +114,11 @@ class BxBaseFavorite extends BxDolFavorite
         if($bShowDoFavoriteAsButton)
             $sClass .= ' bx-btn-height';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameCounter, array(
-            'href' => 'javascript:void(0)',
+        return $this->_oTemplate->parseLink('javascript:void(0)', (int)$aFavorite['count'] > 0 ? $this->_getLabelCounter($aFavorite['count']) : '', array(
             'title' => _t('_favorite_do_favorite_by'),
-            'bx_repeat:attrs' => array(
-                array('key' => 'id', 'value' => $this->_aHtmlIds['counter']),
-                array('key' => 'class', 'value' => $sClass),
-                array('key' => 'onclick', 'value' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)')
-            ),
-            'content' => (int)$aFavorite['count'] > 0 ? $this->_getLabelCounter($aFavorite['count']) : ''
+        	'id' => $this->_aHtmlIds['counter'],
+        	'class' => $sClass,
+        	'onclick' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)'
         ));
     }
 
@@ -199,18 +194,11 @@ class BxBaseFavorite extends BxDolFavorite
 		if($bDisabled)
 			$sClass .= $bShowDoFavoriteAsButton || $bShowDoFavoriteAsButtonSmall ? ' bx-btn-disabled' : 'bx-favorite-disabled';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoFavorite, array(
-            'style_prefix' => $this->_sStylePrefix,
-        	'html_id' => $this->_aHtmlIds['do_link'],
-            'class' => $sClass,
-            'title' => bx_html_attribute(_t($this->_getTitleDoFavorite($bFavorited))),
-        	'bx_if:show_onclick' => array(
-        		'condition' => !$bDisabled,
-        		'content' => array(
-        			'onclick' => $this->getJsClick()
-        		)
-        	),
-            'do_favorite' => $this->_getLabelDoFavorite($aParams),
+        return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDoFavorite($aParams), array(
+        	'id' => $this->_aHtmlIds['do_link'],
+            'class' => $this->_sStylePrefix . '-do-favorite ' . $sClass,
+            'title' => _t($this->_getTitleDoFavorite($bFavorited)),
+        	'onclick' => !$bDisabled ? $this->getJsClick() : ''
         ));
     }
 
@@ -222,7 +210,7 @@ class BxBaseFavorite extends BxDolFavorite
     protected function _getLabelDoFavorite($aParams = array())
     {
     	$bFavorited = isset($aParams['is_favorited']) && $aParams['is_favorited'] === true;
-        return $this->_oTemplate->parseHtmlByName('favorite_do_favorite_label.html', array(
+        return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoFavoriteLabel, array(
         	'bx_if:show_icon' => array(
         		'condition' => isset($aParams['show_do_favorite_icon']) && $aParams['show_do_favorite_icon'] == true,
         		'content' => array(

+ 10 - 18
template/scripts/BxBaseFeature.php

@@ -12,6 +12,8 @@
  */
 class BxBaseFeature extends BxDolFeature
 {
+    protected static $_sTmplContentDoFeatureLabel;
+
     protected $_bCssJsAdded;
 
 	protected $_sJsObjClass;
@@ -22,9 +24,6 @@ class BxBaseFeature extends BxDolFeature
 
     protected $_aElementDefaults;
 
-    protected $_sTmplNameCounter;
-    protected $_sTmplNameDoFeature;
-
     public function __construct($sSystem, $iId, $iInit = 1, $oTemplate = false)
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
@@ -48,8 +47,8 @@ class BxBaseFeature extends BxDolFeature
 			'show_do_feature_label' => false
         );
 
-        $this->_sTmplNameCounter = 'feature_counter.html';
-        $this->_sTmplNameDoFeature = 'feature_do_feature.html';
+        if(empty(self::$_sTmplContentDoFeatureLabel))
+            self::$_sTmplContentDoFeatureLabel = $this->_oTemplate->getHtml('feature_do_feature_label.html');
     }
 
     public function addCssJs($bDynamicMode = false)
@@ -160,25 +159,18 @@ class BxBaseFeature extends BxDolFeature
 		if($bDisabled)
 			$sClass .= $bShowDoFeatureAsButton || $bShowDoFeatureAsButtonSmall ? ' bx-btn-disabled' : 'bx-feature-disabled';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoFeature, array(
-            'style_prefix' => $this->_sStylePrefix,
-        	'html_id' => $this->_aHtmlIds['do_link'],
-            'class' => $sClass,
-            'title' => bx_html_attribute(_t($this->_getTitleDoFeature($bFeatured))),
-        	'bx_if:show_onclick' => array(
-        		'condition' => !$bDisabled,
-        		'content' => array(
-        			'onclick' => $this->getJsClick()
-        		)
-        	),
-            'do_feature' => $this->_getLabelDoFeature($aParams),
+        return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDoFeature($aParams), array(
+        	'id' => $this->_aHtmlIds['do_link'],
+            'class' => $this->_sStylePrefix . '-do-feature ' . $sClass,
+            'title' => _t($this->_getTitleDoFeature($bFeatured)),
+        	'onclick' => !$bDisabled ? $this->getJsClick() : ''
         ));
     }
 
     protected function _getLabelDoFeature($aParams = array())
     {
     	$bFeatured = isset($aParams['is_featured']) && $aParams['is_featured'] === true;
-        return $this->_oTemplate->parseHtmlByName('feature_do_feature_label.html', array(
+        return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoFeatureLabel, array(
         	'bx_if:show_icon' => array(
         		'condition' => isset($aParams['show_do_feature_icon']) && $aParams['show_do_feature_icon'] == true,
         		'content' => array(

+ 10 - 16
template/scripts/BxBaseReport.php

@@ -12,6 +12,8 @@
  */
 class BxBaseReport extends BxDolReport
 {
+    protected static $_sTmplContentDoReport;
+
 	protected $_bCssJsAdded;
 
 	protected $_sJsObjClass;
@@ -22,9 +24,6 @@ class BxBaseReport extends BxDolReport
 
     protected $_aElementDefaults;
 
-    protected $_sTmplNameCounter;
-    protected $_sTmplContentDoReport;
-
     public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
@@ -53,8 +52,8 @@ class BxBaseReport extends BxDolReport
 			'show_counter' => true
         );
 
-        $this->_sTmplNameCounter = 'bx_a';
-        $this->_sTmplContentDoReport = $this->_oTemplate->getHtml('report_do_report.html');
+        if(empty(self::$_sTmplContentDoReport))
+            self::$_sTmplContentDoReport = $this->_oTemplate->getHtml('report_do_report.html');
     }
 
     public function addCssJs($bDynamicMode = false)
@@ -119,16 +118,11 @@ class BxBaseReport extends BxDolReport
         if($bShowDoReportAsButton)
             $sClass .= ' bx-btn-height';
 
-        $sMethod = strpos($this->_sTmplNameCounter, '.html') !== false ? 'parseHtmlByName' : 'parseHtmlByTemplateName';
-        return $this->_oTemplate->$sMethod($this->_sTmplNameCounter, array(
-            'href' => 'javascript:void(0)',
-            'title' => _t('_report_do_report_by'),
-            'bx_repeat:attrs' => array(
-                array('key' => 'id', 'value' => $this->_aHtmlIds['counter']),
-                array('key' => 'class', 'value' => $sClass),
-                array('key' => 'onclick', 'value' => 'javascript:' . $sJsObject . '.toggleByPopup(this)')
-            ),
-            'content' => (int)$aReport['count'] > 0 ? $this->_getLabelCounter($aReport['count']) : ''
+        return $this->_oTemplate->parseLink('javascript:void(0)',  (int)$aReport['count'] > 0 ? $this->_getLabelCounter($aReport['count']) : '', array(
+            'id' => $this->_aHtmlIds['counter'],
+            'class' => $sClass, 
+        	'title' => _t('_report_do_report_by'),
+            'onclick' => 'javascript:' . $sJsObject . '.toggleByPopup(this)' 
         ));
     }
 
@@ -202,7 +196,7 @@ class BxBaseReport extends BxDolReport
 		if($bDisabled)
 			$sClass .= $bShowDoReportAsButton || $bShowDoReportAsButtonSmall ? ' bx-btn-disabled' : 'bx-report-disabled';
 
-        return $this->_oTemplate->parseHtmlByContent($this->_sTmplContentDoReport, array(
+        return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoReport, array(
             'style_prefix' => $this->_sStylePrefix,
         	'html_id' => $this->_aHtmlIds['do_link'],
             'class' => $sClass,

+ 18 - 23
template/scripts/BxBaseView.php

@@ -12,17 +12,17 @@
  */
 class BxBaseView extends BxDolView
 {
+    protected static $_sTmplContentCounter;
+    protected static $_sTmplContentDoViewLabel;
+
+    protected $_sTmplNameByList;
+
     protected $_bCssJsAdded;
     protected $_sStylePrefix;
     protected $_sJsObjName;
     protected $_aHtmlIds;
 
-    protected $_aElementDefaults;
-
-    protected $_sTmplNameCounter;
-    protected $_sTmplNameDoView;
-    protected $_sTmplNameDoViewLabel;
-    protected $_sTmplNameByList;
+    protected $_aElementDefaults;  
 
     public function __construct($sSystem, $iId, $iInit = 1)
     {
@@ -32,7 +32,7 @@ class BxBaseView extends BxDolView
 
         $this->_sStylePrefix = 'bx-view';
         $this->_sJsObjName = 'oView' . bx_gen_method_name($sSystem, array('_' , '-')) . $iId;
-        
+
         $sHtmlId = str_replace(array('_' , ' '), array('-', '-'), $sSystem) . '-' . $iId;
         $this->_aHtmlIds = array(
             'main' => 'bx-view-' . $sHtmlId,
@@ -48,9 +48,12 @@ class BxBaseView extends BxDolView
             'show_counter' => true
         );
 
-        $this->_sTmplNameCounter = 'view_counter.html';
-        $this->_sTmplNameDoView = 'view_do_view.html';
-        $this->_sTmplNameDoViewLabel = 'view_do_view_label.html';
+        if(empty(self::$_sTmplContentCounter))
+            self::$_sTmplContentCounter = $this->_oTemplate->getHtml('view_counter.html');
+
+        if(empty(self::$_sTmplContentDoViewLabel))
+            self::$_sTmplContentDoViewLabel = $this->_oTemplate->getHtml('view_do_view_label.html');
+
         $this->_sTmplNameByList = 'view_by_list.html';
     }
 
@@ -113,7 +116,7 @@ class BxBaseView extends BxDolView
             $sClass .= ' bx-btn-height';
 
         $sContent = (int)$aView['count'] > 0 ? $this->_getLabelCounter($aView['count']) : '';
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameCounter, array(
+        return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentCounter, array(
         	'bx_if:show_text' => array(
                 'condition' => !$bAllowedViewViewViewers,
                 'content' => array(
@@ -233,17 +236,9 @@ class BxBaseView extends BxDolView
 		if($bDisabled)
 			$sClass .= $bShowDoViewAsButton || $bShowDoViewAsButtonSmall ? ' bx-btn-disabled' : 'bx-view-disabled';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoView, array(
-            'style_prefix' => $this->_sStylePrefix,
-            'class' => $sClass,
-            'title' => _t('_view_do_view'),
-        	'bx_if:show_onclick' => array(
-        		'condition' => !$bDisabled,
-        		'content' => array(
-        			'js_object' => $this->getJsObjectName()
-        		)
-        	),
-            'do_view' => $this->_getLabelDo($aParams),
+        return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDo($aParams), array(
+            'class' => $this->_sStylePrefix . '-do-view ' . $sClass,
+            'title' => _t('_view_do_view')
         ));
     }
 
@@ -254,7 +249,7 @@ class BxBaseView extends BxDolView
 
     protected function _getLabelDo($aParams = array())
     {
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoViewLabel, array(
+        return $this->_oTemplate->parseHtmlByContent(self::$_sTmplContentDoViewLabel, array(
         	'bx_if:show_icon' => array(
         		'condition' => isset($aParams['show_do_view_icon']) && $aParams['show_do_view_icon'] == true,
         		'content' => array(

+ 14 - 25
template/scripts/BxBaseVote.php

@@ -23,10 +23,10 @@ class BxBaseVote extends BxDolVote
 
     protected $_sTmplNameElementBlock;
     protected $_sTmplNameElementInline;
-    protected $_sTmplNameCounter;
     protected $_sTmplNameLegend;
-    protected $_sTmplNameDoVoteLikes;
+    protected $_sTmplNameByList;
     protected $_sTmplNameDoVoteStars;
+    protected $_sTmplNameDoVoteLikesLabel;
 
     public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     {
@@ -66,10 +66,10 @@ class BxBaseVote extends BxDolVote
 
         $this->_sTmplNameElementBlock = 'vote_element_block.html';
         $this->_sTmplNameElementInline = 'vote_element_inline.html';
-        $this->_sTmplNameCounter = 'vote_counter.html';
         $this->_sTmplNameLegend = 'vote_legend.html';
-        $this->_sTmplNameDoVoteLikes = 'vote_do_vote_likes.html';
+        $this->_sTmplNameByList = 'vote_by_list.html';
         $this->_sTmplNameDoVoteStars = 'vote_do_vote_stars.html';
+        $this->_sTmplNameDoVoteLikesLabel = 'vote_do_vote_likes_label.html';
     }
 
     public function addCssJs($bDynamicMode = false)
@@ -144,15 +144,11 @@ class BxBaseVote extends BxDolVote
         if($bShowDoVoteAsButton)
             $sClass .= ' bx-btn-height';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameCounter, array(
-            'href' => 'javascript:void(0)',
+        return $this->_oTemplate->parseLink('javascript:void(0)', $bShowEmpty || (int)$aVote['count'] > 0 ? $this->_getLabelCounter($aVote['count']) : '', array(
+            'id' => $this->_aHtmlIds['counter'],
+            'class' => $sClass,
             'title' => _t($this->_getTitleDoBy()),
-            'bx_repeat:attrs' => array(
-                array('key' => 'id', 'value' => $this->_aHtmlIds['counter']),
-                array('key' => 'class', 'value' => $sClass),
-                array('key' => 'onclick', 'value' => 'javascript:' . $this->getJsClickCounter())
-            ),
-            'content' => $bShowEmpty || (int)$aVote['count'] > 0 ? $this->_getLabelCounter($aVote['count']) : ''
+            'onclick' => 'javascript:' . $this->getJsClickCounter() 
         ));
     }
 
@@ -351,17 +347,10 @@ class BxBaseVote extends BxDolVote
 		if($bDisabled)
 			$sClass .= $bShowDoVoteAsButton || $bShowDoVoteAsButtonSmall ? ' bx-btn-disabled' : 'bx-vote-disabled';
 
-        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoVoteLikes, array(
-            'style_prefix' => $this->_sStylePrefix,
-            'class' => $sClass,
-            'title' => bx_html_attribute(_t($this->_getTitleDoLike($bVoted))),
-        	'bx_if:show_onclick' => array(
-        		'condition' => !$bDisabled,
-        		'content' => array(
-                    'onclick' => $this->getJsClick()
-        		)
-        	),
-            'do_vote' => $this->_getLabelDoLike($aParams),
+        return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDoLike($aParams), array(
+            'class' => $this->_sStylePrefix . '-do-vote ' . $sClass,
+            'title' => _t($this->_getTitleDoLike($bVoted)),
+            'onclick' => !$bDisabled ? $this->getJsClick() : ''
         ));
     }
 
@@ -373,7 +362,7 @@ class BxBaseVote extends BxDolVote
     protected function _getLabelDoLike($aParams = array())
     {
     	$bVoted = isset($aParams['is_voted']) && $aParams['is_voted'] === true;
-        return $this->_oTemplate->parseHtmlByName('vote_do_vote_likes_label.html', array(
+        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameDoVoteLikesLabel, array(
         	'bx_if:show_icon' => array(
         		'condition' => isset($aParams['show_do_vote_icon']) && $aParams['show_do_vote_icon'] == true,
         		'content' => array(
@@ -405,7 +394,7 @@ class BxBaseVote extends BxDolVote
         if(empty($aTmplUsers))
             $aTmplUsers = MsgBox(_t('_Empty'));
 
-        return $this->_oTemplate->parseHtmlByName('vote_by_list.html', array(
+        return $this->_oTemplate->parseHtmlByName($this->_sTmplNameByList, array(
             'style_prefix' => $this->_sStylePrefix,
             'bx_repeat:list' => $aTmplUsers
         ));

+ 0 - 1
template/view_do_view.html

@@ -1 +0,0 @@
-<a class="__style_prefix__-do-view __class__" href="javascript:void(0)" <bx_if:show_onclick>onclick="javascript:__js_object__.view(this)"</bx_if:show_onclick> title="__title__">__do_view__</a>

+ 0 - 1
template/vote_counter.html

@@ -1 +0,0 @@
-<bx_include_auto:bx_a.html />

+ 0 - 1
template/vote_do_vote_likes.html

@@ -1 +0,0 @@
-<a class="__style_prefix__-do-vote __class__" href="javascript:void(0)" <bx_if:show_onclick>onclick="javascript:__onclick__"</bx_if:show_onclick> title="__title__">__do_vote__</a>