diff --git a/README.md b/README.md index 4e8945b..1a93873 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # README -[![Release version](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) -[![Release date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) -[![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues) -[![Dotclear version](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) -[![License](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE) +[![Release](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) +[![Date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases) +[![Issues](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues) +[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) +[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/cinecturlink2) +[![License](https://img.shields.io/github/license/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE) ## WHAT IS CINECTURLINK2 ? diff --git a/_admin.php b/_admin.php index c4b3374..f551f60 100644 --- a/_admin.php +++ b/_admin.php @@ -1,16 +1,15 @@ addItem( $core->adminurl->get('admin.plugin.cinecturlink2'), dcPage::getPF('cinecturlink2/icon.png'), preg_match( - '/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/', + '/' . preg_quote($core->adminurl->get('admin.plugin.cinecturlink2')) . '(&.*)?$/', $_SERVER['REQUEST_URI'] ), $core->auth->check('contentadmin', $core->blog->id) ); $core->addBehavior( - 'adminColumnsLists', + 'adminColumnsLists', ['cinecturlink2AdminBehaviors', 'adminColumnsLists'] ); $core->addBehavior( - 'adminFiltersLists', + 'adminFiltersLists', ['cinecturlink2AdminBehaviors', 'adminFiltersLists'] ); $core->addBehavior( @@ -86,19 +85,19 @@ class cinecturlink2AdminBehaviors public static function adminDashboardFavorites($core, $favs) { $favs->register('cinecturlink2', [ - 'title' => __('My cinecturlink'), - 'url' => $core->adminurl->get('admin.plugin.cinecturlink2').'#links', - 'small-icon' => dcPage::getPF('cinecturlink2/icon.png'), - 'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'), + 'title' => __('My cinecturlink'), + 'url' => $core->adminurl->get('admin.plugin.cinecturlink2') . '#links', + 'small-icon' => dcPage::getPF('cinecturlink2/icon.png'), + 'large-icon' => dcPage::getPF('cinecturlink2/icon-big.png'), 'permissions' => $core->auth->check('contentadmin', $core->blog->id), - 'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive'] + 'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive'] ]); } public static function adminDashboardFavoritesActive($request, $params) { - return $request == 'plugin.php' - && isset($params['p']) + return $request == 'plugin.php' + && isset($params['p']) && $params['p'] == 'cinecturlink2'; } -} \ No newline at end of file +} diff --git a/_config.php b/_config.php index 872fa01..f2e277b 100644 --- a/_config.php +++ b/_config.php @@ -1,33 +1,32 @@ getURL().'#plugins' : $_REQUEST['redir']; +$redir = empty($_REQUEST['redir']) ? + $list->getURL() . '#plugins' : $_REQUEST['redir']; $core->blog->settings->addNamespace('cinecturlink2'); -$s = $core->blog->settings->cinecturlink2; -$cinecturlink2_active = (boolean) $s->cinecturlink2_active; -$cinecturlink2_widthmax = abs((integer) $s->cinecturlink2_widthmax); -$cinecturlink2_folder = (string) $s->cinecturlink2_folder; -$cinecturlink2_triggeronrandom = (boolean) $s->cinecturlink2_triggeronrandom; -$cinecturlink2_public_active = (boolean) $s->cinecturlink2_public_active; -$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title; +$s = $core->blog->settings->cinecturlink2; +$cinecturlink2_active = (bool) $s->cinecturlink2_active; +$cinecturlink2_widthmax = abs((int) $s->cinecturlink2_widthmax); +$cinecturlink2_folder = (string) $s->cinecturlink2_folder; +$cinecturlink2_triggeronrandom = (bool) $s->cinecturlink2_triggeronrandom; +$cinecturlink2_public_active = (bool) $s->cinecturlink2_public_active; +$cinecturlink2_public_title = (string) $s->cinecturlink2_public_title; $cinecturlink2_public_description = (string) $s->cinecturlink2_public_description; -$cinecturlink2_public_nbrpp = (integer) $s->cinecturlink2_public_nbrpp; +$cinecturlink2_public_nbrpp = (int) $s->cinecturlink2_public_nbrpp; if ($cinecturlink2_public_nbrpp < 1) { $cinecturlink2_public_nbrpp = 10; } @@ -36,18 +35,17 @@ $combo_dirs = cinecturlink2::getPublicDirs($core); if (!empty($_POST['save'])) { try { - - $cinecturlink2_active = !empty($_POST['cinecturlink2_active']); - $cinecturlink2_widthmax = abs((integer) $_POST['cinecturlink2_widthmax']); - $cinecturlink2_newdir = (string) files::tidyFileName($_POST['cinecturlink2_newdir']); - $cinecturlink2_folder = empty($cinecturlink2_newdir) ? + $cinecturlink2_active = !empty($_POST['cinecturlink2_active']); + $cinecturlink2_widthmax = abs((int) $_POST['cinecturlink2_widthmax']); + $cinecturlink2_newdir = (string) files::tidyFileName($_POST['cinecturlink2_newdir']); + $cinecturlink2_folder = empty($cinecturlink2_newdir) ? (string) files::tidyFileName($_POST['cinecturlink2_folder']) : $cinecturlink2_newdir; - $cinecturlink2_triggeronrandom = !empty($_POST['cinecturlink2_triggeronrandom']); - $cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']); - $cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title']; + $cinecturlink2_triggeronrandom = !empty($_POST['cinecturlink2_triggeronrandom']); + $cinecturlink2_public_active = !empty($_POST['cinecturlink2_public_active']); + $cinecturlink2_public_title = (string) $_POST['cinecturlink2_public_title']; $cinecturlink2_public_description = (string) $_POST['cinecturlink2_public_description']; - $cinecturlink2_public_nbrpp = (integer) $_POST['cinecturlink2_public_nbrpp']; + $cinecturlink2_public_nbrpp = (int) $_POST['cinecturlink2_public_nbrpp']; if ($cinecturlink2_public_nbrpp < 1) { $cinecturlink2_public_nbrpp = 10; } @@ -72,7 +70,7 @@ if (!empty($_POST['save'])) { __('Configuration successfully updated.') ); $core->adminurl->redirect( - 'admin.plugins', + 'admin.plugins', ['module' => 'cinecturlink2', 'conf' => 1, 'redir' => $list->getRedir()] ); } catch (Exception $e) { @@ -88,10 +86,10 @@ echo ' form::checkbox('cinecturlink2_active', 1, $cinecturlink2_active) . __('Enable plugin') . '
-' . +
' . form::combo('cinecturlink2_folder', $combo_dirs, $cinecturlink2_folder) . '
-' . +
' . form::field('cinecturlink2_newdir', 60, 64, '', 'maximal') . '
' . @@ -115,7 +113,7 @@ __('Update cache when use "Random" or "Number of view" order on widget (Need rel
-' . sprintf(__('Public page has url: %s'), '' . $core->blog->url . $core->url->getBase('cinecturlink2') . '') . '
+' . sprintf(__('Public page has url: %s'), '' . $core->blog->url . $core->url->getBase('cinecturlink2') . '') . '
' . form::field('cinecturlink2_public_title', 60, 255, $cinecturlink2_public_title, 'maximal') . '
@@ -140,4 +138,4 @@ form::number('cinecturlink2_public_nbrpp', 1, 100, $cinecturlink2_public_nbrpp)' . + $entries[] = '
' .
($w->withlink && !empty($url) ? '' : '') .
'' . $title . '' . $note . '
' .
($w->showauthor ? $author . '
' : '') . '
' .
@@ -245,15 +242,14 @@ class cinecturlink2Widget
'
' . __('No link') . '
'; } } else { - $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); + $pager = new dcPager($page, $this->rs_count, $nb_per_page, 10); $links = []; if (isset($_REQUEST['links'])) { foreach ($_REQUEST['links'] as $v) { - $links[(integer) $v] = true; + $links[(int) $v] = true; } } $cols = [ - 'title' => '' . - form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) . + form::checkbox(['entries[]'], $this->rs->link_id, ['checked' => $checked]) . ' | ', 'title' => '' . '' . html::escapeHTML($this->rs->link_title) . '' . @@ -127,16 +126,16 @@ class adminlistCinecturlink2 html::escapeHTML($this->rs->link_desc) . ' | ', 'link' => '' . - 'rs->link_url . '" title="' . + html::escapeHTML($this->rs->link_url) . '">' . __('URL') . ' ' . - 'rs->link_img . '" title="' . + html::escapeHTML($this->rs->link_img) . '">' . __('image') . ' ' . ' | ', 'cat' => '' . '' . html::escapeHTML($this->rs->cat_title) . '' . @@ -147,8 +146,8 @@ class adminlistCinecturlink2 ' | ', 'date' => '' . dt::dt2str( - $this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format, - $this->rs->link_upddt, + $this->core->blog->settings->system->date_format . ', ' . $this->core->blog->settings->system->time_format, + $this->rs->link_upddt, $this->core->auth->getInfo('user_tz') ) . ' | ' @@ -157,6 +156,6 @@ class adminlistCinecturlink2 $cols = new ArrayObject($cols); $this->userColumns('c2link', $cols); - return '