Renaming Plugins to camelcase
authorTim Düsterhus <timwolla@arcor.de>
Sun, 28 Aug 2011 10:08:45 +0000 (12:08 +0200)
committerTim Düsterhus <timwolla@arcor.de>
Sun, 28 Aug 2011 10:23:36 +0000 (12:23 +0200)
wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/template/plugin/HtmlcheckboxesFunctionTemplatePlugin.class.php [deleted file]
wcfsetup/install/files/lib/system/template/plugin/HtmloptionsFunctionTemplatePlugin.class.php [deleted file]

diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmlCheckboxesFunctionTemplatePlugin.class.php
new file mode 100644 (file)
index 0000000..a88bd06
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+namespace wcf\system\template\plugin;
+use wcf\system\exception\SystemException;
+use wcf\system\template\TemplateEngine;
+use wcf\util\StringUtil;
+
+/**
+ * The 'htmlCheckboxes' template function generates a list of html checkboxes.
+ * 
+ * Usage:
+ * {htmlCheckboxes name="x" options=$array}
+ * {htmlCheckboxes name="x" options=$array selected=$foo}
+ * {htmlCheckboxes name="x" output=$outputArray}
+ * {htmlCheckboxes name="x" output=$outputArray values=$valueArray}
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.template.plugin
+ * @category   Community Framework
+ */
+class HtmlCheckboxesFunctionTemplatePlugin implements IFunctionTemplatePlugin {
+       protected $disableEncoding = false;
+       
+       /**
+        * @see wcf\system\template\IFunctionTemplatePlugin::execute()
+        */
+       public function execute($tagArgs, TemplateEngine $tplObj) {
+               // get options
+               if (isset($tagArgs['output']) && is_array($tagArgs['output'])) {
+                       if (isset($tagArgs['values']) && is_array($tagArgs['values'])) {
+                               $tagArgs['options'] = array_combine($tagArgs['values'], $tagArgs['output']);
+                       }
+                       else {
+                               $tagArgs['options'] = array_combine($tagArgs['output'], $tagArgs['output']);
+                       }
+               }
+
+               if (!isset($tagArgs['options']) || !is_array($tagArgs['options'])) {
+                       throw new SystemException("missing 'options' argument in htmlCheckboxes tag");
+               }
+               
+               if (!isset($tagArgs['name'])) {
+                       throw new SystemException("missing 'name' argument in htmlCheckboxes tag");
+               }
+               
+               if (isset($tagArgs['disableEncoding']) && $tagArgs['disableEncoding']) {
+                       $this->disableEncoding = true;
+               }
+               else {
+                       $this->disableEncoding = false;
+               }
+               
+               // get selected values
+               if (isset($tagArgs['selected'])) {
+                       if (!is_array($tagArgs['selected'])) $tagArgs['selected'] = array($tagArgs['selected']);        
+               }
+               else {
+                       $tagArgs['selected'] = array();
+               }
+               if (!isset($tagArgs['separator'])) {
+                       $tagArgs['separator'] = '';
+               }
+               
+               // build html
+               $html = '';
+               foreach ($tagArgs['options'] as $key => $value) {
+                       if (!empty($html)) $html .= $tagArgs['separator'];
+                       $html .= '<label><input type="checkbox" name="'.$this->encodeHTML($tagArgs['name']).'[]" value="'.$this->encodeHTML($key).'"'.(in_array($key, $tagArgs['selected']) ? ' checked="checked"' : '').' /> '.$this->encodeHTML($value).'</label>';                   
+               }
+               
+               return $html;
+       }
+       
+       /**
+        * Executes StringUtil::encodeHTML on the given text if disableEncoding is false.
+        * @see wcf\util\StringUtil::encodeHTML()
+        */
+       protected function encodeHTML($text) {
+               if (!$this->disableEncoding) {
+                       $text = StringUtil::encodeHTML($text);
+               }
+               
+               return $text;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmlOptionsFunctionTemplatePlugin.class.php
new file mode 100644 (file)
index 0000000..3bf178b
--- /dev/null
@@ -0,0 +1,128 @@
+<?php
+namespace wcf\system\template\plugin;
+use wcf\system\exception\SystemException;
+use wcf\system\template\TemplateEngine;
+use wcf\util\StringUtil;
+
+/**
+ * The 'htmlOptions' template function generates the options of an html select list.
+ * 
+ * Usage:
+ * {htmlOptions options=$array}
+ * {htmlOptions options=$array selected=$foo}
+ * {htmlOptions options=$array name="x"}
+ * {htmlOptions output=$outputArray}
+ * {htmlOptions output=$outputArray values=$valueArray}
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.template.plugin
+ * @category   Community Framework
+ */
+class HtmlOptionsFunctionTemplatePlugin extends HtmlCheckboxesFunctionTemplatePlugin {
+       protected $selected = array();
+       
+       /**
+        * @see wcf\system\template\IFunctionTemplatePlugin::execute()
+        */
+       public function execute($tagArgs, TemplateEngine $tplObj) {
+               if (isset($tagArgs['output']) && is_array($tagArgs['output'])) {
+                       if (count($tagArgs['output'])) {
+                               if (isset($tagArgs['values']) && is_array($tagArgs['values'])) {
+                                       if (count($tagArgs['output']) == count($tagArgs['values'])) {
+                                               $tagArgs['options'] = array_combine($tagArgs['values'], $tagArgs['output']);
+                                       }
+                                       else {
+                                               $tagArgs['options'] = array();
+                                       }
+                               }
+                               else {
+                                       $tagArgs['options'] = array_combine($tagArgs['output'], $tagArgs['output']);
+                               }
+                       }
+                       else {
+                               $tagArgs['options'] = array();
+                       }
+               }
+
+               if (!isset($tagArgs['options']) || !is_array($tagArgs['options'])) {
+                       throw new SystemException("missing 'options' argument in htmlOptions tag");
+               }
+               
+               if (isset($tagArgs['disableEncoding']) && $tagArgs['disableEncoding']) {
+                       $this->disableEncoding = true;
+               }
+               else {
+                       $this->disableEncoding = false;
+               }
+               
+               // get selected values
+               $this->selected = array();
+               if (isset($tagArgs['selected'])) {
+                       $this->selected = $tagArgs['selected'];
+                       if (!is_array($this->selected)) $this->selected = array($this->selected);       
+               }
+               
+               // create option list
+               $htmloptions = $this->makeOptionGroup(null, $tagArgs['options']);
+               
+               // create also a 'select' tag
+               if (isset($tagArgs['name'])) {
+                       // unset all system vars
+                       unset($tagArgs['options'], $tagArgs['selected'], $tagArgs['output'], $tagArgs['values'], $tagArgs['disableEncoding']);
+                       
+                       // generate 'select' parameters
+                       $params = '';
+                       foreach ($tagArgs as $key => $value) {
+                               $params .= ' '.$key.'="'.$this->encodeHTML($value).'"';
+                       }
+                       
+                       $htmloptions = '<select'.$params.'>'."\n".$htmloptions."</select>\n";
+               }
+               
+               return $htmloptions;
+       }
+       
+       /**
+        * Makes the html for an option group.
+        * 
+        * @param       string          $key
+        * @param       array           $values
+        * @return      string                          html code of an option group
+        */
+       protected function makeOptionGroup($key, $values) {
+               $html = '';
+               if ($key !== null) {
+                       $html = '<optgroup label="'.$this->encodeHTML($key).'">'."\n";
+               }
+               
+               foreach ($values as $childKey => $value) {
+                       if (is_array($value)) {
+                               $html .= $this->makeOptionGroup($childKey, $value);
+                       }
+                       else {
+                               $html .= $this->makeOption($childKey, $value);
+                       }
+               }
+               
+               if ($key !== null) {
+                       $html .= "</optgroup>\n";
+               }
+               
+               return $html;
+       }
+       
+       /**
+        * Makes the html for an option.
+        * 
+        * @param       string          $key
+        * @param       string          $value
+        * @return      string                          html code of an option tag
+        */
+       protected function makeOption($key, $value) {
+               $value = $this->encodeHTML($value);
+               return '<option label="'.$value.'" value="'.$this->encodeHTML($key).'"'.(in_array($key, $this->selected) ? ' selected="selected"' : '').'>'.$value."</option>\n";
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmlcheckboxesFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmlcheckboxesFunctionTemplatePlugin.class.php
deleted file mode 100644 (file)
index 41fe0ff..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-namespace wcf\system\template\plugin;
-use wcf\system\exception\SystemException;
-use wcf\system\template\TemplateEngine;
-use wcf\util\StringUtil;
-
-/**
- * The 'htmlcheckboxes' template function generates a list of html checkboxes.
- * 
- * Usage:
- * {htmlcheckboxes name="x" options=$array}
- * {htmlcheckboxes name="x" options=$array selected=$foo}
- * {htmlcheckboxes name="x" output=$outputArray}
- * {htmlcheckboxes name="x" output=$outputArray values=$valueArray}
- *
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.template.plugin
- * @category   Community Framework
- */
-class HtmlcheckboxesFunctionTemplatePlugin implements IFunctionTemplatePlugin {
-       protected $disableEncoding = false;
-       
-       /**
-        * @see wcf\system\template\IFunctionTemplatePlugin::execute()
-        */
-       public function execute($tagArgs, TemplateEngine $tplObj) {
-               // get options
-               if (isset($tagArgs['output']) && is_array($tagArgs['output'])) {
-                       if (isset($tagArgs['values']) && is_array($tagArgs['values'])) {
-                               $tagArgs['options'] = array_combine($tagArgs['values'], $tagArgs['output']);
-                       }
-                       else {
-                               $tagArgs['options'] = array_combine($tagArgs['output'], $tagArgs['output']);
-                       }
-               }
-
-               if (!isset($tagArgs['options']) || !is_array($tagArgs['options'])) {
-                       throw new SystemException("missing 'options' argument in htmlCheckboxes tag");
-               }
-               
-               if (!isset($tagArgs['name'])) {
-                       throw new SystemException("missing 'name' argument in htmlCheckboxes tag");
-               }
-               
-               if (isset($tagArgs['disableEncoding']) && $tagArgs['disableEncoding']) {
-                       $this->disableEncoding = true;
-               }
-               else {
-                       $this->disableEncoding = false;
-               }
-               
-               // get selected values
-               if (isset($tagArgs['selected'])) {
-                       if (!is_array($tagArgs['selected'])) $tagArgs['selected'] = array($tagArgs['selected']);        
-               }
-               else {
-                       $tagArgs['selected'] = array();
-               }
-               if (!isset($tagArgs['separator'])) {
-                       $tagArgs['separator'] = '';
-               }
-               
-               // build html
-               $html = '';
-               foreach ($tagArgs['options'] as $key => $value) {
-                       if (!empty($html)) $html .= $tagArgs['separator'];
-                       $html .= '<label><input type="checkbox" name="'.$this->encodeHTML($tagArgs['name']).'[]" value="'.$this->encodeHTML($key).'"'.(in_array($key, $tagArgs['selected']) ? ' checked="checked"' : '').' /> '.$this->encodeHTML($value).'</label>';                   
-               }
-               
-               return $html;
-       }
-       
-       /**
-        * Executes StringUtil::encodeHTML on the given text if disableEncoding is false.
-        * @see wcf\util\StringUtil::encodeHTML()
-        */
-       protected function encodeHTML($text) {
-               if (!$this->disableEncoding) {
-                       $text = StringUtil::encodeHTML($text);
-               }
-               
-               return $text;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/template/plugin/HtmloptionsFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/HtmloptionsFunctionTemplatePlugin.class.php
deleted file mode 100644 (file)
index e474cc0..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-namespace wcf\system\template\plugin;
-use wcf\system\exception\SystemException;
-use wcf\system\template\TemplateEngine;
-use wcf\util\StringUtil;
-
-/**
- * The 'htmloptions' template function generates the options of an html select list.
- * 
- * Usage:
- * {htmloptions options=$array}
- * {htmloptions options=$array selected=$foo}
- * {htmloptions options=$array name="x"}
- * {htmloptions output=$outputArray}
- * {htmloptions output=$outputArray values=$valueArray}
- *
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.template.plugin
- * @category   Community Framework
- */
-class HtmloptionsFunctionTemplatePlugin extends HtmlcheckboxesFunctionTemplatePlugin {
-       protected $selected = array();
-       
-       /**
-        * @see wcf\system\template\IFunctionTemplatePlugin::execute()
-        */
-       public function execute($tagArgs, TemplateEngine $tplObj) {
-               if (isset($tagArgs['output']) && is_array($tagArgs['output'])) {
-                       if (count($tagArgs['output'])) {
-                               if (isset($tagArgs['values']) && is_array($tagArgs['values'])) {
-                                       if (count($tagArgs['output']) == count($tagArgs['values'])) {
-                                               $tagArgs['options'] = array_combine($tagArgs['values'], $tagArgs['output']);
-                                       }
-                                       else {
-                                               $tagArgs['options'] = array();
-                                       }
-                               }
-                               else {
-                                       $tagArgs['options'] = array_combine($tagArgs['output'], $tagArgs['output']);
-                               }
-                       }
-                       else {
-                               $tagArgs['options'] = array();
-                       }
-               }
-
-               if (!isset($tagArgs['options']) || !is_array($tagArgs['options'])) {
-                       throw new SystemException("missing 'options' argument in htmloptions tag");
-               }
-               
-               if (isset($tagArgs['disableEncoding']) && $tagArgs['disableEncoding']) {
-                       $this->disableEncoding = true;
-               }
-               else {
-                       $this->disableEncoding = false;
-               }
-               
-               // get selected values
-               $this->selected = array();
-               if (isset($tagArgs['selected'])) {
-                       $this->selected = $tagArgs['selected'];
-                       if (!is_array($this->selected)) $this->selected = array($this->selected);       
-               }
-               
-               // create option list
-               $htmloptions = $this->makeOptionGroup(null, $tagArgs['options']);
-               
-               // create also a 'select' tag
-               if (isset($tagArgs['name'])) {
-                       // unset all system vars
-                       unset($tagArgs['options'], $tagArgs['selected'], $tagArgs['output'], $tagArgs['values'], $tagArgs['disableEncoding']);
-                       
-                       // generate 'select' parameters
-                       $params = '';
-                       foreach ($tagArgs as $key => $value) {
-                               $params .= ' '.$key.'="'.$this->encodeHTML($value).'"';
-                       }
-                       
-                       $htmloptions = '<select'.$params.'>'."\n".$htmloptions."</select>\n";
-               }
-               
-               return $htmloptions;
-       }
-       
-       /**
-        * Makes the html for an option group.
-        * 
-        * @param       string          $key
-        * @param       array           $values
-        * @return      string                          html code of an option group
-        */
-       protected function makeOptionGroup($key, $values) {
-               $html = '';
-               if ($key !== null) {
-                       $html = '<optgroup label="'.$this->encodeHTML($key).'">'."\n";
-               }
-               
-               foreach ($values as $childKey => $value) {
-                       if (is_array($value)) {
-                               $html .= $this->makeOptionGroup($childKey, $value);
-                       }
-                       else {
-                               $html .= $this->makeOption($childKey, $value);
-                       }
-               }
-               
-               if ($key !== null) {
-                       $html .= "</optgroup>\n";
-               }
-               
-               return $html;
-       }
-       
-       /**
-        * Makes the html for an option.
-        * 
-        * @param       string          $key
-        * @param       string          $value
-        * @return      string                          html code of an option tag
-        */
-       protected function makeOption($key, $value) {
-               $value = $this->encodeHTML($value);
-               return '<option label="'.$value.'" value="'.$this->encodeHTML($key).'"'.(in_array($key, $this->selected) ? ' selected="selected"' : '').'>'.$value."</option>\n";
-       }
-}