Commits

Jean-Christian Denis  committed 88e1ebd

Moved tpl attribut has_tag to the right place, fixes #1316

  • Participants
  • Parent commits df7e300

Comments (0)

Files changed (2)

File inc/public/class.dc.template.php

 	current_tpl		CDATA	#IMPLIED	-- tests if current template is the one given in paramater
 	current_mode		CDATA	#IMPLIED	-- tests if current URL mode is the one given in parameter
 	has_tpl			CDATA     #IMPLIED  -- tests if a named template exists
-	has_tag			CDATA     #IMPLIED  -- tests if a named template tag exists (see Tag plugin for code)
+	has_tag			CDATA     #IMPLIED  -- tests if a named template block or value exists
 	blog_id			CDATA     #IMPLIED  -- tests if current blog ID is the one given in parameter
 	comments_active	(0|1)	#IMPLIED	-- test if comments are enabled blog-wide 
 	pings_active		(0|1)	#IMPLIED	-- test if trackbacks are enabled blog-wide 
 			$if[] = $sign."\$core->tpl->getFilePath('".addslashes($attr['has_tpl'])."') !== false";
 		}
 		
+		if (isset($attr['has_tag'])) {
+			$sign = 'true';
+			if (substr($attr['has_tag'],0,1) == '!') {
+				$sign = 'false';
+				$attr['has_tag'] = substr($attr['has_tag'],1);
+			}
+			$if[] =  "\$core->tpl->tagExists('".addslashes($attr['has_tag'])."') === ".$sign;
+		}
+		
 		if (isset($attr['blog_id'])) {
 			$sign = '';
 			if (substr($attr['blog_id'],0,1) == '!') {

File plugins/tags/_public.php

 
 
 $core->addBehavior('templateBeforeBlock',array('behaviorsTags','templateBeforeBlock'));
-$core->addBehavior('tplSysIfConditions',array('behaviorsTags','tplSysIfConditions'));
 $core->addBehavior('publicBeforeDocument',array('behaviorsTags','addTplPath'));
 
 class behaviorsTags
 		}
 	}
 	
-	public static function tplSysIfConditions($tag, $attr,$content,$if)
-	{
-		if ($tag == 'Sys' && isset($attr['has_tag'])) {
-			$sign = '';
-			if (substr($attr['has_tag'],0,1) == '!') {
-				$sign = '!';
-				$attr['has_tag'] = substr($attr['has_tag'],1);
-			}
-			$if[] =  $sign."(\$core->tpl->tagExists('".addslashes($attr['has_tag'])."') )";
-		}
-	}
-	
 	public static function addTplPath($core)
 	{
 		$core->tpl->setPath($core->tpl->getPath(), dirname(__FILE__).'/default-templates');