rs->isEmpty()) { if ($filter) { echo '

' . __('No feeds matches the filter') . '

'; } else { echo '

' . __('No feeds') . '

'; } } else { $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); $entries = []; if (isset($_REQUEST['feeds'])) { foreach ($_REQUEST['feeds'] as $v) { $entries[(integer) $v] = true; } } $html_block = '
' . '' . ''; $cols = [ 'title' => '', 'desc' => '', 'period' => '', 'update' => '', 'entries' => '', 'status' => '' ]; $cols = new ArrayObject($cols); $this->core->callBehavior('adminZcfsFeedsListHeader', $this->core, $this->rs, $cols); $this->userColumns('zcfs_feeds', $cols); $html_block .= '' . implode(iterator_to_array($cols)) . '%s
' . ($filter ? sprintf(__('List of %s feeds matching the filter.'), $this->rs_count) : sprintf(__('List of entries (%s)'), $this->rs_count) ) . '
' . __('Name') . '' . __('Feed') . '' . __('Frequency') . '' . __('Last update') . '' . __('Entries') . '' . __('Status') . '
%s
'; if ($enclose_block) { $html_block = sprintf($enclose_block, $html_block); } echo $pager->getLinks(); $blocks = explode('%s', $html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->feedsLine(isset($entries[$this->rs->feed_id])); } echo $blocks[1]; echo $blocks[2]; echo $pager->getLinks(); } } private function feedsLine($checked) { $combo_status = zoneclearFeedServer::getAllStatus(); $combo_upd_int = zoneclearFeedServer::getAllUpdateInterval(); $status = $this->rs->feed_status ? 'enable' : 'disable'; $entries_count = $this->rs->zc->getPostsByFeed(['feed_id' => $this->rs->feed_id], true)->f(0); $shunk_feed = $this->rs->feed_feed; if (strlen($shunk_feed) > 83) { $shunk_feed = substr($shunk_feed,0,50).'...'.substr($shunk_feed,-20); } $url = 'plugin.php?p=zoneclearFeedServer&part=feed&feed_id=' . $this->rs->feed_id; $cols = [ 'check' => '' . form::checkbox(['feeds[]'], $this->rs->feed_id, ['checked' => $checked]) . '', 'title' => '' . '' . html::escapeHTML($this->rs->feed_name) . '' . '', 'desc' => '' . '' . html::escapeHTML($shunk_feed) . ''. '', 'period' => '' . array_search($this->rs->feed_upd_int,$combo_upd_int) . '', 'update' => '' . ($this->rs->feed_upd_last < 1 ? __('never') : dt::str(__('%Y-%m-%d %H:%M'), $this->rs->feed_upd_last, $this->rs->zc->core->auth->getInfo('user_tz')) ) . '', 'entries' => '' . ($entries_count ? '' . $entries_count . '' : $entries_count ) . '', 'status' => '' . $status . '' ]; $cols = new ArrayObject($cols); $this->core->callBehavior('adminZcfsFeedsListValue', $this->core, $this->rs, $cols); $this->userColumns('zcfs_feeds', $cols); return '' . implode(iterator_to_array($cols)) . ''; } } /** * @ingroup DC_PLUGIN_ZONECLEARFEEDSERVER * @brief Feeds server - Posts list methods * @since 2.6 * @see adminGenericList for more info */ class zcfsEntriesList extends adminGenericList { public function display($page, $nb_per_page, $url, $enclose='') { if ($this->rs->isEmpty()) { return '

'.__('No entry').'

'; } $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); $pager->base_url = $url; $pager->html_prev = $this->html_prev; $pager->html_next = $this->html_next; $pager->var_page = 'page'; $html_block = '
'. ''. ''. ''. ''. ''. ''. ''. ''. '%s
'.__('Title').''.__('Date').''.__('Category').''.__('Author').''.__('Comments').''.__('Trackbacks').''.__('Status').'
'; $res = ''; while ($this->rs->fetch()) { $res .= $this->postLine(); } return $pager->getLinks(). sprintf($enclose, sprintf($html_block, $res)). $pager->getLinks(); } private function postLine() { $cat_link = $this->core->auth->check('categories', $this->core->blog->id) ? '%s' : '%2$s'; $cat_title = $this->rs->cat_title ? sprintf($cat_link,$this->rs->cat_id, html::escapeHTML($this->rs->cat_title)) : __('None'); $img = '%1$s'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img, __('published'), 'check-on.png'); break; case 0: $img_status = sprintf($img, __('unpublished'), 'check-off.png'); break; case -1: $img_status = sprintf($img, __('scheduled'), 'scheduled.png'); break; case -2: $img_status = sprintf($img, __('pending'), 'check-wrn.png'); break; } return ''. ''. form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()).''. ''. html::escapeHTML($this->rs->post_title).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt).''. ''.$cat_title.''. ''.$this->rs->user_id.''. ''.$this->rs->nb_comment.''. ''.$this->rs->nb_trackback.''. ''.$img_status.''. ''; } }