Sfoglia il codice sorgente

add some print_checkbox/print_button calls; rename some plugin preference pane titles

Andrew Dolgov 7 anni fa
parent
commit
dc8bd8a640

+ 3 - 2
include/functions.php

@@ -667,10 +667,11 @@
 		print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"$name\" value=\"$value\">";
 	}
 
-	function print_checkbox($id, $checked, $attributes = "") {
+	function print_checkbox($id, $checked, $value = "", $attributes = "") {
 		$checked_str = $checked ? "checked" : "";
+		$value_str = $value ? "value=\"$value\"" : "";
 
-		print "<input dojoType=\"dijit.form.CheckBox\" id=\"$id\" $checked_str $attributes name=\"$id\">";
+		print "<input dojoType=\"dijit.form.CheckBox\" id=\"$id\" $value_str $checked_str $attributes name=\"$id\">";
 	}
 
 	function print_button($type, $value, $attributes = "") {

+ 4 - 8
plugins/af_psql_trgm/init.php

@@ -134,8 +134,6 @@ class Af_Psql_Trgm extends Plugin {
 			if (!$similarity) $similarity = '0.75';
 			if (!$min_title_length) $min_title_length = '32';
 
-			$enable_globally_checked = $enable_globally ? "checked" : "";
-
 			print "<form dojoType=\"dijit.form.Form\">";
 
 			print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
@@ -174,15 +172,13 @@ class Af_Psql_Trgm extends Plugin {
 				placeholder=\"32\"
 				required=\"1\" name=\"min_title_length\" value=\"$min_title_length\"></td></tr>";
 			print "<tr><td width=\"40%\">" . __("Enable for all feeds:") . "</td>";
-			print "<td>
-				<input dojoType=\"dijit.form.CheckBox\"
-				$enable_globally_checked name=\"enable_globally\"></td></tr>";
+			print "<td>";
+			print_checkbox("enable_globally", $enable_globally);
+			print "</td></tr>";
 
 			print "</table>";
 
-			print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">" .
-				__("Save") . "</button>";
-
+			print "<p>"; print_button("submit", __("Save"));
 			print "</form>";
 
 			$enabled_feeds = $this->host->get($this, "enabled_feeds");

+ 4 - 8
plugins/af_readability/init.php

@@ -36,7 +36,7 @@ class Af_Readability extends Plugin {
 	function hook_prefs_tab($args) {
 		if ($args != "prefFeeds") return;
 
-		print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('af_readability settings')."\">";
+		print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Readability settings (af_readability)')."\">";
 
 		print_notice("Enable the plugin for specific feeds in the feed editor.");
 
@@ -61,15 +61,11 @@ class Af_Readability extends Plugin {
 		print_hidden("plugin", "af_readability");
 
 		$enable_share_anything = $this->host->get($this, "enable_share_anything");
-		$enable_share_anything_checked = $enable_share_anything ? "checked" : "";
 
-		print "<input dojoType=\"dijit.form.CheckBox\"
-			$enable_share_anything_checked name=\"enable_share_anything\" id=\"enable_share_anything\">
-			<label for=\"enable_share_anything\">" . __("Use Readability for pages shared via bookmarklet.") . "</label>";
-
-		print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
-				__("Save")."</button>";
+		print_checkbox("enable_share_anything", $enable_share_anything);
+		print "&nbsp;<label for=\"enable_share_anything\">" . __("Use Readability for pages shared via bookmarklet.") . "</label>";
 
+		print "<p>"; print_button("submit", __("Save"));
 		print "</form>";
 
 		$enabled_feeds = $this->host->get($this, "enabled_feeds");

+ 6 - 15
plugins/af_redditimgur/init.php

@@ -22,13 +22,10 @@ class Af_RedditImgur extends Plugin {
 	function hook_prefs_tab($args) {
 		if ($args != "prefFeeds") return;
 
-		print "<div id=\"af_redditimgur_prefs\" dojoType=\"dijit.layout.AccordionPane\" title=\"".__('af_redditimgur settings')."\">";
+		print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Reddit content settings (af_redditimgur)')."\">";
 
 		$enable_readability = $this->host->get($this, "enable_readability");
-		$enable_readability_checked = $enable_readability ? "checked" : "";
-
 		$enable_content_dupcheck = $this->host->get($this, "enable_content_dupcheck");
-		$enable_content_dupcheck_checked = $enable_content_dupcheck ? "checked" : "";
 
 		print "<form dojoType=\"dijit.form.Form\">";
 
@@ -53,20 +50,14 @@ class Af_RedditImgur extends Plugin {
 		print "<p>" . __("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
 		print "<p/>";
 
-		print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_readability\"
-			$enable_readability_checked name=\"enable_readability\">&nbsp;";
-
-		print "<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
+		print_checkbox("enable_readability", $enable_readability);
+		print "&nbsp;<label for=\"enable_readability\">" . __("Extract missing content using Readability") . "</label>";
 
 		print "<br/>";
 
-		print "<input dojoType=\"dijit.form.CheckBox\" id=\"enable_content_dupcheck\"
-			$enable_content_dupcheck_checked name=\"enable_content_dupcheck\">&nbsp;";
-
-		print "<label for=\"enable_content_dupcheck\">" . __("Enable additional duplicate checking") . "</label>";
-		print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
-			__("Save")."</button>";
-
+		print_checkbox("enable_content_dupcheck", $enable_content_dupcheck);
+		print "&nbsp;<label for=\"enable_content_dupcheck\">" . __("Enable additional duplicate checking") . "</label>";
+		print "<p>"; print_button("submit", __("Save"));
 		print "</form>";
 
 		print "</div>";

+ 1 - 1
plugins/af_zz_imgproxy/init.php

@@ -139,7 +139,7 @@ class Af_Zz_ImgProxy extends Plugin {
 	function hook_prefs_tab($args) {
 		if ($args != "prefFeeds") return;
 
-		print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('af_zz_imgproxy Settings')."\">";
+		print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__('Image proxy settings (af_zz_imgproxy)')."\">";
 
 		print "<form dojoType=\"dijit.form.Form\">";