コード例 #1
0
ファイル: module_tracker.php プロジェクト: hungnv0789/vhtm
		/**
		 * _parseTemplate
		 * This is a wrapper for the sendstudio_functions::ParseTemplate function.
		 * It only loads up the sendstudio class once and stores it in the object for easy caching.
		 * If an array of values to plug in to the template are not supplied, then it triggers an error and returns false.
		 * If the template doesn't exist, this will also return false but the sendstudio_functions::ParseTemplate function handles this directly.
		 *
		 * @param String $templateFullPath The full path where the template reside
		 * @param Array $values Values to merge template with (Optional, default = array())
		 *
		 * @access protected
		 *
		 * @uses SendStudio_Functions
		 * @uses SendStudio_Functions::ParseTemplate()
		 *
		 * @throws E_USER_NOTICE Invalid values
		 * @return String|False Return a processed template if successful, FALSE otherwise
		 */
		function _parseTemplate($templateFullPath, $values = array())
		{
			if (!is_array($values)) {
				trigger_error('module_Tracker::_parseTemplate -- Invalid values', E_USER_NOTICE);
				return false;
			}

			if (is_null($this->_cachedSendStudioFunction)) {
				require_once(SENDSTUDIO_FUNCTION_DIRECTORY . '/sendstudio_functions.php');

				$this->_cachedSendStudioFunction = new SendStudio_Functions();
			}

			foreach ($values as $key => $value) {
				$GLOBALS[$key] = $value;
			}

			return $this->_cachedSendStudioFunction->ParseTemplate(true, true, true, $templateFullPath);
		}