diff --git a/_admin.php b/_admin.php
index 607304b..3826970 100644
--- a/_admin.php
+++ b/_admin.php
@@ -14,7 +14,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
-dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
+dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
require_once __DIR__ . '/_widgets.php';
@@ -22,15 +22,15 @@ $perm = dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id);
-if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
- && '' != dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_user
+if (dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
+ && '' != dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_user
) {
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('Feeds server'),
- dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer'),
- dcPage::getPF('zoneclearFeedServer/icon.svg'),
+ dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
+ dcPage::getPF(basename(__DIR__) . '/icon.svg'),
preg_match(
- '/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer')) . '(&.*)?$/',
+ '/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
$perm
@@ -94,9 +94,9 @@ class zcfsAdminBehaviors
{
$favs->register('zcfs', [
'title' => __('Feeds server'),
- 'url' => dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer'),
- 'small-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
- 'large-icon' => dcPage::getPF('zoneclearFeedServer/icon.svg'),
+ 'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
+ 'small-icon' => dcPage::getPF(basename(__DIR__) . '/icon.svg'),
+ 'large-icon' => dcPage::getPF(basename(__DIR__) . '/icon.svg'),
'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_USAGE,
dcAuth::PERMISSION_CONTENT_ADMIN,
@@ -120,9 +120,9 @@ class zcfsAdminBehaviors
}
$fav['title'] .= '
' . sprintf(__('%s feed disabled', '%s feeds disabled', $count), $count);
- $fav['large-icon'] = dcPage::getPF('zoneclearFeedServer/icon-pdate.svg');
+ $fav['large-icon'] = dcPage::getPF(basename(__DIR__) . '/icon-update.svg');
$fav['url'] = dcCore::app()->adminurl->get(
- 'admin.plugin.zoneclearFeedServer',
+ 'admin.plugin.' . basename(__DIR__),
['part' => 'feeds', 'sortby' => 'feed_status', 'order' => 'asc']
);
}
@@ -183,7 +183,7 @@ class zcfsAdminBehaviors
*/
public static function adminPostHeaders()
{
- return dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/post.js'));
+ return dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/post.js'));
}
/**
@@ -241,7 +241,7 @@ class zcfsAdminBehaviors
$edit = sprintf(
'
';
-if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
+if ($s->zoneclearFeedServer_pub_active) {
echo sprintf(
'
%s
',
$pub_page_url,
diff --git a/_define.php b/_define.php
index 6c399e3..11cd55d 100644
--- a/_define.php
+++ b/_define.php
@@ -25,8 +25,8 @@ $this->registerModule(
dcAuth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin',
- 'support' => 'https://github.com/JcDenis/zoneclearFeedServer',
- 'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
- 'repository' => 'https://raw.githubusercontent.com/JcDenis/zoneclearFeedServer/master/dcstore.xml',
+ 'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
+ 'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
]
);
diff --git a/_init.php b/_init.php
index 08fb0e0..6ea85cd 100644
--- a/_init.php
+++ b/_init.php
@@ -16,5 +16,5 @@ if (!defined('DC_RC_PATH')) {
class initZoneclearFeedServer
{
- public const FEED_TABLE_NAME = 'zc_feed';
+ public const TABLE_NAME = 'zc_feed';
}
diff --git a/_install.php b/_install.php
index 1e37a43..0c6bed5 100644
--- a/_install.php
+++ b/_install.php
@@ -25,7 +25,7 @@ try {
# Tables
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
- $t->{initZoneclearFeedServer::FEED_TABLE_NAME}
+ $t->{initZoneclearFeedServer::TABLE_NAME}
->feed_id('bigint', 0, false)
->feed_creadt('timestamp', 0, false, 'now()')
->feed_upddt('timestamp', 0, false, 'now()')
diff --git a/_public.php b/_public.php
index ff4405b..75ae30b 100644
--- a/_public.php
+++ b/_public.php
@@ -15,8 +15,8 @@ if (!defined('DC_RC_PATH')) {
}
# Namespace for settings
-dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer');
-$s = dcCore::app()->blog->settings->zoneclearFeedServer;
+dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
+$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
# Widgets
require_once __DIR__ . '/_widgets.php';
@@ -236,7 +236,7 @@ class zcfsRsExtPosts extends rsExtPost
public static function getURL(dcRecord $rs): string
{
$url = $rs->zcFeed('url');
- $types = @unserialize(dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_title_redir);
+ $types = @unserialize(dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_post_title_redir);
$full = is_array($types) && in_array(dcCore::app()->url->type, $types);
return $url && $full ?
@@ -257,7 +257,7 @@ class zcfsRsExtPosts extends rsExtPost
$content = self::zcFeedBrother('getContent', [&$rs, $absolute_urls]);
if ($url && $sitename && $rs->post_type == 'post') {
- $types = @unserialize(dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_post_full_tpl);
+ $types = @unserialize(dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_post_full_tpl);
if (is_array($types) && in_array(dcCore::app()->url->type, $types)) {
return $content . sprintf(
@@ -297,7 +297,7 @@ class zcfsUrlHandler extends dcUrlHandlers
*/
public static function zcFeedsPage($args)
{
- $s = dcCore::app()->blog->settings->zoneclearFeedServer;
+ $s = dcCore::app()->blog->settings->__get(basename(__DIR__));
# Not active
if (!$s->zoneclearFeedServer_active) {
diff --git a/_uninstall.php b/_uninstall.php
index 258861f..bdb75a5 100644
--- a/_uninstall.php
+++ b/_uninstall.php
@@ -14,15 +14,13 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
-$mod_id = 'zoneclearFeedServer';
-
$this->addUserAction(
/* type */
'settings',
/* action */
'delete_all',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
__('delete all settings')
);
@@ -32,7 +30,7 @@ $this->addUserAction(
/* action */
'delete',
/* ns */
- initZoneclearFeedServer::FEED_TABLE_NAME,
+ initZoneclearFeedServer::TABLE_NAME,
/* desc */
__('delete table')
);
@@ -42,7 +40,7 @@ $this->addUserAction(
/* action */
'delete',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
__('delete plugin files')
);
@@ -52,7 +50,7 @@ $this->addUserAction(
/* action */
'delete',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
__('delete the version number')
);
@@ -63,9 +61,9 @@ $this->addDirectAction(
/* action */
'delete_all',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
- sprintf(__('delete all %s settings'), $mod_id)
+ sprintf(__('delete all %s settings'), basename(__DIR__))
);
$this->addDirectAction(
/* type */
@@ -73,9 +71,9 @@ $this->addDirectAction(
/* action */
'delete',
/* ns */
- initZoneclearFeedServer::FEED_TABLE_NAME,
+ initZoneclearFeedServer::TABLE_NAME,
/* desc */
- sprintf(__('delete %s table'), $mod_id)
+ sprintf(__('delete %s table'), basename(__DIR__))
);
$this->addDirectAction(
/* type */
@@ -83,9 +81,9 @@ $this->addDirectAction(
/* action */
'delete',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
- sprintf(__('delete %s plugin files'), $mod_id)
+ sprintf(__('delete %s plugin files'), basename(__DIR__))
);
$this->addDirectAction(
/* type */
@@ -93,9 +91,9 @@ $this->addDirectAction(
/* action */
'delete',
/* ns */
- $mod_id,
+ basename(__DIR__),
/* desc */
- sprintf(__('delete %s version number'), $mod_id)
+ sprintf(__('delete %s version number'), basename(__DIR__))
);
$this->addDirectCallback(
/* function */
@@ -106,7 +104,7 @@ $this->addDirectCallback(
function zoneclearfeedServerUninstall($id)
{
- if ($id != 'zoneclearFeedServer') {
+ if ($id != basename(__DIR__)) {
return null;
}
//...
diff --git a/_widgets.php b/_widgets.php
index 92b5c75..405e890 100644
--- a/_widgets.php
+++ b/_widgets.php
@@ -152,7 +152,7 @@ class zoneclearFeedServerWidget
return null;
}
- if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
+ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|| !$w->checkHomeOnly(dcCore::app()->url->type)
) {
return null;
@@ -184,7 +184,7 @@ class zoneclearFeedServerWidget
$i++;
}
$pub = '';
- if ($w->pagelink && dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
+ if ($w->pagelink && dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_pub_active) {
$pub = sprintf(
'
%s
',
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
@@ -212,7 +212,7 @@ class zoneclearFeedServerWidget
return;
}
- if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
+ if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
|| !$w->checkHomeOnly(dcCore::app()->url->type)
) {
return null;
@@ -232,7 +232,7 @@ class zoneclearFeedServerWidget
$text = $count ? sprintf(__('one source', '%d sources', $count), $count) : __('no sources');
- if (dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_pub_active) {
+ if (dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_pub_active) {
$text = sprintf(
'
%s',
dcCore::app()->blog->url . dcCore::app()->url->getBase('zoneclearFeedsPage'),
diff --git a/inc/class.zoneclear.feed.server.php b/inc/class.zoneclear.feed.server.php
index a7efb55..ceeaf88 100644
--- a/inc/class.zoneclear.feed.server.php
+++ b/inc/class.zoneclear.feed.server.php
@@ -38,7 +38,7 @@ class zoneclearFeedServer
{
$this->con = dcCore::app()->con;
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
- $this->table = dcCore::app()->prefix . initZoneclearFeedServer::FEED_TABLE_NAME;
+ $this->table = dcCore::app()->prefix . initZoneclearFeedServer::TABLE_NAME;
}
/**
@@ -395,7 +395,7 @@ class zoneclearFeedServer
*/
public function checkFeedsUpdate($id = null, $throw = false)
{
- $s = dcCore::app()->blog->settings->zoneclearFeedServer;
+ $s = dcCore::app()->blog->settings->__get(basename(dirname('../' . __DIR__)));
# Not configured
if (!$s->zoneclearFeedServer_active || !$s->zoneclearFeedServer_user) {
diff --git a/inc/lib.zcfs.list.php b/inc/lib.zcfs.list.php
index e5f5e3e..16f5241 100644
--- a/inc/lib.zcfs.list.php
+++ b/inc/lib.zcfs.list.php
@@ -98,7 +98,7 @@ class zcfsFeedsList extends adminGenericList
$shunk_feed = substr($shunk_feed, 0, 50) . '...' . substr($shunk_feed, -20);
}
- $url = 'plugin.php?p=zoneclearFeedServer&part=feed&feed_id=' . $this->rs->feed_id;
+ $url = dcCore::app()->adminurl->get('admin.plugin.' . basename(dirname('../' . __DIR__)), ['part' => 'feed', 'feed_id' => $this->rs->feed_id]);
$cols = [
'check' => '
' .
diff --git a/index.php b/index.php
index e0242bc..b9b2e8b 100644
--- a/index.php
+++ b/index.php
@@ -28,8 +28,8 @@ dcPage::check(dcCore::app()->auth->makePermissions([
$zcfs = new zoneclearFeedServer();
# Not configured
-if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_active
- || !dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_user
+if (!dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_active
+ || !dcCore::app()->blog->settings->__get(basename(__DIR__))->zoneclearFeedServer_user
) {
echo
'' . __('Feeds server') . '' .
@@ -224,7 +224,7 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
__('Feed successfully updated.')
);
dcCore::app()->adminurl->redirect(
- 'admin.plugin.zoneclearFeedServer',
+ 'admin.plugin.' . basename(__DIR__),
['part' => 'feed', 'feed_id' => $feed_id]
);
} catch (Exception $e) {
@@ -244,7 +244,7 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
__('Feed successfully created.')
);
dcCore::app()->adminurl->redirect(
- 'admin.plugin.zoneclearFeedServer',
+ 'admin.plugin.' . basename(__DIR__),
['part' => 'feed', 'feed_id' => $return_id]
);
} catch (Exception $e) {
@@ -259,7 +259,7 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
$posts_actions_page = new dcPostsActions(
'plugin.php',
[
- 'p' => 'zoneclearFeedServer',
+ 'p' => basename(__DIR__),
'part' => 'feed',
'feed_id' => $feed_id,
'_ANCHOR' => 'entries',
@@ -309,8 +309,8 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
echo
'' . __('Feeds server') . '' .
($feed_id && !dcCore::app()->error->flag() ?
- $post_filter->js(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') .
- dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js'))
+ $post_filter->js(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feed', 'feed_id' => $feed_id], '&') . '#entries') .
+ dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/list.js'))
: '') .
dcPage::jsPageTabs() .
$next_headlink . "\n" . $prev_headlink .
@@ -426,7 +426,7 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
'
' .
- dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
+ dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), [
'part' => 'feed',
'feed_id' => $feed_id,
'action' => 'savefeed',
@@ -443,8 +443,8 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
# show filters
$post_filter->display(
- ['admin.plugin.zoneclearFeedServer','#entries'],
- dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', [
+ ['admin.plugin.' . basename(__DIR__),'#entries'],
+ dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), [
'part' => 'feed',
'feed_id' => $feed_id,
])
@@ -459,8 +459,8 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
$post_list->display(
$post_filter->page,
$post_filter->nb,
- dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', $args, '&') . '#entries',
- ' ',
@@ -489,7 +489,7 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
# actions
$feeds_actions_page = new zcfsFeedsActionsPage(
'plugin.php',
- ['p' => 'zoneclearFeedServer', 'part' => 'feeds']
+ ['p' => basename(__DIR__), 'part' => 'feeds']
);
if ($feeds_actions_page->process()) {
return null;
@@ -518,8 +518,8 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
# display
echo
'' . __('Feeds server') . '' .
- $feeds_filter->js(dcCore::app()->adminurl->get('admin.plugin.zoneclearFeedServer', ['part' => 'feeds'], '&')) .
- dcPage::jsLoad(dcPage::getPF('zoneclearFeedServer/js/list.js')) .
+ $feeds_filter->js(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__), ['part' => 'feeds'], '&')) .
+ dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/list.js')) .
dcPage::jsPageTabs() .
# --BEHAVIOR-- adminZoneclearFeedServerHeader
@@ -534,25 +534,25 @@ if (!dcCore::app()->blog->settings->zoneclearFeedServer->zoneclearFeedServer_act
dcPage::notices() .
'' .
- '' .
+ '' .
__('New feed') . ' ';
$feeds_filter->display(
- 'admin.plugin.zoneclearFeedServer',
- dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.zoneclearFeedServer', ['part' => 'feeds'])
+ 'admin.plugin.' . basename(__DIR__),
+ dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . basename(__DIR__), ['part' => 'feeds'])
);
$feeds_list->feedsDisplay(
$feeds_filter->page,
$feeds_filter->nb,
- ' |