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,79 +55,77 @@ 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") ?>
evt.preventDefault(); <?= \Controls\hidden_tag("method", "save") ?>
if (this.validate()) { <?= \Controls\hidden_tag("plugin", "af_readability") ?>
console.log(dojo.objectToQuery(this.getValues()));
new Ajax.Request('backend.php', { <script type='dojo/method' event='onSubmit' args='evt'>
parameters: dojo.objectToQuery(this.getValues()), evt.preventDefault();
onComplete: function(transport) { if (this.validate()) {
Notify.info(transport.responseText); console.log(dojo.objectToQuery(this.getValues()));
new Ajax.Request('backend.php', {
parameters: dojo.objectToQuery(this.getValues()),
onComplete: function(transport) {
Notify.info(transport.responseText);
}
});
//this.reset();
} }
}); </script>
//this.reset();
}
</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/>"; <?php
/* cleanup */
$enabled_feeds = $this->filter_unknown_feeds(
$this->get_stored_array("enabled_feeds"));
print \Controls\submit_tag(__("Save")); $append_feeds = $this->filter_unknown_feeds(
print "</form>"; $this->get_stored_array("append_feeds"));
/* cleanup */ $this->host->set($this, "enabled_feeds", $enabled_feeds);
$enabled_feeds = $this->filter_unknown_feeds( $this->host->set($this, "append_feeds", $append_feeds);
$this->get_stored_array("enabled_feeds")); ?>
$append_feeds = $this->filter_unknown_feeds( <?php if (count($enabled_feeds) > 0) { ?>
$this->get_stored_array("append_feeds")); <hr/>
<h3><?= __("Currently enabled for (click to edit):") ?></h3>
$this->host->set($this, "enabled_feeds", $enabled_feeds); <ul class='panel panel-scrollable list list-unstyled'>
$this->host->set($this, "append_feeds", $append_feeds); <?php foreach ($enabled_feeds as $f) { ?>
<li>
if (count($enabled_feeds) > 0) { <i class='material-icons'>rss_feed</i>
print "<hr/>"; <a href='#' onclick="CommonDialogs.editFeed(<?= $f ?>)">
print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>"; <?= Feeds::_get_title($f) . " " . (in_array($f, $append_feeds) ? __("(append)") : "") ?>
</a>
print "<ul class='panel panel-scrollable list list-unstyled'>"; </li>
foreach ($enabled_feeds as $f) { <?php } ?>
$is_append = in_array($f, $append_feeds); </ul>
<?php } ?>
print "<li><i class='material-icons'>rss_feed</i> <a href='#' </div>
onclick='CommonDialogs.editFeed($f)'>". <?php
Feeds::_get_title($f) . " " . ($is_append ? __("(append)") : "") . "</a></li>";
}
print "</ul>";
}
}
print "</div>";
} }
function hook_prefs_edit_feed($feed_id) { function hook_prefs_edit_feed($feed_id) {