| @@ 57-69 (lines=13) @@ | ||
| 54 | return self::$instance; |
|
| 55 | } |
|
| 56 | ||
| 57 | public function run() |
|
| 58 | { |
|
| 59 | if ( is_admin() ) { |
|
| 60 | if ( is_multisite() && is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() ) { |
|
| 61 | add_action( 'network_admin_menu', array( $this, 'admin_menu' ) ); |
|
| 62 | } else { |
|
| 63 | add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 64 | } |
|
| 65 | add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_extra_tab' ) ); |
|
| 66 | } else { |
|
| 67 | add_action( 'wp', array( $this, 'run_on_frontend' ) ); |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| 71 | public function set_options( array $options ) |
|
| 72 | { |
|
| @@ 97-109 (lines=13) @@ | ||
| 94 | return self::$instance; |
|
| 95 | } |
|
| 96 | ||
| 97 | public function run() |
|
| 98 | { |
|
| 99 | if ( is_admin() ) { |
|
| 100 | if ( is_multisite() && is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() ) { |
|
| 101 | add_action( 'network_admin_menu', array( $this, 'imgopt_admin_menu' ) ); |
|
| 102 | } else { |
|
| 103 | add_action( 'admin_menu', array( $this, 'imgopt_admin_menu' ) ); |
|
| 104 | } |
|
| 105 | add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_imgopt_tab' ), 9 ); |
|
| 106 | } else { |
|
| 107 | add_action( 'wp', array( $this, 'run_on_frontend' ) ); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| 111 | public function run_on_frontend() { |
|
| 112 | if ( ! $this->should_run() ) { |
|