Skip to content

Commit

Permalink
Improve method names consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRust committed Jul 27, 2023
1 parent 22fca7e commit d4862c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
12 changes: 6 additions & 6 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down Expand Up @@ -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()
{
?>
<div class="wrap">
Expand All @@ -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
[
Expand All @@ -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(
__(
Expand All @@ -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'];
Expand Down
5 changes: 1 addition & 4 deletions includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
4 changes: 2 additions & 2 deletions includes/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => ''],
Expand Down

0 comments on commit d4862c3

Please sign in to comment.