diff --git a/src/MasterBlocks.php b/src/MasterBlocks.php index cbe915911d..09159a2e3b 100644 --- a/src/MasterBlocks.php +++ b/src/MasterBlocks.php @@ -172,24 +172,25 @@ public function enqueue_block_public_assets(): void */ private function get_p4_options(): array { - $option_values = get_option('planet4_options'); $is_new_ia = !empty(planet4_get_option('new_ia')); + $take_action_page = planet4_get_option('take_action_page', ''); + $act_page = planet4_get_option('act_page', ''); $cookies_default_copy = [ - 'necessary_cookies_name' => $option_values['necessary_cookies_name'] ?? '', - 'necessary_cookies_description' => $option_values['necessary_cookies_description'] ?? '', - 'analytical_cookies_name' => $option_values['analytical_cookies_name'] ?? '', - 'analytical_cookies_description' => $option_values['analytical_cookies_description'] ?? '', - 'all_cookies_name' => $option_values['all_cookies_name'] ?? '', - 'all_cookies_description' => $option_values['all_cookies_description'] ?? '', + 'necessary_cookies_name' => planet4_get_option('necessary_cookies_name', ''), + 'necessary_cookies_description' => planet4_get_option('necessary_cookies_description', ''), + 'analytical_cookies_name' => planet4_get_option('analytical_cookies_name', ''), + 'analytical_cookies_description' => planet4_get_option('analytical_cookies_description', ''), + 'all_cookies_name' => planet4_get_option('all_cookies_name', ''), + 'all_cookies_description' => planet4_get_option('all_cookies_description', ''), ]; return [ - 'enable_analytical_cookies' => $option_values['enable_analytical_cookies'] ?? '', - 'enable_google_consent_mode' => $option_values['enable_google_consent_mode'] ?? '', + 'enable_analytical_cookies' => planet4_get_option('enable_analytical_cookies', ''), + 'enable_google_consent_mode' => planet4_get_option('enable_google_consent_mode', ''), 'cookies_default_copy' => $cookies_default_copy, - 'take_action_covers_button_text' => $option_values['take_action_covers_button_text'] ?? '', - 'take_action_page' => $is_new_ia ? $option_values['take_action_page'] : $option_values['act_page'], + 'take_action_covers_button_text' => planet4_get_option('take_action_covers_button_text', ''), + 'take_action_page' => $is_new_ia ? $take_action_page : $act_page, 'new_ia' => $is_new_ia, ]; } diff --git a/src/Post.php b/src/Post.php index c911e07c42..c0d1414841 100644 --- a/src/Post.php +++ b/src/Post.php @@ -106,9 +106,9 @@ public function is_campaign_page(): bool */ public function is_get_informed_page(): bool { - $act_page_id = planet4_get_option('get_informed_page'); + $get_informed_page_id = planet4_get_option('get_informed_page'); - return absint($act_page_id) === $this->id; + return absint($get_informed_page_id) === $this->id; } /** @@ -117,9 +117,9 @@ public function is_get_informed_page(): bool */ public function is_take_action_page(): bool { - $act_page_id = planet4_get_option('take_action_page'); + $take_action_page_id = planet4_get_option('take_action_page'); - return absint($act_page_id) === $this->id; + return absint($take_action_page_id) === $this->id; } /** @@ -128,9 +128,9 @@ public function is_take_action_page(): bool */ public function is_about_us_page(): bool { - $act_page_id = planet4_get_option('about_us_page'); + $about_us_page_id = planet4_get_option('about_us_page'); - return absint($act_page_id) === $this->id; + return absint($about_us_page_id) === $this->id; } /** @@ -163,7 +163,6 @@ public function get_new_ia_child_page_DLV(): string public function set_issues_links(): void { // Retrieve P4 settings in order to check that we add only categories that are children of the Issues category. - $options = get_option('planet4_options'); $categories = get_the_category($this->ID); $this->issues_nav_data = array_map(