nggallery_wpmu_setup

The NextGEN Gallery nggallery wpmu setup function.

Description

nggallery_wpmu_setup(); 

Usage

  1. if ( !function_exists( 'nggallery_wpmu_setup' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/wpmu.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = nggallery_wpmu_setup(); 
  7.  

Defined (1)

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

/products/photocrati_nextgen/modules/ngglegacy/admin/wpmu.php  
  1. function nggallery_wpmu_setup() {  
  2.  
  3. //to be sure 
  4. if ( !is_super_admin() ) 
  5. die('You are not allowed to call this page.'); 
  6.  
  7. $messagetext = ''; 
  8.  
  9. // get the options 
  10. $ngg_options = get_site_option('ngg_options'); 
  11.  
  12. if ( isset($_POST['updateoption']) ) {  
  13. check_admin_referer('ngg_wpmu_settings'); 
  14. // get the hidden option fields, taken from WP core 
  15. if ( $_POST['page_options'] )  
  16. $options = explode(', ', stripslashes($_POST['page_options'])); 
  17. if ($options) { 
  18. foreach ($options as $option) { 
  19. $option = trim($option); 
  20. $value = isset($_POST[$option]) ? trim($_POST[$option]) : false; 
  21. // $value = sanitize_option($option, $value); // This does strip slashes on those that need it 
  22. $ngg_options[$option] = $value; 
  23.  
  24. // the path should always end with a slash  
  25. $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']); 
  26. update_site_option('ngg_options', $ngg_options); 
  27.  
  28. $messagetext = __('Update successfully', 'nggallery'); 
  29. }  
  30.  
  31. // Show donation message only one time. 
  32. if (isset ( $_GET['hideSupportInfo']) ) { 
  33. $ngg_options['hideSupportInfo'] = true; 
  34. update_site_option('ngg_options', $ngg_options);  
  35.  
  36. // message windows 
  37. if( !empty($messagetext) ) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; } 
  38.  
  39. ?> 
  40.  
  41. <div class="wrap"> 
  42. <h2><?php _e('Network Options', 'nggallery'); ?></h2> 
  43. <form name="generaloptions" method="post"> 
  44. <?php wp_nonce_field('ngg_wpmu_settings') ?> 
  45. <input type="hidden" name="page_options" value="gallerypath, wpmuQuotaCheck, wpmuZipUpload, wpmuImportFolder, wpmuStyle, wpmuRoles, wpmuCSSfile" /> 
  46. <table class="form-table"> 
  47. <tr valign="top"> 
  48. <th align="left"><?php _e('Gallery path', 'nggallery') ?></th> 
  49. <td><input type="text" size="50" name="gallerypath" value="<?php echo $ngg_options['gallerypath']; ?>" /><br /> 
  50. <?php _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.', 'nggallery') ?> 
  51. <?php echo str_replace('%s', '<code>wp-content/uploads/sites/%BLOG_ID%/nggallery/</code>', __('The default setting should be %s', 'nggallery')); ?> 
  52. </td> 
  53. </tr> 
  54. <tr> 
  55. <th valign="top"><?php _e('Enable upload quota check', 'nggallery') ?>:</th> 
  56. <td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuQuotaCheck']); ?> /> 
  57. <?php _e('Should work if the gallery is bellow the blog.dir', 'nggallery') ?> 
  58. </td> 
  59. </tr> 
  60. <tr> 
  61. <th valign="top"><?php _e('Enable zip upload option', 'nggallery') ?>:</th> 
  62. <td><input name="wpmuZipUpload" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuZipUpload']); ?> /> 
  63. <?php _e('Allow users to upload zip folders.', 'nggallery') ?> 
  64. </td> 
  65. </tr> 
  66. <tr> 
  67. <th valign="top"><?php _e('Enable import function', 'nggallery') ?>:</th> 
  68. <td><input name="wpmuImportFolder" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuImportFolder']); ?> /> 
  69. <?php _e('Allow users to import images folders from the server.', 'nggallery') ?> 
  70. </td> 
  71. </tr> 
  72. <tr> 
  73. <th valign="top"><?php _e('Enable style selection', 'nggallery') ?>:</th> 
  74. <td><input name="wpmuStyle" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuStyle']); ?> /> 
  75. <?php _e('Allow users to choose a style for the gallery.', 'nggallery') ?> 
  76. </td> 
  77. </tr> 
  78. <tr> 
  79. <th valign="top"><?php _e('Enable roles/capabilities', 'nggallery') ?>:</th> 
  80. <td><input name="wpmuRoles" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuRoles']); ?> /> 
  81. <?php _e('Allow users to change the roles for other blog authors.', 'nggallery') ?> 
  82. </td> 
  83. </tr> 
  84. <tr> 
  85. <th valign="top"><?php _e('Default style', 'nggallery') ?>:</th> 
  86. <td> 
  87. <select name="wpmuCSSfile"> 
  88. <?php 
  89. // $csslist = ngg_get_cssfiles(); 
  90. $csslist = C_NextGen_Style_Manager::get_instance()->find_all_stylesheets(); 
  91. foreach ($csslist as $key => $a_cssfile) { 
  92. $css_name = $a_cssfile['name']; 
  93. if ($key == $ngg_options['wpmuCSSfile']) { 
  94. $selected = " selected='selected'"; 
  95. else $selected = ''; 
  96. $css_name = esc_attr($css_name); 
  97. echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>"; 
  98. ?> 
  99. </select><br /> 
  100. <?php _e('Choose the default style for the galleries.', 'nggallery') ?> 
  101. </td> 
  102. </tr> 
  103. </table>  
  104. <div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?>"/></div> 
  105. </form>  
  106. </div>  
  107.  
  108. <?php