Jetpack::get_module_slug PHP Method

get_module_slug() public static method

Extract a module's slug from its full path.
public static get_module_slug ( $file )
    public static function get_module_slug($file)
    {
        return str_replace('.php', '', basename($file));
    }

Usage Example

コード例 #1
0
 function options($file, $option)
 {
     $options = func_get_args();
     $file = array_shift($options);
     $module_slug = Jetpack::get_module_slug($file);
     if (!isset($this->sync_options[$module_slug])) {
         $this->sync_options[$module_slug] = array();
     }
     foreach ($options as $option) {
         $this->sync_options[$module_slug][] = $option;
         add_action("delete_option_{$option}", array($this, 'deleted_option_action'));
         add_action("update_option_{$option}", array($this, 'updated_option_action'));
         add_action("add_option_{$option}", array($this, 'added_option_action'));
     }
     $this->sync_options[$module_slug] = array_unique($this->sync_options[$module_slug]);
 }
All Usage Examples Of Jetpack::get_module_slug
Jetpack