| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Class Optml_Divi |
| 5 |
* |
| 6 |
* An example of a conflict. |
| 7 |
*/ |
| 8 |
class Optml_Divi extends Optml_abstract_conflict { |
| 9 |
|
| 10 |
/** |
| 11 |
* Optml_Divi constructor. |
| 12 |
*/ |
| 13 |
public function __construct() { |
| 14 |
$this->priority = 2; |
| 15 |
$this->severity = self::SEVERITY_HIGH; |
| 16 |
parent::__construct(); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Set the message property |
| 21 |
* |
| 22 |
* @since 2.2.6 |
| 23 |
* @access public |
| 24 |
*/ |
| 25 |
public function define_message() { |
| 26 |
$this->message = sprintf( __( 'It seems your are using %1$sDivi%2$s right now. %3$s In order for Optimole to replace the images in your Divi pages, you will need to go to %4$sDivi -> Theme Options -> Builder -> Advanced -> Static CSS File Generations%5$s and click on Clear for the images to be processed. ', 'optimole-wp' ), '<b>', '</b>', '<br/>', '<a target="_blank" href="' . admin_url( 'admin.php?page=et_divi_options' ) . '">', '</a>' ); |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* Determine if conflict is applicable. |
| 32 |
* |
| 33 |
* @return bool |
| 34 |
* @since 2.2.6 |
| 35 |
* @access public |
| 36 |
*/ |
| 37 |
public function is_conflict_valid() { |
| 38 |
$show_message = false; |
| 39 |
if ( is_plugin_active( 'divi-builder/divi-builder.php' ) ) { |
| 40 |
$show_message = true; |
| 41 |
} |
| 42 |
|
| 43 |
$theme = wp_get_theme(); |
| 44 |
// Divi, no child theme. |
| 45 |
if ( strcmp( $theme->get( 'Name' ), 'Divi' ) === 0 && $theme->parent() === false ) { |
| 46 |
$show_message = true; |
| 47 |
} |
| 48 |
// Child theme, parent divi. |
| 49 |
if ( $theme->parent() !== false && strcmp( $theme->parent()->get( 'Name' ), 'Divi' ) === 0 ) { |
| 50 |
$show_message = true; |
| 51 |
} |
| 52 |
if ( ! function_exists( 'et_get_option' ) ) { |
| 53 |
return false; |
| 54 |
} |
| 55 |
if ( 'off' === et_get_option( 'et_pb_static_css_file', 'off' ) ) { |
| 56 |
return false; |
| 57 |
} |
| 58 |
|
| 59 |
return $show_message; |
| 60 |
} |
| 61 |
} |
| 62 |
|