diff options
author | Andrew Dolgov <[email protected]> | 2021-02-16 18:57:06 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-16 18:57:06 +0300 |
commit | 91e796938301b3ca3206515e7232db938d7adccc (patch) | |
tree | 43e85352a36d991da94f4101d73a172a0ef9d8d2 | |
parent | 24c79d91c27d41a30e7593b7dca6b5b8bfe84199 (diff) |
replace a few more controls to new style
-rwxr-xr-x | classes/pref/filters.php | 6 | ||||
-rw-r--r-- | include/controls_compat.php | 102 |
2 files changed, 52 insertions, 56 deletions
diff --git a/classes/pref/filters.php b/classes/pref/filters.php index a540d6570..f9b3217c9 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -442,13 +442,13 @@ class Pref_Filters extends Handler_Protected { <section>"; print "<fieldset class='narrow'> - <label class='checkbox'>".format_checkbox('enabled', $enabled)." ".__('Enabled')."</label></fieldset>"; + <label class='checkbox'>".\Controls\checkbox_tag('enabled', $enabled)." ".__('Enabled')."</label></fieldset>"; print "<fieldset class='narrow'> - <label class='checkbox'>".format_checkbox('match_any_rule', $match_any_rule)." ".__('Match any rule')."</label> + <label class='checkbox'>".\Controls\checkbox_tag('match_any_rule', $match_any_rule)." ".__('Match any rule')."</label> </fieldset>"; - print "<fieldset class='narrow'><label class='checkbox'>".format_checkbox('inverse', $inverse)." ".__('Inverse matching')."</label> + print "<fieldset class='narrow'><label class='checkbox'>".\Controls\checkbox_tag('inverse', $inverse)." ".__('Inverse matching')."</label> </fieldset>"; print "</section> diff --git a/include/controls_compat.php b/include/controls_compat.php index 597eb9879..d62265471 100644 --- a/include/controls_compat.php +++ b/include/controls_compat.php @@ -1,5 +1,53 @@ <?php + +function stylesheet_tag($filename, $id = false) { + $timestamp = filemtime($filename); + + $id_part = $id ? "id=\"$id\"" : ""; + + return "<link rel=\"stylesheet\" $id_part type=\"text/css\" data-orig-href=\"$filename\" href=\"$filename?$timestamp\"/>\n"; +} + +function javascript_tag($filename) { + $query = ""; + + if (!(strpos($filename, "?") === false)) { + $query = substr($filename, strpos($filename, "?")+1); + $filename = substr($filename, 0, strpos($filename, "?")); + } + + $timestamp = filemtime($filename); + + if ($query) $timestamp .= "&$query"; + + return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n"; +} + +function format_warning($msg, $id = "") { + return "<div class=\"alert\" id=\"$id\">$msg</div>"; +} + +function format_notice($msg, $id = "") { + return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>"; +} + +function format_error($msg, $id = "") { + return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>"; +} + +function print_notice($msg) { + return print format_notice($msg); +} + +function print_warning($msg) { + return print format_warning($msg); +} + +function print_error($msg) { + return print format_error($msg); +} + // the following is deprecated and will be eventually removed /*function print_select($id, $default, $values, $attributes = "", $name = "") { @@ -35,9 +83,8 @@ function print_select_hash($id, $default, $values, $attributes = "", $name = "") } print "</select>"; -}*/ +} -/* function format_hidden($name, $value) { return "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"$name\" value=\"$value\">"; } @@ -45,7 +92,6 @@ function format_hidden($name, $value) { function print_hidden($name, $value) { print format_hidden($name, $value); } -*/ function format_checkbox($id, $checked, $value = "", $attributes = "") { $checked_str = $checked ? "checked" : ""; @@ -58,7 +104,6 @@ function print_checkbox($id, $checked, $value = "", $attributes = "") { print format_checkbox($id, $checked, $value, $attributes); } -/* function format_button($type, $value, $attributes = "") { return "<button dojoType=\"dijit.form.Button\" $attributes type=\"$type\">$value</button>"; } @@ -239,56 +284,7 @@ function format_feed_cat_select($id, $default_id, $attributes, $include_all_cats return $ret; } -*/ - -function stylesheet_tag($filename, $id = false) { - $timestamp = filemtime($filename); - - $id_part = $id ? "id=\"$id\"" : ""; - - return "<link rel=\"stylesheet\" $id_part type=\"text/css\" data-orig-href=\"$filename\" href=\"$filename?$timestamp\"/>\n"; -} - -function javascript_tag($filename) { - $query = ""; - - if (!(strpos($filename, "?") === false)) { - $query = substr($filename, strpos($filename, "?")+1); - $filename = substr($filename, 0, strpos($filename, "?")); - } - - $timestamp = filemtime($filename); - - if ($query) $timestamp .= "&$query"; - - return "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n"; -} - -function format_warning($msg, $id = "") { - return "<div class=\"alert\" id=\"$id\">$msg</div>"; -} - -function format_notice($msg, $id = "") { - return "<div class=\"alert alert-info\" id=\"$id\">$msg</div>"; -} - -function format_error($msg, $id = "") { - return "<div class=\"alert alert-danger\" id=\"$id\">$msg</div>"; -} - -function print_notice($msg) { - return print format_notice($msg); -} - -function print_warning($msg) { - return print format_warning($msg); -} - -function print_error($msg) { - return print format_error($msg); -} -/* function print_label_select($name, $value, $attributes = "") { $pdo = Db::pdo(); |