コード例 #1
0
 /**
  * Generates the Brightcove Menus and non-menu admin pages
  */
 public function register_admin_menu()
 {
     global $submenu;
     if (BC_Utility::current_user_can_brightcove()) {
         add_menu_page(esc_html__('Brightcove', 'brightcove'), esc_html__('Brightcove', 'brightcove'), 'edit_posts', 'brightcove', array($this, 'render_settings_page'), plugins_url('images/menu-icon.svg', dirname(__DIR__)), 50);
         add_submenu_page('brightcove', esc_html__('Brightcove Videos', 'brightcove'), esc_html__('Videos', 'brightcove'), 'edit_posts', BC_Admin_Menu::get_videos_page_uri_component(), array($this, 'render_videos_page'));
         add_submenu_page('brightcove', esc_html__('Brightcove Playlists', 'brightcove'), esc_html__('Playlists', 'brightcove'), 'edit_posts', BC_Admin_Menu::get_playlists_page_uri_component(), array($this, 'render_playlists_page'));
         add_submenu_page('brightcove', esc_html__('Brightcove Settings', 'brightcove'), esc_html__('Settings', 'brightcove'), 'manage_options', 'brightcove-sources', array($this, 'render_settings_page'));
         // These have no parent menu slug so they don't appear in the menu
         add_submenu_page(null, esc_html__('Add Source', 'brightcove'), esc_html__('Add Source', 'brightcove'), 'manage_options', 'page-brightcove-edit-source', array($this, 'render_edit_source_page'));
         // Removes the Brightcove Submenu from the menu that WP automatically provides when registering a top level page
         array_shift($submenu['brightcove']);
     }
 }
コード例 #2
0
 public static function preload_params()
 {
     global $bc_accounts;
     $tags = new BC_Tags();
     $params = array();
     // Fetch all preload vids/playlists as appropriate.
     $uri = $_SERVER['REQUEST_URI'];
     $type = 'videos';
     if (BC_Utility::current_user_can_brightcove()) {
         $cms_api = new BC_CMS_API();
         $admin_media_api = new BC_Admin_Media_API();
         if (false !== strpos($uri, BC_Admin_Menu::get_playlists_page_uri_component())) {
             $type = 'playlists';
             $params['playlists'] = $cms_api->playlist_list();
         }
     } else {
         return false;
     }
     $params['dates'] = array($type => BC_Utility::get_video_playlist_dates_for_display($type));
     $params['nonce'] = wp_create_nonce('_bc_ajax_search_nonce');
     $params['tags'] = $tags->get_tags();
     $params['plupload'] = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'brightcove-select-files-button', 'container' => 'drop-target', 'drop_element' => 'drop-target', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php?action=bc_media_upload'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => esc_html__('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => true, 'multipart_params' => array('action' => 'bc_media_upload'));
     $params['messages'] = array('confirmDelete' => esc_html__('Deleting this video will prevent it from showing in any existing posts. Are you sure you want to delete?', 'brightcove'), 'ongoingSync' => esc_html__('We are currently performing a sync of your new Brightcove source, you may not see all videos and playlists until that is complete.', 'brightcove'), 'successUpload' => esc_html__('Successfully uploaded file with name %%s%%.', 'brightcove'), 'unableToUpload' => esc_html__('We were unable to upload the file with name %%s%% Please try reuploading it again.', 'brightcove'));
     // Fetch all account hash/name combos.
     $params['accounts'] = $bc_accounts->get_sanitized_all_accounts();
     // Fetch all supported mime types.
     $params['mimeTypes'] = BC_Utility::get_all_brightcove_mimetypes();
     $defaultAccount = $bc_accounts->get_account_details_for_user();
     $params['defaultAccount'] = $defaultAccount['hash'];
     $params['defaultAccountId'] = $defaultAccount['account_id'];
     return $params;
 }