diff --git a/src/css-optimize.php b/src/css-optimize.php index 88e0bf4a3..41cd5f5a4 100644 --- a/src/css-optimize.php +++ b/src/css-optimize.php @@ -114,7 +114,7 @@ public function generate_optimied_css_for_post( $post_id, $post, $update ) { // Go through and gather all the styles. $styles = array(); // Holds unique ids and styles from blocks. - $this->parse_blocks( $blocks, $styles ); + self::parse_blocks( $blocks, $styles ); // Generate the optimized CSS. $styles_only = array(); @@ -123,7 +123,7 @@ public function generate_optimied_css_for_post( $post_id, $post, $update ) { $styles_only[] = $block_style[1]; } } - $optimized_css = $this->generate_css( $styles_only ); + $optimized_css = self::generate_css( $styles_only ); // Save the optimized CSS to the post. update_post_meta( $post_id, 'stackable_optimized_css', $optimized_css ); @@ -138,14 +138,14 @@ public function generate_optimied_css_for_post( $post_id, $post, $update ) { * * @return void */ - public function parse_blocks( $blocks, &$style_arr ) { + public static function parse_blocks( $blocks, &$style_arr ) { foreach ( $blocks as $block ) { $block_name = isset( $block['blockName'] ) ? $block['blockName'] : ''; if ( stripos( $block_name, 'stackable/' ) !== false ) { - $this->parse_block_style( $block, $style_arr ); + self::parse_block_style( $block, $style_arr ); } - $this->parse_blocks( $block['innerBlocks'], $style_arr ); + self::parse_blocks( $block['innerBlocks'], $style_arr ); } } @@ -157,7 +157,7 @@ public function parse_blocks( $blocks, &$style_arr ) { * * @return void */ - public function parse_block_style( $block, &$style_arr ) { + public static function parse_block_style( $block, &$style_arr ) { $block_content = $block['innerHTML']; if ( stripos( $block_content, ' $selector_arr ) { @@ -428,7 +435,7 @@ public function generate_css( $styles ) { $style_rules = str_replace( '/* */', '', $style_rules ); // Optimize selectors by combining similar ones. - $selector_arr = $this->combine_selectors( $selector_arr ); + $selector_arr = self::combine_selectors( $selector_arr ); $css .= implode( ',', $selector_arr ) . $style_rules; }