Commit 061f5bcb authored by lphuberdeau's avatar lphuberdeau

[ENH] Conerting more libraries to dependency injection

parent 0fdf12ac
......@@ -59,6 +59,9 @@
<service id="tiki.lib.edit" class="EditLib">
<file>%kernel.root_dir%/lib/wiki/editlib.php</file>
</service>
<service id="tiki.lib.faq" class="FaqLib">
<file>%kernel.root_dir%/lib/faqs/faqlib.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"/>
......@@ -84,6 +87,9 @@
<service id="tiki.lib.goalreward" class="GoalRewardLib">
<file>%kernel.root_dir%/lib/goalrewardlib.php</file>
</service>
<service id="tiki.lib.groupalert" class="GroupAlertLib">
<file>%kernel.root_dir%/lib/groupalert/groupalertlib.php</file>
</service>
<service id="tiki.lib.hist" class="HistLib">
<file>%kernel.root_dir%/lib/wiki/histlib.php</file>
</service>
......@@ -188,6 +194,9 @@
<service id="tiki.lib.userprefs" class="UserPrefsLib">
<file>%kernel.root_dir%/lib/userprefs/userprefslib.php</file>
</service>
<service id="tiki.lib.validators" class="Validators">
<file>%kernel.root_dir%/lib/validatorslib.php</file>
</service>
<service id="tiki.lib.wiki" class="WikiLib">
<file>%kernel.root_dir%/lib/wiki/wikilib.php</file>
</service>
......
......@@ -372,4 +372,3 @@ class FaqLib extends TikiLib
return $res;
}
}
$faqlib = new FaqLib;
......@@ -1763,7 +1763,8 @@ class FileGalLib extends TikiLib
// If $galleryIdentifier is not given, default to the "default" / normal / "File Galleries" file galleries.
function getTreeHTML($galleryIdentifier = NULL)
{
global $prefs, $smarty;
global $prefs;
$smarty = TikiLib::lib('smarty');
require_once ('lib/tree/BrowseTreeMaker.php');
$galleryIdentifier = is_null($galleryIdentifier) ? $prefs['fgal_root_id'] : $galleryIdentifier;
$subGalleries = $this->getSubGalleries($galleryIdentifier);
......@@ -3419,7 +3420,7 @@ class FileGalLib extends TikiLib
$cat_name = empty($params['name'][$key]) ? $name : $params['name'][$key];
$cat_href = $aux['dllink'];
if ($prefs['feature_groupalert'] == 'y' && isset($params['listtoalert'])) {
global $groupalertlib; include_once ('lib/groupalert/groupalertlib.php');
$groupalertlib = TikiLib::lib('groupalert');
$groupalertlib->Notify($params['listtoalert'], "tiki-download_file.php?fileId=" . $fileId);
}
include_once ('categorize.php');
......
......@@ -90,5 +90,3 @@ class groupAlertLib extends TikiLib
}
}
}
global $groupalertlib;
$groupalertlib = new groupAlertLib;
......@@ -77,12 +77,6 @@ class TikiLib extends TikiDb_Bridge
case 'captcha':
global $captchalib; require_once 'lib/captcha/captchalib.php';
return self::$libraries[$name] = $captchalib;
case 'groupalert':
global $groupalertlib; require_once ('lib/groupalert/groupalertlib.php');
return self::$libraries[$name] = $groupalertlib;
case 'validators':
global $validatorslib; include_once('lib/validatorslib.php');
return self::$libraries[$name] = $validatorslib;
case 'searchstats':
global $searchstatslib; include_once('lib/search/searchstatslib.php');
return self::$libraries[$name] = $searchstatslib;
......@@ -111,9 +105,6 @@ class TikiLib extends TikiDb_Bridge
case 'usermodules':
global $usermoduleslib; require_once 'lib/usermodules/usermoduleslib.php';
return self::$libraries[$name] = $usermoduleslib;
case 'faq':
global $faqlib; require_once 'lib/faqs/faqlib.php';
return self::$libraries[$name] = $faqlib;
case 'quiz':
global $quizlib; require_once 'lib/quizzes/quizlib.php';
return self::$libraries[$name] = $quizlib;
......
......@@ -146,5 +146,3 @@ class Validators
}
}
global $validatorslib;
$validatorslib = new Validators;
......@@ -1206,15 +1206,14 @@ function wikiplugin_tracker($data, $params)
$smarty->assign('trackerEditFormId', $iTRACKER);
if (!empty($params['_ajax_form_ins_id'])) {
global $headerlib; // when called via AJAX take a copy of the JS so far to allow collection
$headerlib = TikiLib::lib('header');
$old_js['js'] = $headerlib->js; // of tracker form JS into a function to initialise it when the dialog is created
$old_js['jq_onready'] = $headerlib->jq_onready;
$headerlib->clear_js(); // so store existing js for later and clear
}
if ($prefs['feature_jquery'] == 'y' && $prefs['feature_jquery_validation'] == 'y') {
global $validatorslib;
include_once('lib/validatorslib.php');
$validatorslib = TikiLib::lib('validators');
$customvalidation = '';
$customvalidation_m = '';
if ($registration == 'y') {
......
......@@ -44,8 +44,9 @@ function module_last_validated_faq_questions_info()
*/
function module_last_validated_faq_questions($mod_reference, $module_params)
{
global $tikilib, $smarty;
global $faqlib; include_once('lib/faqs/faqlib.php');
$tikilib = TikiLib::lib('tiki');
$smarty = TikiLib::lib('smarty');
$faqlib = TikiLib::lib('faq');
$def = array('faqId'=>0, 'truncate'=>20);
$module_params = array_merge($def, $module_params);
$ranking = $faqlib->list_faq_questions($module_params['faqId'], 0, $mod_reference['rows'], 'created_desc', '');
......
......@@ -11,7 +11,7 @@
$section = 'faqs';
require_once ('tiki-setup.php');
include_once ('lib/faqs/faqlib.php');
$faqlib = TikiLib::lib('faq');
$access->check_feature('feature_faqs');
$access->check_permission('tiki_p_admin_faqs');
......
......@@ -10,7 +10,7 @@
$section = 'faqs';
require_once ('tiki-setup.php');
include_once ('lib/faqs/faqlib.php');
$faqlib = TikiLib::lib('faq');
$auto_query_args = array('offset', 'find', 'sort_mode', 'faqId');
$access->check_feature('feature_faqs');
$access->check_permission('tiki_p_view_faqs');
......
......@@ -18,7 +18,7 @@ $section = 'file_galleries';
require_once ('tiki-setup.php');
$access->check_feature(array('feature_file_galleries', 'feature_jquery_tooltips'));
$filegallib = TikiLib::lib('filegal');
include_once ('lib/stats/statslib.php');
$statslib = TikiLib::lib('stats');
if ($prefs['feature_categories'] == 'y') {
$categlib = TikiLib::lib('categ');
......@@ -30,7 +30,7 @@ if ($prefs['feature_file_galleries_templates'] == 'y') {
}
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
$groupalertlib = TikiLib::lib('groupalert');
}
$auto_query_args = array( 'galleryId'
......
......@@ -30,7 +30,7 @@ $access->check_feature('feature_file_galleries');
$filegallib = TikiLib::lib('filegal');
if ($prefs['feature_groupalert'] == 'y') {
include_once ('lib/groupalert/groupalertlib.php');
$groupalertlib = TikiLib::lib('groupalert');
}
@ini_set('max_execution_time', 0); //will not work in safe_mode is on
$auto_query_args = array('galleryId', 'fileId', 'filegals_manager', 'view', 'simpleMode', 'insertion_syntax');
......
......@@ -10,7 +10,7 @@
$section = 'faqs';
require_once ('tiki-setup.php');
include_once ('lib/faqs/faqlib.php');
$faqlib = TikiLib::lib('faq');
if ($prefs['feature_categories'] == 'y') {
$categlib = TikiLib::lib('categ');
}
......
......@@ -28,8 +28,7 @@ if (empty($_REQUEST["message"])) {
$_REQUEST["message"] = '';
}
global $validatorslib;
include_once('lib/validatorslib.php');
$validatorslib = TikiLib::lib('validators');
if (!in_array($_REQUEST['validator'], $validatorslib->available)) {
echo '{}';
......
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