nggallery_wpmu_setup

The NextCellent Gallery nggallery wpmu setup function.

Description

nggallery_wpmu_setup(); 

Usage

  1. if ( !function_exists( 'nggallery_wpmu_setup' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextcellent-gallery/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).

/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 = false; 
  21. if ( isset( $_POST[ $option ] ) ) { 
  22. $value = trim( $_POST[ $option ] ); 
  23. if ( $value === "true" ) { 
  24. $value = true; 
  25.  
  26. if ( is_numeric( $value ) ) { 
  27. $value = (int) $value; 
  28.  
  29. // $value = sanitize_option($option, $value); // This does stripslashes on those that need it 
  30. $ngg_options[ $option ] = $value; 
  31.  
  32. // the path should always end with a slash 
  33. $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']); 
  34. update_site_option(ngg_options, $ngg_options); 
  35.  
  36. $messagetext = __('Update successfully', 'nggallery'); 
  37.  
  38. global $ngg; 
  39.  
  40. //the directions containing the css files 
  41. if ( file_exists(NGG_CONTENT_DIR . "/ngg_styles") ) { 
  42. $dir = array(NGGALLERY_ABSPATH . "css", NGG_CONTENT_DIR . "/ngg_styles"); 
  43. } else { 
  44. $dir = array(NGGALLERY_ABSPATH . "css"); 
  45.  
  46. //support for legacy location (in theme folder) 
  47. if ( $theme_css_exists = file_exists (get_stylesheet_directory() . "/nggallery.css") ) { 
  48. $act_cssfile = get_stylesheet_directory() . "/nggallery.css"; 
  49.  
  50. //if someone uses the filter, don't display this page. 
  51. if ( !$theme_css_exists && $set_css_file = nggGallery::get_theme_css_file() ) { 
  52. nggGallery::show_error( __('Your CSS file is set by a theme or another plugin.', 'nggallery') . "<br><br>" . __('This CSS file will be applied:', 'nggallery') . "<br>" . $set_css_file); 
  53. return; 
  54.  
  55. //load all files 
  56. if ( !isset($act_cssfile) ) { 
  57. $csslist = NGG_Style::ngg_get_cssfiles($dir); 
  58. $act_cssfile = $ngg->options['CSSfile']; 
  59.  
  60. // message windows 
  61. if( !empty($messagetext) ) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; } 
  62.  
  63. ?> 
  64.  
  65. <div class="wrap"> 
  66. <h2><?php _e('Network Options', 'nggallery'); ?></h2> 
  67. <form name="generaloptions" method="post"> 
  68. <?php wp_nonce_field('ngg_wpmu_settings') ?> 
  69. <input type="hidden" name="page_options" value="silentUpgrade, gallerypath, wpmuQuotaCheck, wpmuZipUpload, wpmuImportFolder, wpmuStyle, wpmuRoles, wpmuCSSfile" /> 
  70. <table class="form-table"> 
  71. <tr> 
  72. <th><label for="gallerypath"><?php _e('Gallery path', 'nggallery'); ?></label></th> 
  73. <td> 
  74. <input type="text" size="50" name="gallerypath" id="gallerypath" value="<?php echo $ngg_options['gallerypath']; ?>"> 
  75. <p class="description"> 
  76. <?php _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.', 'nggallery'); ?> 
  77. <?php echo sprintf( __('The default setting should be %s.', 'nggallery'), '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>' ); ?> 
  78. </p> 
  79. </td> 
  80. </tr> 
  81. <tr> 
  82. <th><?php _e('Silent database upgrade', 'nggallery'); ?></th> 
  83. <td> 
  84. <input type="checkbox" name="silentUpgrade" id="silentUpgrade" value="true" <?php checked( $ngg_options['silentUpgrade'] ); ?>> 
  85. <label for="silentUpgrade"><?php _e('Update the database without notice.', 'nggallery') ?></label> 
  86. </td> 
  87. </tr> 
  88. <tr> 
  89. <th><?php _e('Enable upload quota check', 'nggallery'); ?></th> 
  90. <td> 
  91. <input name="wpmuQuotaCheck" id="wpmuQuotaCheck" type="checkbox" value="true" <?php checked( $ngg_options['wpmuQuotaCheck'] ); ?>> 
  92. <label for="wpmuQuotaCheck"><?php _e('Should work if the gallery is bellow the blog.dir', 'nggallery') ?></label> 
  93. </td> 
  94. </tr> 
  95. <tr> 
  96. <th><?php _e('Enable zip upload option', 'nggallery'); ?></th> 
  97. <td> 
  98. <input name="wpmuZipUpload" id="wpmuZipUpload" type="checkbox" value="true" <?php checked( $ngg_options['wpmuZipUpload'] ); ?>> 
  99. <label for="wpmuZipUpload"><?php _e('Allow users to upload zip folders.', 'nggallery') ?></label> 
  100. </td> 
  101. </tr> 
  102. <tr> 
  103. <th><?php _e('Enable import function', 'nggallery'); ?></th> 
  104. <td> 
  105. <input name="wpmuImportFolder" id="wpmuImportFolder" type="checkbox" value="true" <?php checked( $ngg_options['wpmuImportFolder'] ); ?>> 
  106. <label for="wpmuImportFolder"><?php _e('Allow users to import images folders from the server.', 'nggallery'); ?></label> 
  107. </td> 
  108. </tr> 
  109. <tr> 
  110. <th><?php _e('Enable style selection', 'nggallery'); ?></th> 
  111. <td> 
  112. <input name="wpmuStyle" id="wpmuStyle" type="checkbox" value="true" <?php checked( $ngg_options['wpmuStyle'] ); ?>> 
  113. <label for="wpmuStyle"><?php _e('Allow users to choose a style for the gallery.', 'nggallery'); ?></label> 
  114. </td> 
  115. </tr> 
  116. <tr> 
  117. <th><?php _e('Enable roles/capabilities', 'nggallery'); ?></th> 
  118. <td> 
  119. <input name="wpmuRoles" id="wpmuRoles" type="checkbox" value="true" <?php checked( $ngg_options['wpmuRoles'] ); ?>> 
  120. <label for="wpmuRoles"><?php _e('Allow users to change the roles for other blog authors.', 'nggallery'); ?></label> 
  121. </td> 
  122. </tr> 
  123. <tr> 
  124. <th><label for="wpmuCSSfile"><?php _e('Default style', 'nggallery'); ?></label></th> 
  125. <td> 
  126. <select name="wpmuCSSfile" id="wpmuCSSfile"> 
  127. <?php NGG_Style::output_css_files_dropdown($csslist, $act_cssfile); ?> 
  128. </select> 
  129. <p class="description"> 
  130. <?php _e('Choose the default style for the galleries.', 'nggallery') ?> 
  131. <?php _e('Note: between brackets is the folder in which the file is.', 'nggallery') ?> 
  132. </p> 
  133. </td> 
  134. </tr> 
  135. </table> 
  136. <?php submit_button( __('Save Changes'), 'primary', 'updateoption' ); ?> 
  137. </form>  
  138. </div> 
  139. <?php