/** * Register all of the hooks related to the amdin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_admin_hooks() { $plugin_admin = new Plugin_Name_Admin($this->get_plugin_name(), $this->get_version()); //$this->loader->add_filter( 'single_template', $plugin_admin, 'single_template' ); $this->loader->add_filter('login_redirect', $plugin_admin, 'login_redirect', 10, 3); $this->loader->add_filter('post_row_actions', $plugin_admin, 'add_beer_review_link', 10, 2); //$this->loader->add_filter( 'admin_post_thumbnail_html', $plugin_admin, 'thumbnail_html', 10 , 2 ); //$this->loader->add_filter( 'post_thumbnail_html', $plugin_admin, 'show_thumbnail_url' ); //$this->loader->add_action( 'save_post', $plugin_admin, 'add_thumbnail_url' ); $this->loader->add_action('init', $plugin_admin, 'post_types'); $this->loader->add_action('admin_init', $plugin_admin, 'admin_init'); $this->loader->add_action('add_meta_boxes', $plugin_admin, 'add_meta_box'); $this->loader->add_action('save_post', $plugin_admin, 'add_beer_fields'); $this->loader->add_action('save_post', $plugin_admin, 'add_review_fields'); $this->loader->add_action('admin_menu', $plugin_admin, 'admin_menu'); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); $this->loader->add_action('admin_post_add_categories', $plugin_admin->controller, 'categories_add'); $this->loader->add_action('admin_bar_menu', $plugin_admin, 'admin_bar_menu', 999); $ajax = new My_Ajax(); $this->loader->add_action('wp_ajax_search_brewery', $ajax, 'search_brewery'); $this->loader->add_action('wp_ajax_search_beer', $ajax, 'search_beer'); $this->loader->add_action('wp_ajax_my_beer_cooler', $ajax, 'my_beer_cooler'); $this->loader->add_action('wp_ajax_quick_beer_rate', $ajax, 'quick_beer_rate'); $this->loader->add_action('wp_ajax_remove_punto_venta', $ajax, 'remove_punto_venta'); $this->loader->add_action('wp_ajax_remove_punto_venta', $ajax, 'remove_punto_venta'); $this->loader->add_action('wp_ajax_remove_punto_distribucion', $ajax, 'remove_punto_distribucion'); }
/** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_public_hooks() { $plugin_public = new Plugin_Name_Public($this->get_plugin_name(), $this->get_version()); $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); $this->loader->add_filter('template_include', $plugin_public, 'assign_new_template'); $this->loader->add_filter('pre_get_posts', $plugin_public, 'modify_template_query'); }
/** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - Plugin_Name_Loader. Orchestrates the hooks of the plugin. * - Plugin_Name_i18n. Defines internationalization functionality. * - Plugin_Name_Admin. Defines all hooks for the admin area. * - Plugin_Name_Public. Defines all hooks for the public side of the site. * * Create an instance of the loader which will be used to register the hooks * with WordPress. * * @since 1.0.0 * @access private */ private function load_dependencies() { /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-aria-loader.php'; $this->loader = new ARIA_Loader(); /** * The class responsible for defining internationalization functionality * of the plugin. */ require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-plugin-name-i18n.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-plugin-name-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once plugin_dir_path(dirname(__FILE__)) . 'public/class-aria-public.php'; // Include all of the ARIA files needed as dependencies. require_once "class-aria-create-competition.php"; require_once "class-aria-music.php"; require_once "class-aria-form-hooks.php"; // Register all of the hooks needed by ARIA // Creating student and teacher forms /* !!! like below, this might not work if aria_get_create_competition_form_id returns a value of -1. !!! */ $this->loader->add_action('gform_confirmation_' . strval(ARIA_API::aria_get_create_competition_form_id()), 'ARIA_Create_Competition', 'aria_create_teacher_and_student_forms', 10, 4); $this->loader->add_action('gform_after_submission', 'ARIA_Form_Hooks', 'aria_after_student_submission', 10, 2); // Adding music upload/download functionality $this->loader->add_action('gform_after_submission_' . strval(ARIA_API::aria_get_song_upload_form_id()), 'ARIA_Music', 'aria_add_music_from_csv', 10, 2); // For before/after student and teacher registration /* note: these values are hardcoded for now can't do this here because we do not know the form ID of the student form before the create competition functionality is invoked */ /* $this->loader->add_action('gform_after_submission_292', 'ARIA_Form_Hooks', 'aria_after_student_submission', 10, 2); */ // Modifying the upload path $this->loader->add_filter('gform_upload_path', 'ARIA_Music', 'aria_modify_upload_path', 10, 2); }
/** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_admin_hooks() { $plugin_admin = new Virtual_School_Admin($this->get_plugin_name(), $this->get_version()); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); // Add menu item $this->loader->add_action('admin_menu', $plugin_admin, 'add_plugin_admin_menu'); // Add Settings link to the plugin $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_name . '.php'); $this->loader->add_filter('plugin_action_links_' . $plugin_basename, $plugin_admin, 'add_action_links'); // Save/Update our plugin options $this->loader->add_action('admin_init', $plugin_admin, 'options_update'); }