From 8256aea4cddff1e51b3aa9611c43b29011dbabef Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Thu, 26 Dec 2013 12:57:32 +0000 Subject: [PATCH] Use autoload for \Mibew\Settings class --- src/mibew/b.php | 4 ++++ src/mibew/client.php | 4 ++++ src/mibew/cron.php | 5 ++++- src/mibew/libs/chat.php | 5 ++++- .../libs/classes/{settings.php => Mibew/Settings.php} | 5 +++++ src/mibew/libs/classes/chat_style.php | 3 +++ src/mibew/libs/classes/invitation_style.php | 3 +++ src/mibew/libs/classes/page_style.php | 3 +++ src/mibew/libs/classes/thread.php | 3 +++ src/mibew/libs/classes/thread_processor.php | 3 +++ src/mibew/libs/classes/users_processor.php | 3 +++ src/mibew/libs/common/request.php | 4 ++++ src/mibew/libs/getcode.php | 3 +++ src/mibew/libs/groups.php | 3 +++ src/mibew/libs/init.php | 1 - src/mibew/libs/invitation.php | 3 +++ src/mibew/libs/operator.php | 8 +++++--- src/mibew/libs/settings.php | 3 +++ src/mibew/libs/statistics.php | 3 +++ src/mibew/libs/track.php | 4 ++++ src/mibew/libs/userinfo.php | 3 +++ src/mibew/mail.php | 4 ++++ src/mibew/operator/agent.php | 4 ++++ src/mibew/operator/avatar.php | 4 ++++ src/mibew/operator/features.php | 4 ++++ src/mibew/operator/getcode.php | 4 ++++ src/mibew/operator/groups.php | 4 ++++ src/mibew/operator/index.php | 4 ++++ src/mibew/operator/performance.php | 4 ++++ src/mibew/operator/settings.php | 4 ++++ src/mibew/operator/statistics.php | 4 ++++ src/mibew/operator/tracked.php | 4 ++++ src/mibew/operator/users.php | 4 ++++ src/mibew/widget.php | 4 ++++ 34 files changed, 122 insertions(+), 6 deletions(-) rename src/mibew/libs/classes/{settings.php => Mibew/Settings.php} (98%) diff --git a/src/mibew/b.php b/src/mibew/b.php index 929221e1..24b938bd 100644 --- a/src/mibew/b.php +++ b/src/mibew/b.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(__FILE__).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); diff --git a/src/mibew/client.php b/src/mibew/client.php index ca99ab46..88440868 100644 --- a/src/mibew/client.php +++ b/src/mibew/client.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(__FILE__).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); diff --git a/src/mibew/cron.php b/src/mibew/cron.php index 64962329..c7400805 100644 --- a/src/mibew/cron.php +++ b/src/mibew/cron.php @@ -15,7 +15,10 @@ * limitations under the License. */ -// Initialize librariess +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(__FILE__).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/thread.php'); require_once(MIBEW_FS_ROOT.'/libs/track.php'); diff --git a/src/mibew/libs/chat.php b/src/mibew/libs/chat.php index 5c9237e9..5cb6d3a0 100644 --- a/src/mibew/libs/chat.php +++ b/src/mibew/libs/chat.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(MIBEW_FS_ROOT.'/libs/track.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/thread.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/mibew_api.php'); @@ -29,7 +33,6 @@ require_once(MIBEW_FS_ROOT.'/libs/classes/style.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/chat_style.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/page_style.php'); - /** * Names for chat-related cookies */ diff --git a/src/mibew/libs/classes/settings.php b/src/mibew/libs/classes/Mibew/Settings.php similarity index 98% rename from src/mibew/libs/classes/settings.php rename to src/mibew/libs/classes/Mibew/Settings.php index 95f39181..a04e5ed5 100644 --- a/src/mibew/libs/classes/settings.php +++ b/src/mibew/libs/classes/Mibew/Settings.php @@ -15,6 +15,11 @@ * limitations under the License. */ +namespace Mibew; + +// Import namespaces and classes of the core +use \Database; + /** * Encapsulates work with system settings. */ diff --git a/src/mibew/libs/classes/chat_style.php b/src/mibew/libs/classes/chat_style.php index 23bc3d19..1154a754 100644 --- a/src/mibew/libs/classes/chat_style.php +++ b/src/mibew/libs/classes/chat_style.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Represents a chat style */ diff --git a/src/mibew/libs/classes/invitation_style.php b/src/mibew/libs/classes/invitation_style.php index 8dca61dc..4f03082a 100644 --- a/src/mibew/libs/classes/invitation_style.php +++ b/src/mibew/libs/classes/invitation_style.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Represents a style for invitations */ diff --git a/src/mibew/libs/classes/page_style.php b/src/mibew/libs/classes/page_style.php index 7977cf32..80a0757e 100644 --- a/src/mibew/libs/classes/page_style.php +++ b/src/mibew/libs/classes/page_style.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Represents a style for operator pages */ diff --git a/src/mibew/libs/classes/thread.php b/src/mibew/libs/classes/thread.php index e86e35d7..f249f4d8 100644 --- a/src/mibew/libs/classes/thread.php +++ b/src/mibew/libs/classes/thread.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Represents a chat thread * diff --git a/src/mibew/libs/classes/thread_processor.php b/src/mibew/libs/classes/thread_processor.php index 7783160e..21210a6c 100644 --- a/src/mibew/libs/classes/thread_processor.php +++ b/src/mibew/libs/classes/thread_processor.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Incapsulates thread api and thread processing functions. * diff --git a/src/mibew/libs/classes/users_processor.php b/src/mibew/libs/classes/users_processor.php index b22f2356..340e9824 100644 --- a/src/mibew/libs/classes/users_processor.php +++ b/src/mibew/libs/classes/users_processor.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Incapsulates awaiting users list api related functions. * diff --git a/src/mibew/libs/common/request.php b/src/mibew/libs/common/request.php index 28232bf8..6b675481 100644 --- a/src/mibew/libs/common/request.php +++ b/src/mibew/libs/common/request.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(MIBEW_FS_ROOT.'/libs/common/locale.php'); /* ajax server actions use utf-8 */ diff --git a/src/mibew/libs/getcode.php b/src/mibew/libs/getcode.php index f2702737..804f017d 100644 --- a/src/mibew/libs/getcode.php +++ b/src/mibew/libs/getcode.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + function generate_button($title, $locale, $style, $invitation_style_name, $group, $inner, $showhost, $forcesecure, $modsecurity, $operator_code) { $app_location = get_app_location($showhost, $forcesecure); diff --git a/src/mibew/libs/groups.php b/src/mibew/libs/groups.php index 0e0a31ed..8db0e9de 100644 --- a/src/mibew/libs/groups.php +++ b/src/mibew/libs/groups.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + function group_by_id($id) { $db = Database::getInstance(); diff --git a/src/mibew/libs/init.php b/src/mibew/libs/init.php index 81a16c10..52472fa9 100644 --- a/src/mibew/libs/init.php +++ b/src/mibew/libs/init.php @@ -38,7 +38,6 @@ spl_autoload_register('class_autoload'); // Include system classes require_once(MIBEW_FS_ROOT.'/libs/classes/database.php'); -require_once(MIBEW_FS_ROOT.'/libs/classes/settings.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/event_dispatcher.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/plugin_manager.php'); require_once(MIBEW_FS_ROOT.'/libs/classes/plugin.php'); diff --git a/src/mibew/libs/invitation.php b/src/mibew/libs/invitation.php index 864a473e..07dd8196 100644 --- a/src/mibew/libs/invitation.php +++ b/src/mibew/libs/invitation.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + /** * Check invitation state for specified visitior * diff --git a/src/mibew/libs/operator.php b/src/mibew/libs/operator.php index 063a3224..8c4c8a94 100644 --- a/src/mibew/libs/operator.php +++ b/src/mibew/libs/operator.php @@ -15,10 +15,12 @@ * limitations under the License. */ -/** Name of the cookie to remember an operator - * - */ +// Import namespaces and classes of the core +use Mibew\Settings; +/** + * Name of the cookie to remember an operator + */ define('REMEMBER_OPERATOR_COOKIE_NAME', 'mibew_operator'); /** Permissions constants */ diff --git a/src/mibew/libs/settings.php b/src/mibew/libs/settings.php index 8a5d4ef0..e733e72b 100644 --- a/src/mibew/libs/settings.php +++ b/src/mibew/libs/settings.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + function setup_settings_tabs($active) { global $page, $mibewroot; diff --git a/src/mibew/libs/statistics.php b/src/mibew/libs/statistics.php index 5c424f4a..1ba2cd56 100644 --- a/src/mibew/libs/statistics.php +++ b/src/mibew/libs/statistics.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + function get_statistics_query($type) { $query = $_SERVER['QUERY_STRING']; diff --git a/src/mibew/libs/track.php b/src/mibew/libs/track.php index eeb8c827..29c77945 100644 --- a/src/mibew/libs/track.php +++ b/src/mibew/libs/track.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(MIBEW_FS_ROOT.'/libs/chat.php'); function track_visitor($visitorid, $entry, $referer) diff --git a/src/mibew/libs/userinfo.php b/src/mibew/libs/userinfo.php index e0f8b7cb..169db833 100644 --- a/src/mibew/libs/userinfo.php +++ b/src/mibew/libs/userinfo.php @@ -15,6 +15,9 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + function get_useragent_version($userAgent) { global $knownAgents; diff --git a/src/mibew/mail.php b/src/mibew/mail.php index 1d7970f1..5ab8cc2f 100644 --- a/src/mibew/mail.php +++ b/src/mibew/mail.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(__FILE__).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); require_once(MIBEW_FS_ROOT.'/libs/expand.php'); diff --git a/src/mibew/operator/agent.php b/src/mibew/operator/agent.php index e76b6a5e..3e7086b7 100644 --- a/src/mibew/operator/agent.php +++ b/src/mibew/operator/agent.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/canned.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); diff --git a/src/mibew/operator/avatar.php b/src/mibew/operator/avatar.php index 16ac61e2..96f872a8 100644 --- a/src/mibew/operator/avatar.php +++ b/src/mibew/operator/avatar.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/operator_settings.php'); diff --git a/src/mibew/operator/features.php b/src/mibew/operator/features.php index 3f6cfadb..5a497198 100644 --- a/src/mibew/operator/features.php +++ b/src/mibew/operator/features.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/settings.php'); diff --git a/src/mibew/operator/getcode.php b/src/mibew/operator/getcode.php index 11ef89e5..048724f3 100644 --- a/src/mibew/operator/getcode.php +++ b/src/mibew/operator/getcode.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/groups.php'); diff --git a/src/mibew/operator/groups.php b/src/mibew/operator/groups.php index eeede8b4..e1aaf543 100644 --- a/src/mibew/operator/groups.php +++ b/src/mibew/operator/groups.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/interfaces/style.php'); diff --git a/src/mibew/operator/index.php b/src/mibew/operator/index.php index 40994a13..12992d7c 100644 --- a/src/mibew/operator/index.php +++ b/src/mibew/operator/index.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/interfaces/style.php'); diff --git a/src/mibew/operator/performance.php b/src/mibew/operator/performance.php index 6c070587..255145c5 100644 --- a/src/mibew/operator/performance.php +++ b/src/mibew/operator/performance.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/settings.php'); diff --git a/src/mibew/operator/settings.php b/src/mibew/operator/settings.php index 97d54631..e204035b 100644 --- a/src/mibew/operator/settings.php +++ b/src/mibew/operator/settings.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/settings.php'); diff --git a/src/mibew/operator/statistics.php b/src/mibew/operator/statistics.php index 02cdca5b..5312eeb1 100644 --- a/src/mibew/operator/statistics.php +++ b/src/mibew/operator/statistics.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); diff --git a/src/mibew/operator/tracked.php b/src/mibew/operator/tracked.php index 059e9c94..54fc576c 100644 --- a/src/mibew/operator/tracked.php +++ b/src/mibew/operator/tracked.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/chat.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); diff --git a/src/mibew/operator/users.php b/src/mibew/operator/users.php index f1f7d9ea..574c11f2 100644 --- a/src/mibew/operator/users.php +++ b/src/mibew/operator/users.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(dirname(__FILE__)).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php'); require_once(MIBEW_FS_ROOT.'/libs/groups.php'); diff --git a/src/mibew/widget.php b/src/mibew/widget.php index d54cb029..ca996032 100644 --- a/src/mibew/widget.php +++ b/src/mibew/widget.php @@ -15,6 +15,10 @@ * limitations under the License. */ +// Import namespaces and classes of the core +use Mibew\Settings; + +// Initialize libraries require_once(dirname(__FILE__).'/libs/init.php'); require_once(MIBEW_FS_ROOT.'/libs/invitation.php'); require_once(MIBEW_FS_ROOT.'/libs/operator.php');