47 require_once(SMARTY_PLUGINS_DIR .
'shared.escape_special_chars.php');
61 foreach($params as $_key => $_val) {
65 $$_key = (string) $_val;
71 $$_key = (bool) $_val;
75 $$_key = (array) $_val;
80 $$_key = array_values((array) $_val);
85 if (is_array($_val)) {
87 foreach ($_val as $_sel) {
88 if (is_object($_sel)) {
89 if (method_exists($_sel,
"__toString")) {
90 $_sel = smarty_function_escape_special_chars((
string) $_sel->__toString());
92 trigger_error(
"html_checkboxes: selected attribute contains an object of class '". get_class($_sel) .
"' without __toString() method", E_USER_NOTICE);
96 $_sel = smarty_function_escape_special_chars((
string) $_sel);
98 $selected[$_sel] =
true;
100 }
elseif (is_object($_val)) {
101 if (method_exists($_val,
"__toString")) {
102 $selected = smarty_function_escape_special_chars((
string) $_val->__toString());
104 trigger_error(
"html_checkboxes: selected attribute is an object of class '". get_class($_val) .
"' without __toString() method", E_USER_NOTICE);
107 $selected = smarty_function_escape_special_chars((
string) $_val);
112 trigger_error(
'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
113 $options = (array) $_val;
119 case 'strict':
break;
123 if (!empty($params[
'strict'])) {
124 if (!is_scalar($_val)) {
125 trigger_error(
"html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
128 if ($_val ===
true || $_val === $_key) {
129 $extra .=
' ' . $_key .
'="' . smarty_function_escape_special_chars($_key) .
'"';
137 if(!is_array($_val)) {
138 $extra .=
' '.$_key.
'="'.smarty_function_escape_special_chars($_val).
'"';
140 trigger_error(
"html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
146 if (!isset($options) && !isset($values))
149 $_html_result = array();
151 if (isset($options)) {
152 foreach ($options as $_key=>$_val) {
156 foreach ($values as $_i=>$_key) {
162 if(!empty($params[
'assign'])) {
163 $template->assign($params[
'assign'], $_html_result);
165 return implode(
"\n", $_html_result);
173 if (is_object($value)) {
174 if (method_exists($value,
"__toString")) {
175 $value = (string) $value->__toString();
177 trigger_error(
"html_options: value is an object of class '". get_class($value) .
"' without __toString() method", E_USER_NOTICE);
181 $value = (string) $value;
185 if (method_exists(
$output,
"__toString")) {
188 trigger_error(
"html_options: output is an object of class '". get_class(
$output) .
"' without __toString() method", E_USER_NOTICE);
197 $_id = smarty_function_escape_special_chars(preg_replace(
'![^\w\-\.]!' .
Smarty::$_UTF8_MODIFIER,
'_', $name .
'_' . $value));
198 $_output .=
'<label for="' . $_id .
'">';
200 $_output .=
'<label class="label_checkbox">';
204 $name = smarty_function_escape_special_chars($name);
205 $value = smarty_function_escape_special_chars($value);
210 $_output .=
'<input type="checkbox" name="' . $name .
'[]" value="' . $value .
'"';
212 if ($labels && $label_ids) {
213 $_output .=
' id="' . $_id .
'"';
216 if (is_array($selected)) {
217 if (isset($selected[$value])) {
218 $_output .=
' checked="checked"';
220 }
elseif ($value === $selected) {
221 $_output .=
' checked="checked"';
224 $_output .= $extra .
' /> ' .
$output;
226 $_output .=
'</label>';
229 $_output .= $separator;
static $_UTF8_MODIFIER
Flag denoting if PCRE should run in UTF-8 mode.
smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true)
smarty_function_html_checkboxes($params, $template)
Smarty {html_checkboxes} function plugin.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))