Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Implemented {header} as a function and output filter combo.  This allows 
us to process the header after the modules are executed.

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4378 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Fri Mar 07 06:36:17 -0800 2008
commit  52e44f494932c862c8304554b59182f0cf97d59b
tree    9867e1847197563c76ebfdc71275f3f2cb84a9df
parent  d76807466b95dc124be97c14278f2a5687205b52
...
520
521
522
 
 
523
524
525
...
520
521
522
523
524
525
526
527
0
@@ -520,6 +520,8 @@ class CmsEventOperations extends CmsObject
0
     self::create_event( $modulename, 'ModuleUpgraded');
0
     self::create_event( $modulename, 'AllModulesLoaded');
0
     
0
+ self::create_event( $modulename, 'HeaderTagRender');
0
+
0
     self::create_event( $modulename, 'ContentStylesheet');
0
     self::create_event( $modulename, 'ContentPreCompile');
0
     self::create_event( $modulename, 'ContentPostCompile');
...
20
21
22
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
 
72
73
74
75
76
77
 
 
78
79
80
 
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
105
106
107
...
20
21
22
 
 
 
23
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
26
 
 
 
 
 
27
28
29
30
 
31
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34
35
36
0
@@ -20,88 +20,17 @@
0
 
0
 function smarty_cms_function_header($params, &$smarty)
0
 {
0
- global $gCms;
0
- $pageinfo =& $gCms->variables['pageinfo'];
0
- $root_url = CmsConfig::get('root_url');
0
+ $result = '<!-- headertag';
0
   
0
- $result = '';
0
-
0
- if (isset($params['name']) && $params['name'] != '')
0
- {
0
- $result .= '<link rel="result" type="text/css" ';
0
- if (isset($params['media']) && $params['media'] != '')
0
- {
0
- $result .= 'media="' . $params['media'] . '" ';
0
- }
0
- $result .= 'href="'.$root_url.'/stylesheet.php?name='.$params['name'];
0
- $result .= "\" />\n";
0
- }
0
- else
0
- {
0
- $template = cms_orm('cms_template')->find_by_id($pageinfo->template_id);
0
- if ($template)
0
- {
0
- foreach ($template->get_stylesheet_media_types() as $media)
0
- {
0
- $result .= '<link rel="result" type="text/css" ';
0
- if ($media != '')
0
- {
0
- $result .= 'media="'.$media.'" ';
0
- }
0
- $result .= "href=\"{$root_url}/stylesheet.php?templateid={$pageinfo->template_id}";
0
- if ($media != '')
0
- {
0
- $result .= '&amp;mediatype='.urlencode($media);
0
- }
0
- $result .= "\" />\n";
0
- }
0
- }
0
- }
0
-
0
- $result .= get_site_preference('metadata', '');
0
-
0
- if (isset($pageinfo) && $pageinfo !== FALSE)
0
- {
0
- if (isset($pageinfo->content_metadata) && $pageinfo->content_metadata != '')
0
- {
0
- $result .= "\n" . $pageinfo->content_metadata;
0
- }
0
- }
0
-
0
- if ((!strpos($result,$smarty->left_delimiter) === false) and (!strpos($result,$smarty->right_delimiter) === false))
0
+ foreach ($params as $k=>$v)
0
   {
0
- $smarty->_compile_source('metadata template', $result, $_compiled);
0
- @ob_start();
0
- $smarty->_eval('?>' . $_compiled);
0
- $result = @ob_get_contents();
0
- @ob_end_clean();
0
+ $v = str_replace('"', 'xxx_double_quote_here_xxx', $v);
0
+ $result .= " $k=\"$v\"";
0
   }
0
   
0
- $showbase = true;
0
+ $result .= ' -->';
0
   
0
- #Show a base tag unless showbase is false in config.php
0
- #It really can't hinder, only help.
0
- if (isset($params['showbase']))
0
- {
0
- if ($params['showbase'] == 'false')
0
- {
0
- $showbase = false;
0
- }
0
- }
0
-
0
- if ($showbase)
0
- {
0
- $result .= "\n<base href=\"".$root_url."/\" />\n";
0
- }
0
-
0
- if (array_key_exists('assign', $params))
0
- {
0
- $smarty->assign($params['assign'], $result);
0
- }
0
- else
0
- {
0
- return $result;
0
- }
0
+ return $result;
0
 }
0
 
0
 function smarty_cms_help_function_header() {

Comments

    No one has commented yet.