Beispiel #1
0
function meth_Merge_System(&$Txt,&$Loc) {
// This function enables to merge TBS special fields

	if (isset($Loc->SubLst[1])) {
		switch ($Loc->SubLst[1]) {
		case 'now':
			$x = mktime();
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'version':
			$x = '2.05.1';
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'script_name':
			if (isset($_SERVER)) { // PHP<4.1.0 compatibilty
				$x = tbs_Misc_GetFilePart($_SERVER['PHP_SELF'],1);
			} else {
				global $HTTP_SERVER_VARS;
				$x = tbs_Misc_GetFilePart($HTTP_SERVER_VARS['PHP_SELF'],1);
			}
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'template_name':
			return $this->meth_Locator_Replace($Txt,$Loc,$this->_LastFile,false);
		case 'template_date':
			$x = filemtime($this->_LastFile);
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'template_path':
			$x = tbs_Misc_GetFilePart($this->_LastFile,0);
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'name':
			$x = 'TinyButStrong';
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'logo':
			$x = '**TinyButStrong**';
			return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
		case 'charset':
			return $this->meth_Locator_Replace($Txt,$Loc,$this->HtmlCharSet,false);
		case 'tplvars':
			if ($Loc->SubNbr==2) {
				$x = implode(',',array_keys($this->TplVars));
				return $this->meth_Locator_Replace($Txt,$Loc,$x,false);
			} else {
				if (isset($this->TplVars[$Loc->SubLst[2]])) {
					array_shift($Loc->SubLst);
					array_shift($Loc->SubLst);
					$Loc->SubNbr = $Loc->SubNbr - 2;
					return $this->meth_Locator_Replace($Txt,$Loc,$this->TplVars,true);
				} else {
					$this->meth_Misc_Alert('System Fields','Can\'t merge ['.$Loc->FullName.'] because property TplVars doesn\'t have any item named \''.$Loc->SubLst[2].'\'.');
					return $Loc->PosBeg+1;
				}
			}
		case '':
			$this->meth_Misc_Alert('System Fields','Can\'t merge ['.$Loc->FullName.'] because it doesn\'t have any requested keyword.');
			return $Loc->PosBeg+1;
		default:
			$this->meth_Misc_Alert('System Fields','Can\'t merge ['.$Loc->FullName.'] because \''.$Loc->SubLst[1].'\' is an unknown keyword.');
			return $Loc->PosBeg+1;
		}
	} else {
		$this->meth_Misc_Alert('System Fields','Can\'t merge ['.$Loc->FullName.'] because it doesn\'t have any subname.');
		return $Loc->PosBeg+1;
	}

}
Beispiel #2
0
 function meth_Merge_AutoSpe(&$Txt, &$Loc)
 {
     // Merge [var..*] (Special Var Fields)
     $ErrMsg = false;
     $SubStart = false;
     if (isset($Loc->SubLst[1])) {
         switch ($Loc->SubLst[1]) {
             case 'now':
                 $x = mktime();
                 break;
             case 'version':
                 $x = $this->Version;
                 break;
             case 'script_name':
                 $x = tbs_Misc_GetFilePart(isset($_SERVER) ? $_SERVER['PHP_SELF'] : $GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'], 1);
                 break;
             case 'template_name':
                 $x = $this->_LastFile;
                 break;
             case 'template_date':
                 $x = filemtime($this->_LastFile);
                 break;
             case 'template_path':
                 $x = tbs_Misc_GetFilePart($this->_LastFile, 0);
                 break;
             case 'name':
                 $x = 'TinyButStrong';
                 break;
             case 'logo':
                 $x = '**TinyButStrong**';
                 break;
             case 'charset':
                 $x = $this->HtmlCharSet;
                 break;
             case '':
                 $ErrMsg = 'it doesn\'t have any keyword.';
                 break;
             case 'tplvars':
                 if ($Loc->SubNbr == 2) {
                     $SubStart = 2;
                     $x = implode(',', array_keys($this->TplVars));
                 } else {
                     if (isset($this->TplVars[$Loc->SubLst[2]])) {
                         $SubStart = 3;
                         $x =& $this->TplVars[$Loc->SubLst[2]];
                     } else {
                         $ErrMsg = 'property TplVars doesn\'t have any item named \'' . $Loc->SubLst[2] . '\'.';
                     }
                 }
                 break;
             default:
                 $IsSupported = false;
                 if (isset($this->_piOnSpecialVar)) {
                     $x = '';
                     $ArgLst = array(substr($Loc->SubName, 1), &$IsSupported, &$x, &$Loc->PrmLst, &$Txt, &$Loc->PosBeg, &$Loc->PosEnd, &$Loc);
                     $this->meth_PlugIn_RunAll($this->_piOnSpecialVar, $ArgLst);
                 }
                 if (!$IsSupported) {
                     $ErrMsg = '\'' . $Loc->SubLst[1] . '\' is an unsupported keyword.';
                 }
         }
     } else {
         $ErrMsg = 'it doesn\'t have any subname.';
     }
     if ($ErrMsg !== false) {
         $this->meth_Misc_Alert($Loc, $ErrMsg);
         $x = '';
     }
     if ($Loc->PosBeg === false) {
         return $Loc->PosEnd;
     } else {
         return $this->meth_Locator_Replace($Txt, $Loc, $x, $SubStart);
     }
 }