@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Full_Page_Delegate implements Page_Delegate { |
| 6 | 6 | |
| 7 | - public function render() { |
|
| 8 | - include WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/main_ingredient.php'; |
|
| 9 | - } |
|
| 7 | + public function render() { |
|
| 8 | + include WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/main_ingredient.php'; |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | - public function admin_enqueue_scripts() { |
|
| 12 | - wp_enqueue_style( 'thickbox' ); |
|
| 13 | - wp_enqueue_script( 'plugin-install' ); |
|
| 14 | - } |
|
| 11 | + public function admin_enqueue_scripts() { |
|
| 12 | + wp_enqueue_style( 'thickbox' ); |
|
| 13 | + wp_enqueue_script( 'plugin-install' ); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | 16 | } |
@@ -5,12 +5,12 @@ |
||
| 5 | 5 | class Full_Page_Delegate implements Page_Delegate { |
| 6 | 6 | |
| 7 | 7 | public function render() { |
| 8 | - include WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/main_ingredient.php'; |
|
| 8 | + include WL_FOOD_KG_DIR_PATH.'/includes/admin/partials/main_ingredient.php'; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | public function admin_enqueue_scripts() { |
| 12 | - wp_enqueue_style( 'thickbox' ); |
|
| 13 | - wp_enqueue_script( 'plugin-install' ); |
|
| 12 | + wp_enqueue_style('thickbox'); |
|
| 13 | + wp_enqueue_script('plugin-install'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | } |
@@ -4,55 +4,55 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Page { |
| 6 | 6 | |
| 7 | - /** |
|
| 8 | - * @var Page_Delegate |
|
| 9 | - */ |
|
| 10 | - private $delegate; |
|
| 11 | - |
|
| 12 | - /** |
|
| 13 | - * @param Page_Delegate $full_page_delegate |
|
| 14 | - * @param Page_Delegate $modal_page_delegate |
|
| 15 | - */ |
|
| 16 | - public function __construct( $full_page_delegate, $modal_page_delegate ) { |
|
| 17 | - $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - public function register_hooks() { |
|
| 21 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 22 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 23 | - if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 24 | - add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 25 | - } |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Remove notices from ingredients modal. |
|
| 30 | - */ |
|
| 31 | - public function remove_notices() { |
|
| 32 | - remove_all_actions( 'admin_notices' ); |
|
| 33 | - remove_all_actions( 'all_admin_notices' ); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function admin_menu() { |
|
| 37 | - add_submenu_page( |
|
| 38 | - 'wl_admin_menu', |
|
| 39 | - __( 'Ingredients', 'wordlift' ), |
|
| 40 | - __( 'Ingredients', 'wordlift' ), |
|
| 41 | - 'manage_options', |
|
| 42 | - 'wl_ingredients', |
|
| 43 | - array( $this, 'render' ) |
|
| 44 | - ); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function render() { |
|
| 48 | - $this->delegate->render(); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - public function admin_enqueue_scripts() { |
|
| 52 | - // Check that we are on the right screen |
|
| 53 | - if ( get_current_screen()->id === 'wordlift_page_wl_ingredients' ) { |
|
| 54 | - $this->delegate->admin_enqueue_scripts(); |
|
| 55 | - } |
|
| 56 | - } |
|
| 7 | + /** |
|
| 8 | + * @var Page_Delegate |
|
| 9 | + */ |
|
| 10 | + private $delegate; |
|
| 11 | + |
|
| 12 | + /** |
|
| 13 | + * @param Page_Delegate $full_page_delegate |
|
| 14 | + * @param Page_Delegate $modal_page_delegate |
|
| 15 | + */ |
|
| 16 | + public function __construct( $full_page_delegate, $modal_page_delegate ) { |
|
| 17 | + $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + public function register_hooks() { |
|
| 21 | + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 22 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 23 | + if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 24 | + add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Remove notices from ingredients modal. |
|
| 30 | + */ |
|
| 31 | + public function remove_notices() { |
|
| 32 | + remove_all_actions( 'admin_notices' ); |
|
| 33 | + remove_all_actions( 'all_admin_notices' ); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + public function admin_menu() { |
|
| 37 | + add_submenu_page( |
|
| 38 | + 'wl_admin_menu', |
|
| 39 | + __( 'Ingredients', 'wordlift' ), |
|
| 40 | + __( 'Ingredients', 'wordlift' ), |
|
| 41 | + 'manage_options', |
|
| 42 | + 'wl_ingredients', |
|
| 43 | + array( $this, 'render' ) |
|
| 44 | + ); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function render() { |
|
| 48 | + $this->delegate->render(); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + public function admin_enqueue_scripts() { |
|
| 52 | + // Check that we are on the right screen |
|
| 53 | + if ( get_current_screen()->id === 'wordlift_page_wl_ingredients' ) { |
|
| 54 | + $this->delegate->admin_enqueue_scripts(); |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | } |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | * @param Page_Delegate $full_page_delegate |
| 14 | 14 | * @param Page_Delegate $modal_page_delegate |
| 15 | 15 | */ |
| 16 | - public function __construct( $full_page_delegate, $modal_page_delegate ) { |
|
| 17 | - $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 16 | + public function __construct($full_page_delegate, $modal_page_delegate) { |
|
| 17 | + $this->delegate = isset($_GET['modal_window']) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function register_hooks() { |
| 21 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 22 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 23 | - if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 24 | - add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 21 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
| 22 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 23 | + if (isset($_GET['modal_window'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 24 | + add_action('in_admin_header', array($this, 'remove_notices'), 99); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | * Remove notices from ingredients modal. |
| 30 | 30 | */ |
| 31 | 31 | public function remove_notices() { |
| 32 | - remove_all_actions( 'admin_notices' ); |
|
| 33 | - remove_all_actions( 'all_admin_notices' ); |
|
| 32 | + remove_all_actions('admin_notices'); |
|
| 33 | + remove_all_actions('all_admin_notices'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function admin_menu() { |
| 37 | 37 | add_submenu_page( |
| 38 | 38 | 'wl_admin_menu', |
| 39 | - __( 'Ingredients', 'wordlift' ), |
|
| 40 | - __( 'Ingredients', 'wordlift' ), |
|
| 39 | + __('Ingredients', 'wordlift'), |
|
| 40 | + __('Ingredients', 'wordlift'), |
|
| 41 | 41 | 'manage_options', |
| 42 | 42 | 'wl_ingredients', |
| 43 | - array( $this, 'render' ) |
|
| 43 | + array($this, 'render') |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function admin_enqueue_scripts() { |
| 52 | 52 | // Check that we are on the right screen |
| 53 | - if ( get_current_screen()->id === 'wordlift_page_wl_ingredients' ) { |
|
| 53 | + if (get_current_screen()->id === 'wordlift_page_wl_ingredients') { |
|
| 54 | 54 | $this->delegate->admin_enqueue_scripts(); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | <hr class="wp-header-end"> |
| 12 | 12 | <?php |
| 13 | 13 | |
| 14 | - // Prepare Table of elements |
|
| 15 | - $main_ingredient_list_table = new Main_Ingredient_List_Table(); |
|
| 16 | - $main_ingredient_list_table->prepare_items(); |
|
| 17 | - $main_ingredient_list_table->display(); |
|
| 18 | - ?> |
|
| 14 | + // Prepare Table of elements |
|
| 15 | + $main_ingredient_list_table = new Main_Ingredient_List_Table(); |
|
| 16 | + $main_ingredient_list_table->prepare_items(); |
|
| 17 | + $main_ingredient_list_table->display(); |
|
| 18 | + ?> |
|
| 19 | 19 | </div> |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | <div class="wrap"> |
| 9 | - <h1 class="wp-heading-inline"><?php esc_html_e( 'Main Ingredients', 'wordlift' ); ?></h1> |
|
| 10 | - <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=wl_download_ingredients_data&_wpnonce=' . wp_create_nonce( 'wl-dl-ingredients-data-nonce' ) ) ); ?>" class="page-title-action"><?php esc_html_e( 'Download Ingredients Data', 'wordlift' ); ?></a> |
|
| 9 | + <h1 class="wp-heading-inline"><?php esc_html_e('Main Ingredients', 'wordlift'); ?></h1> |
|
| 10 | + <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=wl_download_ingredients_data&_wpnonce='.wp_create_nonce('wl-dl-ingredients-data-nonce'))); ?>" class="page-title-action"><?php esc_html_e('Download Ingredients Data', 'wordlift'); ?></a> |
|
| 11 | 11 | <hr class="wp-header-end"> |
| 12 | 12 | <?php |
| 13 | 13 | |