use abstract plugin id and settings ns
This commit is contained in:
parent
e538e23c93
commit
59a603437c
22 changed files with 169 additions and 185 deletions
94
_admin.php
94
_admin.php
|
@ -14,24 +14,24 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
return null;
|
||||
}
|
||||
|
||||
dcCore::app()->blog->settings->addNamespace('kUtRL');
|
||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
|
||||
require_once __DIR__ . '/_widgets.php';
|
||||
|
||||
# Plugin menu
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
__('Links shortener'),
|
||||
dcCore::app()->adminurl->get('admin.plugin.kUtRL'),
|
||||
urldecode(dcPage::getPF('kUtRL/icon.svg')),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.kUtRL')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
urldecode(dcPage::getPF(basename(__DIR__) . '/icon.svg')),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id)
|
||||
);
|
||||
|
||||
# Admin behaviors
|
||||
if (dcCore::app()->blog->settings->kUtRL->kutrl_active) {
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminKutrl', 'antispamDashboardFavorites']);
|
||||
dcCore::app()->addBehavior('adminColumnsListsV2', ['adminKutrl', 'adminColumnsLists']);
|
||||
dcCore::app()->addBehavior('adminFiltersListsV2', ['adminKutrl', 'adminFiltersLists']);
|
||||
if (dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', ['adminKutrl', 'antispamDashboardFavoritesV2']);
|
||||
dcCore::app()->addBehavior('adminColumnsListsV2', ['adminKutrl', 'adminColumnsListsV2']);
|
||||
dcCore::app()->addBehavior('adminFiltersListsV2', ['adminKutrl', 'adminFiltersListsV2']);
|
||||
dcCore::app()->addBehavior('adminPostHeaders', ['adminKutrl', 'adminPostHeaders']);
|
||||
dcCore::app()->addBehavior('adminPostFormItems', ['adminKutrl', 'adminPostFormItems']);
|
||||
dcCore::app()->addBehavior('adminAfterPostUpdate', ['adminKutrl', 'adminAfterPostUpdate']); // update existing short url
|
||||
|
@ -41,11 +41,11 @@ if (dcCore::app()->blog->settings->kUtRL->kutrl_active) {
|
|||
dcCore::app()->addBehavior('adminPostsActions', ['adminKutrl', 'adminPostsActions']);
|
||||
}
|
||||
|
||||
dcCore::app()->addBehavior('exportFullV2', ['backupKutrl', 'exportFull']);
|
||||
dcCore::app()->addBehavior('exportSingleV2', ['backupKutrl', 'exportSingle']);
|
||||
dcCore::app()->addBehavior('importInitV2', ['backupKutrl', 'importInit']);
|
||||
dcCore::app()->addBehavior('importSingleV2', ['backupKutrl', 'importSingle']);
|
||||
dcCore::app()->addBehavior('importFullV2', ['backupKutrl', 'importFull']);
|
||||
dcCore::app()->addBehavior('exportFullV2', ['backupKutrl', 'exportFullV2']);
|
||||
dcCore::app()->addBehavior('exportSingleV2', ['backupKutrl', 'exportSingleV2']);
|
||||
dcCore::app()->addBehavior('importInitV2', ['backupKutrl', 'importInitV2']);
|
||||
dcCore::app()->addBehavior('importSingleV2', ['backupKutrl', 'importSingleV2']);
|
||||
dcCore::app()->addBehavior('importFullV2', ['backupKutrl', 'importFullV2']);
|
||||
|
||||
# Admin behaviors class
|
||||
class adminKutrl
|
||||
|
@ -60,21 +60,21 @@ class adminKutrl
|
|||
];
|
||||
}
|
||||
|
||||
public static function antispamDashboardFavorites(dcFavorites $favs)
|
||||
public static function antispamDashboardFavoritesV2(dcFavorites $favs)
|
||||
{
|
||||
$favs->register(
|
||||
'kUtRL',
|
||||
[
|
||||
'title' => __('Links shortener'),
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.kUtRL'),
|
||||
'small-icon' => dcPage::getPF('kUtRL/icon.png'),
|
||||
'large-icon' => dcPage::getPF('kUtRL/icon-b.png'),
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)),
|
||||
'small-icon' => dcPage::getPF(basename(__DIR__) . '/icon.png'),
|
||||
'large-icon' => dcPage::getPF(basename(__DIR__) . '/icon-b.png'),
|
||||
'permissions' => dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public static function adminColumnsLists($cols)
|
||||
public static function adminColumnsListsV2($cols)
|
||||
{
|
||||
$cols['kUtRL'] = [
|
||||
__('Links shortener'),
|
||||
|
@ -86,7 +86,7 @@ class adminKutrl
|
|||
];
|
||||
}
|
||||
|
||||
public static function adminFiltersLists($sorts)
|
||||
public static function adminFiltersListsV2($sorts)
|
||||
{
|
||||
$sorts['kUtRL'] = [
|
||||
__('Links shortener'),
|
||||
|
@ -99,14 +99,14 @@ class adminKutrl
|
|||
|
||||
public static function adminPostHeaders()
|
||||
{
|
||||
return dcPage::jsLoad(dcPage::getPF('kUtRL/js/posts.js'));
|
||||
return dcPage::jsModuleLoad(basename(__DIR__) . '/js/posts.js');
|
||||
}
|
||||
|
||||
public static function adminPostFormItems($main_items, $sidebar_items, $post)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->kutrl_active || !$s->kutrl_admin_service) {
|
||||
if (!$s->get('kutrl_active') || !$s->get('kutrl_admin_service')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
|
@ -125,19 +125,19 @@ class adminKutrl
|
|||
form::hidden(['kutrl_old_post_url'], $post_url);
|
||||
|
||||
if (!$rs) {
|
||||
if (empty($_POST['kutrl_old_post_url']) && $s->kutrl_admin_entry_default) {
|
||||
if (empty($_POST['kutrl_old_post_url']) && $s->get('kutrl_admin_entry_default')) {
|
||||
$chk = true;
|
||||
} else {
|
||||
$chk = !empty($_POST['kutrl_create']);
|
||||
}
|
||||
$ret .= '<p><label class="classic">' .
|
||||
form::checkbox('kutrl_create', 1, $chk, '', 3) . ' ' .
|
||||
form::checkbox('kutrl_create', 1, $chk, '', '3') . ' ' .
|
||||
__('Create short link') . '</label></p>';
|
||||
|
||||
if ($kut->allow_custom_hash) {
|
||||
$ret .= '<p class="classic">' .
|
||||
'<label for="custom">' . __('Custom short link:') . ' ' .
|
||||
form::field('kutrl_create_custom', 32, 32, '', 3) .
|
||||
form::field('kutrl_create_custom', 32, 32, '', '3') .
|
||||
'</label></p>';
|
||||
}
|
||||
} else {
|
||||
|
@ -152,7 +152,7 @@ class adminKutrl
|
|||
$href = $kut->url_base . $rs->hash;
|
||||
|
||||
$ret .= '<p><label class="classic">' .
|
||||
form::checkbox('kutrl_delete', 1, !empty($_POST['kutrl_delete']), '', 3) . ' ' .
|
||||
form::checkbox('kutrl_delete', 1, !empty($_POST['kutrl_delete']), '', '3') . ' ' .
|
||||
__('Delete short link') . '</label></p>' .
|
||||
'<p><a href="' . $href . '" ' . 'title="' . $title . '">' . $href . '</a></p>';
|
||||
}
|
||||
|
@ -163,10 +163,8 @@ class adminKutrl
|
|||
|
||||
public static function adminAfterPostUpdate($cur, $post_id)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
# Create: see adminAfterPostCreate
|
||||
if (!empty($_POST['kutrl_create']) || !$s->kutrl_active) {
|
||||
if (!empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
|
@ -200,7 +198,7 @@ class adminKutrl
|
|||
|
||||
$kut->remove($old_post_url);
|
||||
|
||||
$rs = $kut->hash($new_post_url, $custom); // better to update (not yet implemented)
|
||||
$rs = $kut->hash($new_post_url, '');//$custom); // better to update (not yet implemented)
|
||||
$url = $kut->url_base . $rs->hash;
|
||||
|
||||
# ex: Send new url to messengers
|
||||
|
@ -212,11 +210,10 @@ class adminKutrl
|
|||
|
||||
public static function adminAfterPostCreate($cur, $post_id)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
if (empty($_POST['kutrl_create']) || !$s->kutrl_active) {
|
||||
if (empty($_POST['kutrl_create']) || !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
return null;
|
||||
}
|
||||
|
@ -241,11 +238,10 @@ class adminKutrl
|
|||
|
||||
public static function adminBeforePostDelete($post_id)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
if (!$s->kutrl_active) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
return null;
|
||||
}
|
||||
|
@ -260,9 +256,7 @@ class adminKutrl
|
|||
|
||||
public static function adminPostsActions(dcPostsActions $pa)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
if (!$s->kutrl_active
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')
|
||||
|| !dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]), dcCore::app()->blog->id)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -279,10 +273,6 @@ class adminKutrl
|
|||
|
||||
public static function callbackCreate(dcPostsActions $pa, ArrayObject $post)
|
||||
{
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
# No entry
|
||||
$posts_ids = $pa->getIDs();
|
||||
if (empty($posts_ids)) {
|
||||
|
@ -294,6 +284,10 @@ class adminKutrl
|
|||
throw new Exception(__('No enough right'));
|
||||
}
|
||||
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
# retrieve posts info and create hash
|
||||
$posts = dcCore::app()->blog->getPosts(['post_id' => $posts_ids]);
|
||||
while ($posts->fetch()) {
|
||||
|
@ -317,6 +311,10 @@ class adminKutrl
|
|||
throw new Exception(__('No enough right'));
|
||||
}
|
||||
|
||||
if (null === ($kut = kUtRL::quickPlace('admin'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
# retrieve posts info and create hash
|
||||
$posts = dcCore::app()->blog->getPosts(['post_id' => $posts_ids]);
|
||||
while ($posts->fetch()) {
|
||||
|
@ -331,7 +329,7 @@ class adminKutrl
|
|||
# Import/export behaviors for Import/export plugin
|
||||
class backupKutrl
|
||||
{
|
||||
public static function exportSingle($exp, $blog_id)
|
||||
public static function exportSingleV2($exp, $blog_id)
|
||||
{
|
||||
$exp->export(
|
||||
'kutrl',
|
||||
|
@ -342,18 +340,18 @@ class backupKutrl
|
|||
);
|
||||
}
|
||||
|
||||
public static function exportFull($exp)
|
||||
public static function exportFullV2($exp)
|
||||
{
|
||||
$exp->exportTable('kutrl');
|
||||
}
|
||||
|
||||
public static function importInit($bk)
|
||||
public static function importInitV2($bk)
|
||||
{
|
||||
$bk->cur_kutrl = dcCore::app()->con->openCursor(dcCore::app()->prefix . initkUtRL::KURL_TABLE_NAME);
|
||||
$bk->kutrl = new kutrlLog();
|
||||
}
|
||||
|
||||
public static function importSingle($line, $bk)
|
||||
public static function importSingleV2($line, $bk)
|
||||
{
|
||||
if ($line->__name == 'kutrl') {
|
||||
# Do nothing if str/type exists !
|
||||
|
@ -363,7 +361,7 @@ class backupKutrl
|
|||
}
|
||||
}
|
||||
|
||||
public static function importFull($line, $bk)
|
||||
public static function importFullV2($line, $bk)
|
||||
{
|
||||
if ($line->__name == 'kutrl') {
|
||||
$bk->cur_kutrl->clean();
|
||||
|
|
22
_config.php
22
_config.php
|
@ -18,7 +18,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
dcPage::check(dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_ADMIN]));
|
||||
|
||||
# Settings
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
# Default values
|
||||
$img_green = '<img src="images/check-on.png" alt="ok" />';
|
||||
|
@ -32,15 +32,15 @@ foreach (kUtRL::getServices() as $service_id => $service) {
|
|||
$ext_services_combo = array_merge([__('Disabled') => ''], $services_combo);
|
||||
$lst_services_combo = array_merge(['-' => ''], $services_combo);
|
||||
|
||||
$s_active = (bool) $s->kutrl_active;
|
||||
$s_plugin_service = (string) $s->kutrl_plugin_service;
|
||||
$s_admin_service = (string) $s->kutrl_admin_service;
|
||||
$s_tpl_service = (string) $s->kutrl_tpl_service;
|
||||
$s_wiki_service = (string) $s->kutrl_wiki_service;
|
||||
$s_allow_external_url = (bool) $s->kutrl_allow_external_url;
|
||||
$s_tpl_passive = (bool) $s->kutrl_tpl_passive;
|
||||
$s_tpl_active = (bool) $s->kutrl_tpl_active;
|
||||
$s_admin_entry_default = (string) $s->kutrl_admin_entry_default;
|
||||
$s_active = (bool) $s->get('kutrl_active');
|
||||
$s_plugin_service = (string) $s->get('kutrl_plugin_service');
|
||||
$s_admin_service = (string) $s->get('kutrl_admin_service');
|
||||
$s_tpl_service = (string) $s->get('kutrl_tpl_service');
|
||||
$s_wiki_service = (string) $s->get('kutrl_wiki_service');
|
||||
$s_allow_external_url = (bool) $s->get('kutrl_allow_external_url');
|
||||
$s_tpl_passive = (bool) $s->get('kutrl_tpl_passive');
|
||||
$s_tpl_active = (bool) $s->get('kutrl_tpl_active');
|
||||
$s_admin_entry_default = (string) $s->get('kutrl_admin_entry_default');
|
||||
|
||||
if (!empty($_POST['save'])) {
|
||||
try {
|
||||
|
@ -79,7 +79,7 @@ if (!empty($_POST['save'])) {
|
|||
|
||||
dcCore::app()->adminurl->redirect(
|
||||
'admin.plugins',
|
||||
['module' => 'kUtRL', 'conf' => 1, 'chk' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
|
||||
['module' => basename(__DIR__), 'conf' => 1, 'chk' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
dcCore::app()->error->add($e->getMessage());
|
||||
|
|
|
@ -17,7 +17,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
try {
|
||||
# Compare versions
|
||||
if (!dcCore::app()->newVersion(
|
||||
basename(__DIR__),
|
||||
basename(__DIR__),
|
||||
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
||||
)) {
|
||||
return null;
|
||||
|
@ -46,8 +46,8 @@ try {
|
|||
$changes = $ti->synchronize($t);
|
||||
|
||||
# Settings
|
||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||
$s = dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
|
||||
$s->put('kutrl_active', false, 'boolean', 'Enabled kutrl plugin', false, true);
|
||||
$s->put('kutrl_plugin_service', 'default', 'string', 'Service to use to shorten links on third part plugins', false, true);
|
||||
$s->put('kutrl_admin_service', 'local', 'string', 'Service to use to shorten links on admin', false, true);
|
||||
|
|
52
_public.php
52
_public.php
|
@ -18,11 +18,11 @@ require_once __DIR__ . '/_widgets.php';
|
|||
|
||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), __DIR__ . '/default-templates');
|
||||
|
||||
dcCore::app()->addBehavior('publicBeforeDocumentV2', ['pubKutrl', 'publicBeforeDocument']);
|
||||
dcCore::app()->addBehavior('publicBeforeDocumentV2', ['pubKutrl', 'publicBeforeDocumentV2']);
|
||||
dcCore::app()->addBehavior('publicHeadContent', ['pubKutrl', 'publicHeadContent']);
|
||||
dcCore::app()->addBehavior('publicBeforeContentFilterV2', ['pubKutrl', 'publicBeforeContentFilter']);
|
||||
dcCore::app()->addBehavior('templateBeforeValueV2', ['pubKutrl', 'templateBeforeValue']);
|
||||
dcCore::app()->addBehavior('templateAfterValueV2', ['pubKutrl', 'templateAfterValue']);
|
||||
dcCore::app()->addBehavior('publicBeforeContentFilterV2', ['pubKutrl', 'publicBeforeContentFilterV2']);
|
||||
dcCore::app()->addBehavior('templateBeforeValueV2', ['pubKutrl', 'templateBeforeValueV2']);
|
||||
dcCore::app()->addBehavior('templateAfterValueV2', ['pubKutrl', 'templateAfterValueV2']);
|
||||
|
||||
dcCore::app()->tpl->addBlock('kutrlPageIf', ['tplKutrl', 'pageIf']);
|
||||
dcCore::app()->tpl->addBlock('kutrlMsgIf', ['tplKutrl', 'pageMsgIf']);
|
||||
|
@ -50,10 +50,8 @@ class urlKutrl extends dcUrlHandlers
|
|||
# Redirect !!! local !!! service only
|
||||
public static function redirectUrl($args)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
# Not active, go to default 404
|
||||
if (!$s->kutrl_active) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
|
@ -90,7 +88,7 @@ class urlKutrl extends dcUrlHandlers
|
|||
}
|
||||
# Not find, go to kutrl 404
|
||||
if (false === ($url = $kut->getUrl($args))) {
|
||||
//$_ctx->kutrl_msg = 'Failed to find short link.';
|
||||
//dcCore::app()->ctx->kutrl_msg = 'Failed to find short link.';
|
||||
//self::pageKutrl($kut);
|
||||
self::kutrl404();
|
||||
|
||||
|
@ -111,16 +109,16 @@ class urlKutrl extends dcUrlHandlers
|
|||
|
||||
private static function pageKutrl($kut)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
# Not active, go to default 404
|
||||
if (!$s->kutrl_active) {
|
||||
if (!$s->get('kutrl_active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
}
|
||||
# Public page not active, go to kutrl 404
|
||||
if (!$s->kutrl_srv_local_public) {
|
||||
if (!$s->get('kutrl_srv_local_public')) {
|
||||
self::kutrl404();
|
||||
|
||||
return null;
|
||||
|
@ -220,7 +218,7 @@ class urlKutrl extends dcUrlHandlers
|
|||
|
||||
protected static function kutrl404()
|
||||
{
|
||||
if (!dcCore::app()->blog->settings->kUtRL->kutrl_srv_local_404_active) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_srv_local_404_active')) {
|
||||
self::p404();
|
||||
|
||||
return null;
|
||||
|
@ -257,37 +255,37 @@ class pubKutrl
|
|||
];
|
||||
|
||||
# Disable URL shoretning on filtered tag
|
||||
public static function templateBeforeValue($tag, $attr)
|
||||
public static function templateBeforeValueV2($tag, $attr)
|
||||
{
|
||||
if (!empty($attr['disable_kutrl']) && in_array($tag, pubKutrl::$know_tags)) {
|
||||
return '<?php $GLOBALS["disable_kutrl"] = true; ?>';
|
||||
return '<?php dcCore::app()->ctx->__set("disable_kutrl", true); ?>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Re unable it after tag
|
||||
public static function templateAfterValue($tag, $attr)
|
||||
public static function templateAfterValueV2($tag, $attr)
|
||||
{
|
||||
if (!empty($attr['disable_kutrl']) && in_array($tag, pubKutrl::$know_tags)) {
|
||||
return '<?php $GLOBALS["disable_kutrl"] = false; ?>';
|
||||
return '<?php dcCore::app()->ctx->__set("disable_kutrl", false); ?>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Replace long urls on the fly (on filter) for default tags
|
||||
public static function publicBeforeContentFilter($tag, $args)
|
||||
public static function publicBeforeContentFilterV2($tag, $args)
|
||||
{
|
||||
# Unknow tag
|
||||
if (!in_array($tag, pubKutrl::$know_tags)) {
|
||||
return null;
|
||||
}
|
||||
# URL shortening is disabled by tag attribute
|
||||
if (empty($GLOBALS['disable_kutrl'])) {
|
||||
if (true !== dcCore::app()->ctx->__get('disable_kutrl')) {
|
||||
# kUtRL is not activated
|
||||
if (!dcCore::app()->blog->settings->kUtRL->kutrl_active
|
||||
|| !dcCore::app()->blog->settings->kUtRL->kutrl_tpl_active
|
||||
if (!dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_active')
|
||||
|| !dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_tpl_active')
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -311,14 +309,14 @@ class pubKutrl
|
|||
}
|
||||
}
|
||||
|
||||
public static function publicBeforeDocument()
|
||||
public static function publicBeforeDocumentV2()
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
# Passive : all kutrl tag return long url
|
||||
dcCore::app()->ctx->kutrl_passive = (bool) $s->kutrl_tpl_passive;
|
||||
dcCore::app()->ctx->kutrl_passive = (bool) $s->get('kutrl_tpl_passive');
|
||||
|
||||
if (!$s->kutrl_active || !$s->kutrl_tpl_service) {
|
||||
if (!$s->get('kutrl_active') || !$s->get('kutrl_tpl_service')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('tpl'))) {
|
||||
|
@ -327,9 +325,9 @@ class pubKutrl
|
|||
dcCore::app()->ctx->kutrl = $kut;
|
||||
}
|
||||
|
||||
public static function publicHeadContent($core)
|
||||
public static function publicHeadContent($_)
|
||||
{
|
||||
$css = dcCore::app()->blog->settings->kUtRL->kutrl_srv_local_css;
|
||||
$css = dcCore::app()->blog->settings->get(basename(__DIR__))->get('kutrl_srv_local_css');
|
||||
if ($css) {
|
||||
echo
|
||||
"\n<!-- CSS for kUtRL --> \n" .
|
||||
|
@ -355,7 +353,7 @@ class tplKutrl
|
|||
|
||||
if (isset($attr['is_active'])) {
|
||||
$sign = (bool) $attr['is_active'] ? '' : '!';
|
||||
$if[] = $sign . 'dcCore::app()->blog->settings->kUtRL->kutrl_srv_local_public';
|
||||
$if[] = $sign . 'dcCore::app()->blog->settings->get("kUtRL")->get("kutrl_srv_local_public")';
|
||||
}
|
||||
if (empty($if)) {
|
||||
return $content;
|
||||
|
|
|
@ -20,7 +20,7 @@ $this->addUserAction(
|
|||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
__('delete all settings')
|
||||
);
|
||||
|
@ -42,7 +42,7 @@ $this->addUserAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
__('delete plugin files')
|
||||
);
|
||||
|
@ -53,7 +53,7 @@ $this->addUserAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
__('delete the version number')
|
||||
);
|
||||
|
@ -67,7 +67,7 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete all %s settings'), 'kUtRL')
|
||||
);
|
||||
|
@ -78,7 +78,7 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete %s version number'), 'kUtRL')
|
||||
);
|
||||
|
@ -89,7 +89,7 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
'kUtRL',
|
||||
basename(__DIR__),
|
||||
/* description */
|
||||
sprintf(__('delete %s plugin files'), 'kUtRL')
|
||||
);
|
||||
|
|
10
_widgets.php
10
_widgets.php
|
@ -114,10 +114,10 @@ class widgetKutrl
|
|||
|
||||
public static function publicShorten($w)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->kutrl_active
|
||||
|| !$s->kutrl_srv_local_public
|
||||
if (!$s->get('kutrl_active')
|
||||
|| !$s->get('kutrl_srv_local_public')
|
||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
||||
|| dcCore::app()->url->type == 'kutrl') {
|
||||
return null;
|
||||
|
@ -151,9 +151,9 @@ class widgetKutrl
|
|||
|
||||
public static function publicRank($w)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
$s = dcCore::app()->blog->settings->get(basename(__DIR__));
|
||||
|
||||
if (!$s->kutrl_active || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
if (!$s->get('kutrl_active') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class kUtRL
|
|||
if (!in_array($place, ['tpl', 'wiki', 'admin', 'plugin'])) {
|
||||
return null;
|
||||
}
|
||||
$id = dcCore::app()->blog->settings->kUtRL->get('kutrl_' . $place . '_service');
|
||||
$id = dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_' . $place . '_service');
|
||||
if (!empty($id)) {
|
||||
return self::quickService($id);
|
||||
}
|
||||
|
|
|
@ -16,24 +16,16 @@ if (!defined('DC_RC_PATH')) {
|
|||
return null;
|
||||
}
|
||||
|
||||
dcCore::app()->activityReport->addGroup('kutrl', __('Plugin kUtRL'));
|
||||
dcCore::app()->__get('activityReport')->addGroup('kutrl', __('Plugin kUtRL'));
|
||||
|
||||
# from BEHAVIOR kutrlAfterCreateShortUrl in kUtRL/inc/lib.kutrl.srv.php
|
||||
dcCore::app()->activityReport->addAction(
|
||||
dcCore::app()->__get('activityReport')->addAction(
|
||||
'kutrl',
|
||||
'create',
|
||||
__('Short link creation'),
|
||||
__('New short link of type "%s" and hash "%s" was created.'),
|
||||
'kutrlAfterCreateShortUrl',
|
||||
['kutrlActivityReportBehaviors', 'kutrlCreate']
|
||||
);
|
||||
|
||||
class kutrlActivityReportBehaviors
|
||||
{
|
||||
public static function kutrlCreate($rs)
|
||||
{
|
||||
$logs = [$rs->type,$rs->hash];
|
||||
|
||||
dcCore::app()->activityReport->addLog('kutrl', 'create', $logs);
|
||||
function ($rs) {
|
||||
dcCore::app()->__get('activityReport')->addLog('kutrl', 'create', [$rs->type, $rs->hash]);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -105,16 +105,16 @@ class kutrlLinkslist
|
|||
}
|
||||
|
||||
$cols = [
|
||||
'check' => '<td class="nowrap">' .
|
||||
form::checkbox(['entries[]'], $this->rs->kut_id, ['checked' => isset($entries[$this->rs->kut_id])]) .
|
||||
'check' => '<td class="nowrap">' .
|
||||
form::checkbox(['entries[]'], $this->rs->kut_id, ['checked' => $checked]) .
|
||||
'</td>',
|
||||
'kut_url' => '<td class="maximal" scope="row">' .
|
||||
'kut_url' => '<td class="maximal" scope="row">' .
|
||||
'<a href="' . $this->rs->kut_url . '">' . $this->rs->kut_url . '</a>' .
|
||||
'</td>',
|
||||
'kut_hash' => '<td class="nowrap">' .
|
||||
'kut_hash' => '<td class="nowrap">' .
|
||||
$hash .
|
||||
'</td>',
|
||||
'kut_dt' => '<td class="nowrap count">' .
|
||||
'kut_dt' => '<td class="nowrap count">' .
|
||||
dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->kut_dt, dcCore::app()->auth->getInfo('user_tz')) .
|
||||
'</td>',
|
||||
'kut_service' => '<td class="nowrap">' .
|
||||
|
|
|
@ -22,7 +22,7 @@ class kutrlService
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->settings = dcCore::app()->blog->settings->kUtRL;
|
||||
$this->settings = dcCore::app()->blog->settings->get(basename(dirname(__DIR__)));
|
||||
$this->log = new kutrlLog();
|
||||
$this->error = new dcError();
|
||||
//$this->error->setHTMLFormat('%s', "%s\n");
|
||||
|
@ -30,24 +30,24 @@ class kutrlService
|
|||
$this->init();
|
||||
|
||||
// Force setting
|
||||
$allow_external_url = $this->settings->kutrl_allow_external_url;
|
||||
$allow_external_url = $this->settings->get('kutrl_allow_external_url');
|
||||
$this->config['$allow_external_url'] = null === $allow_external_url ?
|
||||
true : $allow_external_url;
|
||||
|
||||
$this->config = array_merge(
|
||||
[
|
||||
'id' => 'undefined',
|
||||
'name' => 'undefined',
|
||||
'home' => '',
|
||||
'id' => 'undefined',
|
||||
'name' => 'undefined',
|
||||
'home' => '',
|
||||
|
||||
'allow_external_url' => true,
|
||||
'allow_custom_hash' => false,
|
||||
'allow_protocols' => ['http://'],
|
||||
|
||||
'url_test' => 'http://dotclear.jcdenis.com/go/kUtRL',
|
||||
'url_api' => '',
|
||||
'url_base' => '',
|
||||
'url_min_len' => 0,
|
||||
'url_test' => 'http://dotclear.jcdenis.com/go/kUtRL',
|
||||
'url_api' => '',
|
||||
'url_base' => '',
|
||||
'url_min_len' => 0,
|
||||
],
|
||||
$this->config
|
||||
);
|
||||
|
|
|
@ -20,12 +20,10 @@ class kutrlWiki
|
|||
{
|
||||
public static function coreInitWiki($wiki2xhtml)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
# Do nothing on comment preview and post preview
|
||||
if (!empty($_POST['preview'])
|
||||
|| isset(dcCore::app()->ctx) && dcCore::app()->ctx->preview
|
||||
|| !$s->kutrl_active
|
||||
|| !dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_active')
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
@ -42,9 +40,7 @@ class kutrlWiki
|
|||
|
||||
public static function transform($url, $content)
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->kUtRL;
|
||||
|
||||
if (!$s->kutrl_active) {
|
||||
if (!dcCore::app()->blog->settings->get(basename(dirname(__DIR__)))->get('kutrl_active')) {
|
||||
return null;
|
||||
}
|
||||
if (null === ($kut = kUtRL::quickPlace('wiki'))) {
|
||||
|
|
|
@ -24,7 +24,7 @@ class bilbolinksKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$base = (string) $this->settings->kutrl_srv_bilbolinks_base;
|
||||
$base = (string) $this->settings->get('kutrl_srv_bilbolinks_base');
|
||||
if (!empty($base) && substr($base, -1, 1) != '/') {
|
||||
$base .= '/';
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class bilbolinksKutrlService extends kutrlService
|
|||
echo
|
||||
'<p><label class="classic">' .
|
||||
__('Url of the service:') . '<br />' .
|
||||
form::field(['kutrl_srv_bilbolinks_base'], 50, 255, $this->settings->kutrl_srv_bilbolinks_base) .
|
||||
form::field(['kutrl_srv_bilbolinks_base'], 50, 255, $this->settings->get('kutrl_srv_bilbolinks_base')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is the root URL of the "bilbolinks" service you want to use. Ex: "http://tux-pla.net/".') .
|
||||
|
|
|
@ -17,13 +17,13 @@ if (!defined('DC_RC_PATH')) {
|
|||
class bitlyKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'bitly',
|
||||
'name' => 'bit.ly',
|
||||
'home' => 'https://bit.ly',
|
||||
'id' => 'bitly',
|
||||
'name' => 'bit.ly',
|
||||
'home' => 'https://bit.ly',
|
||||
|
||||
'url_api' => 'https://api-ssl.bitly.com/v4/',
|
||||
'url_base' => 'https://bit.ly/',
|
||||
'url_min_len' => 25,
|
||||
'url_api' => 'https://api-ssl.bitly.com/v4/',
|
||||
'url_base' => 'https://bit.ly/',
|
||||
'url_min_len' => 25,
|
||||
|
||||
'allow_protocols' => ['http://', 'https://'],
|
||||
];
|
||||
|
|
|
@ -23,7 +23,7 @@ class customKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$config = unserialize(base64_decode((string) $this->settings->kutrl_srv_custom));
|
||||
$config = unserialize(base64_decode((string) $this->settings->get('kutrl_srv_custom')));
|
||||
if (!is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class customKutrlService extends kutrlService
|
|||
'url_param' => '',
|
||||
'url_encode' => true,
|
||||
];
|
||||
$config = unserialize(base64_decode((string) $this->settings->kutrl_srv_custom));
|
||||
$config = unserialize(base64_decode((string) $this->settings->get('kutrl_srv_custom')));
|
||||
if (!is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
|
|
@ -24,16 +24,16 @@ class defaultKutrlService extends kutrlService
|
|||
protected function init()
|
||||
{
|
||||
$this->config = [
|
||||
'id' => 'default',
|
||||
'name' => 'Default',
|
||||
'home' => '',
|
||||
'id' => 'default',
|
||||
'name' => 'Default',
|
||||
'home' => '',
|
||||
|
||||
'url_api' => SHORTEN_SERVICE_API,
|
||||
'url_base' => SHORTEN_SERVICE_BASE,
|
||||
'url_min_len' => strlen(SHORTEN_SERVICE_BASE) + 2,
|
||||
|
||||
'url_param' => SHORTEN_SERVICE_PARAM,
|
||||
'url_encode' => SHORTEN_SERVICE_ENCODE,
|
||||
'url_param' => SHORTEN_SERVICE_PARAM,
|
||||
'url_encode' => SHORTEN_SERVICE_ENCODE,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ if (!defined('DC_RC_PATH')) {
|
|||
class isgdKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'isgd',
|
||||
'name' => 'is.gd',
|
||||
'home' => 'http://is.gd/',
|
||||
'id' => 'isgd',
|
||||
'name' => 'is.gd',
|
||||
'home' => 'http://is.gd/',
|
||||
|
||||
'url_api' => 'http://is.gd/api.php',
|
||||
'url_base' => 'http://is.gd/',
|
||||
|
|
|
@ -17,16 +17,16 @@ if (!defined('DC_RC_PATH')) {
|
|||
class localKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'local',
|
||||
'name' => 'kUtRL',
|
||||
'home' => 'https://github.com/JcDenis/kUtRL',
|
||||
'id' => 'local',
|
||||
'name' => 'kUtRL',
|
||||
'home' => 'https://github.com/JcDenis/kUtRL',
|
||||
|
||||
'allow_custom_hash' => true,
|
||||
];
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$protocols = (string) $this->settings->kutrl_srv_local_protocols;
|
||||
$protocols = (string) $this->settings->get('kutrl_srv_local_protocols');
|
||||
$this->config['allow_protocols'] = empty($protocols) ? [] : explode(',', $protocols);
|
||||
|
||||
$this->config['url_base'] = dcCore::app()->blog->url . dcCore::app()->url->getBase('kutrl') . '/';
|
||||
|
@ -49,7 +49,7 @@ class localKutrlService extends kutrlService
|
|||
'<p><strong>' . __('Settings:') . '</strong></p>' .
|
||||
'<p><label class="classic">' .
|
||||
__('Allowed protocols:') . '<br />' .
|
||||
form::field(['kutrl_srv_local_protocols'], 50, 255, $this->settings->kutrl_srv_local_protocols) .
|
||||
form::field(['kutrl_srv_local_protocols'], 50, 255, $this->settings->get('kutrl_srv_local_protocols')) .
|
||||
'</label></p>' .
|
||||
|
||||
'<p class="form-note">' .
|
||||
|
@ -57,17 +57,17 @@ class localKutrlService extends kutrlService
|
|||
'</p>' .
|
||||
|
||||
'<p><label class="classic">' .
|
||||
form::checkbox(['kutrl_srv_local_public'], '1', $this->settings->kutrl_srv_local_public) . ' ' .
|
||||
form::checkbox(['kutrl_srv_local_public'], '1', $this->settings->get('kutrl_srv_local_public')) . ' ' .
|
||||
__('Enable public page for visitors to shorten links') .
|
||||
'</label></p>' .
|
||||
|
||||
'<p class="area" id="style-area"><label for="_style">' . __('CSS:') . '</label>' .
|
||||
form::textarea('kutrl_srv_local_css', 50, 3, html::escapeHTML($this->settings->kutrl_srv_local_css), '', '2') .
|
||||
form::textarea('kutrl_srv_local_css', 50, 3, html::escapeHTML($this->settings->get('kutrl_srv_local_css')), '', '2') .
|
||||
'</p>' .
|
||||
'<p class="form-note">' . __('You can add here special cascading style sheet. Body of page has class "dc-kutrl" and widgets have class "shortenkutrlwidget" and "rankkutrlwidget".') . '</p>' .
|
||||
|
||||
'<p><label class="classic">' .
|
||||
form::checkbox(['kutrl_srv_local_404_active'], '1', $this->settings->kutrl_srv_local_404_active) . ' ' .
|
||||
form::checkbox(['kutrl_srv_local_404_active'], '1', $this->settings->get('kutrl_srv_local_404_active')) . ' ' .
|
||||
__('Enable special 404 error public page for unknow urls') .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' . __('If this is not activated, the default 404 page of the theme will be display.') . '</p>' .
|
||||
|
|
|
@ -17,9 +17,9 @@ if (!defined('DC_RC_PATH')) {
|
|||
class shorttoKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'shortto',
|
||||
'name' => 'short.to',
|
||||
'home' => 'http://short.to',
|
||||
'id' => 'shortto',
|
||||
'name' => 'short.to',
|
||||
'home' => 'http://short.to',
|
||||
|
||||
'url_api' => 'http://short.to/s.txt',
|
||||
'url_base' => 'http://short.to/',
|
||||
|
|
|
@ -17,9 +17,9 @@ if (!defined('DC_RC_PATH')) {
|
|||
class suprKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'supr',
|
||||
'name' => 'su.pr StumbleUpon',
|
||||
'home' => 'http://su.pr',
|
||||
'id' => 'supr',
|
||||
'name' => 'su.pr StumbleUpon',
|
||||
'home' => 'http://su.pr',
|
||||
|
||||
'url_api' => 'http://su.pr/api/',
|
||||
'url_base' => 'http://su.pr/',
|
||||
|
@ -35,8 +35,8 @@ class suprKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['login'] = $this->settings->kutrl_srv_supr_login;
|
||||
$this->args['apiKey'] = $this->settings->kutrl_srv_supr_apikey;
|
||||
$this->args['login'] = $this->settings->get('kutrl_srv_supr_login');
|
||||
$this->args['apiKey'] = $this->settings->get('kutrl_srv_supr_apikey');
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
|
@ -49,13 +49,13 @@ class suprKutrlService extends kutrlService
|
|||
{
|
||||
echo
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_supr_login'], 50, 255, $this->settings->kutrl_srv_supr_login) .
|
||||
form::field(['kutrl_srv_supr_login'], 50, 255, $this->settings->get('kutrl_srv_supr_login')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
sprintf(__('This is your login to sign up to %s'), $this->config['name']) .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('API Key:') . '<br />' .
|
||||
form::field(['kutrl_srv_supr_apikey'], 50, 255, $this->settings->kutrl_srv_supr_apikey) .
|
||||
form::field(['kutrl_srv_supr_apikey'], 50, 255, $this->settings->get('kutrl_srv_supr_apikey')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
sprintf(__('This is your personnal %s API key. You can find it on your account page.'), $this->config['name']) .
|
||||
|
|
|
@ -17,9 +17,9 @@ if (!defined('DC_RC_PATH')) {
|
|||
class trimKutrlService extends kutrlService
|
||||
{
|
||||
protected $config = [
|
||||
'id' => 'trim',
|
||||
'name' => 'tr.im',
|
||||
'home' => 'http://tr.im',
|
||||
'id' => 'trim',
|
||||
'name' => 'tr.im',
|
||||
'home' => 'http://tr.im',
|
||||
|
||||
'url_api' => 'http://api.tr.im/v1/',
|
||||
'url_base' => 'http://tr.im/',
|
||||
|
@ -35,10 +35,10 @@ class trimKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->kutrl_srv_trim_username;
|
||||
$this->args['password'] = $this->settings->kutrl_srv_trim_password;
|
||||
$this->args['username'] = $this->settings->get('kutrl_srv_trim_username');
|
||||
$this->args['password'] = $this->settings->get('kutrl_srv_trim_password');
|
||||
|
||||
$this->api_rate_time = (int) $this->settings->kutrl_srv_trim_apiratetime;
|
||||
$this->api_rate_time = (int) $this->settings->get('kutrl_srv_trim_apiratetime');
|
||||
}
|
||||
|
||||
public function saveSettings()
|
||||
|
@ -51,13 +51,13 @@ class trimKutrlService extends kutrlService
|
|||
{
|
||||
echo
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_trim_username'], 50, 255, $this->settings->kutrl_srv_trim_username) .
|
||||
form::field(['kutrl_srv_trim_username'], 50, 255, $this->settings->get('kutrl_srv_trim_username')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your login to sign up to tr.im.') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Password:') . '<br />' .
|
||||
form::field(['kutrl_srv_trim_password'], 50, 255, $this->settings->kutrl_srv_trim_password) .
|
||||
form::field(['kutrl_srv_trim_password'], 50, 255, $this->settings->get('kutrl_srv_trim_password')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your password to sign up to tr.im.') .
|
||||
|
|
|
@ -31,10 +31,10 @@ class yourlsKutrlService extends kutrlService
|
|||
|
||||
protected function init()
|
||||
{
|
||||
$this->args['username'] = $this->settings->kutrl_srv_yourls_username;
|
||||
$this->args['password'] = $this->settings->kutrl_srv_yourls_password;
|
||||
$this->args['username'] = $this->settings->get('kutrl_srv_yourls_username');
|
||||
$this->args['password'] = $this->settings->get('kutrl_srv_yourls_password');
|
||||
|
||||
$base = (string) $this->settings->kutrl_srv_yourls_base;
|
||||
$base = (string) $this->settings->get('kutrl_srv_yourls_base');
|
||||
//if (!empty($base) && substr($base,-1,1) != '/') $base .= '/';
|
||||
|
||||
$this->config['url_api'] = $base;
|
||||
|
@ -54,19 +54,19 @@ class yourlsKutrlService extends kutrlService
|
|||
echo
|
||||
'<p><label class="classic">' .
|
||||
__('Url of the service:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_base'], 50, 255, $this->settings->kutrl_srv_yourls_base) .
|
||||
form::field(['kutrl_srv_yourls_base'], 50, 255, $this->settings->get('kutrl_srv_yourls_base')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is the URL of the YOURLS service you want to use. Ex: "http://www.smaller.org/api.php".') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Login:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_username'], 50, 255, $this->settings->kutrl_srv_yourls_username) .
|
||||
form::field(['kutrl_srv_yourls_username'], 50, 255, $this->settings->get('kutrl_srv_yourls_username')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your user name to sign up to this YOURLS service.') .
|
||||
'</p>' .
|
||||
'<p><label class="classic">' . __('Password:') . '<br />' .
|
||||
form::field(['kutrl_srv_yourls_password'], 50, 255, $this->settings->kutrl_srv_yourls_password) .
|
||||
form::field(['kutrl_srv_yourls_password'], 50, 255, $this->settings->get('kutrl_srv_yourls_password')) .
|
||||
'</label></p>' .
|
||||
'<p class="form-note">' .
|
||||
__('This is your password to sign up to this YOURLS service.') .
|
||||
|
|
|
@ -175,7 +175,7 @@ if ($part == 'link') {
|
|||
]) .
|
||||
dcPage::notices();
|
||||
|
||||
if (null === $kut) {
|
||||
if (!isset($kut) || null === $kut) {
|
||||
echo '<p>' . __('You must set an admin service.') . '</p>';
|
||||
} else {
|
||||
echo '
|
||||
|
|
Loading…
Reference in a new issue