NGG_Admin_Launcher

NGG_Admin_Launcher - Admin Section for NextGEN Gallery.

Defined (1)

The class is defined in the following location(s).

/admin/class-ngg-admin-launcher.php  
  1. class NGG_Admin_Launcher { 
  2.  
  3. /** 
  4. * The admin launcher isn't more than a bunch of functions that run when certain actions/filters are executed. 
  5. */ 
  6. public function __construct() { 
  7.  
  8. // Add the admin menu 
  9. add_action( 'admin_menu', array( $this, 'add_menu' ) ); 
  10. //Add the network menu 
  11. add_action( 'network_admin_menu', array( $this, 'add_network_admin_menu' ) ); 
  12.  
  13. // Add the script and style files 
  14. add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) ); 
  15. add_action( 'admin_enqueue_scripts', array( $this, 'load_styles' ) ); 
  16.  
  17. add_filter( 'current_screen', array( $this, 'edit_current_screen' ) ); 
  18.  
  19. // Add WPML hook to register description / alt text for translation 
  20. add_action( 'ngg_image_updated', array( 'nggGallery', 'RegisterString' ) ); 
  21.  
  22. add_filter( 'set-screen-option', array( $this, 'save_options' ), 10, 3 ); 
  23.  
  24.  
  25. /** 
  26. * Enable dash icons for WP latest versions. 
  27. * @see https://developer.wordpress.org/resource/dashicons/#format-gallery 
  28. * @param string $wp_version The WordPress version. Defaults to the current one. 
  29. * @return string The icon string. 
  30. */ 
  31.  
  32. private function get_icon_gallery( $wp_version = '' ) { 
  33. if ( empty( $wp_version ) ) { 
  34. $wp_version = get_bloginfo( 'version' ); //get WP Version 
  35. if ( $wp_version >= 3.8 ) { 
  36. return 'dashicons-format-gallery'; //new style 
  37.  
  38. //older style 
  39. return path_join( NGGALLERY_URLPATH, 'admin/images/nextgen_16_color.png' ); 
  40.  
  41. /** 
  42. * Add all menu pages to the WordPress menu. 
  43. */ 
  44. public function add_menu() { 
  45. add_menu_page( __( 'Galleries', 'nggallery' ), __( 'Galleries', 'nggallery' ),  
  46. 'NextGEN Gallery overview', NGGFOLDER, array( $this, 'show_menu' ), $this->get_icon_gallery() ); 
  47.  
  48. add_submenu_page( NGGFOLDER, __( 'Overview', 'nggallery' ), __( 'Overview', 'nggallery' ),  
  49. 'NextGEN Gallery overview',  
  50. NGGFOLDER, array( $this, 'show_menu' ) ); 
  51.  
  52. add_submenu_page( NGGFOLDER, __( 'Add Gallery / Images', 'nggallery' ),  
  53. __( 'Add Gallery / Images', 'nggallery' ), 'NextGEN Upload images', 'nggallery-add-gallery',  
  54. array( $this, 'show_menu' ) ); 
  55.  
  56. add_submenu_page( NGGFOLDER, __( 'Galleries', 'nggallery' ), __( 'Galleries', 'nggallery' ),  
  57. 'NextGEN Manage gallery', 'nggallery-manage',  
  58. array( $this, 'show_menu' ) ); 
  59.  
  60. add_submenu_page( NGGFOLDER, __( 'Albums', 'nggallery' ), __( 'Albums', 'nggallery' ), 'NextGEN Edit album',  
  61. 'nggallery-manage-album',  
  62. array( $this, 'show_menu' ) ); 
  63.  
  64. add_submenu_page( NGGFOLDER, __( 'Tags', 'nggallery' ), __( 'Tags', 'nggallery' ), 'NextGEN Manage tags',  
  65. 'nggallery-tags',  
  66. array( $this, 'show_menu' ) ); 
  67.  
  68. add_submenu_page( NGGFOLDER, __( 'Settings', 'nggallery' ), __( 'Settings', 'nggallery' ),  
  69. 'NextGEN Change options', 'nggallery-options',  
  70. array( $this, 'show_menu' ) ); 
  71.  
  72. if ( wpmu_enable_function( 'wpmuStyle' ) ) { 
  73. add_submenu_page( NGGFOLDER, __( 'Style', 'nggallery' ), __( 'Style', 'nggallery' ), 'NextGEN Change style',  
  74. 'nggallery-style',  
  75. array( $this, 'show_menu' ) ); 
  76. if ( wpmu_enable_function( 'wpmuRoles' ) || is_super_admin() ) { 
  77. add_submenu_page( NGGFOLDER, __( 'Roles', 'nggallery' ), __( 'Roles', 'nggallery' ), 'activate_plugins',  
  78. 'nggallery-roles',  
  79. array( $this, 'show_menu' ) ); 
  80.  
  81. if ( ! is_multisite() || is_super_admin() ) { 
  82. add_submenu_page( NGGFOLDER, __( 'Reset / Uninstall', 'nggallery' ), __( 'Reset / Uninstall', 'nggallery' ),  
  83. 'activate_plugins', 'nggallery-setup',  
  84. array( $this, 'show_menu' ) ); 
  85.  
  86. /** 
  87. * Add the network pages to the network menu. 
  88. */ 
  89. public function add_network_admin_menu() { 
  90. add_menu_page( __( 'Galleries', 'nggallery' ), __( 'Galleries', 'nggallery' ), 'nggallery-wpmu',  
  91. NGGFOLDER, array( $this, 'show_network_settings' ), $this->get_icon_gallery() ); 
  92.  
  93. add_submenu_page( NGGFOLDER, __( 'Network settings', 'nggallery' ), __( 'Network settings', 'nggallery' ),  
  94. 'nggallery-wpmu',  
  95. NGGFOLDER, array( $this, 'show_network_settings' ) ); 
  96.  
  97. add_submenu_page( NGGFOLDER, __( 'Reset / Uninstall', 'nggallery' ), __( 'Reset / Uninstall', 'nggallery' ),  
  98. 'activate_plugins',  
  99. 'nggallery-setup', array( $this, 'show_menu' ) ); 
  100.  
  101. /** 
  102. * Maybe show an upgrade page. 
  103. */ 
  104. private function show_upgrade_page() { 
  105.  
  106. // check for upgrade and show upgrade screen 
  107. if ( get_option( 'ngg_db_version' ) != NGG_DBVERSION ) { 
  108. include_once( dirname( __FILE__ ) . '/functions.php' ); 
  109. include_once( dirname( __FILE__ ) . '/upgrade.php' ); 
  110. nggallery_upgrade_page(); 
  111. exit; 
  112.  
  113. /** 
  114. * Show the network pages. 
  115. */ 
  116. public function show_network_settings() { 
  117. $this->show_upgrade_page(); 
  118. include_once( dirname( __FILE__ ) . '/class-ngg-style.php' ); 
  119. include_once( dirname( __FILE__ ) . '/wpmu.php' ); 
  120. nggallery_wpmu_setup(); 
  121.  
  122. // load the script for the defined page and load only this code 
  123. //20140515: removed donation code (not in use) 
  124. public function show_menu() { 
  125.  
  126. //Show the upgrade page if needed. 
  127. $this->show_upgrade_page(); 
  128.  
  129. $options = get_option( 'ngg_options' ); 
  130.  
  131. // Set installation date 
  132. if ( empty( $options['installDate'] ) ) { 
  133. $options['installDate'] = time(); 
  134. update_option( 'ngg_options', $options ); 
  135.  
  136. /** 
  137. * @var NGG_Displayable $page 
  138. */ 
  139. $page = null; 
  140.  
  141. switch ( $_GET['page'] ) { 
  142. case "nggallery-add-gallery" : 
  143. include_once( dirname( __FILE__ ) . '/functions.php' ); 
  144. include_once( dirname( __FILE__ ) . '/class-ngg-adder.php' ); 
  145. $page = new NGG_Adder(); 
  146. break; 
  147. case "nggallery-manage": 
  148. include_once( dirname( __FILE__ ) . '/functions.php' ); 
  149. $page = $this->get_manager(); 
  150. break; 
  151. case "nggallery-manage-album" : 
  152. include_once( dirname( __FILE__ ) . '/class-ngg-album-manager.php' ); 
  153. $page = new NGG_Album_Manager (); 
  154. break; 
  155. case "nggallery-options" : 
  156. include_once( dirname( __FILE__ ) . '/class-ngg-options.php' ); 
  157. $page = new NGG_Options(); 
  158. break; 
  159. case "nggallery-tags" : 
  160. include_once( dirname( __FILE__ ) . '/class-ngg-tag-manager.php' ); 
  161. $page = new NGG_Tag_Manager(); 
  162. break; 
  163. case "nggallery-style" : 
  164. include_once( dirname( __FILE__ ) . '/class-ngg-style.php' ); 
  165. $page = new NGG_Style(); 
  166. break; 
  167. case "nggallery-setup" : 
  168. include_once( dirname( __FILE__ ) . '/class-ngg-setup.php' ); 
  169. $page = new NGG_Setup(); 
  170. break; 
  171. case "nggallery-roles" : 
  172. include_once( dirname( __FILE__ ) . '/class-ngg-roles.php' ); 
  173. $page = new NGG_Roles(); 
  174. break; 
  175. case "nggallery": 
  176. default: 
  177. //Display the overview 
  178. include_once( dirname( __FILE__ ) . '/class-ngg-overview.php' ); 
  179. $page = new NGG_Overview(); 
  180.  
  181. /** 
  182. * Display the page. 
  183. */ 
  184. if ( $page != null ) { 
  185. $page->display(); 
  186.  
  187.  
  188. /** 
  189. * Switch between the different management modes: 
  190. * - a list of all galleries,  
  191. * - a list of all images in a gallery,  
  192. * - sort mode of a gallery,  
  193. * - search mode. 
  194. * @return NGG_Displayable The correct managing page or null if the page could not be found. 
  195. */ 
  196. private function get_manager() { 
  197.  
  198. if ( ! isset( $_GET['mode'] ) || $_GET['mode'] === 'gallery' ) { 
  199.  
  200. //Display the normal page. 
  201. include_once( 'manage/class-ngg-gallery-manager.php' ); 
  202.  
  203. return new NGG_Gallery_Manager(); 
  204.  
  205. } elseif ( $_GET['mode'] == 'image' ) { 
  206.  
  207. //Display overview of a gallery. 
  208. include_once( 'manage/class-ngg-image-manager.php' ); 
  209.  
  210. return new NGG_Image_Manager(); 
  211.  
  212. } elseif ( $_GET['mode'] == 'sort' ) { 
  213.  
  214. //Display sort page. 
  215. include_once( 'manage/class-ngg-sort-manager.php' ); 
  216.  
  217. return new NGG_Sort_Manager(); 
  218.  
  219. } elseif ( $_GET['mode'] == 'search' ) { 
  220.  
  221. //Display search results. 
  222. include_once( 'manage/class-ngg-search-manager.php' ); 
  223.  
  224. return new NGG_Search_Manager(); 
  225. } else { 
  226. return null; 
  227.  
  228. /** 
  229. * Load the scripts on the admin pages. 
  230. */ 
  231. public function load_scripts() { 
  232. // no need to go on if it's not a plugin page 
  233. if ( ! isset( $_GET['page'] ) ) { 
  234. return; 
  235.  
  236. wp_register_script( 'ngg-ajax', plugins_url( 'js/ngg.ajax.js', __FILE__), array( 'jquery' ), '1.4.1' ); 
  237. wp_localize_script( 'ngg-ajax', 'nggAjaxSetup', array( 
  238. 'url' => admin_url( 'admin-ajax.php' ),  
  239. 'action' => 'ngg_ajax_operation',  
  240. 'nonce' => wp_create_nonce( 'ngg-ajax' ),  
  241. 'permission' => __( 'You do not have the correct permission', 'nggallery' ),  
  242. 'error' => __( 'Unexpected Error', 'nggallery' ),  
  243. 'failure' => __( 'A failure occurred', 'nggallery' ) 
  244. ) ); 
  245. wp_register_script( 'ngg-plupload-handler', plugins_url( 'js/plupload.handler.js', __FILE__), array( 'plupload-all' ), '0.0.1' ); 
  246. wp_localize_script( 'ngg-plupload-handler', 'pluploadL10n', array( 
  247. 'queue_limit_exceeded' => __( 'You have attempted to queue too many files.' ),  
  248. 'file_exceeds_size_limit' => __( 'This file exceeds the maximum upload size for this site.' ),  
  249. 'zero_byte_file' => __( 'This file is empty. Please try another.' ),  
  250. 'invalid_filetype' => __( 'This file type is not allowed. Please try another.' ),  
  251. 'not_an_image' => __( 'This file is not an image. Please try another.' ),  
  252. 'image_memory_exceeded' => __( 'Memory exceeded. Please try another smaller file.' ),  
  253. 'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),  
  254. 'default_error' => __( 'An error occurred in the upload. Please try again later.' ),  
  255. 'missing_upload_url' => __( 'There was a configuration error. Please contact the server administrator.' ),  
  256. 'upload_limit_exceeded' => __( 'You may only upload 1 file.' ),  
  257. 'http_error' => __( 'HTTP error.' ),  
  258. 'upload_failed' => __( 'Upload failed.' ),  
  259. 'io_error' => __( 'IO error.' ),  
  260. 'security_error' => __( 'Security error.' ),  
  261. 'file_cancelled' => __( 'File canceled.' ),  
  262. 'upload_stopped' => __( 'Upload stopped.' ),  
  263. 'dismiss' => __( 'Dismiss' ),  
  264. 'crunching' => __( 'Crunching…' ),  
  265. 'deleted' => __( 'moved to the trash.' ),  
  266. 'error_uploading' => __( '“%s” has failed to upload due to an error' ),  
  267. 'no_gallery' => __( 'You didn\'t select a gallery!', 'nggallery' ) 
  268. ) ); 
  269. wp_register_script( 'ngg-progressbar', plugins_url( 'js/ngg.progressbar.js', __FILE__), array( 'jquery' ),  
  270. '2.0.1' ); 
  271. wp_register_script( 'ngg-autocomplete', plugins_url( 'js/ngg.autocomplete.js', __FILE__ ), array( 'jquery-ui-autocomplete' ), '1.1' ); 
  272.  
  273. switch ( $_GET['page'] ) { 
  274. case NGGFOLDER : 
  275. add_thickbox(); 
  276. wp_enqueue_script( 'postbox' ); 
  277. break; 
  278. case "nggallery-manage": 
  279. wp_enqueue_script( 'postbox' ); 
  280. wp_enqueue_script( 'ngg-ajax' ); 
  281. wp_enqueue_script( 'ngg-progressbar' ); 
  282. wp_enqueue_script( 'jquery-ui-dialog' ); 
  283. wp_enqueue_script( 'jquery-ui-sortable' ); 
  284. wp_enqueue_script( 'jquery-ui-datepicker' ); 
  285. wp_enqueue_script( 'ngg-autocomplete' ); 
  286. wp_enqueue_script( 'ngg-cropper', plugins_url('js/cropper/cropper.min.js', __FILE__), '2.2.5' ); 
  287. wp_register_script( 'shutter', plugins_url('shutter/shutter-reloaded.js', __DIR__), false, '1.3.2' ); 
  288. wp_localize_script( 'shutter', 'shutterSettings', array( 
  289. 'msgLoading' => __( 'L O A D I N G', 'nggallery' ),  
  290. 'msgClose' => __( 'Click to Close', 'nggallery' ),  
  291. 'imageCount' => '1' 
  292. ) ); 
  293. wp_enqueue_script( 'shutter' ); 
  294. break; 
  295. case "nggallery-manage-album" : 
  296. wp_enqueue_script( 'jquery-ui-dialog' ); 
  297. wp_enqueue_script( 'jquery-ui-sortable' ); 
  298. wp_enqueue_script( 'ngg-autocomplete' ); 
  299. break; 
  300. case "nggallery-options" : 
  301. wp_enqueue_script( 'jquery-ui-tabs' ); 
  302. wp_enqueue_script( 'wp-color-picker' ); 
  303. wp_enqueue_script( 'ngg-autocomplete' ); 
  304. break; 
  305. case "nggallery-add-gallery" : 
  306. wp_enqueue_script( 'jquery-ui-tabs' ); 
  307. wp_enqueue_script( 'ngg-plupload-handler' ); 
  308. wp_enqueue_script( 'ngg-ajax' ); 
  309. wp_enqueue_script( 'ngg-progressbar' ); 
  310. wp_enqueue_script( 'jquery-ui-dialog' ); 
  311. wp_enqueue_script( 'jqueryFileTree', plugins_url( 'js/jqueryFileTree/jqueryFileTree.js', __FILE__), array( 'jquery' ), '1.0.1' ); 
  312. break; 
  313. case "nggallery-style" : 
  314. wp_enqueue_script( 'codepress' ); 
  315. break; 
  316.  
  317.  
  318. /** 
  319. * Load the CSS files. 
  320. */ 
  321. public function load_styles() { 
  322. wp_register_style( 'nggadmin', plugins_url( 'css/nggadmin.css', __FILE__), false, '2.8.1', 'screen' ); 
  323. wp_register_style( 'ngg-jqueryui', plugins_url( 'css/jquery.ui.css', __FILE__), false, '1.8.5', 'screen' ); 
  324.  
  325. // no need to go on if it's not a plugin page 
  326. if ( ! isset( $_GET['page'] ) ) { 
  327. return; 
  328.  
  329. switch ( $_GET['page'] ) { 
  330. case NGGFOLDER : 
  331. wp_enqueue_style( 'nggadmin' ); 
  332. wp_enqueue_style( 'thickbox' ); 
  333. break; 
  334. case "nggallery-add-gallery" : 
  335. wp_enqueue_style( 'ngg-jqueryui' ); 
  336. wp_enqueue_style( 'jqueryFileTree', plugins_url( 'js/jqueryFileTree/jqueryFileTree.css', __FILE__), false, '1.0.1', 'screen' ); 
  337. case "nggallery-options" : 
  338. wp_enqueue_style( 'nggtabs', plugins_url( 'css/jquery.ui.tabs.css', __FILE__), false, '2.5.0',  
  339. 'screen' ); 
  340. wp_enqueue_style( 'nggadmin' ); 
  341. wp_enqueue_style( 'wp-color-picker' ); 
  342. wp_enqueue_style( 'ngg-jqueryui' ); 
  343. break; 
  344. case "nggallery-manage": 
  345. wp_enqueue_style( 'ngg-cropper', plugins_url( 'js/cropper/cropper.min.css', __FILE__), '2.2.5' ); 
  346. wp_enqueue_style( 'shutter', plugins_url('shutter/shutter-reloaded.css', __DIR__), false, '1.3.2',  
  347. 'screen' ); 
  348. wp_enqueue_style( 'datepicker', plugins_url('css/jquery.ui.datepicker.css', __FILE__), false,  
  349. '1.8.2', 'screen' ); 
  350. case "nggallery-roles" : 
  351. case "nggallery-manage-album" : 
  352. wp_enqueue_style( 'ngg-jqueryui' ); 
  353. wp_enqueue_style( 'nggadmin' ); 
  354. break; 
  355. case "nggallery-tags" : 
  356. wp_enqueue_style( 'nggadmin' ); 
  357. break; 
  358. case "nggallery-style" : 
  359. break; 
  360.  
  361. /** 
  362. * Save the screen options. 
  363. */ 
  364. public static function save_options( $status, $option, $value ) { 
  365. return $value; 
  366.  
  367. /** 
  368. * Add help and options to the correct screens 
  369. * @since 1.9.24 
  370. * @param WP_Screen $screen The current screen. 
  371. * @return WP_Screen $screen The current screen. 
  372. */ 
  373. public function edit_current_screen( $screen ) { 
  374.  
  375. // menu title is localized, so we need to change the toplevel name 
  376. $i18n = strtolower( __( 'Galleries', 'nggallery' ) ); 
  377.  
  378. switch ( $screen->id ) { 
  379. case 'toplevel_page_' . NGGFOLDER : 
  380. //The tab content 
  381. $help = '<p>' . __( 'Welcome to your NextCellent Dashboard! This screen gives you all kinds of information about NextCellent at glance. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>'; 
  382. //Add the tab 
  383. $screen->add_help_tab( array( 
  384. 'id' => $screen->id . '-welcome',  
  385. 'title' => 'Overview',  
  386. 'content' => $help 
  387. ) ); 
  388.  
  389. //The tab content 
  390. $help = '<p>' . __( 'The boxes on your overview screen are:', 'nggallery' ) . '</p>'; 
  391. $help .= '<p><strong>' . __( 'At a Glance',  
  392. 'nggallery' ) . '</strong> - ' . __( 'Shows some general information about your site, such as the number of pictures, albums and galleries.',  
  393. 'nggallery' ) . '</p>'; 
  394. $help .= '<p><strong>' . __( 'Latest News',  
  395. 'nggallery' ) . '</strong> - ' . __( 'The latest NextCellent news.', 'nggallery' ) . '</p>'; 
  396. if ( ! is_multisite() || is_super_admin() ) { 
  397. $help .= '<p><strong>' . __( 'Related plugins',  
  398. 'nggallery' ) . '</strong> - ' . __( 'Shows plugins that extend NextCellent.',  
  399. 'nggallery' ) . ' <strong>' . __( 'Pay attention',  
  400. 'nggallery' ) . '</strong>: ' . __( 'third parties plugins that are compatible with NGG may not be 100% compatible with NextCellent Gallery!',  
  401. 'nggallery' ) . '</p>'; 
  402. $help .= '<p><strong>' . __( 'Help me help YOU!',  
  403. 'nggallery' ) . '</strong> - ' . __( 'Shows general information about he plugin and some links.',  
  404. 'nggallery' ) . '</p>'; 
  405. if ( ! ( get_locale() == 'en_US' ) ) { 
  406. $help .= '<p><strong>' . __( 'Translation',  
  407. 'nggallery' ) . '</strong> - ' . __( 'View information about the current translation.' ) . '</p>'; 
  408. if ( ! is_multisite() || is_super_admin() ) { 
  409. $help .= '<p><strong>' . __( 'Server Settings',  
  410. 'nggallery' ) . '</strong> - ' . __( 'Show all the server settings!.',  
  411. 'nggallery' ) . '</p>'; 
  412. $help .= '<p><strong>' . __( 'Plugin Check',  
  413. 'nggallery' ) . '</strong> - ' . __( 'Check if there are known errors in your installation.',  
  414. 'nggallery' ) . '</p>'; 
  415. //Add the tab 
  416. $screen->add_help_tab( array( 
  417. 'id' => $screen->id . '-content',  
  418. 'title' => 'Content',  
  419. 'content' => $help 
  420. ) ); 
  421. break; 
  422. case "{$i18n}_page_nggallery-add-gallery" : 
  423.  
  424. /** 
  425. * @global nggdb $nggdb 
  426. */ 
  427. global $nggdb; 
  428. $gallerylist = $nggdb->find_all_galleries( 'gid', 'DESC' ); //look for galleries 
  429.  
  430. $help = '<p>' . __( 'On this page you can add galleries and pictures to those galleries.',  
  431. 'nggallery' ) . '</p>'; 
  432. if ( nggGallery::current_user_can( 'NextGEN Add new gallery' ) ) { 
  433. $help .= '<p><strong>' . __( 'New gallery',  
  434. 'nggallery' ) . '</strong> - ' . __( 'Add new galleries to NextCellent.',  
  435. 'nggallery' ) . '</p>'; 
  436. if ( empty ( $gallerylist ) ) { 
  437. $help .= '<p><strong>' . __( 'You must add a gallery before adding images!',  
  438. 'nggallery' ) . '</strong>'; 
  439. } else { 
  440. $help .= '<p><strong>' . __( 'Images',  
  441. 'nggallery' ) . '</strong> - ' . __( 'Add new images to a gallery.', 'nggallery' ) . '</p>'; 
  442. if ( wpmu_enable_function( 'wpmuZipUpload' ) && nggGallery::current_user_can( 'NextGEN Upload a zip' ) && ! empty ( $gallerylist ) ) { 
  443. $help .= '<p><strong>' . __( 'ZIP file',  
  444. 'nggallery' ) . '</strong> - ' . __( 'Add images from a ZIP file.', 'nggallery' ) . '</p>'; 
  445. if ( wpmu_enable_function( 'wpmuImportFolder' ) && nggGallery::current_user_can( 'NextGEN Import image folder' ) ) { 
  446. $help .= '<p><strong>' . __( 'Import folder',  
  447. 'nggallery' ) . '</strong> - ' . __( 'Import a folder from the server as a new gallery.',  
  448. 'nggallery' ) . '</p>'; 
  449.  
  450. $screen->add_help_tab( array( 
  451. 'id' => $screen->id . '-general',  
  452. 'title' => 'Add things',  
  453. 'content' => $help 
  454. ) ); 
  455. break; 
  456. case "{$i18n}_page_nggallery-manage" : 
  457.  
  458. $option = 'per_page'; 
  459.  
  460. if ( ! isset( $_GET['mode'] ) || $_GET['mode'] === 'gallery' ) { 
  461. include_once( 'manage/class-ngg-gallery-list-table.php' ); 
  462. add_filter( 'manage_' . $screen->id . '_columns',  
  463. array( 'NGG_Gallery_List_Table', 'get_columns_static' ), 0 ); 
  464. $args = array( 
  465. 'label' => __( 'Galleries', 'nggallery' ),  
  466. 'default' => 25,  
  467. 'option' => 'ngg_galleries_per_page' 
  468. ); 
  469. } else { 
  470. include_once( 'manage/class-ngg-image-list-table.php' ); 
  471. add_filter( 'manage_' . $screen->id . '_columns',  
  472. array( 'NGG_Image_List_Table', 'get_columns_static' ), 0 ); 
  473. $args = array( 
  474. 'label' => __( 'Images', 'nggallery' ),  
  475. 'default' => 50,  
  476. 'option' => 'ngg_images_per_page' 
  477. ); 
  478.  
  479. $help = '<p>' . __( 'This box contains information and the various options a gallery had.', 'nggallery') . '</p>'; 
  480.  
  481. $screen->add_help_tab( array( 
  482. 'id' => $screen->id . '-general',  
  483. 'title' => __( 'Overview', 'nggallery'),  
  484. 'content' => $help 
  485. ) ); 
  486.  
  487. $help = '<p>' . __( 'Manage a single gallery and the images it contains:', 'nggallery' ) . '</p>'; 
  488. $help .= '<dl class="ncg-dl">'; 
  489.  
  490. $help .= '<dt>' . __( 'Title', 'ngallery') . '</dt>'; 
  491. $help .= '<dd>' . __( 'The title of the gallery. This can be visible to the users of the website. This has no effect on the gallery path.', 'nggallery') .'</dd>'; 
  492.  
  493. $help .= '<dt>' . __( 'Description', 'ngallery') . '</dt>'; 
  494. $help .= '<dd>' . __( 'The description of the gallery. Albums using the "extend" template may display this on the website. The description cannot contain HTML.', 'nggallery') .'</dd>'; 
  495.  
  496. $help .= '<dt>' . __( 'Path', 'ngallery') . '</dt>'; 
  497. $help .= '<dd>' . __( 'The path on the server to the folder containing this gallery. If you change this, NextCellent will not move the gallery for you.', 'nggallery') .'</dd>'; 
  498.  
  499. $help .= '<dt>' . __( 'Gallery ID', 'ngallery') . '</dt>'; 
  500. $help .= '<dd>' . __( 'The internal ID used by NextCellent to represent this gallery. This information can be useful for developers. A gallery ID should never change.', 'nggallery') .'</dd>'; 
  501.  
  502. $help .= '<dt>' . __( 'Page Link', 'ngallery') . '</dt>'; 
  503. $help .= '<dd>' . __( 'With this option you can select the behavior when an user clicks on a gallery in an album. If the option is set to "not linked", the gallery will be displayed on the same page. If you do select a page, the user will be redirected to that page.', 'nggallery'); 
  504. $help .= ' '. sprintf( __( 'More information about this is available on this webpage: %s', 'nggallery'), '<a target="_blank" href="http://www.nextgen-gallery.com/link-to-page/">' . __('page', 'nggallery') . '</a>') . '</dd>'; 
  505.  
  506. $help .= '<dt>' . __( 'Preview image', 'ngallery') . '</dt>'; 
  507. $help .= '<dd>' . __( 'This image will be shown when the gallery is shown on the website and it needs a preview, e.g. an album. If you do not select a preview image, NextCellent will use the last uploaded image of the gallery.', 'nggallery') .'</dd>'; 
  508.  
  509. $help .= '<dt>' . __( 'Author', 'ngallery') . '</dt>'; 
  510. $help .= '<dd>' . __( 'The user who created this gallery.', 'nggallery') .'</dd>'; 
  511.  
  512. $help .= '<dt>' . __( 'Create new page', 'ngallery') . '</dt>'; 
  513. $help .= '<dd>' . __( 'This will create a new page with the same name as the gallery, and include a shortcode for this gallery in it.', 'nggallery') .'</dd>'; 
  514. $help .= '</dl>'; 
  515.  
  516. $screen->add_help_tab( array( 
  517. 'id' => $screen->id . '-options',  
  518. 'title' => __( 'Gallery settings', 'nggallery'),  
  519. 'content' => $help 
  520. ) ); 
  521.  
  522. $help = '<p>' . __( 'There are three buttons:', 'nggallery') . '</p>'; 
  523. $help .= '<dl class="ncg-dl">'; 
  524.  
  525. $help .= '<dt>' . __( 'Sort gallery', 'ngallery') . '</dt>'; 
  526. $help .= '<dd>' . __( 'Allows you to manually set the order of the images in the gallery. This will only be enabled if you have selected the option "Custom sort order" in the NextCellent settings.', 'nggallery') .'</dd>'; 
  527.  
  528. $help .= '<dt>' . __( 'Scan folder for new images', 'ngallery') . '</dt>'; 
  529. $help .= '<dd>' . __( 'Scan the folder (the path of the gallery) for new images and add them to the gallery. <strong>Warning!</strong> This will normalize and rename the images that are added, e.g. spaces are removed.', 'nggallery') .'</dd>'; 
  530.  
  531. $help .= '<dt>' . __( 'Save', 'ngallery') . '</dt>'; 
  532. $help .= '<dd>' . __( 'Save changes you have made to the gallery options.', 'nggallery') .'</dd>'; 
  533.  
  534. $help .= '</dl>'; 
  535.  
  536. $screen->add_help_tab( array( 
  537. 'id' => $screen->id . '-buttons',  
  538. 'title' => __( 'Buttons', 'nggallery'),  
  539. 'content' => $help 
  540. ) ); 
  541.  
  542. $screen->add_option( $option, $args ); 
  543.  
  544. break; 
  545. case "{$i18n}_page_nggallery-manage-album" : 
  546. $help = '<p>' . __( 'Organize your galleries into albums.',  
  547. 'nggallery' ) . '</p><p>' . __( 'First select an album from the dropdown and then drag the galleries you want to add or remove from the selected album.',  
  548. 'nggallery' ) . '</p>'; 
  549.  
  550. $screen->add_help_tab( array( 
  551. 'id' => $screen->id . '-general',  
  552. 'title' => 'Organize everything',  
  553. 'content' => $help 
  554. ) ); 
  555. break; 
  556. case "{$i18n}_page_nggallery-tags" : 
  557. $help = '<p>' . __( 'Organize your pictures with tags.',  
  558. 'nggallery' ) . '</p><p>' . __( 'Rename, delete and edit tags. Use the rename function to merge tags.',  
  559. 'nggallery' ) . '</p>'; 
  560.  
  561. $screen->add_help_tab( array( 
  562. 'id' => $screen->id . '-general',  
  563. 'title' => 'Organize pictures',  
  564. 'content' => $help 
  565. ) ); 
  566. break; 
  567. case "{$i18n}_page_nggallery-options" : 
  568. $help = '<p>' . __( 'Edit all of NextCellent\'s options. The options are sorted in multiple categories.',  
  569. 'nggallery' ) . '</p>'; 
  570. $help .= '<p><strong>' . __( 'General',  
  571. 'nggallery' ) . '</strong> - ' . __( 'General NextCellent options. Contains options for permalinks and related images.',  
  572. 'nggallery' ) . '</p>'; 
  573. $help .= '<p><strong>' . __( 'Images',  
  574. 'nggallery' ) . '</strong> - ' . __( 'All image-related options. Also contains options for thumbnails.',  
  575. 'nggallery' ) . '</p>'; 
  576. $help .= '<p><strong>' . __( 'Gallery',  
  577. 'nggallery' ) . '</strong> - ' . __( 'Everything about galleries. From sorting options to the number of images, it\'s all in here.',  
  578. 'nggallery' ) . '</p>'; 
  579. $help .= '<p><strong>' . __( 'Effects',  
  580. 'nggallery' ) . '</strong> - ' . __( 'Make your gallery look beautiful.',  
  581. 'nggallery' ) . '</p>'; 
  582. $help .= '<p><strong>' . __( 'Watermark',  
  583. 'nggallery' ) . '</strong> - ' . __( 'Who doesn\'t want theft-proof images?',  
  584. 'nggallery' ) . '</p>'; 
  585. $help .= '<p><strong>' . __( 'Slideshow',  
  586. 'nggallery' ) . '</strong> - ' . __( 'Edit options for the slideshow.', 'nggallery' ) . '</p>'; 
  587. $help .= '<p>' . __( 'Don\'t forget to press save!', 'nggallery' ) . '</p>'; 
  588.  
  589. $screen->add_help_tab( array( 
  590. 'id' => $screen->id . '-general',  
  591. 'title' => 'Edit options',  
  592. 'content' => $help 
  593. ) ); 
  594. break; 
  595. case "{$i18n}_page_nggallery-style" : 
  596. $help = '<p>' . __( 'You can edit the css file to adjust how your gallery looks.',  
  597. 'nggallery' ) . '</p>'; 
  598. $help .= '<p>' . __( 'When you save an edited file, NextCellent automatically saves it as a copy in the folder ngg_styles. This protects your changes from upgrades.',  
  599. 'nggallery' ) . '</p>'; 
  600.  
  601. $screen->add_help_tab( array( 
  602. 'id' => $screen->id . '-general',  
  603. 'title' => 'Style your gallery',  
  604. 'content' => $help 
  605. ) ); 
  606. break; 
  607. case "{$i18n}_page_nggallery-roles" : 
  608. $help = '<p>' . __( 'You can assign the lowest user role that has access to a certain feature. Needless to say, all greater user roles will also have access to that feature.',  
  609. 'nggallery' ) . '</p>'; 
  610. $help .= '<p>' . __( 'NextCellent also works with various plugins that extend the default roles capabilities.',  
  611. 'nggallery' ) . '</p>'; 
  612.  
  613. $screen->add_help_tab( array( 
  614. 'id' => $screen->id . '-general',  
  615. 'title' => 'Grant permissions',  
  616. 'content' => $help 
  617. ) ); 
  618. break; 
  619. case "{$i18n}_page_nggallery-setup" : 
  620. $help = '<p>' . __( 'If \'someone\' messed with your settings (yeah, definitely not you), you can reset them here.',  
  621. 'nggallery' ) . '</p>'; 
  622. $help .= '<p><b>' . __( 'Attention!',  
  623. 'nggallery' ) . '</b> ' . __( 'You should not use the Uninstall Plugin button, unless you know what you\'re doing! It should never be necessary to press it.',  
  624. 'nggallery' ) . '</p>'; 
  625.  
  626. $screen->add_help_tab( array( 
  627. 'id' => $screen->id . '-general',  
  628. 'title' => 'Reset',  
  629. 'content' => $help 
  630. ) ); 
  631. break; 
  632.  
  633. //Set the sidebar (same on all pages) 
  634. $screen->set_help_sidebar( 
  635. '<p><strong>' . __( 'For more information:', 'nggallery' ) . '</strong></p>' . 
  636. '<p><a href="http://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">' . __( 'Support Forums',  
  637. 'nggallery' ) . '</a></p>' . 
  638. '<p><a href="https://bitbucket.org/wpgetready/nextcellent" target="_blank">' . __( 'Source Code',  
  639. 'nggallery' ) . '</a></p>' 
  640. ); 
  641.  
  642. return $screen;