Skip to content

Commit

Permalink
fix: compatibility with slider revolution
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoreMihai committed Nov 8, 2019
1 parent 9916ac4 commit 05c21ce
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
16 changes: 14 additions & 2 deletions inc/compatibilities/revslider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,22 @@ function should_load() {
* Register integration details.
*/
public function register() {
add_filter( 'optml_ignore_data_opt_flag', [ $this, 'add_data_ignore' ], 10, 3 );
add_filter( 'optml_lazyload_bg_classes', [ $this, 'add_bg_class' ], 10, 1 );
$settings = new Optml_Settings();
if ( $settings->get( 'lazyload' ) === 'enabled' ) {
add_filter(
'optml_lazyload_class_excluded',
function ( $array ) {
$array['rev-slidebg'] = true;
return $array;
}
);
}

add_filter( 'optml_ignore_data_opt_flag', [$this, 'add_data_ignore'], 10, 3 );
add_filter( 'optml_lazyload_bg_classes', [$this, 'add_bg_class'], 10, 1 );
}


/**
* Add classes for lazyload on background.
*
Expand Down
1 change: 0 additions & 1 deletion inc/lazyload_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ public function can_lazyload_for( $url, $tag = '' ) {
return false;
}
}

if ( false === Optml_Filters::should_do_image( $url, self::$filters[ Optml_Settings::FILTER_TYPE_LAZYLOAD ][ Optml_Settings::FILTER_FILENAME ] ) ) {
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions inc/tag_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function contains_banned_lazyload_class( $image_tag ) {
return false;
}
foreach ( self::$filters[ Optml_Settings::FILTER_TYPE_LAZYLOAD ][ Optml_Settings::FILTER_CLASS ] as $rule_flag => $status ) {
error_log( $rule_flag, 3, '/var/www/html/otimole.log' );
$class = strtok( $tmp_class_list, '" ' );
$loop = true;
while ( $class !== false && $loop === true ) {
Expand Down Expand Up @@ -162,6 +163,10 @@ public function process_image_tags( $content, $images = array() ) {

$image_sizes = self::image_sizes();
$sizes2crop = self::size_to_crop();
self::$filters[ Optml_Settings::FILTER_TYPE_LAZYLOAD ][ Optml_Settings::FILTER_CLASS ] = apply_filters(
'optml_lazyload_class_excluded',
self::$filters[ Optml_Settings::FILTER_TYPE_LAZYLOAD ][ Optml_Settings::FILTER_CLASS ]
);
$defined_lazyload_exclusion = empty( self::$filters[ Optml_Settings::FILTER_TYPE_LAZYLOAD ][ Optml_Settings::FILTER_CLASS ] ) === false;
foreach ( $images[0] as $index => $tag ) {
$width = $height = false;
Expand Down
1 change: 1 addition & 0 deletions optimole-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function optml() {

if ( ! defined( 'OPTML_DEBUG' ) ) {
define( 'OPTML_DEBUG', ( defined( 'TEST_GROUND' ) && TEST_GROUND ) ? true : false );
// define( 'OPTML_DEBUG',true);
}

return Optml_Main::instance();
Expand Down

0 comments on commit 05c21ce

Please sign in to comment.