Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F847849
D338.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 19, 7:01 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Sun, Apr 20, 7:01 PM (17 m, 23 s)
Engine
blob
Format
Raw Data
Handle
602525
Attached To
D338: INP-1739 - Cache results of "\fckFCKHelper::getStyles" method
D338.diff
View Options
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
Log In to Comment