Page MenuHomeIn-Portal Phabricator

D338.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 6:21 AM

D338.diff

Index: branches/5.2.x/core/units/helpers/fck_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/fck_helper.php
+++ branches/5.2.x/core/units/helpers/fck_helper.php
@@ -530,32 +530,38 @@
*/
protected function getStyles()
{
+ static $cache = array();
+
/** @var ThemeItem $theme */
$theme = $this->Application->recallObject('theme.current');
$stylesheet_file = $theme->getStylesheetFile(true);
- if ( $stylesheet_file ) {
- $stylesheet_folder_url = dirname($stylesheet_file) . '/';
-
- $url_params = Array ('events[fck]' => 'OnGetsEditorStyles', 'no_pass_through' => 1, 'pass' => 'm');
+ if ( !isset($cache[$stylesheet_file]) ) {
+ if ( $stylesheet_file ) {
+ $stylesheet_folder_url = dirname($stylesheet_file) . '/';
+
+ $url_params = array('events[fck]' => 'OnGetsEditorStyles', 'no_pass_through' => 1, 'pass' => 'm');
+
+ $prefix = $this->Application->isAdmin ? '_FRONT_END_' : '';
+ $styles_css = $this->Application->HREF('index', $prefix, $url_params, 'index.php');
+
+ /** @var kCurlHelper $curl_helper */
+ $curl_helper = $this->Application->recallObject('CurlHelper');
+ $curl_helper->Send($styles_css, false);
+ $styles_css = $curl_helper->getInfo(CURLINFO_REDIRECT_URL);
+ $curl_helper->CloseConnection();
+ }
+ else {
+ $stylesheet_folder_url = $this->Application->BaseURL(rtrim(EDITOR_PATH, '/'));
+ $styles_css = $stylesheet_folder_url . 'style.css';
+ }
- $prefix = $this->Application->isAdmin ? '_FRONT_END_' : '';
- $styles_css = $this->Application->HREF('index', $prefix, $url_params, 'index.php');
+ $styles_js = $stylesheet_folder_url . 'styles.js';
- /** @var kCurlHelper $curl_helper */
- $curl_helper = $this->Application->recallObject('CurlHelper');
- $curl_helper->Send($styles_css, false);
- $styles_css = $curl_helper->getInfo(CURLINFO_REDIRECT_URL);
- $curl_helper->CloseConnection();
- }
- else {
- $stylesheet_folder_url = $this->Application->BaseURL(rtrim(EDITOR_PATH, '/'));
- $styles_css = $stylesheet_folder_url . 'style.css';
+ $cache[$stylesheet_file] = array($styles_css, $styles_js);
}
- $styles_js = $stylesheet_folder_url . 'styles.js';
-
- return array($styles_css, $styles_js);
+ return $cache[$stylesheet_file];
}
/**

Event Timeline