|
@@ 62-73 (lines=12) @@
|
| 59 |
|
* the default value is 'yes'. Default null. |
| 60 |
|
* @return bool False if value was not updated and true if value was updated. |
| 61 |
|
*/ |
| 62 |
|
public static function update_option( $option, $value, $autoload = null ) |
| 63 |
|
{ |
| 64 |
|
|
| 65 |
|
// Ensure that is_plugin_active_for_network function is declared. |
| 66 |
|
self::maybe_include_plugin_functions(); |
| 67 |
|
|
| 68 |
|
if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) { |
| 69 |
|
return update_network_option( get_main_network_id(), $option, $value ); |
| 70 |
|
} else { |
| 71 |
|
return update_option( $option, $value, $autoload ); |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
/** |
| 76 |
|
* Use the pre_update_option filter to check if the option to be saved if from autoptimize and |
|
@@ 89-102 (lines=14) @@
|
| 86 |
|
} |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public static function update_autoptimize_option_on_network( $value, $option, $old_value ) { |
| 90 |
|
if( strpos( $option, 'autoptimize_' ) === 0 ) { |
| 91 |
|
|
| 92 |
|
// Ensure that is_plugin_active_for_network function is declared. |
| 93 |
|
self::maybe_include_plugin_functions(); |
| 94 |
|
|
| 95 |
|
if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) { |
| 96 |
|
update_network_option( get_main_network_id(), $option, $value ); |
| 97 |
|
// Return old value, to stop update_option logic. |
| 98 |
|
return $old_value; |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
return $value; |
| 102 |
|
} |
| 103 |
|
} |
| 104 |
|
new autoptimizeOption(); |
| 105 |
|
|