2021-08-25 23:06:22 +00:00
|
|
|
<?php
|
|
|
|
# -- BEGIN LICENSE BLOCK ----------------------------------
|
|
|
|
# This file is part of kUtRL, a plugin for Dotclear 2.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2009-2011 JC Denis and contributors
|
|
|
|
# jcdenis@gdwd.com
|
|
|
|
#
|
|
|
|
# Licensed under the GPL version 2.0 license.
|
|
|
|
# A copy of this license is available in LICENSE file or at
|
|
|
|
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
# -- END LICENSE BLOCK ------------------------------------
|
|
|
|
|
2021-08-25 23:34:34 +00:00
|
|
|
if (!defined('DC_RC_PATH')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (version_compare(str_replace("-r", "-p", DC_VERSION), '2.2-alpha', '<')) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-25 23:06:22 +00:00
|
|
|
|
|
|
|
global $__autoload, $core;
|
|
|
|
|
|
|
|
# Set a URL shortener for quick get request
|
|
|
|
if (!defined('SHORTEN_SERVICE_NAME')) {
|
2021-08-25 23:34:34 +00:00
|
|
|
define('SHORTEN_SERVICE_NAME', 'Is.gd');
|
2021-08-25 23:06:22 +00:00
|
|
|
}
|
|
|
|
if (!defined('SHORTEN_SERVICE_API')) {
|
2021-08-25 23:34:34 +00:00
|
|
|
define('SHORTEN_SERVICE_API', 'http://is.gd/api.php?');
|
2021-08-25 23:06:22 +00:00
|
|
|
}
|
|
|
|
if (!defined('SHORTEN_SERVICE_BASE')) {
|
2021-08-25 23:34:34 +00:00
|
|
|
define('SHORTEN_SERVICE_BASE', 'http://is.gd/');
|
2021-08-25 23:06:22 +00:00
|
|
|
}
|
|
|
|
if (!defined('SHORTEN_SERVICE_PARAM')) {
|
2021-08-25 23:34:34 +00:00
|
|
|
define('SHORTEN_SERVICE_PARAM', 'longurl');
|
2021-08-25 23:06:22 +00:00
|
|
|
}
|
|
|
|
if (!defined('SHORTEN_SERVICE_ENCODE')) {
|
2021-08-25 23:34:34 +00:00
|
|
|
define('SHORTEN_SERVICE_ENCODE', false);
|
2021-08-25 23:06:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Main class
|
2021-08-25 23:34:34 +00:00
|
|
|
$d = dirname(__FILE__) . '/inc/';
|
|
|
|
$__autoload['kutrl'] = $d . 'class.kutrl.php';
|
|
|
|
$__autoload['kutrlService'] = $d . 'lib.kutrl.srv.php';
|
|
|
|
$__autoload['kutrlLog'] = $d . 'lib.kutrl.log.php';
|
2021-08-25 23:06:22 +00:00
|
|
|
|
|
|
|
# Services
|
2021-08-25 23:34:34 +00:00
|
|
|
$__autoload['bilbolinksKutrlService'] = $d . 'services/class.bilbolinks.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["bilbolinks","bilbolinksKutrlService"]; } );
|
2021-08-27 23:52:03 +00:00
|
|
|
//$__autoload['bitlyKutrlService'] = $d . 'services/class.bitly.service.php';
|
|
|
|
//$core->addBehavior('kutrlService', function() { return ["bitly","bitlyKutrlService"]; } );
|
2021-08-25 23:34:34 +00:00
|
|
|
$__autoload['customKutrlService'] = $d . 'services/class.custom.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["custom","customKutrlService"]; } );
|
|
|
|
$__autoload['defaultKutrlService'] = $d . 'services/class.default.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["default","defaultKutrlService"]; } );
|
2021-08-27 23:52:03 +00:00
|
|
|
//$__autoload['googlKutrlService'] = $d . 'services/class.googl.service.php';
|
|
|
|
//$core->addBehavior('kutrlService', function() { return ["googl","googlKutrlService"]; } );
|
2021-08-25 23:34:34 +00:00
|
|
|
$__autoload['isgdKutrlService'] = $d . 'services/class.isgd.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["isgd","isgdKutrlService"]; } );
|
|
|
|
$__autoload['localKutrlService'] = $d . 'services/class.local.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["local","localKutrlService"]; } );
|
2021-08-27 23:52:03 +00:00
|
|
|
//$__autoload['shorttoKutrlService'] = $d . 'services/class.shortto.service.php';
|
|
|
|
//$core->addBehavior('kutrlService', function() { return ["shortto","shorttoKutrlService"]; } );
|
|
|
|
//$__autoload['trimKutrlService'] = $d . 'services/class.trim.service.php';
|
|
|
|
//$core->addBehavior('kutrlService', function() { return ["trim","trimKutrlService"]; } );
|
2021-08-25 23:34:34 +00:00
|
|
|
$__autoload['yourlsKutrlService'] = $d . 'services/class.yourls.service.php';
|
|
|
|
$core->addBehavior('kutrlService', function() { return ["yourls","yourlsKutrlService"]; } );
|
2021-08-27 23:52:03 +00:00
|
|
|
//$__autoload['suprKutrlService'] = $d . 'services/class.supr.service.php';
|
|
|
|
//$core->addBehavior('kutrlService', function() { return ["supr","suprKutrlService"]; } );
|
2021-08-25 23:06:22 +00:00
|
|
|
|
|
|
|
# Shorten url passed through wiki functions
|
2021-08-25 23:34:34 +00:00
|
|
|
$__autoload['kutrlWiki'] = $d . 'lib.wiki.kutrl.php';
|
|
|
|
$core->addBehavior('coreInitWikiPost',['kutrlWiki','coreInitWiki']);
|
|
|
|
$core->addBehavior('coreInitWikiComment',['kutrlWiki','coreInitWiki']);
|
|
|
|
$core->addBehavior('coreInitWikiSimpleComment',['kutrlWiki','coreInitWiki']);
|
2021-08-25 23:06:22 +00:00
|
|
|
|
|
|
|
# Public page
|
2021-08-25 23:34:34 +00:00
|
|
|
$core->url->register('kutrl', 'go', '^go(/(.*?)|)$', ['urlKutrl', 'redirectUrl']);
|
2021-08-25 23:06:22 +00:00
|
|
|
|
|
|
|
# Add kUtRL events on plugin activityReport
|
2021-08-25 23:34:34 +00:00
|
|
|
if (defined('ACTIVITY_REPORT')) {
|
|
|
|
require_once $d . 'lib.kutrl.activityreport.php';
|
|
|
|
}
|