af_readability: cleanup markup

This commit is contained in:
Andrew Dolgov 2021-02-17 12:36:02 +03:00
parent 9ac6741d24
commit 91049335eb
1 changed files with 57 additions and 59 deletions

View File

@ -55,20 +55,23 @@ class Af_Readability extends Plugin {
function hook_prefs_tab($args) { function hook_prefs_tab($args) {
if ($args != "prefFeeds") return; if ($args != "prefFeeds") return;
print "<div dojoType='dijit.layout.AccordionPane' $enable_share_anything = sql_bool_to_bool($this->host->get($this, "enable_share_anything"));
title=\"<i class='material-icons'>extension</i> ".__('Readability settings (af_readability)')."\">";
if (version_compare(PHP_VERSION, '7.0.0', '<')) { ?>
print_error("This plugin requires PHP 7.0."); <div dojoType='dijit.layout.AccordionPane'
} else { title="<i class='material-icons'>extension</i> <?= __('Readability settings (af_readability)') ?>">
print "<h2>" . __("Global settings") . "</h2>"; <h2><?= __("Global settings") ?></h2>
print_notice("Enable for specific feeds in the feed editor."); <?= format_notice("Enable for specific feeds in the feed editor.") ?>
print "<form dojoType='dijit.form.Form'>"; <form dojoType='dijit.form.Form'>
print "<script type='dojo/method' event='onSubmit' args='evt'> <?= \Controls\hidden_tag("op", "pluginhandler") ?>
<?= \Controls\hidden_tag("method", "save") ?>
<?= \Controls\hidden_tag("plugin", "af_readability") ?>
<script type='dojo/method' event='onSubmit' args='evt'>
evt.preventDefault(); evt.preventDefault();
if (this.validate()) { if (this.validate()) {
console.log(dojo.objectToQuery(this.getValues())); console.log(dojo.objectToQuery(this.getValues()));
@ -80,26 +83,21 @@ class Af_Readability extends Plugin {
}); });
//this.reset(); //this.reset();
} }
</script>"; </script>
print \Controls\hidden_tag("op", "pluginhandler"); <fieldset>
print \Controls\hidden_tag("method", "save"); <label class='checkbox'>
print \Controls\hidden_tag("plugin", "af_readability"); <?= \Controls\checkbox_tag("enable_share_anything", $enable_share_anything) ?>
<?= __("Provide full-text services to core code (bookmarklets) and other plugins") ?>
</label>
</fieldset>
$enable_share_anything = sql_bool_to_bool($this->host->get($this, "enable_share_anything")); <hr/>
print "<fieldset>"; <?= \Controls\submit_tag(__("Save")) ?>
print "<label class='checkbox'> "; </form>
print \Controls\checkbox_tag("enable_share_anything", $enable_share_anything);
print " " . __("Provide full-text services to core code (bookmarklets) and other plugins");
print "</label>";
print "</fieldset>";
print "<hr/>";
print \Controls\submit_tag(__("Save"));
print "</form>";
<?php
/* cleanup */ /* cleanup */
$enabled_feeds = $this->filter_unknown_feeds( $enabled_feeds = $this->filter_unknown_feeds(
$this->get_stored_array("enabled_feeds")); $this->get_stored_array("enabled_feeds"));
@ -109,25 +107,25 @@ class Af_Readability extends Plugin {
$this->host->set($this, "enabled_feeds", $enabled_feeds); $this->host->set($this, "enabled_feeds", $enabled_feeds);
$this->host->set($this, "append_feeds", $append_feeds); $this->host->set($this, "append_feeds", $append_feeds);
?>
if (count($enabled_feeds) > 0) { <?php if (count($enabled_feeds) > 0) { ?>
print "<hr/>"; <hr/>
print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>"; <h3><?= __("Currently enabled for (click to edit):") ?></h3>
print "<ul class='panel panel-scrollable list list-unstyled'>"; <ul class='panel panel-scrollable list list-unstyled'>
foreach ($enabled_feeds as $f) { <?php foreach ($enabled_feeds as $f) { ?>
$is_append = in_array($f, $append_feeds); <li>
<i class='material-icons'>rss_feed</i>
print "<li><i class='material-icons'>rss_feed</i> <a href='#' <a href='#' onclick="CommonDialogs.editFeed(<?= $f ?>)">
onclick='CommonDialogs.editFeed($f)'>". <?= Feeds::_get_title($f) . " " . (in_array($f, $append_feeds) ? __("(append)") : "") ?>
Feeds::_get_title($f) . " " . ($is_append ? __("(append)") : "") . "</a></li>"; </a>
} </li>
print "</ul>"; <?php } ?>
} </ul>
<?php } ?>
} </div>
<?php
print "</div>";
} }
function hook_prefs_edit_feed($feed_id) { function hook_prefs_edit_feed($feed_id) {