Changeset 3247829 for marquee-block/trunk/includes/Plugin.php
- Timestamp:
- 02/27/2025 12:14:59 PM (13 months ago)
- File:
-
- 1 edited
-
marquee-block/trunk/includes/Plugin.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
marquee-block/trunk/includes/Plugin.php
r3214417 r3247829 48 48 $this->init(); 49 49 } catch ( Exception $e ) { 50 wp_trigger_error( __METHOD__, $e->getMessage() ); 50 $message = sprintf( '<strong>%s:</strong> %s', $this->name(), $e->getMessage() ); 51 add_action( 52 'admin_notices', 53 function () use ( $message ) { 54 printf( '<div class="notice notice-error"><p>%s</p></div>', wp_kses_data( $message ) ); 55 }, 56 50 57 ); 51 58 } 52 59 … … 72 79 73 80 /** 81 * Get Plugin Name. 82 * 83 * @return string 84 * @since 1.0.0 85 */ 86 public function name(): string { 87 static $names; 88 89 if ( is_null( $names ) ) { 90 $names = get_file_data( $this->get_plugin_file(), array( 'Plugin Name' ) ); 91 } 92 93 return esc_attr( $names[0] ); 94 } 95 96 /** 74 97 * Get Plugin Version. 75 98 * … … 124 147 public function hooks() { 125 148 // Register with hook. 149 add_action( 'init', array( $this, 'load_translations' ) ); 150 } 151 152 /** 153 * Load Plugin Translation Files. 154 * 155 * @return void 156 */ 157 public function load_translations() { 158 load_plugin_textdomain( 'marquee-block', false, $this->plugin_dirname() . '/languages' ); 126 159 } 127 160 … … 153 186 */ 154 187 public function plugin_dirname(): string { 155 return dirname( plugin_basename( $this->get_plugin_file() ) );188 return untrailingslashit( dirname( plugin_basename( $this->get_plugin_file() ) ) ); 156 189 } 157 190
Note: See TracChangeset
for help on using the changeset viewer.