- reverted location of loadPlugin() to Smarty class

- fixed comments in plugins
This commit is contained in:
uwe.tews@googlemail.com
2010-11-13 04:10:52 +00:00
parent 3c04e4ff37
commit fe63ad36b8
25 changed files with 71 additions and 109 deletions

View File

@@ -1,5 +1,7 @@
13/11/2010 13/11/2010
- bugfix on {debug} - bugfix on {debug}
- reverted location of loadPlugin() to Smarty class
- fixed comments in plugins
===== Smarty 3.0.2 ===== ===== Smarty 3.0.2 =====

View File

@@ -660,6 +660,54 @@ class Smarty extends Smarty_Internal_Data {
return $this->debug_tpl = $tpl_name; return $this->debug_tpl = $tpl_name;
} }
/**
* Takes unknown classes and loads plugin files for them
* class name format: Smarty_PluginType_PluginName
* plugin filename format: plugintype.pluginname.php
*
* @param string $plugin_name class plugin name to load
* @return string |boolean filepath of loaded file or false
*/
public function loadPlugin($plugin_name, $check = true)
{
// if function or class exists, exit silently (already loaded)
if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
return true;
// Plugin name is expected to be: Smarty_[Type]_[Name]
$_plugin_name = strtolower($plugin_name);
$_name_parts = explode('_', $_plugin_name, 3);
// class name must have three parts to be valid plugin
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
return false;
}
// if type is "internal", get plugin from sysplugins
if ($_name_parts[1] == 'internal') {
$file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
if (file_exists($file)) {
require_once($file);
return $file;
} else {
return false;
}
}
// plugin filename is expected to be: [type].[name].php
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
// loop through plugin dirs and find the plugin
foreach((array)$this->plugins_dir as $_plugin_dir) {
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
$_plugin_dir .= DS;
}
$file = $_plugin_dir . $_plugin_filename;
if (file_exists($file)) {
require_once($file);
return $file;
}
}
// no plugin loaded
return false;
}
/** /**
* clean up properties on cloned object * clean up properties on cloned object
*/ */

View File

@@ -11,9 +11,8 @@
* Smarty {php}{/php} block plugin * Smarty {php}{/php} block plugin
* *
* @param string $content contents of the block * @param string $content contents of the block
* @param object $smarty Smarty object
* @param boolean $ &$repeat repeat flag
* @param object $template template object * @param object $template template object
* @param boolean $ &$repeat repeat flag
* @return string content re-formatted * @return string content re-formatted
*/ */
function smarty_block_php($params, $content, $template, &$repeat) function smarty_block_php($params, $content, $template, &$repeat)

View File

@@ -27,9 +27,8 @@
* </pre> * </pre>
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param string $content contents of the block * @param string $content contents of the block
* @param object $smarty Smarty object
* @param boolean &$repeat repeat flag
* @param object $template template object * @param object $template template object
* @param boolean &$repeat repeat flag
* @return string content re-formatted * @return string content re-formatted
*/ */
function smarty_block_textformat($params, $content, $template, &$repeat) function smarty_block_textformat($params, $content, $template, &$repeat)

View File

@@ -39,7 +39,6 @@
* @author credit to Jason Sweat <jsweat_php@yahoo.com> * @author credit to Jason Sweat <jsweat_php@yahoo.com>
* @version 1.3 * @version 1.3
* @param array * @param array
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string|null * @return string|null
*/ */

View File

@@ -16,7 +16,6 @@
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string|null if the assign parameter is passed, Smarty assigns the * @return string|null if the assign parameter is passed, Smarty assigns the
* result to a template variable * result to a template variable

View File

@@ -34,7 +34,6 @@
* - separator (optional) - ie <br> or &nbsp; * - separator (optional) - ie <br> or &nbsp;
* - output (optional) - the output next to each checkbox * - output (optional) - the output next to each checkbox
* - assign (optional) - assign the output as an array to this variable * - assign (optional) - assign the output as an array to this variable
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
* @uses smarty_function_escape_special_chars() * @uses smarty_function_escape_special_chars()
@@ -42,7 +41,6 @@
function smarty_function_html_checkboxes($params, $template) function smarty_function_html_checkboxes($params, $template)
{ {
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
$name = 'checkbox'; $name = 'checkbox';
$values = null; $values = null;

View File

@@ -29,7 +29,6 @@
* - basedir = base directory for absolute paths, default * - basedir = base directory for absolute paths, default
* is environment variable DOCUMENT_ROOT * is environment variable DOCUMENT_ROOT
* - path_prefix = prefix for path output (optional, default empty) * - path_prefix = prefix for path output (optional, default empty)
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
* @uses smarty_function_escape_special_chars() * @uses smarty_function_escape_special_chars()
@@ -37,8 +36,7 @@
function smarty_function_html_image($params, $template) function smarty_function_html_image($params, $template)
{ {
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
$alt = ''; $alt = '';
$file = ''; $file = '';
$height = ''; $height = '';

View File

@@ -24,7 +24,6 @@
* - options (required if no values supplied) - associative array * - options (required if no values supplied) - associative array
* - selected (optional) - string default not set * - selected (optional) - string default not set
* - output (required if not options supplied) - array * - output (required if not options supplied) - array
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
* @uses smarty_function_escape_special_chars() * @uses smarty_function_escape_special_chars()
@@ -32,7 +31,6 @@
function smarty_function_html_options($params, $template) function smarty_function_html_options($params, $template)
{ {
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
$name = null; $name = null;
$values = null; $values = null;

View File

@@ -35,7 +35,6 @@
* - separator (optional) - ie <br> or &nbsp; * - separator (optional) - ie <br> or &nbsp;
* - output (optional) - the output next to each radio button * - output (optional) - the output next to each radio button
* - assign (optional) - assign the output as an array to this variable * - assign (optional) - assign the output as an array to this variable
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
* @uses smarty_function_escape_special_chars() * @uses smarty_function_escape_special_chars()
@@ -43,7 +42,6 @@
function smarty_function_html_radios($params, $template) function smarty_function_html_radios($params, $template)
{ {
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
$name = 'radio'; $name = 'radio';
$values = null; $values = null;

View File

@@ -34,7 +34,6 @@
* @author Andrei Zmievski * @author Andrei Zmievski
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
*/ */
@@ -43,9 +42,6 @@ function smarty_function_html_select_date($params, $template)
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php'); require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
//$smarty->loadPlugin('Smarty_shared_escape_special_chars');
//$smarty->loadPlugin('Smarty_shared_make_timestamp');
//$smarty->loadPlugin('Smarty_function_html_options');
/* Default values. */ /* Default values. */
$prefix = "Date_"; $prefix = "Date_";
@@ -219,7 +215,7 @@ function smarty_function_html_select_date($params, $template)
'values' => $month_values, 'values' => $month_values,
'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '', 'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$month_result .= '</select>'; $month_result .= '</select>';
} }
@@ -255,7 +251,7 @@ function smarty_function_html_select_date($params, $template)
'values' => $day_values, 'values' => $day_values,
'selected' => $time[2], 'selected' => $time[2],
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$day_result .= '</select>'; $day_result .= '</select>';
} }
@@ -302,7 +298,7 @@ function smarty_function_html_select_date($params, $template)
'values' => $yearvals, 'values' => $yearvals,
'selected' => $time[0], 'selected' => $time[0],
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$year_result .= '</select>'; $year_result .= '</select>';
} }
} }

View File

@@ -18,7 +18,6 @@
* @author Roberto Berto <roberto@berto.net> * @author Roberto Berto <roberto@berto.net>
* @credits Monte Ohrt <monte AT ohrt DOT com> * @credits Monte Ohrt <monte AT ohrt DOT com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
* @uses smarty_make_timestamp() * @uses smarty_make_timestamp()
@@ -27,8 +26,6 @@ function smarty_function_html_select_time($params, $template)
{ {
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php'); require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
//$smarty->loadPlugin('Smarty_shared_make_timestamp');
//$smarty->loadPlugin('Smarty_function_html_options');
/* Default values. */ /* Default values. */
$prefix = "Time_"; $prefix = "Time_";
@@ -108,7 +105,7 @@ function smarty_function_html_select_time($params, $template)
'values' => $hours, 'values' => $hours,
'selected' => strftime($hour_fmt, $time), 'selected' => strftime($hour_fmt, $time),
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$html_result .= "</select>\n"; $html_result .= "</select>\n";
} }
@@ -135,7 +132,7 @@ function smarty_function_html_select_time($params, $template)
'values' => $minutes, 'values' => $minutes,
'selected' => $selected, 'selected' => $selected,
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$html_result .= "</select>\n"; $html_result .= "</select>\n";
} }
@@ -163,7 +160,7 @@ function smarty_function_html_select_time($params, $template)
'values' => $seconds, 'values' => $seconds,
'selected' => $selected, 'selected' => $selected,
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$html_result .= "</select>\n"; $html_result .= "</select>\n";
} }
@@ -187,7 +184,7 @@ function smarty_function_html_select_time($params, $template)
'values' => array('am', 'pm'), 'values' => array('am', 'pm'),
'selected' => strtolower(strftime('%p', $time)), 'selected' => strtolower(strftime('%p', $time)),
'print_result' => false), 'print_result' => false),
$smarty, $template); $template);
$html_result .= "</select>\n"; $html_result .= "</select>\n";
} }

View File

@@ -44,7 +44,6 @@
* - hdir = horizontal direction (default: "right", means left-to-right) * - hdir = horizontal direction (default: "right", means left-to-right)
* - inner = inner loop (default "cols": print $loop line by line, * - inner = inner loop (default "cols": print $loop line by line,
* $loop will be printed column by column otherwise) * $loop will be printed column by column otherwise)
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
*/ */

View File

@@ -45,7 +45,6 @@
* - newsgroups = (optional) newsgroup(s) to post to * - newsgroups = (optional) newsgroup(s) to post to
* - followupto = (optional) address(es) to follow up to * - followupto = (optional) address(es) to follow up to
* - extra = (optional) extra tags for the href link * - extra = (optional) extra tags for the href link
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
*/ */

View File

@@ -17,7 +17,6 @@
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string|null * @return string|null
*/ */

View File

@@ -16,7 +16,6 @@
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
*/ */

View File

@@ -16,7 +16,6 @@
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @param array $params parameters * @param array $params parameters
* @param object $smarty Smarty object
* @param object $template template object * @param object $template template object
* @return string * @return string
*/ */

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
$this->compiler->tag_nocache = true; $this->compiler->tag_nocache = true;
// display debug template // display debug template
$_output = "<?php Smarty_Internal_Plugin_Loader::loadPlugin('Smarty_Internal_Debug', \$_smarty_tpl->smarty->plugins_dir); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>"; $_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>";
return $_output; return $_output;
} }
} }

View File

@@ -46,7 +46,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
} }
} }
// check for plugin modifiercompiler // check for plugin modifiercompiler
} else if (Smarty_Internal_Plugin_Loader::loadPlugin('smarty_modifiercompiler_' . $modifier, $compiler->smarty->plugins_dir)) { } else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
$plugin = 'smarty_modifiercompiler_' . $modifier; $plugin = 'smarty_modifiercompiler_' . $modifier;
$output = $plugin($single_modifier, $compiler); $output = $plugin($single_modifier, $compiler);
// check for plugin modifier // check for plugin modifier

View File

@@ -22,8 +22,8 @@ class Smarty_Internal_Config_File_Compiler {
{ {
$this->smarty = $smarty; $this->smarty = $smarty;
// get required plugins // get required plugins
Smarty_Internal_Plugin_Loader::loadPlugin('Smarty_Internal_Configfilelexer', $this->smarty->plugins_dir); $this->smarty->loadPlugin('Smarty_Internal_Configfilelexer');
Smarty_Internal_Plugin_Loader::loadPlugin('Smarty_Internal_Configfileparser', $this->smarty->plugins_dir); $this->smarty->loadPlugin('Smarty_Internal_Configfileparser');
$this->config_data['sections'] = array(); $this->config_data['sections'] = array();
$this->config_data['vars'] = array(); $this->config_data['vars'] = array();
} }

View File

@@ -72,7 +72,7 @@ class Smarty_Internal_Filter {
{ {
$_plugin = "smarty_{$type}filter_{$name}"; $_plugin = "smarty_{$type}filter_{$name}";
$_filter_name = $_plugin; $_filter_name = $_plugin;
if (Smarty_Internal_Plugin_Loader::loadPlugin($_plugin, $this->smarty->plugins_dir)) { if ($this->smarty->loadPlugin($_plugin)) {
if (class_exists($_plugin, false)) { if (class_exists($_plugin, false)) {
$_plugin = array($_plugin, 'execute'); $_plugin = array($_plugin, 'execute');
} }

View File

@@ -34,7 +34,7 @@ class Smarty_Internal_Filter_Handler {
if (!empty($smarty->autoload_filters[$type])) { if (!empty($smarty->autoload_filters[$type])) {
foreach ((array)$smarty->autoload_filters[$type] as $name) { foreach ((array)$smarty->autoload_filters[$type] as $name) {
$plugin_name = "Smarty_{$type}filter_{$name}"; $plugin_name = "Smarty_{$type}filter_{$name}";
if (Smarty_Internal_Plugin_Loader::loadPlugin($plugin_name, $smarty->plugins_dir)) { if ($smarty->loadPlugin($plugin_name)) {
if (function_exists($plugin_name)) { if (function_exists($plugin_name)) {
// use loaded Smarty2 style plugin // use loaded Smarty2 style plugin
$output = $plugin_name($output, $smarty); $output = $plugin_name($output, $smarty);

View File

@@ -1,64 +0,0 @@
<?php
/**
* Smarty Internal Plugin Loader
*
* Compiles the {ldelim} tag
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*/
/**
* Smarty Internal Plugin Loader Class
*/
class Smarty_Internal_Plugin_Loader {
/**
* Takes unknown classes and loads plugin files for them
* class name format: Smarty_PluginType_PluginName
* plugin filename format: plugintype.pluginname.php
*
* @param string $plugin_name class plugin name to load
* @return string |boolean filepath of loaded file or false
*/
static function loadPlugin($plugin_name, $plugins_dir)
{
// if function or class exists, exit silently (already loaded)
if (is_callable($plugin_name) || class_exists($plugin_name, false))
return true;
// Plugin name is expected to be: Smarty_[Type]_[Name]
$_plugin_name = strtolower($plugin_name);
$_name_parts = explode('_', $_plugin_name, 3);
// class name must have three parts to be valid plugin
if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
return false;
}
// if type is "internal", get plugin from sysplugins
if ($_name_parts[1] == 'internal') {
$file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
if (file_exists($file)) {
require_once($file);
return $file;
} else {
return false;
}
}
// plugin filename is expected to be: [type].[name].php
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
// loop through plugin dirs and find the plugin
foreach((array)$plugins_dir as $_plugin_dir) {
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
$_plugin_dir .= DS;
}
$file = $_plugin_dir . $_plugin_filename;
if (file_exists($file)) {
require_once($file);
return $file;
}
}
// no plugin loaded
return false;
}
}
?>

View File

@@ -245,7 +245,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
// compile template // compile template
if (!is_object($this->compiler_object)) { if (!is_object($this->compiler_object)) {
// load compiler // load compiler
Smarty_Internal_Plugin_Loader::loadPlugin($this->resource_object->compiler_class,$this->smarty->plugins_dir); $this->smarty->loadPlugin($this->resource_object->compiler_class);
$this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty); $this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty);
} }
// compile locking // compile locking
@@ -705,7 +705,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
} else { } else {
// try plugins dir // try plugins dir
$_resource_class = 'Smarty_Resource_' . ucfirst($resource_type); $_resource_class = 'Smarty_Resource_' . ucfirst($resource_type);
if (Smarty_Internal_Plugin_Loader::loadPlugin($_resource_class,$this->smarty->plugins_dir)) { if ($this->smarty->loadPlugin($_resource_class)) {
if (class_exists($_resource_class, false)) { if (class_exists($_resource_class, false)) {
return new $_resource_class($this->smarty); return new $_resource_class($this->smarty);
} else { } else {

View File

@@ -193,7 +193,7 @@ class Smarty_Internal_TemplateCompilerBase {
} }
// check plugins from plugins folder // check plugins from plugins folder
foreach ($this->smarty->plugin_search_order as $plugin_type) { foreach ($this->smarty->plugin_search_order as $plugin_type) {
if ($plugin_type == Smarty::PLUGIN_BLOCK && Smarty_Internal_Plugin_Loader::loadPlugin('smarty_compiler_' . $tag, $this->smarty->plugins_dir)) { if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
$plugin = 'smarty_compiler_' . $tag; $plugin = 'smarty_compiler_' . $tag;
if (is_callable($plugin)) { if (is_callable($plugin)) {
return $plugin($args, $this->smarty); return $plugin($args, $this->smarty);
@@ -231,7 +231,7 @@ class Smarty_Internal_TemplateCompilerBase {
if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) { if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {
return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function); return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);
} }
if (Smarty_Internal_Plugin_Loader::loadPlugin('smarty_compiler_' . $tag, $this->smarty->plugins_dir)) { if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
$plugin = 'smarty_compiler_' . $tag; $plugin = 'smarty_compiler_' . $tag;
if (is_callable($plugin)) { if (is_callable($plugin)) {
return $plugin($args, $this->smarty); return $plugin($args, $this->smarty);
@@ -272,7 +272,7 @@ class Smarty_Internal_TemplateCompilerBase {
} }
// lazy load internal compiler plugin // lazy load internal compiler plugin
$class_name = 'Smarty_Internal_Compile_' . $tag; $class_name = 'Smarty_Internal_Compile_' . $tag;
if (Smarty_Internal_Plugin_Loader::loadPlugin($class_name, $this->smarty->plugins_dir)) { if ($this->smarty->loadPlugin($class_name)) {
// use plugin if found // use plugin if found
self::$_tag_objects[$tag] = new $class_name; self::$_tag_objects[$tag] = new $class_name;
// compile this tag // compile this tag