avada_builder.php
6 months ago
bricks_builder.php
6 months ago
divi_theme.php
6 months ago
google_site_kit.php
6 months ago
hive_press.php
6 months ago
maintenance.php
6 months ago
oxygen_builder.php
6 months ago
the_events_calendar.php
6 months ago
wpml.php
6 months ago
hive_press.php
48 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Legacy\EmailEncoderBundle\Integration; |
| 4 | |
| 5 | use OnlineOptimisation\EmailEncoderBundle\Integrations\IntegrationInterface; |
| 6 | use OnlineOptimisation\EmailEncoderBundle\Traits\PluginHelper; |
| 7 | |
| 8 | class HivePress implements IntegrationInterface { |
| 9 | |
| 10 | use PluginHelper; |
| 11 | |
| 12 | public function boot (): void { |
| 13 | if ( $this->is_active() ) { |
| 14 | add_filter( 'eeb/settings/fields', [ $this, 'deactivate_logic' ], 10 ); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | |
| 19 | public function is_active(): bool { |
| 20 | return defined( 'HP_FILE' ); |
| 21 | } |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * @param array< string, array< string, mixed > > $fields |
| 26 | * @return array< string, array< string, mixed > > |
| 27 | */ |
| 28 | public function deactivate_logic( $fields ) { |
| 29 | |
| 30 | $uri = isset( $_SERVER['REQUEST_URI'] ) |
| 31 | ? wp_parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) |
| 32 | : '' |
| 33 | ; |
| 34 | |
| 35 | $condition = preg_match( '#/account/listings/(\d+)/?$#', $uri ) |
| 36 | && isset( $fields['protect']['value'] ) |
| 37 | ; |
| 38 | |
| 39 | if ( $condition ) { |
| 40 | // $this->log( 'HivePress: protecting; trait is working :)' ); |
| 41 | $fields[ 'protect' ]['value'] = $this->settings()::PROTECT_DISABLED; |
| 42 | } |
| 43 | |
| 44 | return $fields; |
| 45 | } |
| 46 | |
| 47 | } |
| 48 |