Skip to content
Snippets Groups Projects
Commit 5e011feb authored by Piotr Potrebka's avatar Piotr Potrebka
Browse files

fix: script version, docs

parent 0ce715a4
No related branches found
No related tags found
1 merge request!33feat: plugin path, lang, scripts version
Pipeline #138983 passed with stages
in 48 seconds
## [2.1.0] - 2022-11-07 ## [2.1.0] - 2022-12-15
### Added ### Added
- plugin path - plugin path
- plugin lang - plugin lang
......
...@@ -156,7 +156,7 @@ abstract class AbstractPlugin extends SlimPlugin { ...@@ -156,7 +156,7 @@ abstract class AbstractPlugin extends SlimPlugin {
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ] );
add_action( 'plugins_loaded', [ $this, 'load_plugin_text_domain' ] ); add_action( 'plugins_loaded', [ $this, 'load_plugin_text_domain' ] );
add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), [ $this, 'links_filter' ] ); add_filter( 'plugin_action_links_' . plugin_basename( $this->get_plugin_file_path() ), [ $this, 'links_filter' ] );
} }
/** /**
...@@ -171,9 +171,11 @@ abstract class AbstractPlugin extends SlimPlugin { ...@@ -171,9 +171,11 @@ abstract class AbstractPlugin extends SlimPlugin {
/** /**
* Append JS scripts in the WordPress admin panel. This is a hook function. Do not execute directly. * Append JS scripts in the WordPress admin panel. This is a hook function. Do not execute directly.
* *
* @param string $hook_suffix The current admin page passed from WordPress filter.
*
* @return void * @return void
*/ */
public function admin_enqueue_scripts( $hook = '' ) { public function admin_enqueue_scripts( $hook_suffix = '' ) {
} }
/** /**
...@@ -186,18 +188,20 @@ abstract class AbstractPlugin extends SlimPlugin { ...@@ -186,18 +188,20 @@ abstract class AbstractPlugin extends SlimPlugin {
/** /**
* @param string $prefix * @param string $prefix
* @param bool $random
* *
* @return int|string * @return string
*/ */
public function get_scripts_version( $prefix = '', $random = false ) { public function get_scripts_version( $prefix = '' ) {
if ( $random ) {
return time();
}
return $prefix . $this->plugin_info->get_version(); return $prefix . $this->plugin_info->get_version();
} }
/**
* @return int
*/
public function get_random_script_version() {
return time();
}
/** /**
* Initialize plugin admin links. This is a hook function. Do not execute directly. * Initialize plugin admin links. This is a hook function. Do not execute directly.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment