'. - form::combo('sortby',$sortby_combo,$sortby).'
'. - 'diff --git a/README.md b/README.md
index ff1ecd7..5f0acef 100644
--- a/README.md
+++ b/README.md
@@ -40,4 +40,4 @@ to your theme tpl path and adapt them.
* License : GNU GPL v2
* Source & contribution : [GitHub Page](https://github.com/JcDenis/cinecturlink2)
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/cinecturlink2)
- * Discuss and help : [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=40893)
+ * Discuss and help : [Dotclear Forum](https://forum.dotclear.org/viewtopic.php?id=40893)
\ No newline at end of file
diff --git a/_admin.php b/_admin.php
index 295082e..54e1270 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,65 +1,56 @@
addItem(
- __('My cinecturlink'),
- 'plugin.php?p=cinecturlink2',
- 'index.php?pf=cinecturlink2/icon.png',
- preg_match(
- '/plugin.php\?p=cinecturlink2(&.*)?$/',
- $_SERVER['REQUEST_URI'])
- ,
- $core->auth->check('contentadmin', $core->blog->id)
+ __('My cinecturlink'),
+ $core->adminurl->get('admin.plugin.cinecturlink2'),
+ dcPage::getPF('cinecturlink2/icon.png'),
+ preg_match(
+ '/' . preg_quote($core->adminurl->get('admin.plugin.dcAdvancedCleaner')) . '(&.*)?$/',
+ $_SERVER['REQUEST_URI']
+ ),
+ $core->auth->check('contentadmin', $core->blog->id)
);
$core->addBehavior(
- 'adminDashboardFavorites',
- array('cinecturlink2AdminBehaviors', 'adminDashboardFavorites')
+ 'adminDashboardFavorites',
+ ['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
);
class cinecturlink2AdminBehaviors
{
- public static function adminDashboardFavorites($core, $favs)
- {
- $favs->register('cinecturlink2', array(
- 'title' => __('My cinecturlink'),
- 'url' => 'plugin.php?p=cinecturlink2#links',
- 'small-icon' => 'index.php?pf=cinecturlink2/icon.png',
- 'large-icon' => 'index.php?pf=cinecturlink2/icon-big.png',
- 'permissions' => $core->auth->check(
- 'contentadmin',
- $core->blog->id
- ),
- 'active_cb' => array(
- 'cinecturlink2AdminBehaviors',
- 'adminDashboardFavoritesActive'
- )
- ));
- }
+ 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'),
+ 'permissions' => $core->auth->check('contentadmin', $core->blog->id),
+ 'active_cb' => ['cinecturlink2AdminBehaviors', 'adminDashboardFavoritesActive']
+ ]);
+ }
- public static function adminDashboardFavoritesActive($request, $params)
- {
- return $request == 'plugin.php'
- && isset($params['p'])
- && $params['p'] == 'cinecturlink2';
- }
-}
+ public static function adminDashboardFavoritesActive($request, $params)
+ {
+ return $request == 'plugin.php'
+ && isset($params['p'])
+ && $params['p'] == 'cinecturlink2';
+ }
+}
\ No newline at end of file
diff --git a/_install.php b/_install.php
index 3832363..4a7a717 100644
--- a/_install.php
+++ b/_install.php
@@ -1,19 +1,18 @@
plugins->moduleInfo('cinecturlink2', 'version');
@@ -24,69 +23,69 @@ if (version_compare($old_version, $new_version, '>=')) {
}
try {
- $s = new dbStruct($core->con, $core->prefix);
- $s->cinecturlink2
- ->link_id ('bigint', 0, false)
- ->blog_id ('varchar', 32, false)
- ->cat_id ('bigint', 0, true)
- ->user_id ('varchar', 32, true)
- ->link_type ('varchar', 32, false, "'cinecturlink'")
- ->link_title ('varchar', 255, false)
- ->link_desc ('varchar', 255, false)
- ->link_author ('varchar', 255, false)
- ->link_lang ('varchar', 5, false, "'en'")
- ->link_url ('varchar', 255, false)
- ->link_img ('varchar', 255, false)
- ->link_creadt ('timestamp', 0, false, 'now()')
- ->link_upddt ('timestamp', 0, false, 'now()')
- ->link_pos ('smallint', 0, false, "'0'")
- ->link_note('smallint', 0, false, "'10'")
- ->link_count('bigint', 0, false, "'0'")
+ $s = new dbStruct($core->con, $core->prefix);
+ $s->cinecturlink2
+ ->link_id ('bigint', 0, false)
+ ->blog_id ('varchar', 32, false)
+ ->cat_id ('bigint', 0, true)
+ ->user_id ('varchar', 32, true)
+ ->link_type ('varchar', 32, false, "'cinecturlink'")
+ ->link_title ('varchar', 255, false)
+ ->link_desc ('varchar', 255, false)
+ ->link_author ('varchar', 255, false)
+ ->link_lang ('varchar', 5, false, "'en'")
+ ->link_url ('varchar', 255, false)
+ ->link_img ('varchar', 255, false)
+ ->link_creadt ('timestamp', 0, false, 'now()')
+ ->link_upddt ('timestamp', 0, false, 'now()')
+ ->link_pos ('smallint', 0, false, "'0'")
+ ->link_note('smallint', 0, false, "'10'")
+ ->link_count('bigint', 0, false, "'0'")
- ->primary('pk_cinecturlink2', 'link_id')
- ->index('idx_cinecturlink2_title', 'btree', 'link_title')
- ->index('idx_cinecturlink2_author', 'btree', 'link_author')
- ->index('idx_cinecturlink2_blog_id', 'btree', 'blog_id')
- ->index('idx_cinecturlink2_cat_id', 'btree', 'cat_id')
- ->index('idx_cinecturlink2_user_id', 'btree', 'user_id')
- ->index('idx_cinecturlink2_type', 'btree', 'link_type');
+ ->primary('pk_cinecturlink2', 'link_id')
+ ->index('idx_cinecturlink2_title', 'btree', 'link_title')
+ ->index('idx_cinecturlink2_author', 'btree', 'link_author')
+ ->index('idx_cinecturlink2_blog_id', 'btree', 'blog_id')
+ ->index('idx_cinecturlink2_cat_id', 'btree', 'cat_id')
+ ->index('idx_cinecturlink2_user_id', 'btree', 'user_id')
+ ->index('idx_cinecturlink2_type', 'btree', 'link_type');
- $s->cinecturlink2_cat
- ->cat_id ('bigint', 0, false)
- ->blog_id ('varchar', 32, false)
- ->cat_title ('varchar', 255, false)
- ->cat_desc ('varchar', 255, false)
- ->cat_creadt ('timestamp', 0, false, 'now()')
- ->cat_upddt ('timestamp', 0, false, 'now()')
- ->cat_pos ('smallint', 0, false, "'0'")
+ $s->cinecturlink2_cat
+ ->cat_id ('bigint', 0, false)
+ ->blog_id ('varchar', 32, false)
+ ->cat_title ('varchar', 255, false)
+ ->cat_desc ('varchar', 255, false)
+ ->cat_creadt ('timestamp', 0, false, 'now()')
+ ->cat_upddt ('timestamp', 0, false, 'now()')
+ ->cat_pos ('smallint', 0, false, "'0'")
- ->primary('pk_cinecturlink2_cat', 'cat_id')
- ->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
- ->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
+ ->primary('pk_cinecturlink2_cat', 'cat_id')
+ ->index('idx_cinecturlink2_cat_blog_id', 'btree', 'blog_id')
+ ->unique('uk_cinecturlink2_cat_title', 'cat_title', 'blog_id');
- $si = new dbStruct($core->con,$core->prefix);
- $changes = $si->synchronize($s);
+ $si = new dbStruct($core->con,$core->prefix);
+ $changes = $si->synchronize($s);
- $core->blog->settings->addNamespace('cinecturlink2');
- $s = $core->blog->settings->cinecturlink2;
- $s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true);
- $s->put('cinecturlink2_widthmax', 100, 'integer', 'Maximum width of picture', false, true);
- $s->put('cinecturlink2_folder', 'cinecturlink', 'string', 'Public folder of pictures', false, true);
- $s->put('cinecturlink2_triggeronrandom', false, 'boolean', 'Open link in new window', false, true);
- $s->put('cinecturlink2_public_active', false, 'boolean', 'Enable cinecturlink2', false, true);
- $s->put('cinecturlink2_public_title', '', 'string', 'Title of public page', false, true);
- $s->put('cinecturlink2_public_description', '', 'string','Description of public page', false, true);
- $s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true);
- $s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true);
+ $core->blog->settings->addNamespace('cinecturlink2');
+ $s = $core->blog->settings->cinecturlink2;
+ $s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true);
+ $s->put('cinecturlink2_widthmax', 100, 'integer', 'Maximum width of picture', false, true);
+ $s->put('cinecturlink2_folder', 'cinecturlink', 'string', 'Public folder of pictures', false, true);
+ $s->put('cinecturlink2_triggeronrandom', false, 'boolean', 'Open link in new window', false, true);
+ $s->put('cinecturlink2_public_active', false, 'boolean', 'Enable cinecturlink2', false, true);
+ $s->put('cinecturlink2_public_title', '', 'string', 'Title of public page', false, true);
+ $s->put('cinecturlink2_public_description', '', 'string','Description of public page', false, true);
+ $s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true);
+ $s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true);
- $core->setVersion(
- 'cinecturlink2',
- $core->plugins->moduleInfo('cinecturlink2', 'version')
- );
+ $core->setVersion(
+ 'cinecturlink2',
+ $core->plugins->moduleInfo('cinecturlink2', 'version')
+ );
- return true;
+ return true;
} catch (Exception $e) {
- $core->error->add($e->getMessage());
+ $core->error->add($e->getMessage());
}
return false;
\ No newline at end of file
diff --git a/_public.php b/_public.php
index 898122c..7ddb514 100644
--- a/_public.php
+++ b/_public.php
@@ -1,20 +1,19 @@
blog->settings->addNamespace('cinecturlink2');
$c2_tpl_values = array(
- 'c2PageFeedID',
- 'c2PageFeedURL',
- 'c2PageURL',
- 'c2PageTitle',
- 'c2PageDescription',
+ 'c2PageFeedID',
+ 'c2PageFeedURL',
+ 'c2PageURL',
+ 'c2PageTitle',
+ 'c2PageDescription',
- 'c2EntryIfOdd',
- 'c2EntryIfFirst',
- 'c2EntryFeedID',
- 'c2EntryID',
- 'c2EntryTitle',
- 'c2EntryDescription',
- 'c2EntryFromAuthor',
- 'c2EntryAuthorCommonName',
- 'c2EntryAuthorDisplayName',
- 'c2EntryAuthorEmail',
- 'c2EntryAuthorID',
- 'c2EntryAuthorLink',
- 'c2EntryAuthorURL',
- 'c2EntryLang',
- 'c2EntryURL',
- 'c2EntryCategory',
- 'c2EntryCategoryID',
- 'c2EntryCategoryURL',
- 'c2EntryImg',
- 'c2EntryDate',
- 'c2EntryTime',
+ 'c2EntryIfOdd',
+ 'c2EntryIfFirst',
+ 'c2EntryFeedID',
+ 'c2EntryID',
+ 'c2EntryTitle',
+ 'c2EntryDescription',
+ 'c2EntryFromAuthor',
+ 'c2EntryAuthorCommonName',
+ 'c2EntryAuthorDisplayName',
+ 'c2EntryAuthorEmail',
+ 'c2EntryAuthorID',
+ 'c2EntryAuthorLink',
+ 'c2EntryAuthorURL',
+ 'c2EntryLang',
+ 'c2EntryURL',
+ 'c2EntryCategory',
+ 'c2EntryCategoryID',
+ 'c2EntryCategoryURL',
+ 'c2EntryImg',
+ 'c2EntryDate',
+ 'c2EntryTime',
- 'c2PaginationCounter',
- 'c2PaginationCurrent',
- 'c2PaginationURL',
+ 'c2PaginationCounter',
+ 'c2PaginationCurrent',
+ 'c2PaginationURL',
- 'c2CategoryFeedID',
- 'c2CategoryFeedURL',
- 'c2CategoryID',
- 'c2CategoryTitle',
- 'c2CategoryDescription',
- 'c2CategoryURL'
+ 'c2CategoryFeedID',
+ 'c2CategoryFeedURL',
+ 'c2CategoryID',
+ 'c2CategoryTitle',
+ 'c2CategoryDescription',
+ 'c2CategoryURL'
);
$c2_tpl_blocks = array(
- 'c2If',
+ 'c2If',
- 'c2Entries',
- 'c2EntriesHeader',
- 'c2EntriesFooter',
- 'c2EntryIf',
+ 'c2Entries',
+ 'c2EntriesHeader',
+ 'c2EntriesFooter',
+ 'c2EntryIf',
- 'c2Pagination',
- 'c2PaginationIf',
+ 'c2Pagination',
+ 'c2PaginationIf',
- 'c2Categories',
- 'c2CategoriesHeader',
- 'c2CategoriesFooter',
- 'c2CategoryIf'
+ 'c2Categories',
+ 'c2CategoriesHeader',
+ 'c2CategoriesFooter',
+ 'c2CategoryIf'
);
if ($core->blog->settings->cinecturlink2->cinecturlink2_active) {
- foreach($c2_tpl_blocks as $v) {
- $core->tpl->addBlock($v, array('tplCinecturlink2', $v));
- }
- foreach($c2_tpl_values as $v) {
- $core->tpl->addValue($v, array('tplCinecturlink2', $v));
- }
+ foreach($c2_tpl_blocks as $v) {
+ $core->tpl->addBlock($v, array('tplCinecturlink2', $v));
+ }
+ foreach($c2_tpl_values as $v) {
+ $core->tpl->addValue($v, array('tplCinecturlink2', $v));
+ }
}
else {
- foreach(array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
- $core->tpl->addBlock($v, array('tplCinecturlink2', 'disable'));
- }
+ foreach(array_merge($c2_tpl_blocks, $c2_tpl_values) as $v) {
+ $core->tpl->addBlock($v, array('tplCinecturlink2', 'disable'));
+ }
}
class urlCinecturlink2 extends dcUrlHandlers
{
- public static function c2Page($args)
- {
- global $core, $_ctx;
- $core->blog->settings->addNamespace('cinecturlink2');
+ public static function c2Page($args)
+ {
+ global $core, $_ctx;
+ $core->blog->settings->addNamespace('cinecturlink2');
- if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
- || !$core->blog->settings->cinecturlink2->cinecturlink2_public_active)
- {
- self::p404();
+ if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
+ || !$core->blog->settings->cinecturlink2->cinecturlink2_public_active)
+ {
+ self::p404();
- return null;
- }
+ return null;
+ }
- $core->tpl->setPath(
- $core->tpl->getPath(),
- dirname(__FILE__).'/default-templates/'
- );
+ $core->tpl->setPath(
+ $core->tpl->getPath(),
+ dirname(__FILE__).'/default-templates/'
+ );
- $params = array();
+ $params = array();
- $n = self::getPageArgs($args, 'c2page');
- if ($n) {
- $GLOBALS['c2_page_number'] = $n;
- }
+ $n = self::getPageArgs($args, 'c2page');
+ if ($n) {
+ $GLOBALS['c2_page_number'] = $n;
+ }
- $caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
- if (!$caturl) $caturl = 'c2cat';
+ $caturl = $core->blog->settings->cinecturlink2->cinecturlink2_public_caturl;
+ if (!$caturl) $caturl = 'c2cat';
- $c = self::getPageArgs($args, $caturl);
- if ($c) {
- if (is_numeric($c)) {
- $params['cat_id'] = (integer) $c;
- }
- else {
- $params['cat_title'] = urldecode($c);
- }
- }
+ $c = self::getPageArgs($args, $caturl);
+ if ($c) {
+ if (is_numeric($c)) {
+ $params['cat_id'] = (integer) $c;
+ }
+ else {
+ $params['cat_title'] = urldecode($c);
+ }
+ }
- $f = self::getPageArgs($args, 'feed');
- if ($f && in_array($f, array('atom', 'rss2'))) {
- $mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
+ $f = self::getPageArgs($args, 'feed');
+ if ($f && in_array($f, array('atom', 'rss2'))) {
+ $mime = $f == 'atom' ? 'application/atom+xml' : 'application/xml';
- //$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
+ //$_ctx->short_feed_items = $core->blog->settings->system->short_feed_items;
- $params['limit'] = $core->blog->settings->system->nb_post_per_feed;
- $_ctx->c2_page_params = $params;
+ $params['limit'] = $core->blog->settings->system->nb_post_per_feed;
+ $_ctx->c2_page_params = $params;
- header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
- self::serveDocument('cinecturlink2-'.$f.'.xml', $mime);
- }
- else {
- $d = self::getPageArgs($args, 'c2detail');
- if ($d) {
- if (is_numeric($d)) {
- $params['link_id'] = (integer) $d;
- }
- else {
- $params['link_title'] = urldecode($d);
- }
- }
+ header('X-Robots-Tag: '.context::robotsPolicy($core->blog->settings->system->robots_policy, ''));
+ self::serveDocument('cinecturlink2-'.$f.'.xml', $mime);
+ }
+ else {
+ $d = self::getPageArgs($args, 'c2detail');
+ if ($d) {
+ if (is_numeric($d)) {
+ $params['link_id'] = (integer) $d;
+ }
+ else {
+ $params['link_title'] = urldecode($d);
+ }
+ }
- $params['limit'] = $core->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
- $_ctx->c2_page_params = $params;
+ $params['limit'] = $core->blog->settings->cinecturlink2->cinecturlink2_public_nbrpp;
+ $_ctx->c2_page_params = $params;
- self::serveDocument('cinecturlink2.html', 'text/html');
- }
+ self::serveDocument('cinecturlink2.html', 'text/html');
+ }
- return null;
- }
+ return null;
+ }
- protected static function getPageArgs(&$args, $part)
- {
- if (preg_match('#(^|/)'.$part.'/([^/]+)#', $args, $m)) {
- $args = preg_replace('#(^|/)'.$part.'/([^/]+)#', '', $args);
+ protected static function getPageArgs(&$args, $part)
+ {
+ if (preg_match('#(^|/)'.$part.'/([^/]+)#', $args, $m)) {
+ $args = preg_replace('#(^|/)'.$part.'/([^/]+)#', '', $args);
- return $m[2];
- }
+ return $m[2];
+ }
- return false;
- }
+ return false;
+ }
}
class tplCinecturlink2
{
- public static function disable($a, $c=null)
- {
- return '';
- }
-
- public static function c2PageURL($a)
- {
- return "tpl->getFilters($a), '$core->blog->url.$core->url->getBase(\'cinecturlink2\')')."; ?>";
- }
-
- public static function c2PageTitle($a)
- {
- return "blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$title')."; ?>";
- }
-
- public static function c2PageFeedURL($a)
- {
- return "tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/feed/'.(!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom').'"')."; ?>";
- }
-
- public static function c2PageFeedID($a)
- {
- return 'urn:md5:blog->blog_id."cinecturlink2"); ?>';
- }
-
- public static function c2PageDescription($a)
- {
- return "blog->settings->cinecturlink2->cinecturlink2_public_description; echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$description')."; ?>";
- }
-
- public static function c2If($a ,$c)
- {
- $if = array();
-
- $operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
-
- if (isset($a['request_link'])) {
- $sign = (boolean) $a['request_link'] ? '' : '!';
- $if[] = $sign.'(isset($_ctx->c2_page_params["link_id"]) || isset($_ctx->c2_page_params["link_title"]))';
- }
-
- if (isset($a['request_cat'])) {
- $sign = (boolean) $a['request_cat'] ? '' : '!';
- $if[] = $sign.'(isset($_ctx->c2_page_params["cat_id"]) || isset($_ctx->c2_page_params["cat_title"]))';
- }
-
- return empty($if) ? $c : "\n".$c."\n";
- }
-
- public static function c2Entries($a, $c)
- {
- $lastn = isset($a['lastn']) ? abs((integer) $a['lastn'])+0 : -1;
-
- $res = 'if (!isset($c2_page_number)) { $c2_page_number = 1; }'."\n";
-
- if ($lastn != 0) {
- if ($lastn > 0) {
- $res .= "\$params['limit'] = ".$lastn.";\n";
- }
- else {
- $res .= "if (!isset(\$params['limit']) || \$params['limit'] < 1) { \$params['limit'] = 10; }\n";
- }
- if (!isset($a['ignore_pagination']) || $a['ignore_pagination'] == "0") {
- $res .= "\$params['limit'] = array(((\$c2_page_number-1)*\$params['limit']),\$params['limit']);\n";
- }
- else {
- $res .= "\$params['limit'] = array(0, \$params['limit']);\n";
- }
- }
-
- if (isset($a['category'])) {
- if ($a['category'] == 'null') {
- $res .= "\$params['sql'] = ' AND L.cat_id IS NULL ';\n";
- }
- elseif (is_numeric($a['category'])) {
- $res .= "\$params['cat_id'] = ".(integer) $a['category'].";\n";
- }
- else {
- $res .= "\$params['cat_title'] = '".$a['category']."';\n";
- }
- }
-
- $sort = isset($a['sort']) && $a['sort'] == 'asc' ? ' asc' : ' desc';
- $sortby = isset($a['order']) && in_array($a['order'],array('link_count','link_upddt','link_creadt','link_note','link_title')) ? $a['order'] : 'link_upddt';
-
- $res .=
- "\$params['order'] = '".$sortby.$sort."';\n";
-
- return
- "c2_page_params) ? \$_ctx->c2_page_params : array(); \n".
- $res.
- "\$_ctx->c2_params = \$params; unset(\$params);\n".
- "if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
- "\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n".
- 'while ($_ctx->c2_entries->fetch()) : ?>'.$c.'c2_entries = null; \$_ctx->c2_params = null; \n".
- "?>\n";
- }
-
- public static function c2EntriesHeader($a, $c)
- {
- return "c2_entries->isStart()) : ?>".$c."";
- }
-
- public static function c2EntriesFooter($a, $c)
- {
- return "c2_entries->isEnd()) : ?>".$c."";
- }
-
- public static function c2EntryIf($a, $c)
- {
- $if = array();
-
- $operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
-
- if (isset($a['has_category'])) {
- $sign = (boolean) $a['has_category'] ? '!' : '=';
- $if[] = '($_ctx->exists("c2_entries") && "" '.$sign.'= $_ctx->c2_entries->cat_title)';
- }
-
- return empty($if) ? $c : "\n".$c."\n";
- }
-
- public static function c2EntryIfFirst($a)
- {
- return 'c2_entries->index() == 0) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first').'"; } ?>';
- }
-
- public static function c2EntryIfOdd($a)
- {
- return 'c2_entries->index()+1)%2 == 1) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd').'"; } ?>';
- }
-
- public static function c2EntryFeedID($a)
- {
- return 'urn:md5:c2_entries->blog_id.$_ctx->c2_entries->link_id.$_ctx->c2_entries->link_dt); ?>';
- }
-
- public static function c2EntryID($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_id', $a);
- }
-
- public static function c2EntryTitle($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_title', $a);
- }
-
- public static function c2EntryDescription($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_desc', $a);
- }
-
- public static function c2EntryAuthorCommonName($a)
- {
- return self::getGenericValue('dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)', $a);
- }
-
- public static function c2EntryAuthorDisplayName($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->user_displayname', $a);
- }
-
- public static function c2EntryAuthorID($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->user_id', $a);
- }
-
- public static function c2EntryAuthorEmail($a)
- {
- return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? '$_ctx->c2_entries->user_email' : "strtr(\$_ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
- }
-
- public static function c2EntryAuthorLink($a)
- {
- return self::getGenericValue('sprintf(($_ctx->c2_entries->user_url ? \'%1$s\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)),html::escapeHTML($_ctx->c2_entries->user_url))', $a);
- }
-
- public static function c2EntryAuthorURL($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->user_url', $a);
- }
-
- public static function c2EntryFromAuthor($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_author', $a);
- }
-
- public static function c2EntryLang($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_lang', $a);
- }
-
- public static function c2EntryURL($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->link_url', $a);
- }
-
- public static function c2EntryCategory($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->cat_title', $a);
- }
-
- public static function c2EntryCategoryID($a)
- {
- return self::getGenericValue('$_ctx->c2_entries->cat_id', $a);
- }
-
- public static function c2EntryCategoryURL($a)
- {
- return self::getGenericValue('$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_entries->cat_title)', $a);
- }
-
- public static function c2EntryImg($a)
- {
- global $core;
- $f = $core->tpl->getFilters($a);
- $style = isset($a['style']) ? html::escapeHTML($a['style']) : '';
-
- return
- "exists('c2_entries')) { ".
- "\$widthmax = (integer) \$core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ".
- "\$img = sprintf('',".
- "\$_ctx->c2_entries->link_img, ".
- "html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), ".
- "(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') ".
- "); ".
- "echo ".sprintf($f,'$img')."; unset(\$img); } ?> \n";
- }
-
- public static function c2EntryDate($a)
- {
- $format = !empty($a['format']) ? addslashes($a['format']) : '';
-
- if (!empty($a['rfc822']))
- $p = "dt::rfc822(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
- elseif (!empty($a['iso8601']))
- $p = "dt::iso8601(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
- elseif ($format)
- $p = "dt::dt2str('".$format."', \$_ctx->c2_entries->link_creadt)";
- else
- $p = "dt::dt2str(\$core->blog->settings->system->date_format, \$_ctx->c2_entries->link_creadt)";
-
- return self::getGenericValue($p, $a);
- }
-
- public static function c2EntryTime($a)
- {
- return self::getGenericValue("dt::dt2str(".(!empty($a['format']) ? "'".addslashes($a['format'])."'" : '$core->blog->settings->system->time_format').", \$_ctx->c2_entries->link_creadt)", $a);
- }
-
- public static function c2Pagination($a, $c)
- {
- $p =
- "c2_params;\n".
- "\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n".
- "?>\n";
-
- return isset($a['no_context']) ? $p.$c : $p.'c2_pagination->f(0) > $_ctx->c2_entries->count()) : ?>'.$c.'';
- }
-
- public static function c2PaginationCounter($a)
- {
- return self::getGenericValue('cinecturlink2Context::PaginationNbPages()', $a);
- }
-
- public static function c2PaginationCurrent($a)
- {
- return self::getGenericValue('cinecturlink2Context::PaginationPosition('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
- }
-
- public static function c2PaginationIf($a, $c)
- {
- $if = array();
-
- if (isset($a['start'])) {
- $sign = (boolean) $a['start'] ? '' : '!';
- $if[] = $sign.'cinecturlink2Context::PaginationStart()';
- }
- if (isset($a['end'])) {
- $sign = (boolean) $a['end'] ? '' : '!';
- $if[] = $sign.'cinecturlink2Context::PaginationEnd()';
- }
-
- return empty($if) ? $c : ''.$c.'';
- }
-
- public static function c2PaginationURL($a)
- {
- return self::getGenericValue('cinecturlink2Context::PaginationURL('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
- }
-
- public static function c2Categories($a, $c)
- {
- return
- "exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
- "\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n".
- 'while ($_ctx->c2_categories->fetch()) : ?>'.$c.'c2_categories = null; \n".
- "?>\n";
- }
-
- public static function c2CategoriesHeader($a, $c)
- {
- return "c2_categories->isStart()) : ?>".$c."";
- }
-
- public static function c2CategoriesFooter($a, $c)
- {
- return "c2_categories->isEnd()) : ?>".$c."";
- }
-
- public static function c2CategoryIf($a, $c)
- {
- $if = array();
-
- if (isset($a['current'])) {
- $sign = (boolean) $a['current'] ? '' : '!';
- $if[] = $sign.'cinecturlink2Context::CategoryCurrent()';
- }
- if (isset($a['first'])) {
- $sign = (boolean) $a['first'] ? '' : '!';
- $if[] = $sign.'$_ctx->c2_categories->isStart()';
- }
-
- return empty($if) ? $c : ''.$c.'';
- }
-
- public static function c2CategoryFeedURL($a)
- {
- $p = !empty($a['type']) ? $a['type'] : 'atom';
-
- if (!preg_match('#^(rss2|atom)$#', $p)) {
- $p = 'atom';
- }
-
- return "tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)."/feed/'.$p.'"')."; ?>";
- }
-
- public static function c2CategoryFeedID($a)
- {
- return 'urn:md5:blog->blog_id."cinecturlink2".$_ctx->c2_categories->cat_id); ?>';
- }
-
- public static function c2CategoryID($a)
- {
- return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_id')."; } ?>";
- }
-
- public static function c2CategoryTitle($a)
- {
- return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_title')."; } ?>";
- }
-
- public static function c2CategoryDescription($a)
- {
- return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_desc')."; } ?>";
- }
-
- public static function c2CategoryURL($a)
- {
- return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)')."; } ?>";
- }
-
- protected static function getGenericValue($p,$a)
- {
- return "exists('c2_entries')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), "$p")."; } ?>";
- }
-
- protected static function getOperator($op)
- {
- switch (strtolower($op))
- {
- case 'or':
- case '||':
- return '||';
- case 'and':
- case '&&':
- default:
- return '&&';
- }
- }
-}
+ public static function disable($a, $c=null)
+ {
+ return '';
+ }
+
+ public static function c2PageURL($a)
+ {
+ return "tpl->getFilters($a), '$core->blog->url.$core->url->getBase(\'cinecturlink2\')')."; ?>";
+ }
+
+ public static function c2PageTitle($a)
+ {
+ return "blog->settings->cinecturlink2->cinecturlink2_public_title; if (empty(\$title)) { \$title = __('My cinecturlink'); } echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$title')."; ?>";
+ }
+
+ public static function c2PageFeedURL($a)
+ {
+ return "tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/feed/'.(!empty($a['type']) && preg_match('#^(rss2|atom)$#', $a['type']) ? $a['type'] : 'atom').'"')."; ?>";
+ }
+
+ public static function c2PageFeedID($a)
+ {
+ return 'urn:md5:blog->blog_id."cinecturlink2"); ?>';
+ }
+
+ public static function c2PageDescription($a)
+ {
+ return "blog->settings->cinecturlink2->cinecturlink2_public_description; echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$description')."; ?>";
+ }
+
+ public static function c2If($a ,$c)
+ {
+ $if = array();
+
+ $operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
+
+ if (isset($a['request_link'])) {
+ $sign = (boolean) $a['request_link'] ? '' : '!';
+ $if[] = $sign.'(isset($_ctx->c2_page_params["link_id"]) || isset($_ctx->c2_page_params["link_title"]))';
+ }
+
+ if (isset($a['request_cat'])) {
+ $sign = (boolean) $a['request_cat'] ? '' : '!';
+ $if[] = $sign.'(isset($_ctx->c2_page_params["cat_id"]) || isset($_ctx->c2_page_params["cat_title"]))';
+ }
+
+ return empty($if) ? $c : "\n".$c."\n";
+ }
+
+ public static function c2Entries($a, $c)
+ {
+ $lastn = isset($a['lastn']) ? abs((integer) $a['lastn'])+0 : -1;
+
+ $res = 'if (!isset($c2_page_number)) { $c2_page_number = 1; }'."\n";
+
+ if ($lastn != 0) {
+ if ($lastn > 0) {
+ $res .= "\$params['limit'] = ".$lastn.";\n";
+ }
+ else {
+ $res .= "if (!isset(\$params['limit']) || \$params['limit'] < 1) { \$params['limit'] = 10; }\n";
+ }
+ if (!isset($a['ignore_pagination']) || $a['ignore_pagination'] == "0") {
+ $res .= "\$params['limit'] = array(((\$c2_page_number-1)*\$params['limit']),\$params['limit']);\n";
+ }
+ else {
+ $res .= "\$params['limit'] = array(0, \$params['limit']);\n";
+ }
+ }
+
+ if (isset($a['category'])) {
+ if ($a['category'] == 'null') {
+ $res .= "\$params['sql'] = ' AND L.cat_id IS NULL ';\n";
+ }
+ elseif (is_numeric($a['category'])) {
+ $res .= "\$params['cat_id'] = ".(integer) $a['category'].";\n";
+ }
+ else {
+ $res .= "\$params['cat_title'] = '".$a['category']."';\n";
+ }
+ }
+
+ $sort = isset($a['sort']) && $a['sort'] == 'asc' ? ' asc' : ' desc';
+ $sortby = isset($a['order']) && in_array($a['order'],array('link_count','link_upddt','link_creadt','link_note','link_title')) ? $a['order'] : 'link_upddt';
+
+ $res .=
+ "\$params['order'] = '".$sortby.$sort."';\n";
+
+ return
+ "c2_page_params) ? \$_ctx->c2_page_params : array(); \n".
+ $res.
+ "\$_ctx->c2_params = \$params; unset(\$params);\n".
+ "if (!\$_ctx->exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
+ "\$_ctx->c2_entries = \$_ctx->cinecturlink->getLinks(\$_ctx->c2_params); \n".
+ 'while ($_ctx->c2_entries->fetch()) : ?>'.$c.'c2_entries = null; \$_ctx->c2_params = null; \n".
+ "?>\n";
+ }
+
+ public static function c2EntriesHeader($a, $c)
+ {
+ return "c2_entries->isStart()) : ?>".$c."";
+ }
+
+ public static function c2EntriesFooter($a, $c)
+ {
+ return "c2_entries->isEnd()) : ?>".$c."";
+ }
+
+ public static function c2EntryIf($a, $c)
+ {
+ $if = array();
+
+ $operator = isset($a['operator']) ? self::getOperator($a['operator']) : '&&';
+
+ if (isset($a['has_category'])) {
+ $sign = (boolean) $a['has_category'] ? '!' : '=';
+ $if[] = '($_ctx->exists("c2_entries") && "" '.$sign.'= $_ctx->c2_entries->cat_title)';
+ }
+
+ return empty($if) ? $c : "\n".$c."\n";
+ }
+
+ public static function c2EntryIfFirst($a)
+ {
+ return 'c2_entries->index() == 0) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'first').'"; } ?>';
+ }
+
+ public static function c2EntryIfOdd($a)
+ {
+ return 'c2_entries->index()+1)%2 == 1) { echo "'.(isset($a['return']) ? addslashes(html::escapeHTML($a['return'])) : 'odd').'"; } ?>';
+ }
+
+ public static function c2EntryFeedID($a)
+ {
+ return 'urn:md5:c2_entries->blog_id.$_ctx->c2_entries->link_id.$_ctx->c2_entries->link_dt); ?>';
+ }
+
+ public static function c2EntryID($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_id', $a);
+ }
+
+ public static function c2EntryTitle($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_title', $a);
+ }
+
+ public static function c2EntryDescription($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_desc', $a);
+ }
+
+ public static function c2EntryAuthorCommonName($a)
+ {
+ return self::getGenericValue('dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)', $a);
+ }
+
+ public static function c2EntryAuthorDisplayName($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->user_displayname', $a);
+ }
+
+ public static function c2EntryAuthorID($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->user_id', $a);
+ }
+
+ public static function c2EntryAuthorEmail($a)
+ {
+ return self::getGenericValue((isset($a['spam_protected']) && !$a['spam_protected'] ? '$_ctx->c2_entries->user_email' : "strtr(\$_ctx->c2_entries->user_email,array('@'=>'%40','.'=>'%2e'))"), $a);
+ }
+
+ public static function c2EntryAuthorLink($a)
+ {
+ return self::getGenericValue('sprintf(($_ctx->c2_entries->user_url ? \'%1$s\' : \'%1$s\'),html::escapeHTML(dcUtils::getUserCN($_ctx->c2_entries->user_id,$_ctx->c2_entries->user_name,$_ctx->c2_entries->user_firstname,$_ctx->c2_entries->user_displayname)),html::escapeHTML($_ctx->c2_entries->user_url))', $a);
+ }
+
+ public static function c2EntryAuthorURL($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->user_url', $a);
+ }
+
+ public static function c2EntryFromAuthor($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_author', $a);
+ }
+
+ public static function c2EntryLang($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_lang', $a);
+ }
+
+ public static function c2EntryURL($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->link_url', $a);
+ }
+
+ public static function c2EntryCategory($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->cat_title', $a);
+ }
+
+ public static function c2EntryCategoryID($a)
+ {
+ return self::getGenericValue('$_ctx->c2_entries->cat_id', $a);
+ }
+
+ public static function c2EntryCategoryURL($a)
+ {
+ return self::getGenericValue('$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_entries->cat_title)', $a);
+ }
+
+ public static function c2EntryImg($a)
+ {
+ global $core;
+ $f = $core->tpl->getFilters($a);
+ $style = isset($a['style']) ? html::escapeHTML($a['style']) : '';
+
+ return
+ "exists('c2_entries')) { ".
+ "\$widthmax = (integer) \$core->blog->settings->cinecturlink2->cinecturlink2_widthmax; ".
+ "\$img = sprintf('',".
+ "\$_ctx->c2_entries->link_img, ".
+ "html::escapeHTML(\$_ctx->c2_entries->link_title.' - '.\$_ctx->c2_entries->link_author), ".
+ "(\$widthmax ? ' style=\"width:'.\$widthmax.'px;$style\"' : '') ".
+ "); ".
+ "echo ".sprintf($f,'$img')."; unset(\$img); } ?> \n";
+ }
+
+ public static function c2EntryDate($a)
+ {
+ $format = !empty($a['format']) ? addslashes($a['format']) : '';
+
+ if (!empty($a['rfc822']))
+ $p = "dt::rfc822(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
+ elseif (!empty($a['iso8601']))
+ $p = "dt::iso8601(strtotime(\$_ctx->c2_entries->link_creadt), \$_ctx->posts->post_tz)";
+ elseif ($format)
+ $p = "dt::dt2str('".$format."', \$_ctx->c2_entries->link_creadt)";
+ else
+ $p = "dt::dt2str(\$core->blog->settings->system->date_format, \$_ctx->c2_entries->link_creadt)";
+
+ return self::getGenericValue($p, $a);
+ }
+
+ public static function c2EntryTime($a)
+ {
+ return self::getGenericValue("dt::dt2str(".(!empty($a['format']) ? "'".addslashes($a['format'])."'" : '$core->blog->settings->system->time_format').", \$_ctx->c2_entries->link_creadt)", $a);
+ }
+
+ public static function c2Pagination($a, $c)
+ {
+ $p =
+ "c2_params;\n".
+ "\$_ctx->c2_pagination = \$_ctx->cinecturlink->getLinks(\$params,true); unset(\$params);\n".
+ "?>\n";
+
+ return isset($a['no_context']) ? $p.$c : $p.'c2_pagination->f(0) > $_ctx->c2_entries->count()) : ?>'.$c.'';
+ }
+
+ public static function c2PaginationCounter($a)
+ {
+ return self::getGenericValue('cinecturlink2Context::PaginationNbPages()', $a);
+ }
+
+ public static function c2PaginationCurrent($a)
+ {
+ return self::getGenericValue('cinecturlink2Context::PaginationPosition('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
+ }
+
+ public static function c2PaginationIf($a, $c)
+ {
+ $if = array();
+
+ if (isset($a['start'])) {
+ $sign = (boolean) $a['start'] ? '' : '!';
+ $if[] = $sign.'cinecturlink2Context::PaginationStart()';
+ }
+ if (isset($a['end'])) {
+ $sign = (boolean) $a['end'] ? '' : '!';
+ $if[] = $sign.'cinecturlink2Context::PaginationEnd()';
+ }
+
+ return empty($if) ? $c : ''.$c.'';
+ }
+
+ public static function c2PaginationURL($a)
+ {
+ return self::getGenericValue('cinecturlink2Context::PaginationURL('.(isset($a['offset']) ? (integer) $a['offset'] : 0).')', $a);
+ }
+
+ public static function c2Categories($a, $c)
+ {
+ return
+ "exists('cinecturlink')) { \$_ctx->cinecturlink = new cinecturlink2(\$core); } \n".
+ "\$_ctx->c2_categories = \$_ctx->cinecturlink->getCategories(); \n".
+ 'while ($_ctx->c2_categories->fetch()) : ?>'.$c.'c2_categories = null; \n".
+ "?>\n";
+ }
+
+ public static function c2CategoriesHeader($a, $c)
+ {
+ return "c2_categories->isStart()) : ?>".$c."";
+ }
+
+ public static function c2CategoriesFooter($a, $c)
+ {
+ return "c2_categories->isEnd()) : ?>".$c."";
+ }
+
+ public static function c2CategoryIf($a, $c)
+ {
+ $if = array();
+
+ if (isset($a['current'])) {
+ $sign = (boolean) $a['current'] ? '' : '!';
+ $if[] = $sign.'cinecturlink2Context::CategoryCurrent()';
+ }
+ if (isset($a['first'])) {
+ $sign = (boolean) $a['first'] ? '' : '!';
+ $if[] = $sign.'$_ctx->c2_categories->isStart()';
+ }
+
+ return empty($if) ? $c : ''.$c.'';
+ }
+
+ public static function c2CategoryFeedURL($a)
+ {
+ $p = !empty($a['type']) ? $a['type'] : 'atom';
+
+ if (!preg_match('#^(rss2|atom)$#', $p)) {
+ $p = 'atom';
+ }
+
+ return "tpl->getFilters($a),'$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)."/feed/'.$p.'"')."; ?>";
+ }
+
+ public static function c2CategoryFeedID($a)
+ {
+ return 'urn:md5:blog->blog_id."cinecturlink2".$_ctx->c2_categories->cat_id); ?>';
+ }
+
+ public static function c2CategoryID($a)
+ {
+ return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_id')."; } ?>";
+ }
+
+ public static function c2CategoryTitle($a)
+ {
+ return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_title')."; } ?>";
+ }
+
+ public static function c2CategoryDescription($a)
+ {
+ return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$_ctx->c2_categories->cat_desc')."; } ?>";
+ }
+
+ public static function c2CategoryURL($a)
+ {
+ return "exists('c2_categories')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), '$core->blog->url.$core->url->getBase("cinecturlink2")."/".$core->blog->settings->cinecturlink2->cinecturlink2_public_caturl."/".urlencode($_ctx->c2_categories->cat_title)')."; } ?>";
+ }
+
+ protected static function getGenericValue($p,$a)
+ {
+ return "exists('c2_entries')) { echo ".sprintf($GLOBALS['core']->tpl->getFilters($a), "$p")."; } ?>";
+ }
+
+ protected static function getOperator($op)
+ {
+ switch (strtolower($op))
+ {
+ case 'or':
+ case '||':
+ return '||';
+ case 'and':
+ case '&&':
+ default:
+ return '&&';
+ }
+ }
+}
\ No newline at end of file
diff --git a/_uninstall.php b/_uninstall.php
index ce91a81..dfb24d5 100644
--- a/_uninstall.php
+++ b/_uninstall.php
@@ -1,88 +1,86 @@
addUserAction(
- /* type */ 'settings',
- /* action */ 'delete_all',
- /* ns */ 'cinecturlink2',
- /* desc */ __('delete all settings')
+ /* type */ 'settings',
+ /* action */ 'delete_all',
+ /* ns */ 'cinecturlink2',
+ /* desc */ __('delete all settings')
);
$this->addUserAction(
- /* type */ 'tables',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
+ /* type */ 'tables',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
);
$this->addUserAction(
- /* type */ 'tables',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2_cat',
- /* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
+ /* type */ 'tables',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2_cat',
+ /* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
);
$this->addUserAction(
- /* type */ 'versions',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* desc */ __('delete the version number')
+ /* type */ 'versions',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* desc */ __('delete the version number')
);
$this->addUserAction(
- /* type */ 'plugins',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* desc */ __('delete plugin files')
+ /* type */ 'plugins',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* desc */ __('delete plugin files')
);
$this->addDirectAction(
- /* type */ 'settings',
- /* action */ 'delete_all',
- /* ns */ 'cinecturlink2',
- /* desc */ sprintf(__('delete all %s settings'), 'cinecturlink2')
+ /* type */ 'settings',
+ /* action */ 'delete_all',
+ /* ns */ 'cinecturlink2',
+ /* desc */ sprintf(__('delete all %s settings'), 'cinecturlink2')
);
$this->addDirectAction(
- /* type */ 'tables',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
+ /* type */ 'tables',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* desc */ sprintf(__('delete %s table'), 'cinecturlink2')
);
$this->addDirectAction(
- /* type */ 'tables',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2_cat',
- /* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
+ /* type */ 'tables',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2_cat',
+ /* desc */ sprintf(__('delete %s table'), 'cinecturlink2_cat')
);
$this->addDirectAction(
- /* type */ 'versions',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* desc */ sprintf(__('delete %s version number'), 'cinecturlink2')
+ /* type */ 'versions',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* desc */ sprintf(__('delete %s version number'), 'cinecturlink2')
);
$this->addDirectAction(
- /* type */ 'plugins',
- /* action */ 'delete',
- /* ns */ 'cinecturlink2',
- /* description */ sprintf(__('delete %s plugin files'), 'cinecturlink2')
-);
+ /* type */ 'plugins',
+ /* action */ 'delete',
+ /* ns */ 'cinecturlink2',
+ /* description */ sprintf(__('delete %s plugin files'), 'cinecturlink2')
+);
\ No newline at end of file
diff --git a/_widgets.php b/_widgets.php
index 36b8f58..9cb411d 100644
--- a/_widgets.php
+++ b/_widgets.php
@@ -1,347 +1,346 @@
addBehavior(
- 'initWidgets',
- array('cinecturlink2Widget', 'adminLinks')
+ 'initWidgets',
+ array('cinecturlink2Widget', 'adminLinks')
);
$core->addBehavior(
- 'initWidgets',
- array('cinecturlink2Widget', 'adminCats')
+ 'initWidgets',
+ array('cinecturlink2Widget', 'adminCats')
);
class cinecturlink2Widget
{
- public static function adminLinks($w)
- {
- global $core;
+ public static function adminLinks($w)
+ {
+ global $core;
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2($core);
- $categories_combo = array('' => '', __('Uncategorized') => 'null');
- $categories = $C2->getCategories();
- while($categories->fetch()) {
- $cat_title = html::escapeHTML($categories->cat_title);
- $categories_combo[$cat_title] = $categories->cat_id;
- }
+ $categories_combo = array('' => '', __('Uncategorized') => 'null');
+ $categories = $C2->getCategories();
+ while($categories->fetch()) {
+ $cat_title = html::escapeHTML($categories->cat_title);
+ $categories_combo[$cat_title] = $categories->cat_id;
+ }
- $sortby_combo = array(
- __('Update date') => 'link_upddt',
- __('My rating') => 'link_note',
- __('Title') => 'link_title',
- __('Random') => 'RANDOM',
- __('Number of views') => 'COUNTER'
- );
- $order_combo = array(
- __('Ascending') => 'asc',
- __('Descending') => 'desc'
- );
+ $sortby_combo = array(
+ __('Update date') => 'link_upddt',
+ __('My rating') => 'link_note',
+ __('Title') => 'link_title',
+ __('Random') => 'RANDOM',
+ __('Number of views') => 'COUNTER'
+ );
+ $order_combo = array(
+ __('Ascending') => 'asc',
+ __('Descending') => 'desc'
+ );
- $w->create(
- 'cinecturlink2links',
- __('My cinecturlink'),
- array('cinecturlink2Widget', 'publicLinks'),
- 'null',
- __('Show selection of cinecturlinks')
- );
- $w->cinecturlink2links->setting(
- 'title',
- __('Title:'),
- __('My cinecturlink'),
- 'text'
- );
- $w->cinecturlink2links->setting(
- 'category',
- __('Category:'),
- '',
- 'combo',
- $categories_combo
- );
- $w->cinecturlink2links->setting(
- 'sortby',
- __('Order by:'),
- 'link_upddt',
- 'combo',
- $sortby_combo
- );
- $w->cinecturlink2links->setting(
- 'sort',
- __('Sort: (only for date, note and title)'),
- 'desc',
- 'combo',
- $order_combo
- );
- $w->cinecturlink2links->setting(
- 'limit',
- __('Limit:'),
- 10,
- 'text'
- );
- $w->cinecturlink2links->setting(
- 'withlink',
- __('Enable link'),
- 1,
- 'check'
- );
- $w->cinecturlink2links->setting(
- 'showauthor',
- __('Show author'),
- 1,
- 'check'
- );
- $w->cinecturlink2links->setting(
- 'shownote',
- __('Show my rating'),
- 0,
- 'check'
- );
- $w->cinecturlink2links->setting(
- 'showdesc',
- __('Show description'),
- 0,
- 'check'
- );
- $w->cinecturlink2links->setting(
- 'showpagelink',
- __('Show a link to cinecturlink page'),
- 0,
- 'check'
- );
- $w->cinecturlink2links->setting(
- 'homeonly',
- __('Display on:'),
- 1,
- 'combo',
- array(
- __('All pages') => 0,
- __('Home page only') => 1,
- __('Except on home page') => 2
- )
- );
- }
+ $w->create(
+ 'cinecturlink2links',
+ __('My cinecturlink'),
+ array('cinecturlink2Widget', 'publicLinks'),
+ 'null',
+ __('Show selection of cinecturlinks')
+ );
+ $w->cinecturlink2links->setting(
+ 'title',
+ __('Title:'),
+ __('My cinecturlink'),
+ 'text'
+ );
+ $w->cinecturlink2links->setting(
+ 'category',
+ __('Category:'),
+ '',
+ 'combo',
+ $categories_combo
+ );
+ $w->cinecturlink2links->setting(
+ 'sortby',
+ __('Order by:'),
+ 'link_upddt',
+ 'combo',
+ $sortby_combo
+ );
+ $w->cinecturlink2links->setting(
+ 'sort',
+ __('Sort: (only for date, note and title)'),
+ 'desc',
+ 'combo',
+ $order_combo
+ );
+ $w->cinecturlink2links->setting(
+ 'limit',
+ __('Limit:'),
+ 10,
+ 'text'
+ );
+ $w->cinecturlink2links->setting(
+ 'withlink',
+ __('Enable link'),
+ 1,
+ 'check'
+ );
+ $w->cinecturlink2links->setting(
+ 'showauthor',
+ __('Show author'),
+ 1,
+ 'check'
+ );
+ $w->cinecturlink2links->setting(
+ 'shownote',
+ __('Show my rating'),
+ 0,
+ 'check'
+ );
+ $w->cinecturlink2links->setting(
+ 'showdesc',
+ __('Show description'),
+ 0,
+ 'check'
+ );
+ $w->cinecturlink2links->setting(
+ 'showpagelink',
+ __('Show a link to cinecturlink page'),
+ 0,
+ 'check'
+ );
+ $w->cinecturlink2links->setting(
+ 'homeonly',
+ __('Display on:'),
+ 1,
+ 'combo',
+ array(
+ __('All pages') => 0,
+ __('Home page only') => 1,
+ __('Except on home page') => 2
+ )
+ );
+ }
- public static function adminCats($w)
- {
- $w->create(
- 'cinecturlink2cats',
- __('List of categories of cinecturlink'),
- array('cinecturlink2Widget', 'publicCats'),
- null,
- __('List of categories of cinecturlink')
- );
- $w->cinecturlink2cats->setting(
- 'title',
- __('Title:'),
- __('My cinecturlink by categories'),
- 'text'
- );
- $w->cinecturlink2cats->setting(
- 'shownumlink',
- __('Show number of links'),
- 0,
- 'check'
- );
- $w->cinecturlink2cats->setting(
- 'homeonly',
- __('Display on:'),
- 1,
- 'combo',
- array(
- __('All pages') => 0,
- __('Home page only') => 1,
- __('Except on home page') => 2
- )
- );
- }
+ public static function adminCats($w)
+ {
+ $w->create(
+ 'cinecturlink2cats',
+ __('List of categories of cinecturlink'),
+ array('cinecturlink2Widget', 'publicCats'),
+ null,
+ __('List of categories of cinecturlink')
+ );
+ $w->cinecturlink2cats->setting(
+ 'title',
+ __('Title:'),
+ __('My cinecturlink by categories'),
+ 'text'
+ );
+ $w->cinecturlink2cats->setting(
+ 'shownumlink',
+ __('Show number of links'),
+ 0,
+ 'check'
+ );
+ $w->cinecturlink2cats->setting(
+ 'homeonly',
+ __('Display on:'),
+ 1,
+ 'combo',
+ array(
+ __('All pages') => 0,
+ __('Home page only') => 1,
+ __('Except on home page') => 2
+ )
+ );
+ }
- public static function publicLinks($w)
- {
- global $core;
+ public static function publicLinks($w)
+ {
+ global $core;
- $core->blog->settings->addNamespace('cinecturlink2');
+ $core->blog->settings->addNamespace('cinecturlink2');
- if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
- || $w->homeonly == 1 && $core->url->type != 'default'
- || $w->homeonly == 2 && $core->url->type == 'default'
- ) {
- return null;
- }
+ if (!$core->blog->settings->cinecturlink2->cinecturlink2_active
+ || $w->homeonly == 1 && $core->url->type != 'default'
+ || $w->homeonly == 2 && $core->url->type == 'default'
+ ) {
+ return null;
+ }
- $C2 = new cinecturlink2($core);
+ $C2 = new cinecturlink2($core);
- if ($w->category) {
- if ($w->category == 'null') {
- $params['sql'] = ' AND L.cat_id IS NULL ';
- }
- elseif (is_numeric($w->category)) {
- $params['cat_id'] = (integer) $w->category;
- }
- }
+ if ($w->category) {
+ if ($w->category == 'null') {
+ $params['sql'] = ' AND L.cat_id IS NULL ';
+ }
+ elseif (is_numeric($w->category)) {
+ $params['cat_id'] = (integer) $w->category;
+ }
+ }
- $limit = abs((integer) $w->limit);
+ $limit = abs((integer) $w->limit);
- # Tirage aléatoire
- # Consomme beaucoup de ressources!
- if ($w->sortby == 'RANDOM') {
- $big_rs = $C2->getLinks($params);
+ # Tirage aléatoire
+ # Consomme beaucoup de ressources!
+ if ($w->sortby == 'RANDOM') {
+ $big_rs = $C2->getLinks($params);
- if ($big_rs->isEmpty()) {
+ if ($big_rs->isEmpty()) {
- return null;
- }
+ return null;
+ }
- $ids= array();
- while($big_rs->fetch()) {
- $ids[] = $big_rs->link_id;
- }
- shuffle($ids);
- $ids = array_slice($ids, 0, $limit);
+ $ids= array();
+ while($big_rs->fetch()) {
+ $ids[] = $big_rs->link_id;
+ }
+ shuffle($ids);
+ $ids = array_slice($ids, 0, $limit);
- $params['link_id'] = array();
- foreach($ids as $id) {
- $params['link_id'][] = $id;
- }
- }
- elseif ($w->sortby == 'COUNTER') {
- $params['order'] = 'link_count asc';
- $params['limit'] = $limit;
- }
- else {
- $params['order'] = $w->sortby;
- $params['order'] .= $w->sort == 'asc' ? ' asc' : ' desc';
- $params['limit'] = $limit;
- }
+ $params['link_id'] = array();
+ foreach($ids as $id) {
+ $params['link_id'][] = $id;
+ }
+ }
+ elseif ($w->sortby == 'COUNTER') {
+ $params['order'] = 'link_count asc';
+ $params['limit'] = $limit;
+ }
+ else {
+ $params['order'] = $w->sortby;
+ $params['order'] .= $w->sort == 'asc' ? ' asc' : ' desc';
+ $params['limit'] = $limit;
+ }
- $rs = $C2->getLinks($params);
+ $rs = $C2->getLinks($params);
- if ($rs->isEmpty()) {
+ if ($rs->isEmpty()) {
- return null;
- }
+ return null;
+ }
- $widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
- $style = $widthmax ? ' style="width:'.$widthmax.'px;"' : '';
+ $widthmax = (integer) $core->blog->settings->cinecturlink2->cinecturlink2_widthmax;
+ $style = $widthmax ? ' style="width:'.$widthmax.'px;"' : '';
- $entries = array();
- while($rs->fetch()) {
- $url = $rs->link_url;
- $img = $rs->link_img;
- $title = html::escapeHTML($rs->link_title);
- $author = html::escapeHTML($rs->link_author);
- $cat = html::escapeHTML($rs->cat_title);
- $note = $w->shownote ? ' ('.$rs->link_note.'/20)' : '';
- $desc = $w->showdesc ? '
'.html::escapeHTML($rs->link_desc).'' : '';
- $lang = $rs->link_lang ? ' hreflang="'.$rs->link_lang.'"' : '';
- $count = abs((integer) $rs->link_count);
+ $entries = array();
+ while($rs->fetch()) {
+ $url = $rs->link_url;
+ $img = $rs->link_img;
+ $title = html::escapeHTML($rs->link_title);
+ $author = html::escapeHTML($rs->link_author);
+ $cat = html::escapeHTML($rs->cat_title);
+ $note = $w->shownote ? ' ('.$rs->link_note.'/20)' : '';
+ $desc = $w->showdesc ? '
'.html::escapeHTML($rs->link_desc).'' : '';
+ $lang = $rs->link_lang ? ' hreflang="'.$rs->link_lang.'"' : '';
+ $count = abs((integer) $rs->link_count);
- # --BEHAVIOR-- cinecturlink2WidgetLinks
- $bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
+ # --BEHAVIOR-- cinecturlink2WidgetLinks
+ $bhv = $core->callBehavior('cinecturlink2WidgetLinks', $rs->link_id);
- $entries[] =
- '
'.
- ($w->withlink && !empty($url) ? '' : '').
- ''.$title.''.$note.'
'.
- ($w->showauthor ? $author.'
' : '').'
'.
- ''.
- $desc.
- ($w->withlink && !empty($url) ? '' : '').
- '
'.
+ ($w->withlink && !empty($url) ? '' : '').
+ ''.$title.''.$note.'
'.
+ ($w->showauthor ? $author.'
' : '').'
'.
+ ''.
+ $desc.
+ ($w->withlink && !empty($url) ? '' : '').
+ '
'.__('There is no link').'
'; - } - else { - $pager = new pager($page, $this->rs_count, $nb_per_page,10); + public function display($page, $nb_per_page, $url) + { + if ($this->rs->isEmpty()) { + echo ''.__('There is no link').'
'; + } + else { + $pager = new pager($page, $this->rs_count, $nb_per_page,10); - $pager->base_url = $url; + $pager->base_url = $url; - $html_block = - ''.__('Title').' | '. - ''.__('Author').' | '. - ''.__('Description').' | '. - ''.__('Links').' | '. - ''.__('Category').' | '. - ''.__('My rating').' | '. - ''.__('Date').' | '. - '
---|
'.__('Title').' | '. + ''.__('Author').' | '. + ''.__('Description').' | '. + ''.__('Links').' | '. + ''.__('Category').' | '. + ''.__('My rating').' | '. + ''.__('Date').' | '. + '
---|
'.__('Page(s)').' : '.$pager->getLinks().'
'; - $blocks = explode('%s',$html_block); - echo $blocks[0]; + echo ''.__('Page(s)').' : '.$pager->getLinks().'
'; + $blocks = explode('%s',$html_block); + echo $blocks[0]; - $this->rs->index(((integer)$page - 1) * $nb_per_page); - $iter = 0; - while ($iter < $nb_per_page) { - echo $this->linkLine($url,$iter); + $this->rs->index(((integer)$page - 1) * $nb_per_page); + $iter = 0; + while ($iter < $nb_per_page) { + echo $this->linkLine($url,$iter); - if ($this->rs->isEnd()) - break; - else - $this->rs->moveNext(); + if ($this->rs->isEnd()) + break; + else + $this->rs->moveNext(); - $iter++; - } - echo $blocks[1]; - echo ''.__('Page(s)').' : '.$pager->getLinks().'
'; - } - } + $iter++; + } + echo $blocks[1]; + echo ''.__('Page(s)').' : '.$pager->getLinks().'
'; + } + } - private function linkLine($url, $loop) - { - return - ''.__('Change note for this selection :').'
'; +'.__('Change note for this selection :').'
'; - foreach($_POST['links'] as $k => $link) { - echo - ''; - } + foreach($_POST['links'] as $k => $link) { + echo + ''; + } - echo ' -- '. - form::hidden(array('action'), 'change_links_note'). - $core->formNonce().' -
-+ '. + form::hidden(array('action'), 'change_links_note'). + $core->formNonce().' +
+'.__('There is no link').'
'; - } - else { - echo ' -'.__('There is no link').'
'; + } + else { + echo ' +'. - form::combo('sortby',$sortby_combo,$sortby).'
'. - ''. - form::combo('order',$order_combo,$order).'
'. - ''.__('Show').'
'. - ''. + form::combo('sortby',$sortby_combo,$sortby).'
'. + ''. + form::combo('order',$order_combo,$order).'
'. + ''.__('Show').'
'. + ''.
- form::hidden(array('p'), 'cinecturlink2').
- '
'.
+ form::hidden(array('p'), 'cinecturlink2').
+ '
'.__('Selected links action:').' '. - form::combo(array('action'),$links_action_combo).' - '. - form::hidden(array('sortby'),$sortby). - form::hidden(array('order'),$order). - form::hidden(array('page'),$page). - form::hidden(array('nb'),$nb_per_page). - $core->formNonce().' -
-'.__('Selected links action:').' '. + form::combo(array('action'),$links_action_combo).' + '. + form::hidden(array('sortby'),$sortby). + form::hidden(array('order'),$order). + form::hidden(array('page'),$page). + form::hidden(array('nb'),$nb_per_page). + $core->formNonce().' +
+'. - ''. - __('Search with Google').''. - '
+ -'. - ''. - __('Search with Amazon').''. - '
'; +'. + ''. + __('Search with Google').''. + '
- if (empty($medias_combo)) { - echo - ''.__('There is no image in cinecturlink media path.').'
'; - } - else { - echo ' - '. - ''.__('Go to media manager to add image to cinecturlink path.').'
'; - } +'. + ''. + __('Search with Amazon').''. + '
'; - echo ' + if (empty($medias_combo)) { + echo + ''.__('There is no image in cinecturlink media path.').'
'; + } + else { + echo ' + '. + ''.__('Go to media manager to add image to cinecturlink path.').'
'; + } -'. - form::hidden(array('link_id'),$upd_link_id). - form::hidden(array('action'),'create_link'). - $core->formNonce().' - -
-'. + form::hidden(array('link_id'),$upd_link_id). + form::hidden(array('action'),'create_link'). + $core->formNonce().' + +
+ +'.__('There is no category').'
'; - } - else { - echo ' -# | '.__('name').' | '.__('description').' |
---|
# | '.__('name').' | '.__('description').' | |
---|---|---|---|
'.form::field(array('catpos['.$id.']'),2,5,$i).' | -'.form::checkbox(array('delcat[]'),$id).' | -'.$title.' | -'.$desc.' | -
'.__('Check to delete').'
-'. - form::hidden('cats_order', ''). - form::hidden(array('action'), 'update_categories'). - $core->formNonce().' - -
-'.__('Check to delete').'
+'. + form::hidden('cats_order', ''). + form::hidden(array('action'), 'update_categories'). + $core->formNonce().' + +
+'. - form::hidden(array('action'), 'create_category'). - $core->formNonce().' - -
-'. + form::hidden(array('action'), 'create_category'). + $core->formNonce().' + +
+ +