Commit bf7ca46a authored by lphuberdeau's avatar lphuberdeau

[ENH] Converting libraries to dependency injection

parent 58edd7d1
......@@ -17,6 +17,12 @@
<service id="tiki.lib.attribute" class="AttributeLib">
<file>%kernel.root_dir%/lib/attributes/attributelib.php</file>
</service>
<service id="tiki.lib.banner" class="BannerLib">
<file>%kernel.root_dir%/lib/banners/bannerlib.php</file>
</service>
<service id="tiki.lib.bigbluebutton" class="BigBlueButtonLib">
<file>%kernel.root_dir%/lib/bigbluebutton.php</file>
</service>
<service id="tiki.lib.blog" class="BlogLib">
<file>%kernel.root_dir%/lib/blogs/bloglib.php</file>
</service>
......@@ -35,9 +41,18 @@
<service id="tiki.lib.contribution" class="ContributionLib">
<file>%kernel.root_dir%/lib/contribution/contributionlib.php</file>
</service>
<service id="tiki.lib.cart" class="CartLib">
<file>%kernel.root_dir%/lib/payment/cartlib.php</file>
</service>
<service id="tiki.lib.css" class="cssLib">
<file>%kernel.root_dir%/lib/csslib.php</file>
</service>
<service id="tiki.lib.dcs" class="DCSLib">
<file>%kernel.root_dir%/lib/dcs/dcslib.php</file>
</service>
<service id="tiki.lib.edit" class="EditLib">
<file>%kernel.root_dir%/lib/wiki/editlib.php</file>
</service>
<service id="tiki.lib.federatedsearch" class="FederatedSearchLib">
<file>%kernel.root_dir%/lib/search/federatedsearchlib.php</file>
<argument type="service" id="tiki.lib.unifiedsearch"/>
......@@ -51,6 +66,18 @@
<service id="tiki.lib.freetag" class="FreetagLib">
<file>%kernel.root_dir%/lib/freetag/freetaglib.php</file>
</service>
<service id="tiki.lib.geo" class="GeoLib">
<file>%kernel.root_dir%/lib/geo/geolib.php</file>
</service>
<service id="tiki.lib.goal" class="GoalLib">
<file>%kernel.root_dir%/lib/goal/goallib.php</file>
</service>
<service id="tiki.lib.goalevent" class="GoalEventLib">
<file>%kernel.root_dir%/lib/goal/goaleventlib.php</file>
</service>
<service id="tiki.lib.goalreward" class="GoalRewardLib">
<file>%kernel.root_dir%/lib/goalrewardlib.php</file>
</service>
<service id="tiki.lib.hist" class="HistLib">
<file>%kernel.root_dir%/lib/wiki/histlib.php</file>
</service>
......@@ -78,15 +105,24 @@
<service id="tiki.lib.notification" class="NotificationLib">
<file>%kernel.root_dir%/lib/notifications/notificationlib.php</file>
</service>
<service id="tiki.lib.oauth" class="OAuthLib">
<file>%kernel.root_dir%/lib/oauthlib.php</file>
</service>
<service id="tiki.lib.object" class="ObjectLib">
<file>%kernel.root_dir%/lib/objectlib.php</file>
</service>
<service id="tiki.lib.objectselector" class="Tiki\Object\Selector">
<argument type="service" id="tiki.lib.object"/>
</service>
<service id="tiki.lib.pagecontent" class="PageContentLib">
<file>%kernel.root_dir%/lib/rss/pagecontentlib.php</file>
</service>
<service id="tiki.lib.quantify" class="QuantifyLib">
<file>%kernel.root_dir%/lib/wiki/quantifylib.php</file>
</service>
<service id="tiki.lib.queue" class="QueueLib">
<file>%kernel.root_dir%/lib/queuelib.php</file>
</service>
<service id="tiki.lib.rating" class="RatingLib">
<file>%kernel.root_dir%/lib/rating/ratinglib.php</file>
</service>
......@@ -96,6 +132,9 @@
<service id="tiki.lib.relation" class="RelationLib">
<file>%kernel.root_dir%/lib/attributes/relationlib.php</file>
</service>
<service id="tiki.lib.rss" class="RSSLib">
<file>%kernel.root_dir%/lib/rss/rsslib.php</file>
</service>
<service id="tiki.lib.score" class="ScoreLib">
<file>%kernel.root_dir%/lib/score/scorelib.php</file>
</service>
......@@ -109,6 +148,9 @@
<service id="tiki.lib.sheet" class="SheetLib">
<file>%kernel.root_dir%/lib/sheet/sheetlib.php</file>
</service>
<service id="tiki.lib.storedsearch" class="StoredSearchLib">
<file>%kernel.root_dir%/lib/search/storedsearchlib.php</file>
</service>
<service id="tiki.lib.struct" class="StructLib">
<file>%kernel.root_dir%/lib/structures/structlib.php</file>
</service>
......@@ -131,7 +173,9 @@
<service id="tiki.lib.wiki" class="WikiLib">
<file>%kernel.root_dir%/lib/wiki/wikilib.php</file>
</service>
<service id="tiki.lib.zotero" class="ZoteroLib">
<file>%kernel.root_dir%/lib/zoterolib.php</file>
</service>
<service id="tiki.wiki.slug.underscore" class="Tiki\Wiki\SlugManager\UnderscoreGenerator">
<tag name="tiki.wiki.slug.generator"/>
</service>
......
......@@ -420,4 +420,3 @@ class BannerLib extends TikiLib
return true;
}
}
global $bannerlib; $bannerlib = new BannerLib;
......@@ -472,6 +472,3 @@ class BigBlueButtonLib
}
}
global $bigbluebuttonlib;
$bigbluebuttonlib = new BigBlueButtonLib;
......@@ -369,4 +369,3 @@ class DCSLib extends TikiLib
return $contentId;
}
}
global $dcslib; $dcslib = new DCSLib;
......@@ -198,4 +198,3 @@ class GeoLib
}
}
$geolib = new GeoLib;
......@@ -893,5 +893,3 @@ class RSSLib extends TikiDb_Bridge
return $writer;
}
}
global $rsslib;
$rsslib = new RSSLib;
......@@ -24,7 +24,7 @@ class EditLibTest extends TikiTestCase
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -10,8 +10,6 @@
*
*/
require_once 'lib/wiki/editlib.php';
class EditLib_ParseToWiki_CharacterTest extends TikiTestCase
{
......@@ -27,7 +25,7 @@ class EditLib_ParseToWiki_CharacterTest extends TikiTestCase
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -10,8 +10,6 @@
*
*/
require_once 'lib/wiki/editlib.php';
class EditLib_ParseToWiki_LinkTest extends TikiTestCase
{
private $dir = ''; // the unmodifed directory
......@@ -27,7 +25,7 @@ class EditLib_ParseToWiki_LinkTest extends TikiTestCase
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -24,7 +24,7 @@ class EditLib_ParseToWiki_ListTest extends TikiTestCase
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -25,7 +25,7 @@ class EditLib_ParseToWiki_TextTest extends TikiTestCase
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -22,9 +22,9 @@ class EditLib_ParseToWysiwyg_CharacterTest extends TikiTestCase
function setUp()
{
TikiLib::lib('edit');
$_SERVER['HTTP_HOST'] = ''; // editlib expects that HTTP_HOST is defined
require_once 'lib/wiki/editlib.php';
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -24,9 +24,9 @@ class EditLib_ParseToWysiwyg_ListTest extends TikiTestCase
function setUp()
{
TikiLib::lib('edit');
$_SERVER['HTTP_HOST'] = ''; // editlib expects that HTTP_HOST is defined
require_once 'lib/wiki/editlib.php';
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -25,7 +25,7 @@ private $el = null; // the EditLib
function setUp()
{
require_once 'lib/wiki/editlib.php';
TikiLib::lib('edit');
$this->el = new EditLib();
chdir($this->dir);
chdir('../../'); // the tiki installation directory
......
......@@ -5,7 +5,7 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
require_once 'lib/payment/cartlib.php';
TikiLib::lib('cart');
class Payment_CartTest extends TikiTestCase
{
......
......@@ -71,21 +71,9 @@ class TikiLib extends TikiDb_Bridge
case 'header':
global $headerlib; require_once 'lib/headerlib.php';
return self::$libraries[$name] = $headerlib;
case 'zotero':
require_once 'lib/zoterolib.php';
return self::$libraries[$name] = new ZoteroLib;
case 'oauth':
require_once 'lib/oauthlib.php';
return self::$libraries[$name] = new OAuthLib;
case 'geo':
global $geolib; require_once 'lib/geo/geolib.php';
return self::$libraries[$name] = $geolib;
case 'poll':
global $polllib; require_once 'lib/polls/polllib.php';
return self::$libraries[$name] = $polllib;
case 'queue':
require_once 'lib/queuelib.php';
return self::$libraries[$name] = new QueueLib;
case 'captcha':
global $captchalib; require_once 'lib/captcha/captchalib.php';
return self::$libraries[$name] = $captchalib;
......@@ -95,15 +83,6 @@ class TikiLib extends TikiDb_Bridge
case 'validators':
global $validatorslib; include_once('lib/validatorslib.php');
return self::$libraries[$name] = $validatorslib;
case 'rss':
global $rsslib; include_once('lib/rss/rsslib.php');
return self::$libraries[$name] = $rsslib;
case 'pagecontent':
global $rsslib; include_once('lib/rss/pagecontentlib.php');
return self::$libraries[$name] = new PageContentLib;
case 'storedsearch':
include_once('lib/search/storedsearchlib.php');
return self::$libraries[$name] = new StoredSearchLib;
case 'searchstats':
global $searchstatslib; include_once('lib/search/searchstatslib.php');
return self::$libraries[$name] = $searchstatslib;
......@@ -132,12 +111,6 @@ class TikiLib extends TikiDb_Bridge
return self::$libraries[$name] = new Tiki_Connect_Client();
case 'connect_server':
return self::$libraries[$name] = new Tiki_Connect_Server();
case 'bigbluebutton':
global $bigbluebuttonlib; require_once 'lib/bigbluebuttonlib.php';
return self::$libraries[$name] = $bigbluebuttonlib;
case 'edit':
global $editlib; require_once 'lib/wiki/editlib.php';
return self::$libraries[$name] = $editlib;
case 'scorm':
require_once 'lib/filegals/scormlib.php';
return self::$libraries[$name] = new ScormLib;
......@@ -166,12 +139,6 @@ class TikiLib extends TikiDb_Bridge
case 'tcontrol':
global $tcontrollib; require_once 'lib/themecontrol/tcontrol.php';
return self::$libraries[$name] = $tcontrollib;
case 'dcs':
global $dcslib; require_once 'lib/dcs/dcslib.php';
return self::$libraries[$name] = $dcslib;
case 'banner':
global $bannerlib; require_once 'lib/banners/bannerlib.php';
return self::$libraries[$name] = $bannerlib;
case 'kalturauser':
require_once 'lib/videogals/kalturalib.php';
return self::$libraries[$name] = new KalturaLib(KalturaLib::SESSION_USER);
......@@ -217,18 +184,6 @@ class TikiLib extends TikiDb_Bridge
case 'payment':
global $paymentlib; require_once 'lib/payment/paymentlib.php';
return self::$libraries[$name] = $paymentlib;
case 'cart':
require_once 'lib/payment/cartlib.php';
return self::$libraries[$name] = new CartLib();
case 'goal':
require_once 'lib/goal/goallib.php';
return self::$libraries[$name] = new GoalLib();
case 'goalevent':
require_once 'lib/goal/eventlib.php';
return self::$libraries[$name] = new GoalEventLib();
case 'goalreward':
require_once 'lib/goal/rewardlib.php';
return self::$libraries[$name] = new GoalRewardLib();
case 'credits':
global $creditslib; require_once 'lib/credits/creditslib.php';
return self::$libraries[$name] = $creditslib;
......
......@@ -113,8 +113,8 @@ function wikiplugin_rss_info()
function wikiplugin_rss($data,$params)
{
global $smarty;
global $rsslib; require_once 'lib/rss/rsslib.php';
$smarty = TikiLib::lib('smarty');
$rsslib = TikiLib::lib('rss');
$params = array_merge(
array(
......
......@@ -1264,6 +1264,3 @@ class EditLib
}
}
global $editlib;
$editlib = new EditLib;
......@@ -6,9 +6,8 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
require_once ('lib/calendar/calendarlib.php');
$rsslib = TikiLib::lib('rss');
$calendarlib = TikiLib::lib('calendar');
if (!isset($prefs['feed_calendar']) || $prefs['feed_calendar'] != 'y') {
$errmsg=tra("rss feed disabled");
......
......@@ -9,8 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
if ($prefs['feed_directories'] != 'y') {
$errmsg = tra("rss feed disabled");
require_once ('tiki-rss_error.php');
......
......@@ -9,9 +9,8 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/directory/dirlib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
if ($prefs['feed_directories'] != 'y') {
$errmsg = tra("rss feed disabled");
require_once ('tiki-rss_error.php');
......
......@@ -9,8 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
$access->check_feature('feature_file_galleries');
......
......@@ -9,8 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
if ($prefs['feed_file_gallery'] != 'y') {
$errmsg=tra("rss feed disabled");
......
......@@ -9,8 +9,7 @@
// $Id$
require_once('tiki-setup.php');
require_once('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
if ($prefs['feed_forum'] != 'y') {
$errmsg=tra("rss feed disabled");
......
......@@ -9,8 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
$access->check_feature('feature_forums');
......
......@@ -9,8 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
$access->check_feature('feature_maps');
if ($prefs['rss_mapfiles'] != 'y') {
$errmsg = tra("rss feed disabled");
......
......@@ -134,7 +134,7 @@ if (isset($_REQUEST["remove"])) {
$nllib->remove_edition($_REQUEST["nlId"], $_REQUEST["remove"]);
}
include_once ('lib/wiki/editlib.php');
$editlib = TikiLib::lib('edit');
// wysiwyg decision
include_once ('lib/setup/editmode.php');
......
......@@ -10,7 +10,7 @@
require_once ('tiki-setup.php');
require_once ('lib/shoutbox/shoutboxlib.php');
require_once ('lib/rss/rsslib.php');
$rsslib = TikiLib::lib('rss');
$access->check_feature('feature_shoutbox');
......
......@@ -9,10 +9,9 @@
// $Id$
require_once ('tiki-setup.php');
require_once ('lib/tikilib.php');
$trklib = TikiLib::lib('trk');
require_once ('lib/rss/rsslib.php');
require_once ('lib/smarty_tiki/modifier.sefurl.php');
$rsslib = TikiLib::lib('rss');
$smarty->loadPlugin('smarty_modifier_sefurl');
if ($prefs['feed_tracker'] != 'y') {
$errmsg = tra("rss feed disabled");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment