diff options
author | Andrew Dolgov <[email protected]> | 2021-02-16 12:37:31 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-16 12:37:31 +0300 |
commit | 5cc998a9ddeb9d83d19ff981082f9cdccad538f6 (patch) | |
tree | e6ce83a81226821f8c51e1d65b3157b6e7467f0e /init.php | |
parent | cf4e51056af94c0e7e9b5b755202e76180e192be (diff) |
minor markup fixes
Diffstat (limited to 'init.php')
-rwxr-xr-x | init.php | 165 |
1 files changed, 82 insertions, 83 deletions
@@ -62,109 +62,108 @@ class Af_Img_Phash extends Plugin { function hook_prefs_tab($args) { if ($args != "prefFeeds") return; - print "<div dojoType='dijit.layout.AccordionPane' - title=\"<i class='material-icons'>photo</i> ".$this->__( 'Filter similar images (af_img_phash)')."\">"; + ?> + <div dojoType='dijit.layout.AccordionPane' + title="<i class='material-icons'>photo</i> <?= $this->__( 'Filter similar images (af_img_phash)') ?>"> - if (DB_TYPE == "pgsql") { - if (true === IMG_HASH_SQL_FUNCTION) { - print_error("Using SQL implementation of bit_count; UI performance may not be as responsive as installing extension 'https://github.com/sldab/count-bits'. See README.txt"); - } - else { - try { $res = $this->pdo->query("select 'unique_1bits'::regproc"); } catch (PDOException $e) { ; } - if (empty($res) || !$res->fetch()) { - print_error("Required function from count_bits extension not found."); + <?php + if (DB_TYPE == "pgsql") { + if (true === IMG_HASH_SQL_FUNCTION) { + print_error("Using SQL implementation of bit_count; UI performance may not be as responsive as installing extension 'https://github.com/sldab/count-bits'. See README.txt"); } - } - } - - $similarity = (int) $this->host->get($this, "similarity", $this->default_similarity); - $domains_list = $this->host->get($this, "domains_list", $this->default_domains_list); - $enable_globally = $this->host->get($this, "enable_globally"); - - print "<form dojoType='dijit.form.Form'>"; - - print "<script type='dojo/method' event='onSubmit' args='evt'> - evt.preventDefault(); - if (this.validate()) { - console.log(dojo.objectToQuery(this.getValues())); - new Ajax.Request('backend.php', { - parameters: dojo.objectToQuery(this.getValues()), - onComplete: function(transport) { - Notify.info(transport.responseText); + else { + try { $res = $this->pdo->query("select 'unique_1bits'::regproc"); } catch (PDOException $e) { ; } + if (empty($res) || !$res->fetch()) { + print_error("Required function from count_bits extension not found."); } - }); - //this.reset(); + } } - </script>"; - - print_hidden("op", "pluginhandler"); - print_hidden("method", "save"); - print_hidden("plugin", "af_img_phash"); - - print "<h2>" . $this->__( "Global settings") . "</h2>"; - - print "<fieldset>"; - print "<label>".$this->__( "Limit to domains (space-separated):")."</label>"; - print "<textarea dojoType='dijit.form.SimpleTextarea' style='height: 100px; width: 500px; display: block' - required='1' name='domains_list'>$domains_list</textarea>"; - - print "</fieldset><fieldset>"; - - print "<label>".$this->__( "Maximum hamming distance:")."</label>"; - print "<input dojoType='dijit.form.NumberSpinner' - placeholder='5' required='1' name='similarity' id='phash_img_similarity' value='$similarity'>"; - - print "<div dojoType='dijit.Tooltip' connectId='phash_img_similarity' position='below'>" . - $this->__( "Lower hamming distance value indicates images being more similar.") . "</div>"; + $similarity = (int) $this->host->get($this, "similarity", $this->default_similarity); + $domains_list = $this->host->get($this, "domains_list", $this->default_domains_list); + $enable_globally = $this->host->get($this, "enable_globally"); + + ?> + <form dojoType='dijit.form.Form'> + + <?= format_hidden("op", "pluginhandler") ?> + <?= format_hidden("method", "save") ?> + <?= format_hidden("plugin", "af_img_phash") ?> + + <script type='dojo/method' event='onSubmit' args='evt'> + evt.preventDefault(); + if (this.validate()) { + console.log(dojo.objectToQuery(this.getValues())); + new Ajax.Request('backend.php', { + parameters: dojo.objectToQuery(this.getValues()), + onComplete: function(transport) { + Notify.info(transport.responseText); + } + }); + } + </script> - print "</fieldset><fieldset class='narrow'>"; + <h2><?= $this->__( "Global settings") ?></h2> - print "<label class='checkbox'>"; - print_checkbox("phash_enable_globally", $enable_globally); - print " " . $this->__( "Enable for all feeds"); - print "</label>"; + <fieldset> + <label><?= $this->__( "Limit to domains (space-separated):") ?>"</label> + <textarea dojoType='dijit.form.SimpleTextarea' style='height: 100px; width: 500px; display: block' + required='1' name='domains_list'><?= $domains_list ?></textarea> + </fieldset> - print "</fieldset>"; + <fieldset> + <label><?= $this->__( "Maximum Hamming distance:") ?></label> + <input dojoType='dijit.form.NumberSpinner' + placeholder='5' required='1' name='similarity' id='phash_img_similarity' value='<?= $similarity ?>'> - print "</table>"; + <div dojoType='dijit.Tooltip' connectId='phash_img_similarity' position='below'> + <?= $this->__( "Lower Hamming distance value indicates images being more similar.") ?> + </div> + </fieldset> - print_button("submit", $this->__( "Save"), "class='alt-primary'"); + <fieldset class='narrow'> + <label class='checkbox'> + <?= format_checkbox("phash_enable_globally", $enable_globally) ?> + <?= $this->__( "Enable for all feeds") ?> + </label> + </fieldset> - print "</form>"; + <?php print_button("submit", $this->__( "Save"), "class='alt-primary'") ?> - $enabled_feeds = $this->filter_unknown_feeds( - $this->get_stored_array("enabled_feeds")); + </form> - $this->host->set($this, "enabled_feeds", $enabled_feeds); + <?php + $enabled_feeds = $this->filter_unknown_feeds( + $this->get_stored_array("enabled_feeds")); - if (count($enabled_feeds) > 0) { - print "<h3>" . __("Currently enabled for (click to edit):") . "</h3>"; + $this->host->set($this, "enabled_feeds", $enabled_feeds); - print "<ul class='panel panel-scrollable list list-unstyled'>"; - foreach ($enabled_feeds as $f) { - print "<li><i class='material-icons'>rss_feed</i> <a href='#' onclick=\"CommonDialogs.editFeed($f)\">". - Feeds::_get_title($f) . "</a></li>"; - } - print "</ul>"; - } + if (count($enabled_feeds) > 0) { ?> + <h3><?= __("Currently enabled for (click to edit):") ?></h3> - print "</div>"; + <ul class='panel panel-scrollable list list-unstyled'> + <?php foreach ($enabled_feeds as $f) { ?> + <li><i class='material-icons'>rss_feed</i> <a href='#' onclick="CommonDialogs.editFeed(<?= $f ?>)"> + <?= htmlspecialchars(Feeds::_get_title($f)) ?></a></li> + <?php } ?> + </ul> + <?php } ?> + </div> + <?php } function hook_prefs_edit_feed($feed_id) { - print "<header>".$this->__( "Similar images")."</header>"; - print "<section>"; - $enabled_feeds = $this->get_stored_array("enabled_feeds"); - $checked = in_array($feed_id, $enabled_feeds) ? "checked" : ""; - - print "<fieldset>"; - print "<label class='checkbox'><input dojoType='dijit.form.CheckBox' type='checkbox' id='phash_similarity_enabled' - name='phash_similarity_enabled' $checked> ".$this->__( 'Filter similar images')."</label>"; - print "</fieldset>"; - - print "</section>"; + ?> + <header><?= $this->__( "Similar images") ?></header> + <section> + <fieldset> + <label class='checkbox'> + <?= format_checkbox("phash_similarity_enabled", in_array($feed_id, $enabled_feeds)) ?> + <?= $this->__( 'Filter similar images') ?></label> + </fieldset> + </section> + <?php } private function get_stored_array($name) { |