balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

widgets-css.php (896B)


      1 <?php
      2 namespace Elementor\Core\Page_Assets\Data_Managers;
      3 
      4 if ( ! defined( 'ABSPATH' ) ) {
      5 	exit; // Exit if accessed directly.
      6 }
      7 
      8 /**
      9  * Elementor Assets Data.
     10  *
     11  * @since 3.3.0
     12  */
     13 class Widgets_Css extends Base {
     14 	protected $content_type = 'css';
     15 
     16 	protected $assets_category = 'widgets';
     17 
     18 	protected function get_asset_content() {
     19 		$asset_css_file_size = $this->get_file_data( 'size' );
     20 
     21 		$widget_css = '';
     22 
     23 		if ( $asset_css_file_size ) {
     24 			// If the file size is larger than 8KB then calling the external CSS file, otherwise, printing inline CSS.
     25 			if ( $asset_css_file_size > 8000 ) {
     26 				$asset_url = $this->get_config_data( 'file_url' );
     27 
     28 				$widget_css = sprintf( '<link rel="stylesheet" href="%s">', $asset_url );
     29 			} else {
     30 				$widget_css = $this->get_file_data( 'content' );
     31 				$widget_css = sprintf( '<style>%s</style>', $widget_css );
     32 			}
     33 		}
     34 
     35 		return $widget_css;
     36 	}
     37 }