Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1050572
D338.id848.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
Thu, Jul 3, 12:07 AM
Size
2 KB
Mime Type
text/x-diff
Expires
Fri, Jul 4, 12:07 AM (5 h, 58 m)
Engine
blob
Format
Raw Data
Handle
678802
Attached To
D338: INP-1739 - Cache results of "\fckFCKHelper::getStyles" method
D338.id848.diff
View Options
Index: core/units/helpers/fck_helper.php
===================================================================
--- core/units/helpers/fck_helper.php
+++ 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