| @@ -1,9 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Core\Page_Assets\Data_Managers; |
| 3 | 3 | |
| 4 | -use Elementor\Utils; | |
| 5 | - | |
| 6 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | 5 | exit; // Exit if accessed directly. |
| 8 | 6 | } |
| 9 | 7 | |
| @@ -172,9 +170,9 @@ | ||
| 172 | 170 | * |
| 173 | 171 | * @since 3.3.0 |
| 174 | 172 | * @access protected |
| 175 | 173 | * |
| 176 | - * @param string $version | |
| 174 | + * @param string $asset_key | |
| 177 | 175 | * |
| 178 | 176 | * @return boolean |
| 179 | 177 | */ |
| 180 | 178 | protected function is_asset_version_changed( $version ) { |
| @@ -188,9 +186,9 @@ | ||
| 188 | 186 | * |
| 189 | 187 | * @since 3.3.0 |
| 190 | 188 | * @access protected |
| 191 | 189 | * |
| 192 | - * @param string $data_type (exists|content|size). | |
| 190 | + * @param string $data_type (content|size) | |
| 193 | 191 | * @param string $file_key - In case that the same file data is needed for multiple assets (like a JSON file), the file data key should be the same for all shared assets to make sure that the file is being read only once. |
| 194 | 192 | * |
| 195 | 193 | * @return string|number |
| 196 | 194 | */ |
| @@ -206,12 +204,10 @@ | ||
| 206 | 204 | } |
| 207 | 205 | |
| 208 | 206 | $asset_path = $this->get_file_path(); |
| 209 | 207 | |
| 210 | - if ( 'exists' === $data_type ) { | |
| 211 | - $data = file_exists( $asset_path ); | |
| 212 | - } elseif ( 'content' === $data_type ) { | |
| 213 | - $data = Utils::file_get_contents( $asset_path ); | |
| 208 | + if ( 'content' === $data_type ) { | |
| 209 | + $data = file_get_contents( $asset_path ); | |
| 214 | 210 | |
| 215 | 211 | if ( ! $data ) { |
| 216 | 212 | $data = ''; |
| 217 | 213 | } |
| @@ -250,22 +246,8 @@ | ||
| 250 | 246 | return $assets_data; |
| 251 | 247 | } |
| 252 | 248 | |
| 253 | 249 | /** |
| 254 | - * Get Config. | |
| 255 | - * | |
| 256 | - * Getting the assets data config. | |
| 257 | - * | |
| 258 | - * @since 3.5.0 | |
| 259 | - * @access protected | |
| 260 | - * | |
| 261 | - * @return array | |
| 262 | - */ | |
| 263 | - protected function get_config( $data ) { | |
| 264 | - return []; | |
| 265 | - } | |
| 266 | - | |
| 267 | - /** | |
| 268 | 250 | * Init Asset Data. |
| 269 | 251 | * |
| 270 | 252 | * Initialize the asset data and handles the asset content updates when needed. |
| 271 | 253 | * |
| @@ -293,11 +275,11 @@ | ||
| 293 | 275 | } |
| 294 | 276 | } |
| 295 | 277 | |
| 296 | 278 | /** |
| 297 | - * Get Asset Data From Config. | |
| 279 | + * Get Asset Data. | |
| 298 | 280 | * |
| 299 | - * Getting the asset data content from config. | |
| 281 | + * Getting the asset data content. | |
| 300 | 282 | * |
| 301 | 283 | * @since 3.3.0 |
| 302 | 284 | * @access public |
| 303 | 285 | * |
| @@ -309,32 +291,14 @@ | ||
| 309 | 291 | * } |
| 310 | 292 | * |
| 311 | 293 | * @return mixed |
| 312 | 294 | */ |
| 313 | - public function get_asset_data_from_config( array $config ) { | |
| 295 | + public function get_asset_data( $config ) { | |
| 314 | 296 | $this->init_asset_data( $config ); |
| 315 | 297 | |
| 316 | 298 | $asset_key = $config['key']; |
| 317 | 299 | |
| 318 | 300 | return $this->assets_data[ $asset_key ]['content']; |
| 319 | - } | |
| 320 | - | |
| 321 | - /** | |
| 322 | - * Get Asset Data. | |
| 323 | - * | |
| 324 | - * Getting the asset data content. | |
| 325 | - * | |
| 326 | - * @since 3.5.0 | |
| 327 | - * @access public | |
| 328 | - * | |
| 329 | - * @param array $data | |
| 330 | - * | |
| 331 | - * @return mixed | |
| 332 | - */ | |
| 333 | - public function get_asset_data( array $data ) { | |
| 334 | - $config = $this->get_config( $data ); | |
| 335 | - | |
| 336 | - return $this->get_asset_data_from_config( $config ); | |
| 337 | 301 | } |
| 338 | 302 | |
| 339 | 303 | public function __construct() { |
| 340 | 304 | $assets_data = $this->get_saved_assets_data(); |