Alex Trofimov 10 лет назад
Родитель
Сommit
8334eaebc1

+ 21 - 0
modules/boonex/chat_plus/classes/BxChatPlusAlerts.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusAlerts extends BxDolAlertsResponse
+{
+    function __construct()
+    {
+        parent::__construct();
+        //$this -> oModule = BxDolModule::getInstance('BxChatPlusModule');
+    }
+}
+
+/** @} */

+ 20 - 0
modules/boonex/chat_plus/classes/BxChatPlusConfig.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusConfig extends BxDolModuleConfig
+{
+    function __construct($aModule)
+    {
+        parent::__construct($aModule);
+    }
+}
+
+/** @} */

+ 20 - 0
modules/boonex/chat_plus/classes/BxChatPlusDb.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusDb extends BxDolModuleDb
+{
+    function __construct(&$oConfig)
+    {
+        parent::__construct($oConfig);
+    }
+}
+
+/** @} */

+ 91 - 0
modules/boonex/chat_plus/classes/BxChatPlusModule.php

@@ -0,0 +1,91 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusModule extends BxDolModule
+{
+    function __construct(&$aModule)
+    {
+        parent::__construct($aModule);
+    }
+
+    function actionRedirect ()
+    {
+        if (!getParam('bx_chat_plus_url')) {
+            $this->_oTemplate->displayMsg(_t('_bx_chat_plus_not_configured'));
+            return;
+        }
+
+        header("Location:" . getParam('bx_chat_plus_url'), true, 302);
+    }
+
+    function actionLogo ()
+    {
+        if (!($sLogoUrl = BxTemplFunctions::getInstance()->getMainLogoUrl())) {
+            header("HTTP/1.0 404 Not Found");
+            echo '404 Not Found';
+            return;
+        }
+
+        header("Location:" . $sLogoUrl);
+    }
+
+    function serviceChatBlock ()
+    {
+        if (!getParam('bx_chat_plus_url'))
+           return MsgBox(_t('_bx_chat_plus_not_configured'));
+       
+        $this->_oTemplate->addCss('main.css');
+        $s = $this->_oTemplate->parseHtmlByName('chat_block.html', array('chat_url' => getParam('bx_chat_plus_url')));
+       
+        return array(
+            'content' => $s, 
+            'menu' => array (
+                array (
+                    'title' => _t('_bx_chat_plus_open_in_separate_window'),
+                    'link' => getParam('bx_chat_plus_url'),
+                    'target' => '_blank',
+                ),
+            ),
+        );
+    }
+
+    function serviceHelpdeskCode ()
+    {
+        $sChatUrl = getParam('bx_chat_plus_url');
+        if (!getParam('bx_chat_plus_helpdesk') || !$sChatUrl)
+            return '';
+
+        if (getParam('bx_chat_plus_helpdesk_guest_only') && isLogged())
+            return '';
+
+        $aUrl = parse_url($sChatUrl);
+        $sChatUrl = $aUrl['scheme'] . '://' . $aUrl['host'] . ($aUrl['port'] ? ':' . $aUrl['port'] : '');
+
+        return <<<EOS
+<!-- Start of Helpdesk Livechat Script -->
+<script type="text/javascript">
+(function(w, d, s, f, u) {
+	w[f] = w[f] || [];
+	w[f].push(u);
+	var h = d.getElementsByTagName(s)[0],
+		j = d.createElement(s);
+	j.async = true;
+	j.src = '{$sChatUrl}/packages/rocketchat_livechat/assets/rocket-livechat.js';
+	h.parentNode.insertBefore(j, h);
+})(window, document, 'script', 'initRocket', '{$sChatUrl}/livechat');
+</script>
+<!-- End of Helpdesk Livechat Script -->
+EOS;
+
+    }
+}
+
+/** @} */

+ 20 - 0
modules/boonex/chat_plus/classes/BxChatPlusTemplate.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusTemplate extends BxDolModuleTemplate
+{
+    function __construct(&$oConfig, &$oDb)
+    {
+        parent::__construct($oConfig, $oDb);
+    }
+}
+
+/** @} */

+ 68 - 0
modules/boonex/chat_plus/install/config.php

@@ -0,0 +1,68 @@
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+$aConfig = array(
+    /**
+     * Main Section.
+     */
+    'type' => BX_DOL_MODULE_TYPE_MODULE,
+    'name' => 'bx_chat_plus',
+    'title' => 'Chat+',
+    'note' => 'Chat+ integration.',
+    'version' => '8.0.0.DEV',
+    'vendor' => 'BoonEx',
+	'help_url' => 'http://feed.boonex.com/?section={module_name}',
+
+    'compatible_with' => array(
+        '8.0.x'
+    ),
+
+    /**
+     * 'home_dir' and 'home_uri' - should be unique. Don't use spaces in 'home_uri' and the other special chars.
+     */
+    'home_dir' => 'boonex/chat_plus/',
+    'home_uri' => 'chat_plus',
+
+    'db_prefix' => 'bx_chat_plus_',
+    'class_prefix' => 'BxChatPlus',
+
+    /**
+     * Category for language keys.
+     */
+    'language_category' => 'Chat+',
+
+    /**
+     * Installation/Uninstallation Section.
+     */
+    'install' => array(
+        'execute_sql' => 1,
+        'update_languages' => 1,
+    ),
+    'uninstall' => array (
+        'execute_sql' => 1,
+        'update_languages' => 1,
+    ),
+    'enable' => array(
+        'execute_sql' => 1,
+        'clear_db_cache' => 1,
+    ),
+    'disable' => array(
+        'execute_sql' => 1,
+        'clear_db_cache' => 1,
+    ),
+
+    /**
+     * Dependencies Section
+     */
+    'dependencies' => array(
+        //'oauth2' => 'BoonEx OAuth2 Server Module'
+    ),
+);

+ 20 - 0
modules/boonex/chat_plus/install/installer.php

@@ -0,0 +1,20 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxChatPlusInstaller extends BxDolStudioInstaller
+{
+    function __construct($aConfig)
+    {
+        parent::__construct($aConfig);
+    }
+}
+
+/** @} */

+ 35 - 0
modules/boonex/chat_plus/install/langs/en.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources name="en" flag="gb" title="English">
+	<string name="_sys_module_chat_plus"><![CDATA[Chat Plus]]></string>
+	<string name="_bx_chat_plus"><![CDATA[Chat+]]></string>
+	<string name="_bx_chat_plus_chat"><![CDATA[Chat]]></string>
+
+	<string name="_bx_chat_plus_setting"><![CDATA[Chat Setting]]></string>
+    <string name="_bx_chat_plus_adm_stg_cpt_type"><![CDATA[Chat+]]></string>
+    <string name="_bx_chat_plus_adm_stg_cpt_category_general"><![CDATA[General]]></string>
+    <string name="_bx_chat_plus_option_url"><![CDATA[Chat URL]]></string>
+    <string name="_bx_chat_plus_option_helpdesk"><![CDATA[Enable Helpdesk Chat]]></string>
+    <string name="_bx_chat_plus_option_helpdesk_guest_only"><![CDATA[Show Helpdesk Chat For Guests Only]]></string>
+
+    <string name="_bx_chat_plus_menu_item_title_entries_home"><![CDATA[Chat]]></string>
+    <string name="_bx_chat_plus_menu_item_title_system_entries_home"><![CDATA[Chat+]]></string>
+
+    <string name="_bx_chat_plus_page_title_chat"><![CDATA[Chat]]></string>
+    <string name="_bx_chat_plus_page_title_sys_chat"><![CDATA[Chat+]]></string>
+    <string name="_bx_chat_plus_page_block_title_chat"><![CDATA[Chat]]></string>
+
+	<string name="_bx_chat_plus_not_configured"><![CDATA[Chat isn't configured]]></string>
+	<string name="_bx_chat_plus_open_in_separate_window"><![CDATA[Full-window mode]]></string>
+	<string name="_bx_chat_plus_information"><![CDATA[Information]]></string>
+	<string name="_bx_chat_plus_information_block"><![CDATA[To enable this module, chat server must be installed separately. <br />
+
+Enter the chat URL in the form below. <br />
+
+Then OAuth login must be configured. <a href="{0}modules/?r=oauth2/administration/">Generate Key & Secret pair</a> in OAuth2 Server module by pointing chat URL and  desired name. <br />
+
+After Key & Secret pair is generated you need to enter them in Chat Administration &gt; Accounts &gt; Dolphin.
+
+<hr />
+
+To enable Helpdesk Chat you need to enable it in the Chat Administration &gt; Livechat and in the form below. You don\'t need to insert JS code into Dolphin, it is added automatically.]]></string>
+</resources>

+ 18 - 0
modules/boonex/chat_plus/install/sql/disable.sql

@@ -0,0 +1,18 @@
+
+-- Settings
+
+DELETE FROM `top`, `toc`, `to` USING `sys_options_types` AS `top` LEFT JOIN `sys_options_categories` AS `toc` ON `top`.`id`=`toc`.`type_id` LEFT JOIN `sys_options` AS `to` ON `toc`.`id`=`to`.`category_id` WHERE `top`.`name` = 'bx_chat_plus';
+
+-- Menu
+
+DELETE FROM `sys_menu_items` WHERE `module` = 'bx_chat_plus' OR `name` = 'chat-plus';
+
+-- Page
+
+DELETE FROM `sys_objects_page` WHERE `module` = 'bx_chat_plus';
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_chat_plus' OR `object` IN('bx_chat_plus_chat');
+
+-- Injections
+
+DELETE FROM `sys_injections` WHERE `name` = 'bx_chat_plus';
+

+ 40 - 0
modules/boonex/chat_plus/install/sql/enable.sql

@@ -0,0 +1,40 @@
+
+-- Settings
+
+SET @iTypeOrder = (SELECT MAX(`order`) FROM `sys_options_types` WHERE `group` = 'modules');
+INSERT INTO `sys_options_types` (`group`, `name`, `caption`, `icon`, `order`) VALUES 
+('modules', 'bx_chat_plus', '_bx_chat_plus_adm_stg_cpt_type', 'bx_chat_plus@modules/boonex/chat_plus/|std-mi.png', IF(NOT ISNULL(@iTypeOrder), @iTypeOrder + 1, 1));
+SET @iTypeId = LAST_INSERT_ID();
+
+INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order` )  
+VALUES (@iTypeId, 'bx_chat_plus_general', '_bx_chat_plus_adm_stg_cpt_category_general', 1);
+SET @iCategId = LAST_INSERT_ID();
+
+INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `order`, `extra`) VALUES
+('bx_chat_plus_url', '', @iCategId, '_bx_chat_plus_option_url', 'digit', '', '', 10, ''),
+('bx_chat_plus_helpdesk', '', @iCategId, '_bx_chat_plus_option_helpdesk', 'checkbox', '', '', 20, ''),
+('bx_chat_plus_helpdesk_guest_only', 'on', @iCategId, '_bx_chat_plus_option_helpdesk_guest_only', 'checkbox', '', '', 30, '');
+
+-- Menu
+
+SET @iSiteMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_site' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('sys_site', 'bx_chat_plus', 'chat-plus', '_bx_chat_plus_menu_item_title_system_entries_home', '_bx_chat_plus_menu_item_title_entries_home', 'page.php?i=chat-plus', '', '', 'commenting col-blue3', '', 2147483647, 1, 1, IFNULL(@iSiteMenuOrder, 0) + 1);
+
+SET @iHomepageMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_homepage' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('sys_homepage', 'bx_chat_plus', 'chat-plus', '_bx_chat_plus_menu_item_title_system_entries_home', '_bx_chat_plus_menu_item_title_entries_home', 'page.php?i=chat-plus', '', '', 'commenting col-blue3', '', 2147483647, 1, 1, IFNULL(@iHomepageMenuOrder, 0) + 1);
+
+-- Page
+
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_chat_plus_chat', 'chat-plus', '_bx_chat_plus_page_title_sys_chat', '_bx_chat_plus_page_title_chat', 'bx_chat_plus', 5, 2147483647, 1, 'page.php?i=chat-plus', '', '', '', 0, 1, 0, '', '');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_chat_plus_chat', 1, 'bx_chat_plus', '_bx_chat_plus_page_block_title_chat', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:12:\"bx_chat_plus\";s:6:\"method\";s:10:\"chat_block\";}', 0, 1, 1);
+
+-- Injections
+
+INSERT INTO `sys_injections` (`name`, `page_index`, `key`, `type`, `data`, `replace`, `active`) VALUES
+('bx_chat_plus', 0, 'injection_footer', 'service', 'a:2:{s:6:"module";s:9:"chat_plus";s:6:"method";s:13:"helpdesk_code";}', 0, 1);
+

+ 14 - 0
modules/boonex/chat_plus/install/sql/install.sql

@@ -0,0 +1,14 @@
+
+-- Studio page and widget
+
+INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
+(3, 'bx_chat_plus', '_bx_chat_plus', '_bx_chat_plus', 'bx_chat_plus@modules/boonex/chat_plus/|std-pi.png');
+SET @iPageId = LAST_INSERT_ID();
+
+SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
+SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
+INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
+(@iPageId, 'bx_chat_plus', '{url_studio}module.php?name=bx_chat_plus', '', 'bx_chat_plus@modules/boonex/chat_plus/|std-wi.png', '_bx_chat_plus', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
+INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
+(@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));
+

+ 7 - 0
modules/boonex/chat_plus/install/sql/uninstall.sql

@@ -0,0 +1,7 @@
+
+-- Studio page and widget
+
+DELETE FROM `tp`, `tw`, `tpw`
+USING `sys_std_pages` AS `tp`, `sys_std_widgets` AS `tw`, `sys_std_pages_widgets` AS `tpw`
+WHERE `tp`.`id` = `tw`.`page_id` AND `tw`.`id` = `tpw`.`widget_id` AND `tp`.`name` = 'bx_chat_plus';
+

+ 20 - 0
modules/boonex/chat_plus/request.php

@@ -0,0 +1,20 @@
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    ChatPlus Chat+ module
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+check_logged();
+
+if ( empty($aRequest) || empty($aRequest[0]) ) {
+    BxDolRequest::processAsFile($aModule, $aRequest);
+} else {
+    BxDolRequest::processAsAction($aModule, $aRequest);
+}
+
+/** @} */

+ 1 - 0
modules/boonex/chat_plus/template/chat_block.html

@@ -0,0 +1 @@
+<iframe class="bx_chat_plus_iframe" src="__chat_url__"></iframe>

+ 7 - 0
modules/boonex/chat_plus/template/css/main.css

@@ -0,0 +1,7 @@
+
+.bx_chat_plus_iframe {
+    width:100%;
+    height:600px;
+    border:none;
+}
+

BIN
modules/boonex/chat_plus/template/images/icons/std-mi.png


BIN
modules/boonex/chat_plus/template/images/icons/std-pi.png


BIN
modules/boonex/chat_plus/template/images/icons/std-si.png


BIN
modules/boonex/chat_plus/template/images/icons/std-wi.png


+ 2 - 0
modules/boonex/oauth2/classes/BxOAuthAPI.php

@@ -136,6 +136,7 @@ class BxOAuthAPI extends BxDol
     {
         $oAccount = $oProfile->getAccountObject();
         $aProfileInfo = $oProfile->getInfo();
+        $aAccountInfo = $oAccount->getInfo();
 
         if ($bPublicFieldsOnly) {
             $aProfileInfo = array(
@@ -153,6 +154,7 @@ class BxOAuthAPI extends BxDol
         }
 
 
+        $aProfileInfo['role'] = $aAccountInfo['role'];
         $aProfileInfo['name'] = $oAccount->getDisplayName();
         $aProfileInfo['profile_display_name'] = $oProfile->getDisplayName();
         $aProfileInfo['profile_link'] = $oProfile->getUrl();

+ 38 - 0
modules/boonex/russian/data/langs/bx_chat_plus/ru.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources name="ru" flag="ru" title="Russian">
+	<string name="_sys_module_chat_plus"><![CDATA[Чат+]]></string>
+	<string name="_bx_chat_plus"><![CDATA[Чат+]]></string>
+	<string name="_bx_chat_plus_chat"><![CDATA[Чат]]></string>
+
+	<string name="_bx_chat_plus_setting"><![CDATA[Настройки Чата]]></string>
+    <string name="_bx_chat_plus_adm_stg_cpt_type"><![CDATA[Чат+]]></string>
+    <string name="_bx_chat_plus_adm_stg_cpt_category_general"><![CDATA[Общие]]></string>
+    <string name="_bx_chat_plus_option_url"><![CDATA[Чат URL]]></string>
+    <string name="_bx_chat_plus_option_helpdesk"><![CDATA[Включить чат поддержки сайта]]></string>
+    <string name="_bx_chat_plus_option_helpdesk_guest_only"><![CDATA[Показывать чат поддержки сайта только для гостей]]></string>
+
+    <string name="_bx_chat_plus_menu_item_title_entries_home"><![CDATA[Чат]]></string>
+    <string name="_bx_chat_plus_menu_item_title_system_entries_home"><![CDATA[Чат+]]></string>
+
+    <string name="_bx_chat_plus_page_title_chat"><![CDATA[Чат]]></string>
+    <string name="_bx_chat_plus_page_title_sys_chat"><![CDATA[Чат+]]></string>
+    <string name="_bx_chat_plus_page_block_title_chat"><![CDATA[Чат]]></string>
+
+	<string name="_bx_chat_plus_not_configured"><![CDATA[Чат не сконфигурирован]]></string>
+	<string name="_bx_chat_plus_open_in_separate_window"><![CDATA[Полно-экранный режим]]></string>
+	<string name="_bx_chat_plus_information"><![CDATA[Информация]]></string>
+	<string name="_bx_chat_plus_information_block"><![CDATA[Чат сервер должен быть сконфигурирован, чтобы этот модуль заработал. <br />
+
+Нужно ввести URL чата в форме ниже. <br />
+
+Затем OAuth модуль должен быть сконфигурирован. <a href="{0}modules/?r=oauth2/administration/">Сгенерируйте пару Ключ & Секрет</a> в модуле OAuth2 сервер указав адрес чата и произвольный заголовок. <br />
+
+После того как пара Ключ & Секрет сгенерированы, нужно указать их в чате: <br />
+Администрирование &gt; Аккаунты &gt; Dolphin.
+
+<hr />
+
+Чтобы заработала "Служба поддержки" нужно включить эту функцию в форме ниже и в чате: Администрирование &gt; Livechat.
+Вставлять специальный JavaScript код в Dolphin не нужно - это делается автоматически.]]></string>
+
+</resources>

+ 4 - 3
template/scripts/BxBasePage.php

@@ -7,6 +7,8 @@
  * @{
  */
 
+require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+
 /**
  * Page representation.
  * @see BxDolPage
@@ -163,9 +165,8 @@ class BxBasePage extends BxDolPage
                     isset($mixedContent['designbox_id']) ? $mixedContent['designbox_id'] : $aBlock['designbox_id'],
                     isset($mixedContent['menu']) ? $mixedContent['menu'] : false
 				);
-            } elseif (is_string($mixedContent) && !empty($mixedContent)) {
-                if (!function_exists('DesignBoxContent'))
-                    require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+            } 
+            elseif (is_string($mixedContent) && !empty($mixedContent)) {                    
                 $sContentWithBox = DesignBoxContent($sTitle, $mixedContent, $aBlock['designbox_id']);
             }
         }