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
Added get and set methods to CmsApplication to act as wrappers to the 
$variables array
Added CmsModuleBase::add_header_text to append text into {header}'s output


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


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4379 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Fri Mar 07 08:32:00 -0800 2008
commit  19a6d7159da286ce9fa7169c953286461160a962
tree    ca5090d3c8ecb33dcd7b5c944771ab26fff15317
parent  52e44f494932c862c8304554b59182f0cf97d59b
...
177
178
179
 
 
 
 
 
 
 
 
 
 
180
181
182
...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
0
@@ -177,6 +177,16 @@ class CmsApplication extends CmsObject
0
     return CmsDatabase::get_instance();
0
   }
0
   
0
+ function get($name)
0
+ {
0
+ return $this->variables[$name];
0
+ }
0
+
0
+ function set($name, $value)
0
+ {
0
+ $this->variables[$name] = $value;
0
+ }
0
+
0
   /**
0
    * Getter overload method. Called when an $obj->field and field
0
    * does not exist in the object's variable list. In this case,
...
40
41
42
 
 
43
44
45
...
1629
1630
1631
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1632
1633
1634
...
40
41
42
43
44
45
46
47
...
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
0
@@ -40,6 +40,8 @@ abstract class CmsModuleBase extends CmsObject
0
   var $modredirect = false;
0
   var $modmisc = false;
0
   
0
+ var $has_added_header_text = false;
0
+
0
   var $set_params;
0
   
0
   function __construct()
0
@@ -1629,6 +1631,35 @@ abstract class CmsModuleBase extends CmsObject
0
     $variables = &$this->cms->variables;
0
     $variables['content-type'] = $contenttype;
0
   }
0
+
0
+ /**
0
+ * Adds text to be displayed by the {header} tag in the frontend rendering
0
+ * process.
0
+ *
0
+ * @param string The text to add to the {header} output
0
+ * @return void
0
+ * @author Ted Kulp
0
+ **/
0
+ public function add_header_text($text)
0
+ {
0
+ $headers = cmsms()->get('header_additions');
0
+ if ($headers == null)
0
+ $headers = array();
0
+ $headers[] = $text;
0
+ cmsms()->set('header_additions', $headers);
0
+ $this->has_added_header_text = true;
0
+ }
0
+
0
+ /**
0
+ * Checks to see if any add_header_text calls have been made yet.
0
+ *
0
+ * @return boolean Whether or not header text has been added
0
+ * @author Ted Kulp
0
+ **/
0
+ public function has_added_header_text()
0
+ {
0
+ return $this->has_added_header_text;
0
+ }
0
 
0
   /**
0
    * Put an event into the audit (admin) log.   This should be
...
138
139
140
 
 
 
 
 
 
 
 
141
142
143
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151
0
@@ -138,6 +138,14 @@ function cms_header_filter_plugin_function($params, &$smarty)
0
       $showbase = false;
0
     }
0
   }
0
+
0
+ if (cmsms()->get('header_additions') != null)
0
+ {
0
+ foreach (cmsms()->get('header_additions') as $addt)
0
+ {
0
+ $result .= $addt . "\n";
0
+ }
0
+ }
0
 
0
   if ($showbase)
0
   {

Comments

    No one has commented yet.