' .
- '' . ($filter ?
+ '' . (
+ $filter ?
sprintf(__('List of %s links matching the filter.'), $this->rs_count) :
sprintf(__('List of links (%s)'), $this->rs_count)
- ). '' .
+ ) . '' .
'' .
'' . implode(iterator_to_array($cols)) . '
' .
'' .
@@ -111,11 +110,11 @@ class adminlistCinecturlink2
{
$cols = [
'check' => '' .
- 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 '' . implode(iterator_to_array($cols)) . '
' . "\n";
+ return '' . implode(iterator_to_array($cols)) . '
' . "\n";
}
-}
\ No newline at end of file
+}
diff --git a/inc/lib.sitemaps.cinecturlink2.php b/inc/lib.sitemaps.cinecturlink2.php
index b644bd8..9852186 100644
--- a/inc/lib.sitemaps.cinecturlink2.php
+++ b/inc/lib.sitemaps.cinecturlink2.php
@@ -1,16 +1,15 @@
blog->settings->addNamespace('sitemaps');
- if ($core->plugins->moduleExists('cinecturlink2')
+ if ($core->plugins->moduleExists('cinecturlink2')
&& $core->blog->settings->sitemaps->sitemaps_cinecturlink2_url
) {
$freq = $sitemaps->getFrequency($core->blog->settings->sitemaps->sitemaps_cinecturlink2_fq);
@@ -33,11 +32,11 @@ class sitemapsCinecturlink2
$sitemaps->addEntry($base, $prio, $freq);
$core->blog->settings->addNamespace('cinecturlink2');
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2($core);
$cats = $C2->getCategories();
while ($cats->fetch()) {
- $sitemaps->addEntry($base . "/" . $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
+ $sitemaps->addEntry($base . '/' . $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl . '/' . urlencode($cats->cat_title), $prio, $freq);
}
}
}
-}
\ No newline at end of file
+}
diff --git a/index.php b/index.php
index 905e968..1fbe244 100644
--- a/index.php
+++ b/index.php
@@ -1,40 +1,39 @@
auth->getInfo('user_lang');
-$linkimage = $_POST['linkimage'] ?? '';
-$linknote = $_POST['linknote'] ?? '';
-$catid = $_REQUEST['catid'] ?? '';
-$cattitle = $_POST['cattitle'] ?? '';
-$catdesc = $_POST['catdesc'] ?? '';
-$redir = $_REQUEST['redir'] ?? '';
-$part = $_REQUEST['part'] ?? 'links';
-$entries = $_POST['entries'] ?? [];
-$headers = '';
+$linkurl = $_POST['linkurl'] ?? '';
+$linkcat = $_POST['linkcat'] ?? null;
+$linklang = $_POST['linklang'] ?? $core->auth->getInfo('user_lang');
+$linkimage = $_POST['linkimage'] ?? '';
+$linknote = $_POST['linknote'] ?? '';
+$catid = $_REQUEST['catid'] ?? '';
+$cattitle = $_POST['cattitle'] ?? '';
+$catdesc = $_POST['catdesc'] ?? '';
+$redir = $_REQUEST['redir'] ?? '';
+$part = $_REQUEST['part'] ?? 'links';
+$entries = $_POST['entries'] ?? [];
+$headers = '';
$breadcrumb = [
- __('Plugins') => '',
+ __('Plugins') => '',
__('My cinecturlink') => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])
];
if (!in_array($part, ['links', 'link', 'cats', 'cat', 'dellinks', 'updlinksnote', 'updlinkscat'])) {
@@ -45,11 +44,11 @@ if (!is_array($entries)) {
}
try {
- $C2 = new cinecturlink2($core);
- $categories = $C2->getCategories();
+ $C2 = new cinecturlink2($core);
+ $categories = $C2->getCategories();
$categories_combo = ['-' => ''];
- while($categories->fetch()) {
- $cat_title = html::escapeHTML($categories->cat_title);
+ while ($categories->fetch()) {
+ $cat_title = html::escapeHTML($categories->cat_title);
$categories_combo[$cat_title] = $categories->cat_id;
}
} catch (Exception $e) {
@@ -87,10 +86,10 @@ if ($part == 'updlinksnote') {
try {
// update group of links note
if (!empty($entries) && isset($_POST['newlinknote'])) {
- while($links->fetch()) {
+ while ($links->fetch()) {
if (in_array($links->link_id, $entries)) {
- $cur = $core->con->openCursor($C2->table);
- $cur->link_note = (integer) $_POST['newlinknote'];
+ $cur = $core->con->openCursor($C2->table);
+ $cur->link_note = (int) $_POST['newlinknote'];
$C2->updLink($links->link_id, $cur);
}
}
@@ -113,10 +112,10 @@ if ($part == 'updlinkscat') {
try {
// update group of links category
if (!empty($entries) && !empty($_POST['newcatid'])) {
- while($links->fetch()) {
+ while ($links->fetch()) {
if (in_array($links->link_id, $entries)) {
- $cur = $core->con->openCursor($C2->table);
- $cur->cat_id = (integer) $_POST['newcatid'];
+ $cur = $core->con->openCursor($C2->table);
+ $cur->cat_id = (int) $_POST['newcatid'];
$C2->updLink($links->link_id, $cur);
}
}
@@ -133,39 +132,41 @@ if ($part == 'updlinkscat') {
$core->error->add($e->getMessage());
}
$breadcrumb[__('Update links category')] = '';
-}
+}
if ($part == 'links') {
$action_combo = [
- __('Delete') => 'dellinks',
+ __('Delete') => 'dellinks',
__('Change category') => 'updlinkscat',
- __('Change rating') => 'updlinksnote'
+ __('Change rating') => 'updlinksnote'
];
$c2link_filter = new adminGenericFilter($core, 'c2link');
$c2link_filter->add('part', 'links');
$c2link_filter->add(dcAdminFilters::getPageFilter());
$c2link_filter->add(dcAdminFilters::getSelectFilter(
- 'catid', __('Category:'), $categories_combo, 'cat_id'
+ 'catid',
+ __('Category:'),
+ $categories_combo,
+ 'cat_id'
));
- $params = $c2link_filter->params();
- $params['link_type'] = 'cinecturlink';
+ $params = $c2link_filter->params();
+ $params['link_type'] = 'cinecturlink';
$params['no_content'] = true;
$links_list = null;
try {
- $links = $C2->getLinks($params);
- $links_counter = $C2->getLinks($params,true)->f(0);
- $links_list = new adminlistCinecturlink2($core, $links, $links_counter);
+ $links = $C2->getLinks($params);
+ $links_counter = $C2->getLinks($params, true)->f(0);
+ $links_list = new adminlistCinecturlink2($core, $links, $links_counter);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
$breadcrumb[__('My cinecturlink')] = '';
- $headers .=
- dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
+ $headers .= dcPage::jsVars(['dotclear.filter_reset_url' => $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'links'])]) .
dcPage::jsFilterControl($c2link_filter->show()) .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2links.js'));
}
@@ -174,14 +175,15 @@ if ($part == 'link') {
$langs_combo = l10n::getISOcodes(true);
$notes_combo = range(0, 20);
$media_combo = $tmp_media_combo = $dir = null;
+
try {
$allowed_media = ['png', 'jpg', 'gif', 'bmp', 'jpeg'];
- $core->media = new dcMedia($core);
+ $core->media = new dcMedia($core);
$core->media->chdir($core->blog->settings->cinecturlink2->cinecturlink2_folder);
$core->media->getDir();
- $dir =& $core->media->dir;
+ $dir = & $core->media->dir;
- foreach($dir['files'] as $file) {
+ foreach ($dir['files'] as $file) {
if (!in_array(files::getExtension($file->relname), $allowed_media)) {
continue;
}
@@ -197,7 +199,7 @@ if ($part == 'link') {
if (!empty($_POST['save'])) {
try {
cinecturlink2::makePublicDir(
- DC_ROOT . '/' .$core->blog->settings->system->public_path,
+ DC_ROOT . '/' . $core->blog->settings->system->public_path,
$core->blog->settings->cinecturlink2->cinecturlink2_folder
);
if (empty($linktitle)) {
@@ -210,15 +212,15 @@ if ($part == 'link') {
throw new Exception(__('You must provide a link to an image.'));
}
- $cur = $core->con->openCursor($C2->table);
- $cur->link_title = $linktitle;
- $cur->link_desc = $linkdesc;
+ $cur = $core->con->openCursor($C2->table);
+ $cur->link_title = $linktitle;
+ $cur->link_desc = $linkdesc;
$cur->link_author = $linkauthor;
- $cur->link_url = $linkurl;
- $cur->cat_id = $linkcat == '' ? null : $linkcat;
- $cur->link_lang = $linklang;
- $cur->link_img = $linkimage;
- $cur->link_note = $linknote;
+ $cur->link_url = $linkurl;
+ $cur->cat_id = $linkcat == '' ? null : $linkcat;
+ $cur->link_lang = $linklang;
+ $cur->link_img = $linkimage;
+ $cur->link_note = $linknote;
// create a link
if (empty($linkid)) {
@@ -243,11 +245,12 @@ if ($part == 'link') {
__('Link successfully updated.')
);
}
- $core->adminurl->redirect('admin.plugin.cinecturlink2',
+ $core->adminurl->redirect(
+ 'admin.plugin.cinecturlink2',
[
- 'part' => 'link',
+ 'part' => 'link',
'linkid' => $linkid,
- 'redir' => $redir
+ 'redir' => $redir
]
);
} catch (Exception $e) {
@@ -275,19 +278,18 @@ if ($part == 'link') {
if (!empty($linkid)) {
$link = $C2->getLinks(['link_id' => $linkid]);
if (!$link->isEmpty()) {
- $linktitle = $link->link_title;
- $linkdesc = $link->link_desc;
+ $linktitle = $link->link_title;
+ $linkdesc = $link->link_desc;
$linkauthor = $link->link_author;
- $linkurl = $link->link_url;
- $linkcat = $link->cat_id;
- $linklang = $link->link_lang;
- $linkimage = $link->link_img;
- $linknote = $link->link_note;
+ $linkurl = $link->link_url;
+ $linkcat = $link->cat_id;
+ $linklang = $link->link_lang;
+ $linkimage = $link->link_img;
+ $linknote = $link->link_note;
}
}
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
- $headers .=
- dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
+ $headers .= dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
}
@@ -308,9 +310,9 @@ if ($part == 'cats') {
$catorder = explode(',', $catorder);
}
$i = 0;
- foreach($catorder as $id) {
+ foreach ($catorder as $id) {
$i++;
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = $core->con->openCursor($C2->table . '_cat');
$cur->cat_pos = $i;
$C2->updCategory($id, $cur);
}
@@ -329,7 +331,6 @@ if ($part == 'cats') {
);
$core->adminurl->redirect('admin.plugin.cinecturlink2', ['part' => 'cats']);
}
-
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
@@ -338,8 +339,7 @@ if ($part == 'cats') {
$core->auth->user_prefs->addWorkspace('accessibility');
if (!$core->auth->user_prefs->accessibility->nodragdrop) {
- $headers .=
- dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
+ $headers .= dcPage::jsLoad('js/jquery/jquery-ui.custom.js') .
dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2cats.js'));
}
@@ -353,9 +353,9 @@ if ($part == 'cat') {
if ($exists) {
throw new Exception(__('Category with same name already exists.'));
}
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = $core->con->openCursor($C2->table . '_cat');
$cur->cat_title = $cattitle;
- $cur->cat_desc = $catdesc;
+ $cur->cat_desc = $catdesc;
$catid = $C2->addCategory($cur);
@@ -370,9 +370,9 @@ if ($part == 'cat') {
if ($exists) {
throw new Exception(__('Category with same name already exists.'));
}
- $cur = $core->con->openCursor($C2->table . '_cat');
+ $cur = $core->con->openCursor($C2->table . '_cat');
$cur->cat_title = $cattitle;
- $cur->cat_desc = $catdesc;
+ $cur->cat_desc = $catdesc;
$C2->updCategory($catid, $cur);
@@ -393,19 +393,19 @@ if ($part == 'cat') {
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
- $breadcrumb[__('Categories')] = $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
+ $breadcrumb[__('Categories')] = $core->adminurl->get('admin.plugin.cinecturlink2', ['part' => 'cats']);
$breadcrumb[(empty($catid) ? __('New category') : __('Edit category'))] = '';
}
-echo
-''.__('Cinecturlink 2').'' .
+echo
+'' . __('Cinecturlink 2') . '' .
$headers .
-''.
+'' .
dcPage::breadcrumb($breadcrumb) .
dcPage::notices();
if (!empty($redir)) {
- echo '' . __('Back') .'
';
+ echo '' . __('Back') . '
';
}
if (!empty($title)) {
echo '' . $title . '
';
@@ -413,10 +413,10 @@ if (!empty($title)) {
if ($part == 'updlinksnote') {
if ($links->isEmpty()) {
- echo ''.__('There is no link').'
';
+ echo '' . __('There is no link') . '
';
} else {
echo '' . __('Links') . '
';
- while($links->fetch()) {
+ while ($links->fetch()) {
echo '- ' . $links->link_title . ' ' . $links->link_note . '/20
';
}
echo '
';
@@ -425,19 +425,20 @@ if ($part == 'updlinksnote') {
';
}
-if ($part == "cats") {
- echo
- '' . __('New Category') .'
';
+ ) .
+ '">' . __('New Category') . ' ';
if ($categories->isEmpty()) {
- echo ''.__('There is no category').'
';
- }
- else {
+ echo '' . __('There is no category') . '
';
+ } else {
echo '