update.phtml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <?php /** @var FreshRSS_View $this */ ?>
  2. <div class="post">
  3. <h1><?= $this->feed->name() ?></h1>
  4. <div>
  5. <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  6. <?= _t('gen.short.or') ?>
  7. <a href="<?= _url('stats', 'repartition', 'id', $this->feed->id()) ?>"><?= _i('stats') ?> <?= _t('sub.feed.stats') ?></a>
  8. </div>
  9. <p><?= sanitizeHTML($this->feed->description()) ?></p>
  10. <?php $nbEntries = $this->feed->nbEntries(); ?>
  11. <?php if ($this->feed->inError()) { ?>
  12. <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('sub.feed.error') ?></p>
  13. <?php } elseif ($nbEntries === 0) { ?>
  14. <p class="alert alert-warn"><?= _t('sub.feed.empty') ?></p>
  15. <?php } ?>
  16. <?php
  17. $from = Minz_Request::param('from');
  18. if ($from === false) {
  19. $url = _url('subscription', 'feed', 'id', $this->feed->id());
  20. } else {
  21. $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from);
  22. }
  23. ?>
  24. <form method="post" action="<?= $url ?>" autocomplete="off">
  25. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  26. <legend><?= _t('sub.feed.information') ?></legend>
  27. <div class="form-group">
  28. <label class="group-name" for="name"><?= _t('sub.feed.title') ?></label>
  29. <div class="group-controls">
  30. <input type="text" name="name" id="name" class="extend" value="<?= $this->feed->name(true) ?>" />
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="group-name" for="description"><?= _t('sub.feed.description') ?></label>
  35. <div class="group-controls">
  36. <textarea name="description" id="description"><?= htmlspecialchars($this->feed->description(), ENT_NOQUOTES, 'UTF-8') ?></textarea>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="group-name" for="website"><?= _t('sub.feed.website') ?></label>
  41. <div class="group-controls">
  42. <div class="stick">
  43. <input type="text" name="website" id="website" class="extend" value="<?= $this->feed->website() ?>" />
  44. <a class="btn" target="_blank" rel="noreferrer" href="<?= $this->feed->website() ?>"><?= _i('link') ?></a>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <label class="group-name" for="url"><?= _t('sub.feed.url') ?></label>
  50. <div class="group-controls">
  51. <div class="stick">
  52. <input type="text" name="url" id="url" class="extend" value="<?= $this->feed->url() ?>" />
  53. <a class="btn" target="_blank" rel="noreferrer" href="<?= $this->feed->url() ?>"><?= _i('link') ?></a>
  54. </div>
  55. <a class="btn" target="_blank" rel="noreferrer" href="https://validator.w3.org/feed/check.cgi?url=<?=
  56. rawurlencode(htmlspecialchars_decode($this->feed->url(), ENT_QUOTES)) ?>"><?= _t('sub.feed.validator') ?></a>
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  61. <div class="group-controls">
  62. <select name="category" id="category">
  63. <?php foreach ($this->categories as $cat) { ?>
  64. <option value="<?= $cat->id() ?>"<?= $cat->id() == $this->feed->category() ? ' selected="selected"' : '' ?>>
  65. <?= $cat->name() ?>
  66. </option>
  67. <?php } ?>
  68. </select>
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="group-name" for="priority"><?= _t('sub.feed.priority') ?></label>
  73. <div class="group-controls">
  74. <select name="priority" id="priority">
  75. <option value='<?= FreshRSS_Feed::PRIORITY_MAIN_STREAM ?>' <?php
  76. if (FreshRSS_Feed::PRIORITY_MAIN_STREAM === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.main_stream') ?></option>
  77. <option value='<?= FreshRSS_Feed::PRIORITY_NORMAL ?>' <?php
  78. if (FreshRSS_Feed::PRIORITY_NORMAL === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.normal') ?></option>
  79. <option value='<?= FreshRSS_Feed::PRIORITY_ARCHIVED ?>' <?php
  80. if (FreshRSS_Feed::PRIORITY_ARCHIVED === $this->feed->priority()) {echo 'selected="selected"';}?>><?= _t('sub.feed.priority.archived') ?></option>
  81. </select>
  82. </div>
  83. </div>
  84. <div class="form-group">
  85. <label class="group-name" for="ttl"><?= _t('sub.feed.ttl') ?></label>
  86. <div class="group-controls">
  87. <select class="number" name="ttl" id="ttl" required="required"><?php
  88. $found = false;
  89. foreach (array(FreshRSS_Feed::TTL_DEFAULT => _t('gen.short.by_default'), 900 => '15min', 1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min',
  90. 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h',
  91. 36000 => '10h', 43200 => '12h', 64800 => '18h',
  92. 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d',
  93. 604800 => '1wk', 1209600 => '2wk', 1814400 => '3wk', 2419200 => '4wk', 2629744 => '1mo') as $v => $t) {
  94. echo '<option value="' . $v . ($this->feed->ttl() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
  95. if ($this->feed->ttl() == $v) {
  96. $found = true;
  97. }
  98. }
  99. if (!$found) {
  100. echo '<option value="' . intval($this->feed->ttl()) . '" selected="selected">' . intval($this->feed->ttl()) . 's</option>';
  101. }
  102. ?></select>
  103. <label for="mute">
  104. <input type="checkbox" name="mute" id="mute" value="1"<?= $this->feed->mute() ? ' checked="checked"' : '' ?> />
  105. <?= _t('sub.feed.mute') ?>
  106. </label>
  107. </div>
  108. </div>
  109. <?php if ($this->feed->pubSubHubbubEnabled()) { ?>
  110. <div class="form-group">
  111. <div class="group-controls">
  112. <label class="checkbox" for="pubsubhubbub">
  113. <input type="checkbox" name="pubsubhubbub" id="pubsubhubbub" disabled="disabled" value="1" checked="checked" />
  114. <?= _t('sub.feed.websub') ?>
  115. </label>
  116. </div>
  117. </div>
  118. <?php } ?>
  119. <div class="form-group form-actions">
  120. <div class="group-controls">
  121. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  122. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  123. <button type="submit" class="btn btn-attention confirm"
  124. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  125. formaction="<?= _url('feed', 'delete', 'id', $this->feed->id()) ?>"
  126. formmethod="post"><?= _t('gen.action.remove') ?></button>
  127. </div>
  128. </div>
  129. <legend><?= _t('sub.feed.auth.configuration') ?></legend>
  130. <?php $auth = $this->feed->httpAuth(false); ?>
  131. <div class="form-group">
  132. <label class="group-name" for="http_user_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.username') ?></label>
  133. <div class="group-controls">
  134. <input type="text" name="http_user_feed<?= $this->feed->id() ?>" id="http_user_feed<?= $this->feed->id() ?>" class="extend" value="<?=
  135. empty($auth['username']) ? '' : $auth['username'] ?>" autocomplete="off" />
  136. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.auth.help') ?></p>
  137. </div>
  138. </div>
  139. <div class="form-group">
  140. <label class="group-name" for="http_pass_feed<?= $this->feed->id() ?>"><?= _t('sub.feed.auth.password') ?></label>
  141. <div class="group-controls">
  142. <div class="stick">
  143. <input type="password" name="http_pass_feed<?= $this->feed->id() ?>" id="http_pass_feed<?= $this->feed->id() ?>" value="<?=
  144. $auth['password'] ?>" autocomplete="new-password" />
  145. <button type="button" class="btn toggle-password" data-toggle="http_pass_feed<?= $this->feed->id() ?>"><?= _i('key') ?></button>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="form-group form-actions">
  150. <div class="group-controls">
  151. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  152. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  153. </div>
  154. </div>
  155. <legend><?= _t('sub.feed.filteractions') ?></legend>
  156. <div class="form-group">
  157. <label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label>
  158. <div class="group-controls">
  159. <label class="checkbox" for="mark_updated_article_unread">
  160. <select name="mark_updated_article_unread" id="mark_updated_article_unread">
  161. <option value=""<?= $this->feed->attributes('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  162. <option value="0"<?= $this->feed->attributes('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  163. <option value="1"<?= $this->feed->attributes('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  164. </select>
  165. </label>
  166. </div>
  167. </div>
  168. <div class="form-group">
  169. <label class="group-name" for="keep_max_n_unread"><?= _t('conf.reading.read.keep_max_n_unread') ?></label>
  170. <div class="group-controls">
  171. <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" min="1" max="10000000" value="<?= $this->feed->attributes('keep_max_n_unread') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  172. </div>
  173. </div>
  174. <div class="form-group">
  175. <label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label>
  176. <div class="group-controls">
  177. <label class="checkbox" for="read_upon_reception">
  178. <select name="read_upon_reception" id="read_upon_reception">
  179. <option value=""<?= $this->feed->attributes('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  180. <option value="0"<?= $this->feed->attributes('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  181. <option value="1"<?= $this->feed->attributes('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  182. </select>
  183. <?= _t('conf.reading.read.upon_reception') ?>
  184. </label>
  185. </div>
  186. </div>
  187. <div class="form-group">
  188. <label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label>
  189. <div class="group-controls">
  190. <label class="checkbox" for="read_when_same_title_in_feed">
  191. <select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed">
  192. <option value=""<?= $this->feed->attributes('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  193. <option value="0"<?= $this->feed->attributes('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  194. <option value="10"<?= $this->feed->attributes('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option>
  195. <option value="25"<?= $this->feed->attributes('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option>
  196. <option value="100"<?= $this->feed->attributes('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option>
  197. <option value="1000"<?= $this->feed->attributes('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option>
  198. </select>
  199. <?= _t('conf.reading.read.when_same_title') ?>
  200. </label>
  201. </div>
  202. </div>
  203. <div class="form-group">
  204. <label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label>
  205. <div class="group-controls">
  206. <textarea name="filteractions_read" id="filteractions_read"><?php
  207. foreach ($this->feed->filtersAction('read') as $filterRead) {
  208. echo $filterRead->getRawInput(), PHP_EOL;
  209. }
  210. ?></textarea>
  211. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
  212. </div>
  213. </div>
  214. <div class="form-group form-actions">
  215. <div class="group-controls">
  216. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  217. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  218. </div>
  219. </div>
  220. <legend><?= _t('sub.feed.archiving') ?></legend>
  221. <div class="form-group">
  222. <div class="group-controls">
  223. <div class="stick">
  224. <input type="text" value="<?= _t('sub.feed.number_entries', $nbEntries) ?>" disabled="disabled" />
  225. <a class="btn" href="<?= _url('feed', 'actualize', 'id', $this->feed->id()) ?>">
  226. <?= _i('refresh') ?> <?= _t('gen.action.actualize') ?>
  227. </a>
  228. </div>
  229. </div>
  230. </div>
  231. <?php
  232. $archiving = $this->feed->attributes('archiving');
  233. if (empty($archiving)) {
  234. $archiving = [ 'default' => true ];
  235. } else {
  236. $archiving['default'] = false;
  237. }
  238. $volatile = [
  239. 'enable_keep_period' => false,
  240. 'keep_period_count' => '3',
  241. 'keep_period_unit' => 'P1M',
  242. ];
  243. if (!empty($archiving['keep_period'])) {
  244. if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) {
  245. $volatile['enable_keep_period'] = true;
  246. $volatile['keep_period_count'] = $matches['count'];
  247. $volatile['keep_period_unit'] = str_replace($matches['count'], '1', $archiving['keep_period']);
  248. }
  249. }
  250. //Defaults
  251. if (!isset($archiving['keep_max'])) {
  252. $archiving['keep_max'] = false;
  253. }
  254. if (!isset($archiving['keep_min'])) {
  255. $archiving['keep_min'] = 50;
  256. }
  257. if (!isset($archiving['keep_favourites'])) {
  258. $archiving['keep_favourites'] = true;
  259. }
  260. if (!isset($archiving['keep_labels'])) {
  261. $archiving['keep_labels'] = true;
  262. }
  263. if (!isset($archiving['keep_unreads'])) {
  264. $archiving['keep_unreads'] = false;
  265. }
  266. ?>
  267. <p class="alert alert-warn">
  268. <?= _t('conf.archiving.policy_warning') ?>
  269. </p>
  270. <div class="form-group">
  271. <label class="group-name" for="use_default_purge_options"><?= _t('conf.archiving.policy') ?></label>
  272. <div class="group-controls">
  273. <label class="checkbox">
  274. <input type="checkbox" name="use_default_purge_options" id="use_default_purge_options" value="1"<?= $archiving['default'] ? ' checked="checked"' : '' ?>
  275. data-leave-validation="<?= $archiving['default'] ? 1 : 0 ?>" />
  276. <?= _t('gen.short.by_default') ?>
  277. </label>
  278. </div>
  279. </div>
  280. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  281. <div class="group-controls">
  282. <label class="checkbox" for="enable_keep_max">
  283. <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= empty($archiving['keep_max']) ? '' : ' checked="checked"' ?>
  284. data-leave-validation="<?= empty($archiving['keep_max']) ? 0 : 1 ?>"/>
  285. <?= _t('conf.archiving.keep_max') ?>
  286. <input type="number" id="keep_max" name="keep_max" min="0" value="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"
  287. data-leave-validation="<?= empty($archiving['keep_max']) ? 200 : $archiving['keep_max'] ?>"/>
  288. </label>
  289. </div>
  290. </div>
  291. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  292. <div class="group-controls">
  293. <label class="checkbox" for="enable_keep_period">
  294. <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= $volatile['enable_keep_period'] ? ' checked="checked"' : '' ?>
  295. data-leave-validation="<?= $volatile['enable_keep_period'] ? 1 : 0 ?>"/>
  296. <?= _t('conf.archiving.keep_period') ?>
  297. <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= $volatile['keep_period_count'] ?>"
  298. data-leave-validation="<?= $volatile['keep_period_count'] ?>"/>
  299. <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= $volatile['keep_period_unit'] ?>">
  300. <option></option>
  301. <option value="P1Y" <?= 'P1Y' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option>
  302. <option value="P1M" <?= 'P1M' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option>
  303. <option value="P1W" <?= 'P1W' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option>
  304. <option value="P1D" <?= 'P1D' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option>
  305. <option value="PT1H" <?= 'PT1H' === $volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option>
  306. </select>
  307. </label>
  308. </div>
  309. </div>
  310. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  311. <div class="group-name"><?= _t('conf.archiving.exception') ?></div>
  312. <div class="group-controls">
  313. <label class="checkbox" for="keep_favourites">
  314. <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= $archiving['keep_favourites'] ? ' checked="checked"' : '' ?>
  315. data-leave-validation="<?= $archiving['keep_favourites'] ? 1 : 0 ?>"/>
  316. <?= _t('conf.archiving.keep_favourites') ?>
  317. </label>
  318. </div>
  319. </div>
  320. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  321. <div class="group-controls">
  322. <label class="checkbox" for="keep_labels">
  323. <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= $archiving['keep_labels'] ? ' checked="checked"' : '' ?>
  324. data-leave-validation="<?= $archiving['keep_labels'] ? 1 : 0 ?>"/>
  325. <?= _t('conf.archiving.keep_labels') ?>
  326. </label>
  327. </div>
  328. </div>
  329. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  330. <div class="group-controls">
  331. <label class="checkbox" for="keep_unreads">
  332. <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= $archiving['keep_unreads'] ? ' checked="checked"' : '' ?>
  333. data-leave-validation="<?= $archiving['keep_unreads'] ?>"/>
  334. <?= _t('conf.archiving.keep_unreads') ?>
  335. </label>
  336. </div>
  337. </div>
  338. <div class="form-group archiving"<?= $archiving['default'] ? ' hidden="hidden"' : '' ?>>
  339. <div class="group-controls">
  340. <label for="keep_min"><?= _t('sub.feed.keep_min') ?>
  341. <input type="number" id="keep_min" name="keep_min" min="0" value="<?= $archiving['keep_min'] ?>"
  342. data-leave-validation="<?= $archiving['keep_min'] ?>">
  343. </label>
  344. </div>
  345. </div>
  346. <div class="form-group form-actions">
  347. <div class="group-controls">
  348. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  349. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  350. <button type="submit" class="btn btn-attention confirm" formmethod="post" formaction="<?= _url('feed', 'truncate', 'id', $this->feed->id()) ?>"><?= _t('gen.action.truncate') ?></button>
  351. </div>
  352. </div>
  353. <legend><?= _t('sub.feed.kind') ?></legend>
  354. <div class="form-group">
  355. <label class="group-name" for="feed_kind"><?= _t('sub.feed.kind') ?></label>
  356. <div class="group-controls">
  357. <select name="feed_kind" id="feed_kind" class="select-show">
  358. <option value="<?= FreshRSS_Feed::KIND_RSS ?>" <?= $this->feed->kind() == FreshRSS_Feed::KIND_RSS ? 'selected="selected"' : '' ?>><?= _t('sub.feed.kind.rss') ?></option>
  359. <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH ?>" <?= $this->feed->kind() == FreshRSS_Feed::KIND_HTML_XPATH ? 'selected="selected"' : '' ?> data-show="html_xpath"><?= _t('sub.feed.kind.html_xpath') ?></option>
  360. </select>
  361. </div>
  362. </div>
  363. <fieldset id="html_xpath">
  364. <?php
  365. $xpath = Minz_Helper::htmlspecialchars_utf8($this->feed->attributes('xpath'));
  366. ?>
  367. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
  368. <div class="form-group">
  369. <label class="group-name" for="xPathFeedTitle"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  370. <?= _t('sub.feed.kind.html_xpath.feed_title') ?></label>
  371. <div class="group-controls">
  372. <textarea class="valid-xpath" name="xPathFeedTitle" id="xPathFeedTitle" rows="2" cols="64" spellcheck="false"
  373. data-leave-validation="<?= $xpath['feedTitle'] ?? '' ?>"><?= $xpath['feedTitle'] ?? '' ?></textarea>
  374. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.feed_title.help') ?></p>
  375. </div>
  376. </div>
  377. <div class="form-group">
  378. <label class="group-name" for="xPathItem"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  379. <?= _t('sub.feed.kind.html_xpath.item') ?></label>
  380. <div class="group-controls">
  381. <textarea class="valid-xpath" name="xPathItem" id="xPathItem" rows="2" cols="64" spellcheck="false"
  382. data-leave-validation="<?= $xpath['item'] ?? '' ?>"><?= $xpath['item'] ?? '' ?></textarea>
  383. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item.help') ?></p>
  384. </div>
  385. </div>
  386. <div class="form-group">
  387. <label class="group-name" for="xPathItemTitle"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  388. <?= _t('sub.feed.kind.html_xpath.item_title') ?></label>
  389. <div class="group-controls">
  390. <textarea class="valid-xpath" name="xPathItemTitle" id="xPathItemTitle" rows="2" cols="64" spellcheck="false"
  391. data-leave-validation="<?= $xpath['itemTitle'] ?? '' ?>"><?= $xpath['itemTitle'] ?? '' ?></textarea>
  392. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_title.help') ?></p>
  393. </div>
  394. </div>
  395. <div class="form-group">
  396. <label class="group-name" for="xPathItemContent"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  397. <?= _t('sub.feed.kind.html_xpath.item_content') ?></label>
  398. <div class="group-controls">
  399. <textarea class="valid-xpath" name="xPathItemContent" id="xPathItemContent" rows="2" cols="64" spellcheck="false"
  400. data-leave-validation="<?= $xpath['itemContent'] ?? '' ?>"><?= $xpath['itemContent'] ?? '' ?></textarea>
  401. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_content.help') ?></p>
  402. </div>
  403. </div>
  404. <div class="form-group">
  405. <label class="group-name" for="xPathItemUri"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  406. <?= _t('sub.feed.kind.html_xpath.item_uri') ?></label>
  407. <div class="group-controls">
  408. <textarea class="valid-xpath" name="xPathItemUri" id="xPathItemUri" rows="2" cols="64" spellcheck="false"
  409. data-leave-validation="<?= $xpath['itemUri'] ?? '' ?>"><?= $xpath['itemUri'] ?? '' ?></textarea>
  410. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_uri.help') ?></p>
  411. </div>
  412. </div>
  413. <div class="form-group">
  414. <label class="group-name" for="xPathItemThumbnail"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  415. <?= _t('sub.feed.kind.html_xpath.item_thumbnail') ?></label>
  416. <div class="group-controls">
  417. <textarea class="valid-xpath" name="xPathItemThumbnail" id="xPathItemThumbnail" rows="2" cols="64" spellcheck="false"
  418. data-leave-validation="<?= $xpath['itemThumbnail'] ?? '' ?>"><?= $xpath['itemThumbnail'] ?? '' ?></textarea>
  419. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_thumbnail.help') ?></p>
  420. </div>
  421. </div>
  422. <div class="form-group">
  423. <label class="group-name" for="xPathItemAuthor"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  424. <?= _t('sub.feed.kind.html_xpath.item_author') ?></label>
  425. <div class="group-controls">
  426. <textarea class="valid-xpath" name="xPathItemAuthor" id="xPathItemAuthor" rows="2" cols="64" spellcheck="false"
  427. data-leave-validation="<?= $xpath['itemAuthor'] ?? '' ?>"><?= $xpath['itemAuthor'] ?? '' ?></textarea>
  428. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_author.help') ?></p>
  429. </div>
  430. </div>
  431. <div class="form-group">
  432. <label class="group-name" for="xPathItemTimestamp"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  433. <?= _t('sub.feed.kind.html_xpath.item_timestamp') ?></label>
  434. <div class="group-controls">
  435. <textarea class="valid-xpath" name="xPathItemTimestamp" id="xPathItemTimestamp" rows="2" cols="64" spellcheck="false"
  436. data-leave-validation="<?= $xpath['itemTimestamp'] ?? '' ?>"><?= $xpath['itemTimestamp'] ?? '' ?></textarea>
  437. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timestamp.help') ?></p>
  438. </div>
  439. </div>
  440. <div class="form-group">
  441. <label class="group-name" for="xPathItemCategories"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  442. <?= _t('sub.feed.kind.html_xpath.item_categories') ?></label>
  443. <div class="group-controls">
  444. <textarea class="valid-xpath" name="xPathItemCategories" id="xPathItemCategories" rows="2" cols="64" spellcheck="false"
  445. data-leave-validation="<?= $xpath['itemCategories'] ?? '' ?>"><?= $xpath['itemCategories'] ?? '' ?></textarea>
  446. </div>
  447. </div>
  448. </fieldset>
  449. <div class="form-group form-actions">
  450. <div class="group-controls">
  451. <button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  452. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  453. </div>
  454. </div>
  455. <legend><?= _t('sub.feed.advanced') ?></legend>
  456. <div class="form-group">
  457. <label class="group-name" for="path_entries"><?= _t('sub.feed.css_path') ?></label>
  458. <div class="group-controls">
  459. <div class="stick">
  460. <input type="text" name="path_entries" id="path_entries" class="extend" value="<?= $this->feed->pathEntries() ?>"
  461. placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  462. <a id="popup-preview-selector" class="btn" href="<?=
  463. _url('feed', 'contentSelectorPreview', 'id', $this->feed->id(), 'selector', 'selector-token') ?>"><?= _i('look') ?></a>
  464. </div>
  465. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_help') ?></p>
  466. </div>
  467. </div>
  468. <div class="form-group">
  469. <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
  470. <div class="group-controls">
  471. <div class="stick">
  472. <input type="text" name="curl_params_cookie" id="curl_params_cookie" class="extend" value="<?=
  473. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_COOKIE]) ?
  474. $this->feed->attributes('curl_params')[CURLOPT_COOKIE] : ''
  475. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  476. </div>
  477. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
  478. </div>
  479. </div>
  480. <div class="form-group">
  481. <label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label>
  482. <div class="group-controls">
  483. <select name="content_action" id="content_action">
  484. <option value="replace"<?= 'replace' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>
  485. <option value="prepend"<?= 'prepend' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>
  486. <option value="append"<?= 'append' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>
  487. </select>
  488. </div>
  489. </div>
  490. <div class="form-group">
  491. <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
  492. <div class="group-controls">
  493. <div class="stick">
  494. <input type="text" name="curl_params_useragent" id="curl_params_useragent" class="extend" value="<?=
  495. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_USERAGENT]) ?
  496. $this->feed->attributes('curl_params')[CURLOPT_USERAGENT] : ''
  497. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  498. </div>
  499. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
  500. </div>
  501. </div>
  502. <div class="form-group">
  503. <label class="group-name" for="proxy_type"><?= _t('sub.feed.proxy') ?></label>
  504. <div class="group-controls">
  505. <select class="number" name="proxy_type" id="proxy_type"><?php
  506. $type = '';
  507. if (is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE])) {
  508. $type = $this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE];
  509. }
  510. foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) {
  511. echo '<option value="' . $k . ($type === $k ? '" selected="selected' : '' ) . '">' . $v . '</option>';
  512. }
  513. ?>
  514. </select>
  515. <div class="stick">
  516. <input type="text" name="curl_params" id="curl_params" class="extend" value="<?=
  517. is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_PROXY]) ?
  518. $this->feed->attributes('curl_params')[CURLOPT_PROXY] : ''
  519. ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  520. </div>
  521. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
  522. </div>
  523. </div>
  524. <div class="form-group">
  525. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  526. <div class="group-controls">
  527. <input type="number" name="timeout" id="timeout" min="3" max="120" value="<?= $this->feed->attributes('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" />
  528. </div>
  529. </div>
  530. <div class="form-group">
  531. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  532. <div class="group-controls">
  533. <select name="ssl_verify" id="ssl_verify">
  534. <option value=""<?= $this->feed->attributes('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option>
  535. <option value="0"<?= $this->feed->attributes('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option>
  536. <option value="1"<?= $this->feed->attributes('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option>
  537. </select>
  538. </div>
  539. </div>
  540. <div class="form-group">
  541. <div class="group-controls">
  542. <label class="checkbox" for="clear_cache">
  543. <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributes('clear_cache') ? ' checked="checked"' : '' ?> />
  544. <?= _t('sub.feed.clear_cache') ?>
  545. </label>
  546. </div>
  547. </div>
  548. <div class="form-group form-actions">
  549. <div class="group-controls">
  550. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  551. <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
  552. </div>
  553. </div>
  554. <legend><?= _t('sub.feed.maintenance.title') ?></legend>
  555. <div class="form-group">
  556. <div class="group-controls">
  557. <a class="btn btn-important" href="<?= _url('feed', 'clearCache', 'id', $this->feed->id()) ?>">
  558. <?= _t('sub.feed.maintenance.clear_cache') ?>
  559. </a>
  560. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
  561. </div>
  562. <div class="group-controls">
  563. <a class="btn btn-important" href="<?= _url('feed', 'reload', 'id', $this->feed->id()) ?>">
  564. <?= _t('sub.feed.maintenance.reload_articles') ?>
  565. </a>
  566. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.reload_articles_help') ?></p>
  567. </div>
  568. </div>
  569. </form>
  570. </div>