PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | php/Flat_Files/Snippet_Files.php +7 -7 4.0.0-beta.1 → trunk View file →
@@ -8,8 +8,9 @@
8 8 use Code_Snippets\Flat_Files\Interfaces\Snippet_Type_Handler;
9 9 use Code_Snippets\Model\Snippet;
10 10 use function Code_Snippets\code_snippets;
11 11 use function Code_Snippets\get_snippet;
12 +use function wp_hash;
12 13 use const Code_Snippets\CACHE_GROUP;
13 14
14 15 /**
15 16 /**
@@ -105,9 +106,8 @@
105 106 /**
106 107 * Register WordPress hooks used by file-based execution.
107 108 *
108 109 * @return void
109 - * @noinspection PhpRedundantOptionalArgumentInspection
110 110 */
111 111 public function register_hooks(): void {
112 112 if ( ! $this->fs->is_writable( WP_CONTENT_DIR ) ) {
113 113 return;
@@ -117,9 +117,9 @@
117 117 add_action( 'code_snippets/create_snippet', [ $this, 'handle_snippet' ], 10, 2 );
118 118 add_action( 'code_snippets/update_snippet', [ $this, 'handle_snippet' ], 10, 2 );
119 119 add_action( 'code_snippets/delete_snippet', [ $this, 'delete_snippet' ], 10, 2 );
120 120 add_action( 'code_snippets/trash_snippet', [ $this, 'delete_snippet' ], 10, 2 );
121 - add_action( 'code_snippets/activate_snippet', [ $this, 'activate_snippet' ], 10, 1 );
121 + add_action( 'code_snippets/activate_snippet', [ $this, 'activate_snippet' ] );
122 122 add_action( 'code_snippets/deactivate_snippet', [ $this, 'deactivate_snippet' ], 10, 2 );
123 123 add_action( 'code_snippets/activate_snippets', [ $this, 'activate_snippets' ], 10, 2 );
124 124
125 125 add_action( 'updated_option', [ $this, 'sync_active_shared_network_snippets' ], 10, 3 );
@@ -125,10 +125,10 @@
125 125 add_action( 'updated_option', [ $this, 'sync_active_shared_network_snippets' ], 10, 3 );
126 126 add_action( 'add_option', [ $this, 'sync_active_shared_network_snippets_add' ], 10, 2 );
127 127 }
128 128
129 - add_filter( 'code_snippets_settings_fields', [ $this, 'add_settings_fields' ], 10, 1 );
130 - add_action( 'code_snippets/settings_updated', [ $this, 'create_all_flat_files' ], 10, 1 );
129 + add_filter( 'code_snippets_settings_fields', [ $this, 'add_settings_fields' ] );
130 + add_action( 'code_snippets/settings_updated', [ $this, 'create_all_flat_files' ] );
131 131 }
132 132
133 133 /**
134 134 * Set a number of snippets to active status.
@@ -168,11 +168,11 @@
168 168 $this->config_repo->update( $base_dir, $snippet );
169 169 }
170 170
171 171 /**
172 - * Synchronise a snippet with the filesystem storage.
172 + * Synchronize a snippet with the filesystem storage.
173 173 *
174 - * @param Snippet $snippet Snippet to synchronise.
174 + * @param Snippet $snippet Snippet to synchronize.
175 175 * @param string $table Database table snippet belongs to.
176 176 *
177 177 * @return void
178 178 */
@@ -404,9 +404,9 @@
404 404 * @return string Hashed table name.
405 405 */
406 406 public static function get_hashed_table_name( string $table ): string {
407 407 // wp_hash() is pluggable and may not be available during early bootstrap.
408 - return function_exists( 'wp_hash' ) ? \wp_hash( $table ) : md5( $table );
408 + return function_exists( 'wp_hash' ) ? wp_hash( $table ) : md5( $table );
409 409 }
410 410
411 411 /**
412 412 * Get a list of active snippets from flat file config.