Parcourir la source

Ticket #3719 - Studio: Settings form should be disconnected from Settings page: Changes in modules.

AntonLV il y a 4 ans
Parent
commit
2e5b338a1f

+ 17 - 19
modules/boonex/artificer/classes/BxArtificerStudioPage.php

@@ -15,13 +15,11 @@ class BxArtificerStudioPage extends BxTemplStudioDesign
 {
     function __construct($sModule, $mixedPageName, $sPage = "")
     {
-    	$this->MODULE = 'bx_artificer';
-
         parent::__construct($sModule, $mixedPageName, $sPage);
 
-        $this->aMenuItems = bx_array_insert_after(array(
-            BX_ARTIFICER_STUDIO_TEMPL_TYPE_STYLES => array('title' => '_bx_artificer_lmi_cpt_styles', 'icon' => 'paint-brush')
-        ), $this->aMenuItems, BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS);
+        $this->aMenuItems = bx_array_insert_after([
+            BX_ARTIFICER_STUDIO_TEMPL_TYPE_STYLES => ['title' => '_bx_artificer_lmi_cpt_styles', 'icon' => 'paint-brush']
+        ], $this->aMenuItems, BX_DOL_STUDIO_TEMPL_TYPE_SETTINGS);
     }
 
     protected function getSettings($mixedCategory = '', $sMix = '')
@@ -29,25 +27,25 @@ class BxArtificerStudioPage extends BxTemplStudioDesign
     	return parent::getSettings('bx_artificer_system', $sMix);
     }
 
-    protected function getStyles($sMix = '')
+    protected function getStyles($mixedCategory = '', $sMix = '')
     {
-    	$oTemplate = BxDolStudioTemplate::getInstance();
+    	$sPrefix = $this->sModule;
 
-    	$sPrefix = $this->MODULE;
-    	$aCategories = array(
-            $sPrefix . '_styles_custom',
-        );
-    	$oPage = new BxTemplStudioSettings($this->sModule, $aCategories, $sMix);
+        if(empty($mixedCategory))
+            $mixedCategory = [
+                $sPrefix . '_styles_custom',
+            ];
 
-    	$oTemplate->addJs(array('codemirror/codemirror.min.js'));
-        $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
+    	$oOptions = new BxTemplStudioOptions($this->sModule, $mixedCategory, $sMix);
 
-        return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getFormCode(),
-            'js_content' => $this->getPageJsCode(array(
+        $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss(), [BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css']);
+        $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs(), ['codemirror/codemirror.min.js']);
+        return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', [
+            'content' => $oOptions->getCode(),
+            'js_content' => $this->getPageJsCode([
                 'sCodeMirror' => "textarea[name='" . $sPrefix . "_styles_custom']"
-            ))
-        ));
+            ])
+        ]);
     }
 }
 

+ 29 - 41
modules/boonex/decorous/classes/BxDecorousStudioPage.php

@@ -15,10 +15,9 @@ class BxDecorousStudioPage extends BxTemplStudioDesign
 {
     function __construct($sModule, $mixedPageName, $sPage = "")
     {
-    	$this->MODULE = 'bx_decorous';
         parent::__construct($sModule, $mixedPageName, $sPage);
 
-        $this->aMenuItems[BX_DECOROUS_STUDIO_TEMPL_TYPE_STYLES] = array('title' => '_bx_decorous_lmi_cpt_styles', 'icon' => 'paint-brush');
+        $this->aMenuItems[BX_DECOROUS_STUDIO_TEMPL_TYPE_STYLES] = ['title' => '_bx_decorous_lmi_cpt_styles', 'icon' => 'paint-brush'];
         unset($this->aMenuItems[BX_DOL_STUDIO_TEMPL_TYPE_LOGO]);
     }
 
@@ -27,46 +26,35 @@ class BxDecorousStudioPage extends BxTemplStudioDesign
     	return parent::getSettings('bx_decorous_system', $sMix);
     }
 
-    protected function getStyles($sMix = '')
+    protected function getStyles($mixedCategory = '', $sMix = '')
     {
-    	$oTemplate = BxDolStudioTemplate::getInstance();
-
-    	$sPrefix = $this->MODULE;
-    	$aCategories = array(
-        $sPrefix . '_styles_general',
-            $sPrefix . '_styles_header',
-            $sPrefix . '_styles_footer',
-            $sPrefix . '_styles_body',
-            $sPrefix . '_styles_cover',
-            $sPrefix . '_styles_block',
-            $sPrefix . '_styles_card',
-            $sPrefix . '_styles_popup',
-            $sPrefix . '_styles_menu_main',
-            $sPrefix . '_styles_menu_account',
-            $sPrefix . '_styles_menu_add',
-            $sPrefix . '_styles_menu_page',
-            $sPrefix . '_styles_menu_slide',
-            $sPrefix . '_styles_form',
-            $sPrefix . '_styles_large_button',
-            $sPrefix . '_styles_small_button',
-            $sPrefix . '_styles_font',
-            $sPrefix . '_styles_custom',
-            $sPrefix . '_viewport_tablet',
-            $sPrefix . '_viewport_mobile'
-        );
-    	$oPage = new BxTemplStudioSettings($this->sModule, $aCategories, $sMix);
-    	$oPage->enableReadOnly(true);
-    	$oPage->enableMixes(true);
-
-    	$oTemplate->addJs(array('codemirror/codemirror.min.js'));
-        $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
-
-        return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getFormCode(),
-            'js_content' => $this->getPageJsCode(array(
-                'sCodeMirror' => "textarea[name='" . $sPrefix . "_styles_custom']"
-            ))
-        ));
+    	$sPrefix = $this->sModule;
+
+    	if(empty($mixedCategory))
+            $mixedCategory = [
+                $sPrefix . '_styles_general',
+                $sPrefix . '_styles_header',
+                $sPrefix . '_styles_footer',
+                $sPrefix . '_styles_body',
+                $sPrefix . '_styles_cover',
+                $sPrefix . '_styles_block',
+                $sPrefix . '_styles_card',
+                $sPrefix . '_styles_popup',
+                $sPrefix . '_styles_menu_main',
+                $sPrefix . '_styles_menu_account',
+                $sPrefix . '_styles_menu_add',
+                $sPrefix . '_styles_menu_page',
+                $sPrefix . '_styles_menu_slide',
+                $sPrefix . '_styles_form',
+                $sPrefix . '_styles_large_button',
+                $sPrefix . '_styles_small_button',
+                $sPrefix . '_styles_font',
+                $sPrefix . '_styles_custom',
+                $sPrefix . '_viewport_tablet',
+                $sPrefix . '_viewport_mobile'
+            ];
+
+        return parent::getStyles($mixedCategory, $sMix);
     }
 }
 

+ 5 - 3
modules/boonex/developer/classes/BxDevStudioPage.php

@@ -43,14 +43,16 @@ class BxDevStudioPage extends BxTemplStudioModule
 
     protected function getSettings()
     {
-        $oContent = new BxTemplStudioSettings('system', 'hidden');
+        $oOptions = new BxTemplStudioOptions('system', 'hidden');
 
-        if(($mixedResult = $oContent->checkAction()) !== false) {
+        if(($mixedResult = $oOptions->checkAction()) !== false) {
             echoJson($mixedResult);
             exit;
         }
 
-        return $this->oModule->_oTemplate->displayPageContent($this->sPage, $oContent, 'getFormCode');
+        $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss());
+        $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs());
+        return $this->oModule->_oTemplate->displayPageSettings($this->sPage, $oOptions);
     }
 
     protected function getForms()

+ 13 - 4
modules/boonex/developer/classes/BxDevTemplate.php

@@ -15,7 +15,16 @@ class BxDevTemplate extends BxDolModuleTemplate
     {
         parent::__construct($oConfig, $oDb);
 
-        $this->addStudioCss(array('main.css'));
+        $this->addStudioCss(['main.css']);
+    }
+
+    function displayPageSettings($sPage, $oContent, $sGetPageCodeMethod = 'getPageCode')
+    {
+        $this->addStudioCss($oContent->getCss(), false, false);
+        $this->addStudioJs($oContent->getJs(), false, false);
+
+        $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-single');
+        return $oContent->getCode();
     }
 
     function displayPageContent($sPage, $oContent, $sGetPageCodeMethod = 'getPageCode')
@@ -25,16 +34,16 @@ class BxDevTemplate extends BxDolModuleTemplate
 
         $sMenu = $oContent->getPageMenu();
         $sContent = $oContent->getPageJsCode() . $oContent->$sGetPageCodeMethod();
-        if(in_array($sPage, array(BX_DEV_TOOLS_SETTINGS)) || empty($sMenu)) {
+        if(empty($sMenu)) {
             $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-single');
             return $sContent;
         }
 
         $this->addStudioInjection('injection_body_style', 'text', ' bx-dev-page-body-columns');
-        return $this->parseHtmlByName('page_content.html', array(
+        return $this->parseHtmlByName('page_content.html', [
             'page_menu_code' => $sMenu,
             'page_main_code' => $sContent
-        ));
+        ]);
     }
 }
 

+ 31 - 43
modules/boonex/lucid/classes/BxLucidStudioPage.php

@@ -15,10 +15,9 @@ class BxLucidStudioPage extends BxTemplStudioDesign
 {
     function __construct($sModule, $mixedPageName, $sPage = "")
     {
-    	$this->MODULE = 'bx_lucid';
         parent::__construct($sModule, $mixedPageName, $sPage);
 
-        $this->aMenuItems[BX_LUCID_STUDIO_TEMPL_TYPE_STYLES] = array('title' => '_bx_lucid_lmi_cpt_styles', 'icon' => 'paint-brush');
+        $this->aMenuItems[BX_LUCID_STUDIO_TEMPL_TYPE_STYLES] = ['title' => '_bx_lucid_lmi_cpt_styles', 'icon' => 'paint-brush'];
         unset($this->aMenuItems[BX_DOL_STUDIO_TEMPL_TYPE_LOGO]);
     }
 
@@ -27,50 +26,39 @@ class BxLucidStudioPage extends BxTemplStudioDesign
     	return parent::getSettings('bx_lucid_system', $sMix);
     }
 
-    protected function getStyles($sMix = '')
+    protected function getStyles($mixedCategory = '', $sMix = '')
     {
-    	$oTemplate = BxDolStudioTemplate::getInstance();
+        $sPrefix = $this->sModule;
 
-    	$sPrefix = $this->MODULE;
-    	$aCategories = array(
-        $sPrefix . '_styles_general',
-            $sPrefix . '_styles_header',
-            $sPrefix . '_styles_footer',
-            $sPrefix . '_styles_body',
-            $sPrefix . '_styles_cover',
-            $sPrefix . '_styles_block',
-            $sPrefix . '_styles_card',
-            $sPrefix . '_styles_popup',
-            $sPrefix . '_styles_menu_main',
-            $sPrefix . '_styles_menu_account',
-            $sPrefix . '_styles_menu_add',
-            $sPrefix . '_styles_menu_page',
-            $sPrefix . '_styles_menu_slide',
-            $sPrefix . '_styles_form',
-            $sPrefix . '_styles_large_button',
-            $sPrefix . '_styles_large_button_primary',
-            $sPrefix . '_styles_button',
-            $sPrefix . '_styles_button_primary',
-            $sPrefix . '_styles_small_button',
-            $sPrefix . '_styles_small_button_primary',
-            $sPrefix . '_styles_font',
-            $sPrefix . '_styles_custom',
-            $sPrefix . '_viewport_tablet',
-            $sPrefix . '_viewport_mobile'
-        );
-    	$oPage = new BxTemplStudioSettings($this->sModule, $aCategories, $sMix);
-    	$oPage->enableReadOnly(true);
-    	$oPage->enableMixes(true);
+        if(empty($mixedCategory))
+            $mixedCategory = [
+                $sPrefix . '_styles_general',
+                $sPrefix . '_styles_header',
+                $sPrefix . '_styles_footer',
+                $sPrefix . '_styles_body',
+                $sPrefix . '_styles_cover',
+                $sPrefix . '_styles_block',
+                $sPrefix . '_styles_card',
+                $sPrefix . '_styles_popup',
+                $sPrefix . '_styles_menu_main',
+                $sPrefix . '_styles_menu_account',
+                $sPrefix . '_styles_menu_add',
+                $sPrefix . '_styles_menu_page',
+                $sPrefix . '_styles_menu_slide',
+                $sPrefix . '_styles_form',
+                $sPrefix . '_styles_large_button',
+                $sPrefix . '_styles_large_button_primary',
+                $sPrefix . '_styles_button',
+                $sPrefix . '_styles_button_primary',
+                $sPrefix . '_styles_small_button',
+                $sPrefix . '_styles_small_button_primary',
+                $sPrefix . '_styles_font',
+                $sPrefix . '_styles_custom',
+                $sPrefix . '_viewport_tablet',
+                $sPrefix . '_viewport_mobile'
+            ];
 
-    	$oTemplate->addJs(array('codemirror/codemirror.min.js'));
-        $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
-
-        return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getFormCode(),
-            'js_content' => $this->getPageJsCode(array(
-                'sCodeMirror' => "textarea[name='" . $sPrefix . "_styles_custom']"
-            ))
-        ));
+        return parent::getStyles($mixedCategory, $sMix);
     }
 }
 

+ 37 - 0
modules/boonex/markerio/classes/BxMarkerIoStudioOptions.php

@@ -0,0 +1,37 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Marker.io Marker.io
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxMarkerIoStudioOptions extends BxTemplStudioOptions
+{
+    protected function field($aItem, $aItems2Mixes)
+    {
+        $sName = trim(str_replace($this->sType, '', $aItem['name']), '_');
+        $mixedValue = isset($aItems2Mixes[$aItem['name']]) ? $aItems2Mixes[$aItem['name']] : $aItem['value'];
+
+        $aField = [];
+        if($aItem['type'] == 'text' && $sName == 'code')
+            $aField = array(
+                'type' => 'textarea',
+                'name' => $aItem['name'],
+                'caption' => _t($aItem['caption']),
+                'value' => $mixedValue,
+                'attrs' => [],
+                'code' => true,
+                'db' => array (
+                    'pass' => 'XssHtml',
+                ),
+            );
+        else 
+            $aField = parent::field($aItem, $aItems2Mixes);
+
+        return $aField;
+    }
+}

+ 5 - 3
modules/boonex/markerio/classes/BxMarkerIoStudioPage.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-require_once ('BxMarkerIoStudioSettings.php');
+require_once ('BxMarkerIoStudioOptions.php');
 
 class BxMarkerIoStudioPage extends BxTemplStudioModule
 {
@@ -26,10 +26,12 @@ class BxMarkerIoStudioPage extends BxTemplStudioModule
 
     protected function getSettings()
     {
-        $oPage = new BxMarkerIoStudioSettings($this->sModule);
+        $oOptions = new BxMarkerIoStudioOptions($this->sModule);
 
+        $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss());
+        $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs());
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('module.html', array(
-            'content' => $oPage->getFormCode(),
+            'content' => $oOptions->getCode(),
         ));
     }
 }

+ 0 - 1
modules/boonex/ocean/classes/BxOceanStudioPage.php

@@ -13,7 +13,6 @@ class BxOceanStudioPage extends BxTemplStudioDesign
 {
     function __construct($sModule, $mixedPageName, $sPage = "")
     {
-    	$this->MODULE = 'bx_ocean';
         parent::__construct($sModule, $mixedPageName, $sPage);
     }
 }

+ 30 - 42
modules/boonex/protean/classes/BxProteanStudioPage.php

@@ -15,10 +15,9 @@ class BxProteanStudioPage extends BxTemplStudioDesign
 {
     function __construct($sModule, $mixedPageName, $sPage = "")
     {
-    	$this->MODULE = 'bx_protean';
         parent::__construct($sModule, $mixedPageName, $sPage);
 
-        $this->aMenuItems[BX_PROTEAN_STUDIO_TEMPL_TYPE_STYLES] = array('title' => '_bx_protean_lmi_cpt_styles', 'icon' => 'paint-brush');
+        $this->aMenuItems[BX_PROTEAN_STUDIO_TEMPL_TYPE_STYLES] = ['title' => '_bx_protean_lmi_cpt_styles', 'icon' => 'paint-brush'];
         unset($this->aMenuItems[BX_DOL_STUDIO_TEMPL_TYPE_LOGO]);
     }
 
@@ -27,49 +26,38 @@ class BxProteanStudioPage extends BxTemplStudioDesign
     	return parent::getSettings('bx_protean_system', $sMix);
     }
 
-    protected function getStyles($sMix = '')
+    protected function getStyles($mixedCategory = '', $sMix = '')
     {
-    	$oTemplate = BxDolStudioTemplate::getInstance();
+    	$sPrefix = $this->sModule;
 
-    	$sPrefix = $this->MODULE;
-    	$aCategories = array(
-        $sPrefix . '_styles_general',
-            $sPrefix . '_styles_header',
-            $sPrefix . '_styles_footer',
-            $sPrefix . '_styles_body',
-            $sPrefix . '_styles_cover',
-            $sPrefix . '_styles_block',
-            $sPrefix . '_styles_card',
-            $sPrefix . '_styles_popup',
-            $sPrefix . '_styles_menu_main',
-            $sPrefix . '_styles_menu_account',
-            $sPrefix . '_styles_menu_page',
-            $sPrefix . '_styles_menu_slide',
-            $sPrefix . '_styles_form',
-            $sPrefix . '_styles_large_button',
-            $sPrefix . '_styles_large_button_primary',
-            $sPrefix . '_styles_button',
-            $sPrefix . '_styles_button_primary',
-            $sPrefix . '_styles_small_button',
-            $sPrefix . '_styles_small_button_primary',
-            $sPrefix . '_styles_font',
-            $sPrefix . '_styles_custom',
-            $sPrefix . '_viewport_tablet',
-            $sPrefix . '_viewport_mobile'
-        );
-    	$oPage = new BxTemplStudioSettings($this->sModule, $aCategories, $sMix);
-    	$oPage->enableReadOnly(true);
-    	$oPage->enableMixes(true);
+        if(empty($mixedCategory))
+            $mixedCategory = [
+                $sPrefix . '_styles_general',
+                $sPrefix . '_styles_header',
+                $sPrefix . '_styles_footer',
+                $sPrefix . '_styles_body',
+                $sPrefix . '_styles_cover',
+                $sPrefix . '_styles_block',
+                $sPrefix . '_styles_card',
+                $sPrefix . '_styles_popup',
+                $sPrefix . '_styles_menu_main',
+                $sPrefix . '_styles_menu_account',
+                $sPrefix . '_styles_menu_page',
+                $sPrefix . '_styles_menu_slide',
+                $sPrefix . '_styles_form',
+                $sPrefix . '_styles_large_button',
+                $sPrefix . '_styles_large_button_primary',
+                $sPrefix . '_styles_button',
+                $sPrefix . '_styles_button_primary',
+                $sPrefix . '_styles_small_button',
+                $sPrefix . '_styles_small_button_primary',
+                $sPrefix . '_styles_font',
+                $sPrefix . '_styles_custom',
+                $sPrefix . '_viewport_tablet',
+                $sPrefix . '_viewport_mobile'
+            ];
 
-    	$oTemplate->addJs(array('codemirror/codemirror.min.js'));
-        $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
-
-        return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getFormCode(),
-            'js_content' => $this->getPageJsCode(array(
-                'sCodeMirror' => "textarea[name='" . $sPrefix . "_styles_custom']"
-            ))
-        ));
+        return parent::getStyles($mixedCategory, $sMix);
     }
 }
 

+ 32 - 0
modules/boonex/stripe_connect/classes/BxStripeConnectStudioOptions.php

@@ -0,0 +1,32 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    StripeConnect Stripe Connect
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+class BxStripeConnectStudioOptions extends BxTemplStudioOptions
+{
+    protected $_sModule;
+    protected $_oModule;
+
+    public function __construct($sType = '', $sCategory = '', $sMix = '')
+    {
+        parent::__construct($sType, $sCategory, $sMix);
+
+        $this->_sModule = 'bx_stripe_connect';
+        $this->_oModule = BxDolModule::getInstance($this->_sModule);
+    }
+
+    public function getCustomValueRedirectUrl($aItem, $mixedValue)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        return BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . $CNF['URI_REDIRECT'];
+    }
+}
+/** @} */

+ 5 - 3
modules/boonex/stripe_connect/classes/BxStripeConnectStudioPage.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-require_once('BxStripeConnectStudioSettings.php');
+require_once('BxStripeConnectStudioOptions.php');
 
 define('BX_DOL_STUDIO_MOD_TYPE_ACCOUNTS', 'accounts');
 
@@ -30,10 +30,12 @@ class BxStripeConnectStudioPage extends BxTemplStudioModule
 
     protected function getSettings()
     {
-        $oPage = new BxStripeConnectStudioSettings($this->sModule);
+        $oOptions = new BxStripeConnectStudioOptions($this->sModule);
 
+        $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss());
+        $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs());
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('module.html', array(
-            'content' => $oPage->getFormCode(),
+            'content' => $oOptions->getCode(),
         ));
     }
 

+ 26 - 0
modules/boonex/xero/classes/BxXeroStudioOptions.php

@@ -0,0 +1,26 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Xero Xero
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxXeroStudioOptions extends BxTemplStudioOptions
+{
+    protected function getCustomValueRedirectUrl($aItem, $mixedValue)
+    {
+        return bx_replace_markers($mixedValue, array(
+            'site_url' => BX_DOL_URL_ROOT
+        ));
+    }
+    protected function getCustomValueWebhookUrl($aItem, $mixedValue)
+    {
+        return bx_replace_markers($mixedValue, array(
+            'site_url' => BX_DOL_URL_ROOT
+        ));
+    }
+}

+ 8 - 6
modules/boonex/xero/classes/BxXeroStudioPage.php

@@ -9,7 +9,7 @@
  * @{
  */
 
-require_once ('BxXeroStudioSettings.php');
+require_once ('BxXeroStudioOptions.php');
 
 class BxXeroStudioPage extends BxTemplStudioModule
 {
@@ -23,22 +23,24 @@ class BxXeroStudioPage extends BxTemplStudioModule
 
         parent::__construct($sModule, $mixedPageName, $sPage);
 
-        $this->aMenuItems['authorize'] = array('name' => 'authorize', 'icon' => 'sign-in-alt', 'title' => '_bx_xero_lmi_cpt_authorize');
+        $this->aMenuItems['authorize'] = ['name' => 'authorize', 'icon' => 'sign-in-alt', 'title' => '_bx_xero_lmi_cpt_authorize'];
     }
 
     protected function getSettings()
     {
-        $oPage = new BxXeroStudioSettings($this->sModule);
+        $oOptions = new BxXeroStudioOptions($this->sModule);
 
+        $this->aPageCss = array_merge($this->aPageCss, $oOptions->getCss());
+        $this->aPageJs = array_merge($this->aPageJs, $oOptions->getJs());
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('module.html', array(
-            'content' => $oPage->getFormCode(),
+            'content' => $oOptions->getCode(),
         ));
     }
 
     protected function getAuthorize()
     {
-        $this->_oModule->_oTemplate->addStudioCss(array('main.css'));
-        $this->_oModule->_oTemplate->addStudioJs(array('main.js'));
+        $this->_oModule->_oTemplate->addStudioCss(['main.css']);
+        $this->_oModule->_oTemplate->addStudioJs(['main.js']);
         return $this->_oModule->_oTemplate->getBlockAuthorize(bx_get('code'));
     }
 }