diff --git a/includes/admin.php b/includes/admin.php index f011218..736afd3 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -62,7 +62,7 @@ public function add_menu_item() __('Protected Video', 'protected-video'), // menu_title 'manage_options', // capability $this->plugin_name, // menu_slug - [$this, 'protected_video_create_admin_page'] // function + [$this, 'render_settings_page'] // callback ); } @@ -102,7 +102,7 @@ public function add_settings_link($links) /** * Return settings page. */ - public function protected_video_create_admin_page() + public function render_settings_page() { ?>
@@ -125,14 +125,14 @@ public function settings_page_init() add_settings_section( 'protected_video_setting_section', // HTML id __('Settings', 'protected-video'), // title - [$this, 'protected_video_section_info'], // callback + [$this, 'render_settings_description'], // callback 'protected-video-admin' // page ); add_settings_field( 'player_theme_color', // HTML id __('Player Theme Color', 'protected-video'), // field title - [$this, 'player_theme_color_callback'], // callback + [$this, 'render_color_input'], // callback 'protected-video-admin', // page 'protected_video_setting_section', // section [ @@ -159,7 +159,7 @@ public function sanitize_plugin_color_input($input) /** * Explanation copy on settings page (between heading and fields). */ - public function protected_video_section_info() + public function render_settings_description() { printf( __( @@ -175,7 +175,7 @@ public function protected_video_section_info() /** * Returns player theme color field on settings page. */ - public function player_theme_color_callback($val) + public function render_color_input($val) { $id = $val['id']; $name = $val['option_name']; diff --git a/includes/core.php b/includes/core.php index fc638cf..3f2b739 100644 --- a/includes/core.php +++ b/includes/core.php @@ -112,10 +112,7 @@ private function define_public_hooks() ); // Shortcode - add_shortcode('protected_video', [ - $plugin_public, - 'protected_video_shortcode', - ]); + add_shortcode('protected_video', [$plugin_public, 'render_shortcode']); // Public CSS add_action('wp_enqueue_scripts', [$plugin_public, 'enqueue_styles']); diff --git a/includes/public.php b/includes/public.php index 8a292e0..646d8fe 100644 --- a/includes/public.php +++ b/includes/public.php @@ -41,11 +41,11 @@ public function __construct($plugin_name, $version) } /** - * Set up shortcode for use as alternative to Gutenberg block. + * Render Shortcode (Gutenberg block alternative). * * Usage example: [protected_video url="https://youtu.be/c_hO_fjmMnk" service="youtube"] */ - public function protected_video_shortcode($atts) + public function render_shortcode($atts) { $atts = shortcode_atts( ['url' => '', 'service' => ''],