示例#1
0
 function optionsrara_init()
 {
     //  If user can't edit theme options, exit
     if (!current_user_can('edit_theme_options')) {
         return;
     }
     // Loads the required Options rara classes.
     require plugin_dir_path(__FILE__) . 'includes/class-options-rara.php';
     require plugin_dir_path(__FILE__) . 'includes/class-options-rara-admin.php';
     require plugin_dir_path(__FILE__) . 'includes/class-options-interface.php';
     require plugin_dir_path(__FILE__) . 'includes/class-options-media-uploader.php';
     require plugin_dir_path(__FILE__) . 'includes/class-options-sanitization.php';
     // Instantiate the options page.
     $options_rara_admin = new Options_rara_Admin();
     $options_rara_admin->init();
     // Instantiate the media uploader class
     $options_rara_media_uploader = new Options_rara_Media_Uploader();
     $options_rara_media_uploader->init();
 }
 /**
  * Enqueue scripts for file uploader
  */
 function optionsrara_media_scripts($hook)
 {
     $menu = Options_rara_Admin::menu_settings();
     if (substr($hook, -strlen($menu['menu_slug'])) !== $menu['menu_slug']) {
         return;
     }
     if (function_exists('wp_enqueue_media')) {
         wp_enqueue_media();
     }
     wp_register_script('of-media-uploader', OPTIONS_rara_DIRECTORY . 'js/media-uploader.js', array('jquery'), Options_rara::VERSION);
     wp_enqueue_script('of-media-uploader');
     wp_localize_script('of-media-uploader', 'optionsrara_l10n', array('upload' => __('Upload', 'rara-clean'), 'remove' => __('Remove', 'rara-clean')));
 }