PageRenderTime 52ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/settings.php

https://github.com/Fishgate/privatecollectionswp
PHP | 943 lines | 786 code | 80 blank | 77 comment | 62 complexity | 79e8c2e30abc513a72dca3bfaf5a9a8d MD5 | raw file
  1. <?php
  2. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
  3. /**
  4. * Rebuild slugs for albums, galleries and images via AJAX request
  5. *
  6. * @sine 1.7.0
  7. * @access internal
  8. */
  9. class ngg_rebuild_unique_slugs {
  10. function start_rebuild() {
  11. global $wpdb;
  12. $total = array();
  13. // get the total number of images
  14. $total['images'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") );
  15. $total['gallery'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") );
  16. $total['album'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
  17. $messages = array(
  18. 'images' => __( 'Rebuild image structure : %s / %s images', 'nggallery' ),
  19. 'gallery' => __( 'Rebuild gallery structure : %s / %s galleries', 'nggallery' ),
  20. 'album' => __( 'Rebuild album structure : %s / %s albums', 'nggallery' ),
  21. );
  22. ?>
  23. <?php
  24. foreach ( array_keys( $messages ) as $key ) {
  25. $message = sprintf( $messages[ $key ] ,
  26. "<span class='ngg-count-current'>0</span>",
  27. "<span class='ngg-count-total'>" . $total[ $key ] . "</span>"
  28. );
  29. echo "<div class='$key updated'><p class='ngg'>$message</p></div>";
  30. }
  31. $ajax_url = add_query_arg( 'action', 'ngg_rebuild_unique_slugs', admin_url( 'admin-ajax.php' ) );
  32. ?>
  33. <script type="text/javascript">
  34. jQuery(document).ready(function($) {
  35. var ajax_url = '<?php echo $ajax_url; ?>',
  36. _action = 'images',
  37. images = <?php echo $total['images']; ?>,
  38. gallery = <?php echo $total['gallery']; ?>,
  39. album = <?php echo $total['album']; ?>,
  40. total = 0,
  41. offset = 0,
  42. count = 50;
  43. var $display = $('.ngg-count-current');
  44. $('.finished, .gallery, .album').hide();
  45. total = images;
  46. function call_again() {
  47. if ( offset > total ) {
  48. offset = 0;
  49. // 1st run finished
  50. if (_action == 'images') {
  51. _action = 'gallery';
  52. total = gallery;
  53. $('.images, .gallery').toggle();
  54. $display.html(offset);
  55. call_again();
  56. return;
  57. }
  58. // 2nd run finished
  59. if (_action == 'gallery') {
  60. _action = 'album';
  61. total = album;
  62. $('.gallery, .album').toggle();
  63. $display.html(offset);
  64. call_again();
  65. return;
  66. }
  67. // 3rd run finished, exit now
  68. if (_action == 'album') {
  69. $('.ngg')
  70. .html('<?php _e( 'Done.', 'nggallery' ); ?>')
  71. .parent('div').hide();
  72. $('.finished').show();
  73. return;
  74. }
  75. }
  76. $.post(ajax_url, {'_action': _action, 'offset': offset}, function(response) {
  77. $display.html(offset);
  78. offset += count;
  79. call_again();
  80. });
  81. }
  82. call_again();
  83. });
  84. </script>
  85. <?php
  86. }
  87. }
  88. class nggOptions {
  89. /**
  90. * PHP4 compatibility layer for calling the PHP5 constructor.
  91. *
  92. */
  93. function nggOptions() {
  94. return $this->__construct();
  95. }
  96. /**
  97. * nggOptions::__construct()
  98. *
  99. * @return void
  100. */
  101. function __construct() {
  102. // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
  103. $this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
  104. //Look for POST updates
  105. if ( !empty($_POST) )
  106. $this->processor();
  107. }
  108. /**
  109. * Save/Load options and add a new hook for plugins
  110. *
  111. * @return void
  112. */
  113. function processor() {
  114. global $ngg, $nggRewrite;
  115. $old_state = $ngg->options['usePermalinks'];
  116. $old_slug = $ngg->options['permalinkSlug'];
  117. if ( isset($_POST['irDetect']) ) {
  118. check_admin_referer('ngg_settings');
  119. $ngg->options['irURL'] = ngg_search_imagerotator();
  120. update_option('ngg_options', $ngg->options);
  121. }
  122. if ( isset($_POST['updateoption']) ) {
  123. check_admin_referer('ngg_settings');
  124. // get the hidden option fields, taken from WP core
  125. if ( $_POST['page_options'] )
  126. $options = explode(',', stripslashes($_POST['page_options']));
  127. if ($options) {
  128. foreach ($options as $option) {
  129. $option = trim($option);
  130. $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
  131. // $value = sanitize_option($option, $value); // This does stripslashes on those that need it
  132. $ngg->options[$option] = $value;
  133. }
  134. // do not allow a empty string
  135. if ( empty ( $ngg->options['permalinkSlug'] ) )
  136. $ngg->options['permalinkSlug'] = 'nggallery';
  137. // the path should always end with a slash
  138. $ngg->options['gallerypath'] = trailingslashit($ngg->options['gallerypath']);
  139. $ngg->options['imageMagickDir'] = trailingslashit($ngg->options['imageMagickDir']);
  140. // the custom sortorder must be ascending
  141. $ngg->options['galSortDir'] = ($ngg->options['galSort'] == 'sortorder') ? 'ASC' : $ngg->options['galSortDir'];
  142. }
  143. // Save options
  144. update_option('ngg_options', $ngg->options);
  145. // Flush Rewrite rules
  146. if ( $old_state != $ngg->options['usePermalinks'] || $old_slug != $ngg->options['permalinkSlug'] )
  147. $nggRewrite->flush();
  148. nggGallery::show_message(__('Update Successfully','nggallery'));
  149. }
  150. if ( isset($_POST['clearcache']) ) {
  151. check_admin_referer('ngg_settings');
  152. $path = ABSPATH . $ngg->options['gallerypath'] . 'cache/';
  153. if (is_dir($path))
  154. if ($handle = opendir($path)) {
  155. while (false !== ($file = readdir($handle))) {
  156. if ($file != '.' && $file != '..') {
  157. @unlink($path . '/' . $file);
  158. }
  159. }
  160. closedir($handle);
  161. }
  162. nggGallery::show_message(__('Cache cleared','nggallery'));
  163. }
  164. if ( isset($_POST['createslugs']) ) {
  165. check_admin_referer('ngg_settings');
  166. ngg_rebuild_unique_slugs::start_rebuild();
  167. }
  168. do_action( 'ngg_update_options_page' );
  169. }
  170. /**
  171. * Render the page content
  172. *
  173. * @return void
  174. */
  175. function controller() {
  176. // get list of tabs
  177. $tabs = $this->tabs_order();
  178. ?>
  179. <script type="text/javascript">
  180. jQuery(document).ready(function(){
  181. jQuery('html,body').scrollTop(0);
  182. jQuery("a.switch-expert").hide();
  183. /*
  184. jQuery(".expert").hide();
  185. jQuery("a.switch-expert").click(function(e) {
  186. jQuery(".expert").toggle();
  187. return false;
  188. });
  189. */
  190. jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
  191. jQuery('#slider').css('display', 'block');
  192. /*
  193. jQuery('.picker').ColorPicker({
  194. onSubmit: function(hsb, hex, rgb, el) {
  195. jQuery(el).val(hex);
  196. jQuery(el).ColorPickerHide();
  197. },
  198. onBeforeShow: function () {
  199. jQuery(this).ColorPickerSetColor(this.value);
  200. }
  201. })
  202. .bind('keyup', function(){
  203. jQuery(this).ColorPickerSetColor(this.value);
  204. });
  205. */
  206. });
  207. function insertcode(value) {
  208. var effectcode;
  209. switch (value) {
  210. case "none":
  211. effectcode = "";
  212. jQuery('#tbImage').hide("slow");
  213. break;
  214. case "thickbox":
  215. effectcode = 'class="thickbox" rel="%GALLERY_NAME%"';
  216. jQuery('#tbImage').show("slow");
  217. break;
  218. case "lightbox":
  219. effectcode = 'rel="lightbox[%GALLERY_NAME%]"';
  220. jQuery('#tbImage').hide("slow");
  221. break;
  222. case "highslide":
  223. effectcode = 'class="highslide" onclick="return hs.expand(this, { slideshowGroup: %GALLERY_NAME% })"';
  224. jQuery('#tbImage').hide("slow");
  225. break;
  226. case "shutter":
  227. effectcode = 'class="shutterset_%GALLERY_NAME%"';
  228. jQuery('#tbImage').hide("slow");
  229. break;
  230. default:
  231. break;
  232. }
  233. jQuery("#thumbCode").val(effectcode);
  234. };
  235. function setcolor(fileid, color) {
  236. jQuery(fileid).css("background-color", '#' + color );
  237. };
  238. </script>
  239. <?php include('templates/social_media_buttons.php'); ?>
  240. <div id="slider" class="wrap" style="display: none;">
  241. <ul id="tabs">
  242. <?php
  243. foreach($tabs as $tab_key => $tab_name) {
  244. echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
  245. }
  246. ?>
  247. </ul>
  248. <?php
  249. foreach($tabs as $tab_key => $tab_name) {
  250. echo "\n\t<div id='$tab_key'>\n";
  251. // Looks for the internal class function, otherwise enable a hook for plugins
  252. if ( method_exists( $this, "tab_$tab_key" ))
  253. call_user_func( array( &$this , "tab_$tab_key") );
  254. else
  255. do_action( 'ngg_tab_content_' . $tab_key );
  256. echo "\n\t</div>";
  257. }
  258. ?>
  259. </div>
  260. <?php
  261. }
  262. /**
  263. * Create array for tabs and add a filter for other plugins to inject more tabs
  264. *
  265. * @return array $tabs
  266. */
  267. function tabs_order() {
  268. $tabs = array();
  269. $tabs['generaloptions'] = __('General Options', 'nggallery');
  270. $tabs['thumbnails'] = __('Thumbnails', 'nggallery');
  271. $tabs['images'] = __('Images', 'nggallery');
  272. $tabs['gallery'] = _n( 'Gallery', 'Galleries', 1, 'nggallery' );
  273. $tabs['effects'] = __('Effects', 'nggallery');
  274. $tabs['watermark'] = __('Watermark', 'nggallery');
  275. $tabs['slideshow'] = __('Slideshow', 'nggallery');
  276. $tabs = apply_filters('ngg_settings_tabs', $tabs);
  277. return $tabs;
  278. }
  279. function tab_generaloptions() {
  280. global $ngg;
  281. ?>
  282. <!-- General Options -->
  283. <h2><?php _e('General Options','nggallery'); ?></h2>
  284. <form name="generaloptions" method="post" action="<?php echo $this->filepath; ?>">
  285. <?php wp_nonce_field('ngg_settings') ?>
  286. <input type="hidden" name="page_options" value="gallerypath,deleteImg,useMediaRSS,usePicLens,usePermalinks,permalinkSlug,graphicLibrary,imageMagickDir,activateTags,appendType,maxImages" />
  287. <table class="form-table ngg-options">
  288. <tr valign="top">
  289. <th align="left"><?php _e('Gallery path','nggallery'); ?></th>
  290. <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="gallerypath" value="<?php echo $ngg->options['gallerypath']; ?>" />
  291. <span class="setting-description"><?php _e('This is the default path for all galleries','nggallery') ?></span></td>
  292. </tr>
  293. <tr class="expert" valign="top">
  294. <th align="left"><?php _e('Delete image files','nggallery'); ?></th>
  295. <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="checkbox" name="deleteImg" value="1" <?php checked('1', $ngg->options['deleteImg']); ?> />
  296. <?php _e('Delete files, when removing a gallery in the database','nggallery'); ?></td>
  297. </tr>
  298. <tr valign="top">
  299. <th align="left"><?php _e('Activate permalinks','nggallery') ?></th>
  300. <td><input type="checkbox" name="usePermalinks" value="1" <?php checked('1', $ngg->options['usePermalinks']); ?> />
  301. <?php _e('When you activate this option, you need to update your permalink structure one time.','nggallery'); ?>
  302. <?php _e('Gallery slug name :','nggallery'); ?>
  303. <input type="text" size="15" name="permalinkSlug" value="<?php echo $ngg->options['permalinkSlug']; ?>" /></td>
  304. </tr>
  305. <tr class="expert">
  306. <th valign="top"><?php _e('Create new URL friendly image slugs','nggallery'); ?></th>
  307. <td><input type="submit" name="createslugs" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
  308. </tr>
  309. <tr class="expert">
  310. <th valign="top"><?php _e('Select graphic library','nggallery'); ?></th>
  311. <td><label><input name="graphicLibrary" type="radio" value="gd" <?php checked('gd', $ngg->options['graphicLibrary']); ?> /> <?php _e('GD Library', 'nggallery') ;?></label><br />
  312. <label><input name="graphicLibrary" type="radio" value="im" <?php checked('im', $ngg->options['graphicLibrary']); ?> /> <?php _e('ImageMagick (Experimental). Path to the library :', 'nggallery') ;?>&nbsp;
  313. <input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="imageMagickDir" value="<?php echo $ngg->options['imageMagickDir']; ?>" /></label>
  314. </td>
  315. </tr>
  316. <tr>
  317. <th align="left"><?php _e('Activate Media RSS feed','nggallery'); ?></th>
  318. <td><input type="checkbox" name="useMediaRSS" value="1" <?php checked('1', $ngg->options['useMediaRSS']); ?> />
  319. <span class="setting-description"><?php _e('A RSS feed will be added to you blog header. Useful for CoolIris/PicLens','nggallery') ?></span></td>
  320. </tr>
  321. <tr>
  322. <th align="left"><?php _e('Activate PicLens/CoolIris support','nggallery'); ?> (<a href="http://www.cooliris.com">CoolIris</a>)</th>
  323. <td><input type="checkbox" name="usePicLens" value="1" <?php checked('1', $ngg->options['usePicLens']); ?> />
  324. <span class="setting-description"><?php _e('When you activate this option, some javascript is added to your site footer. Make sure that wp_footer is called in your theme.','nggallery') ?></span></td>
  325. </tr>
  326. </table>
  327. <h3 class="expert"><?php _e('Tags / Categories','nggallery'); ?></h3>
  328. <table class="expert form-table ngg-options">
  329. <tr>
  330. <th valign="top"><?php _e('Activate related images','nggallery'); ?></th>
  331. <td><input name="activateTags" type="checkbox" value="1" <?php checked('1', $ngg->options['activateTags']); ?> />
  332. <?php _e('This option will append related images to every post','nggallery'); ?>
  333. </td>
  334. </tr>
  335. <tr>
  336. <th valign="top"><?php _e('Match with','nggallery'); ?></th>
  337. <td><label><input name="appendType" type="radio" value="category" <?php checked('category', $ngg->options['appendType']); ?> /> <?php _e('Categories', 'nggallery') ;?></label><br />
  338. <label><input name="appendType" type="radio" value="tags" <?php checked('tags', $ngg->options['appendType']); ?> /> <?php _e('Tags', 'nggallery') ;?></label>
  339. </td>
  340. </tr>
  341. <tr>
  342. <th valign="top"><?php _e('Max. number of images','nggallery'); ?></th>
  343. <td><input type="text" name="maxImages" value="<?php echo $ngg->options['maxImages']; ?>" size="3" maxlength="3" />
  344. <span class="setting-description"><?php _e('0 will show all images','nggallery'); ?></span>
  345. </td>
  346. </tr>
  347. </table>
  348. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  349. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes'); ?>"/></div>
  350. </form>
  351. <?php
  352. }
  353. function tab_thumbnails() {
  354. global $ngg;
  355. ?>
  356. <!-- Thumbnail settings -->
  357. <h2><?php _e('Thumbnail settings','nggallery'); ?></h2>
  358. <form name="thumbnailsettings" method="POST" action="<?php echo $this->filepath.'#thumbnails'; ?>" >
  359. <?php wp_nonce_field('ngg_settings') ?>
  360. <input type="hidden" name="page_options" value="thumbwidth,thumbheight,thumbfix,thumbquality" />
  361. <p><?php _e('Please note : If you change the settings, you need to recreate the thumbnails under -> Manage Gallery .', 'nggallery') ?></p>
  362. <table class="form-table ngg-options">
  363. <tr valign="top">
  364. <th align="left"><?php _e('Width x height (in pixel)','nggallery'); ?></th>
  365. <td>
  366. <?php // TODO, use template here as well? I don't think this file is used anymore...
  367. // include(dirname(__FILE__) . '/thumbnails-template.php');
  368. ?>
  369. <input type="text" size="4" maxlength="4" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="4" maxlength="4" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
  370. <span class="setting-description"><?php _e('These values are maximum values ','nggallery'); ?></span>
  371. </td>
  372. </tr>
  373. <tr valign="top">
  374. <th align="left"><?php _e('Set fix dimension','nggallery'); ?></th>
  375. <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
  376. <?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></td>
  377. </tr>
  378. <tr class="expert" valign="top">
  379. <th align="left"><?php _e('Thumbnail quality','nggallery'); ?></th>
  380. <td><input type="text" size="3" maxlength="3" name="thumbquality" value="<?php echo $ngg->options['thumbquality']; ?>" /> %</td>
  381. </tr>
  382. </table>
  383. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  384. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  385. </form>
  386. <?php
  387. }
  388. function tab_images() {
  389. global $ngg;
  390. ?>
  391. <!-- Image settings -->
  392. <h2><?php _e('Image settings','nggallery'); ?></h2>
  393. <form name="imagesettings" method="POST" action="<?php echo $this->filepath.'#images'; ?>" >
  394. <?php wp_nonce_field('ngg_settings') ?>
  395. <input type="hidden" name="page_options" value="imgResize,imgWidth,imgHeight,imgQuality,imgBackup,imgAutoResize" />
  396. <table class="form-table ngg-options">
  397. <tr valign="top">
  398. <th valign="top"><label for="fixratio"><?php _e('Resize Images','nggallery') ?></label></th>
  399. <td><input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
  400. <span class="setting-description"><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></span></td>
  401. </tr>
  402. <tr valign="top">
  403. <th valign="top"><?php _e('Image quality','nggallery'); ?></th>
  404. <td><input type="text" size="3" maxlength="3" name="imgQuality" value="<?php echo $ngg->options['imgQuality']; ?>" /> %</td>
  405. </tr>
  406. <tr>
  407. <th valign="top"><?php _e('Backup original images','nggallery'); ?></th>
  408. <td><input type="checkbox" name="imgBackup" value="1"<?php echo ($ngg->options['imgBackup'] == 1) ? ' checked ="chechked"' : ''; ?>/>
  409. <span class="setting-description"><?php _e('Creates a backup for inserted images','nggallery'); ?></span></td>
  410. </tr>
  411. <tr>
  412. <th valign="top"><?php _e('Automatically resize','nggallery'); ?></th>
  413. <td><input type="checkbox" name="imgAutoResize" value="1"<?php echo ($ngg->options['imgAutoResize'] == 1) ? ' checked ="chechked"' : ''; ?>/>
  414. <span class="setting-description"><?php _e('Automatically resize images on upload.','nggallery') ?></span></td>
  415. </tr>
  416. </table>
  417. <h3 class="expert"><?php _e('Single picture','nggallery') ?></h3>
  418. <table class="expert form-table ngg-options">
  419. <tr>
  420. <th valign="top"><?php _e('Clear cache folder','nggallery'); ?></th>
  421. <td><input type="submit" name="clearcache" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
  422. </tr>
  423. </table>
  424. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  425. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  426. </form>
  427. <?php
  428. }
  429. function tab_gallery() {
  430. global $ngg;
  431. ?>
  432. <!-- Gallery settings -->
  433. <h2><?php _e('Gallery settings','nggallery'); ?></h2>
  434. <form name="galleryform" method="POST" action="<?php echo $this->filepath.'#gallery'; ?>" >
  435. <?php wp_nonce_field('ngg_settings') ?>
  436. <input type="hidden" name="page_options" value="galNoPages,galImages,galColumns,galShowSlide,galTextSlide,galTextGallery,galShowOrder,galImgBrowser,galSort,galSortDir,galHiddenImg,galAjaxNav" />
  437. <table class="form-table ngg-options">
  438. <tr class="expert" >
  439. <th valign="top"><?php _e('Deactivate gallery page link','nggallery') ?></th>
  440. <td><input name="galNoPages" type="checkbox" value="1" <?php checked('1', $ngg->options['galNoPages']); ?> />
  441. <?php _e('The album will not link to a gallery subpage. The gallery is shown on the same page.','nggallery') ?>
  442. </td>
  443. </tr>
  444. <tr>
  445. <th valign="top"><?php _e('Number of images per page','nggallery') ?></th>
  446. <td><input type="text" name="galImages" value="<?php echo $ngg->options['galImages']; ?>" size="3" maxlength="3" />
  447. <span class="setting-description"><?php _e('0 will disable pagination, all images on one page','nggallery') ?></span>
  448. </td>
  449. </tr>
  450. <tr>
  451. <th valign="top"><?php _e('Number of columns','nggallery'); ?></th>
  452. <td><input type="text" name="galColumns" value="<?php echo $ngg->options['galColumns']; ?>" size="3" maxlength="3" />
  453. <span class="setting-description"><?php _e('0 will display as much as possible based on the width of your theme. Setting normally only required for captions below the images','nggallery') ?></span>
  454. </td>
  455. </tr>
  456. <tr>
  457. <th valign="top"><?php _e('Integrate slideshow','nggallery'); ?></th>
  458. <td><input name="galShowSlide" type="checkbox" value="1" <?php checked('1', $ngg->options['galShowSlide']); ?> />
  459. <input type="text" name="galTextSlide" value="<?php echo $ngg->options['galTextSlide'] ?>" size="20" />
  460. <input type="text" name="galTextGallery" value="<?php echo $ngg->options['galTextGallery'] ?>" size="20" />
  461. </td>
  462. </tr>
  463. <tr class="expert" >
  464. <th valign="top"><?php _e('Show first','nggallery'); ?></th>
  465. <td><label><input name="galShowOrder" type="radio" value="gallery" <?php checked('gallery', $ngg->options['galShowOrder']); ?> /> <?php _e('Thumbnails', 'nggallery') ;?></label><br />
  466. <label><input name="galShowOrder" type="radio" value="slide" <?php checked('slide', $ngg->options['galShowOrder']); ?> /> <?php _e('Slideshow', 'nggallery') ;?></label>
  467. </td>
  468. </tr>
  469. <tr class="expert" >
  470. <th valign="top"><?php _e('Show ImageBrowser','nggallery'); ?></th>
  471. <td><input name="galImgBrowser" type="checkbox" value="1" <?php checked('1', $ngg->options['galImgBrowser']); ?> />
  472. <?php _e('The gallery will open the ImageBrowser instead the effect.', 'nggallery'); ?>
  473. </td>
  474. </tr>
  475. <tr class="expert" >
  476. <th valign="top"><?php _e('Add hidden images','nggallery'); ?></th>
  477. <td><input name="galHiddenImg" type="checkbox" value="1" <?php checked('1', $ngg->options['galHiddenImg']); ?> />
  478. <?php _e('If pagination is used, this option will still show all images in the modal window (Thickbox, Lightbox etc.). Note : This increases the page load','nggallery'); ?>
  479. </td>
  480. </tr>
  481. <tr class="expert" >
  482. <th valign="top"><?php _e('Enable AJAX pagination','nggallery'); ?></th>
  483. <td><input name="galAjaxNav" type="checkbox" value="1" <?php checked('1', $ngg->options['galAjaxNav']); ?> />
  484. <?php _e('Browse images without reload the page. Note : Works only in combination with Shutter effect','nggallery'); ?>
  485. </td>
  486. </tr>
  487. </table>
  488. <h3 class="expert" ><?php _e('Sort options','nggallery') ?></h3>
  489. <table class="expert form-table ngg-options">
  490. <tr>
  491. <th valign="top"><?php _e('Sort thumbnails','nggallery') ?></th>
  492. <td>
  493. <label><input name="galSort" type="radio" value="sortorder" <?php checked('sortorder', $ngg->options['galSort']); ?> /> <?php _e('Custom order', 'nggallery') ;?></label><br />
  494. <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $ngg->options['galSort']); ?> /> <?php _e('Image ID', 'nggallery') ;?></label><br />
  495. <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $ngg->options['galSort']); ?> /> <?php _e('File name', 'nggallery') ;?></label><br />
  496. <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $ngg->options['galSort']); ?> /> <?php _e('Alt / Title text', 'nggallery') ;?></label><br />
  497. <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $ngg->options['galSort']); ?> /> <?php _e('Date / Time', 'nggallery') ;?></label>
  498. </td>
  499. </tr>
  500. <tr>
  501. <th valign="top"><?php _e('Sort direction','nggallery') ?></th>
  502. <td><label><input name="galSortDir" type="radio" value="ASC" <?php checked('ASC', $ngg->options['galSortDir']); ?> /> <?php _e('Ascending', 'nggallery') ;?></label><br />
  503. <label><input name="galSortDir" type="radio" value="DESC" <?php checked('DESC', $ngg->options['galSortDir']); ?> /> <?php _e('Descending', 'nggallery') ;?></label>
  504. </td>
  505. </tr>
  506. </table>
  507. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  508. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  509. </form>
  510. <?php
  511. }
  512. function tab_effects() {
  513. global $ngg;
  514. ?>
  515. <!-- Effects settings -->
  516. <h2><?php _e('Effects','nggallery'); ?></h2>
  517. <form name="effectsform" method="POST" action="<?php echo $this->filepath.'#effects'; ?>" >
  518. <?php wp_nonce_field('ngg_settings') ?>
  519. <input type="hidden" name="page_options" value="thumbEffect,thumbCode" />
  520. <p><?php _e('Here you can select the thumbnail effect, NextGEN Gallery will integrate the required HTML code in the images. Please note that only the Shutter and Thickbox effect will automatic added to your theme.','nggallery'); ?>
  521. <?php _e('With the placeholder','nggallery'); ?><strong> %GALLERY_NAME% </strong> <?php _e('you can activate a navigation through the images (depend on the effect). Change the code line only , when you use a different thumbnail effect or you know what you do.','nggallery'); ?></p>
  522. <table class="form-table ngg-options">
  523. <tr valign="top">
  524. <th><?php _e('JavaScript Thumbnail effect','nggallery') ?></th>
  525. <td>
  526. <select size="1" id="thumbEffect" name="thumbEffect" onchange="insertcode(this.value)">
  527. <option value="none" <?php selected('none', $ngg->options['thumbEffect']); ?> ><?php _e('None', 'nggallery') ;?></option>
  528. <option value="thickbox" <?php selected('thickbox', $ngg->options['thumbEffect']); ?> ><?php _e('Thickbox', 'nggallery') ;?></option>
  529. <option value="lightbox" <?php selected('lightbox', $ngg->options['thumbEffect']); ?> ><?php _e('Lightbox', 'nggallery') ;?></option>
  530. <option value="highslide" <?php selected('highslide', $ngg->options['thumbEffect']); ?> ><?php _e('Highslide', 'nggallery') ;?></option>
  531. <option value="shutter" <?php selected('shutter', $ngg->options['thumbEffect']); ?> ><?php _e('Shutter', 'nggallery') ;?></option>
  532. <option value="custom" <?php selected('custom', $ngg->options['thumbEffect']); ?> ><?php _e('Custom', 'nggallery') ;?></option>
  533. </select>
  534. </td>
  535. </tr>
  536. <tr class="expert" valign="top">
  537. <th><?php _e('Link Code line','nggallery') ?></th>
  538. <td><textarea id="thumbCode" name="thumbCode" cols="50" rows="5"><?php echo htmlspecialchars(stripslashes($ngg->options['thumbCode'])); ?></textarea></td>
  539. </tr>
  540. </table>
  541. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  542. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  543. </form>
  544. <?php
  545. }
  546. function tab_watermark() {
  547. global $wpdb, $ngg;
  548. // take the first image as sample
  549. $imageID = $wpdb->get_var("SELECT MIN(pid) FROM $wpdb->nggpictures");
  550. $imageURL = ($imageID) ? $imageURL = '<img src="'. home_url('index.php') . '?callback=image&amp;pid=' . intval ($imageID) . '&amp;mode=watermark&amp;width=300&amp;height=250" />' : '';
  551. ?>
  552. <!-- Watermark settings -->
  553. <h2><?php _e('Watermark','nggallery'); ?></h2>
  554. <p><?php _e('Please note : You can only activate the watermark under -> Manage Gallery . This action cannot be undone.', 'nggallery') ?></p>
  555. <form name="watermarkform" method="POST" action="<?php echo $this->filepath.'#watermark'; ?>" >
  556. <?php wp_nonce_field('ngg_settings') ?>
  557. <input type="hidden" name="page_options" value="wmPos,wmXpos,wmYpos,wmType,wmPath,wmFont,wmSize,wmColor,wmText,wmOpaque" />
  558. <div id="wm-preview">
  559. <h3><?php _e('Preview','nggallery') ?></h3>
  560. <p style="text-align:center;"><?php echo $imageURL; ?></p>
  561. <h3><?php _e('Position','nggallery') ?></h3>
  562. <div>
  563. <table id="wm-position">
  564. <tr>
  565. <td valign="top">
  566. <strong><?php _e('Position','nggallery') ?></strong>
  567. <table border="1">
  568. <tr>
  569. <td><input type="radio" name="wmPos" value="topLeft" <?php checked('topLeft', $ngg->options['wmPos']); ?> /></td>
  570. <td><input type="radio" name="wmPos" value="topCenter" <?php checked('topCenter', $ngg->options['wmPos']); ?> /></td>
  571. <td><input type="radio" name="wmPos" value="topRight" <?php checked('topRight', $ngg->options['wmPos']); ?> /></td>
  572. </tr>
  573. <tr>
  574. <td><input type="radio" name="wmPos" value="midLeft" <?php checked('midLeft', $ngg->options['wmPos']); ?> /></td>
  575. <td><input type="radio" name="wmPos" value="midCenter" <?php checked('midCenter', $ngg->options['wmPos']); ?> /></td>
  576. <td><input type="radio" name="wmPos" value="midRight" <?php checked('midRight', $ngg->options['wmPos']); ?> /></td>
  577. </tr>
  578. <tr>
  579. <td><input type="radio" name="wmPos" value="botLeft" <?php checked('botLeft', $ngg->options['wmPos']); ?> /></td>
  580. <td><input type="radio" name="wmPos" value="botCenter" <?php checked('botCenter', $ngg->options['wmPos']); ?> /></td>
  581. <td><input type="radio" name="wmPos" value="botRight" <?php checked('botRight', $ngg->options['wmPos']); ?> /></td>
  582. </tr>
  583. </table>
  584. </td>
  585. <td valign="top">
  586. <strong><?php _e('Offset','nggallery') ?></strong>
  587. <table border="0">
  588. <tr>
  589. <td>x</td>
  590. <td><input type="text" name="wmXpos" value="<?php echo $ngg->options['wmXpos'] ?>" size="4" /> px</td>
  591. </tr>
  592. <tr>
  593. <td>y</td>
  594. <td><input type="text" name="wmYpos" value="<?php echo $ngg->options['wmYpos'] ?>" size="4" /> px</td>
  595. </tr>
  596. </table>
  597. </td>
  598. </tr>
  599. </table>
  600. </div>
  601. </div>
  602. <h3><label><input type="radio" name="wmType" value="image" <?php checked('image', $ngg->options['wmType']); ?> /> <?php _e('Use image as watermark','nggallery') ?></label></h3>
  603. <table class="wm-table form-table">
  604. <tr>
  605. <th><?php _e('URL to file','nggallery') ?></th>
  606. <td><input type="text" size="40" name="wmPath" value="<?php echo $ngg->options['wmPath']; ?>" /><br />
  607. <?php if(!ini_get('allow_url_fopen')) _e('The accessing of URL files is disabled at your server (allow_url_fopen)','nggallery') ?> </td>
  608. </tr>
  609. </table>
  610. <h3><label><input type="radio" name="wmType" value="text" <?php checked('text', $ngg->options['wmType']); ?> /> <?php _e('Use text as watermark','nggallery') ?></label></h3>
  611. <table class="wm-table form-table">
  612. <tr>
  613. <th><?php _e('Font','nggallery') ?></th>
  614. <td><select name="wmFont" size="1"> <?php
  615. $fontlist = ngg_get_TTFfont();
  616. foreach ( $fontlist as $fontfile ) {
  617. echo "\n".'<option value="'.$fontfile.'" '.ngg_input_selected($fontfile, $ngg->options['wmFont']).' >'.$fontfile.'</option>';
  618. }
  619. ?>
  620. </select><br /><span class="setting-description">
  621. <?php if ( !function_exists('ImageTTFBBox') )
  622. _e('This function will not work, cause you need the FreeType library','nggallery');
  623. else
  624. _e('You can upload more fonts in the folder <strong>nggallery/fonts</strong>','nggallery'); ?>
  625. </span>
  626. </td>
  627. </tr>
  628. <tr>
  629. <th><?php _e('Size','nggallery') ?></th>
  630. <td><input type="text" name="wmSize" value="<?php echo $ngg->options['wmSize']; ?>" size="4" maxlength="2" /> px</td>
  631. </tr>
  632. <tr>
  633. <th><?php _e('Color','nggallery') ?></th>
  634. <td><input class="picker" type="text" size="6" maxlength="6" id="wmColor" name="wmColor" onchange="setcolor('#previewText', this.value)" value="<?php echo $ngg->options['wmColor'] ?>" />
  635. <input type="text" size="1" readonly="readonly" id="previewText" style="background-color: #<?php echo $ngg->options['wmColor']; ?>" /> <?php _e('(hex w/o #)','nggallery') ?></td>
  636. </tr>
  637. <tr>
  638. <th valign="top"><?php _e('Text','nggallery') ?></th>
  639. <td><textarea name="wmText" cols="40" rows="4"><?php echo $ngg->options['wmText'] ?></textarea></td>
  640. </tr>
  641. <tr>
  642. <th><?php _e('Opaque','nggallery') ?></th>
  643. <td><input type="text" name="wmOpaque" value="<?php echo $ngg->options['wmOpaque'] ?>" size="3" maxlength="3" /> % </td>
  644. </tr>
  645. </table>
  646. <div class="clear"> &nbsp; </div>
  647. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  648. </form>
  649. <?php
  650. }
  651. function tab_slideshow() {
  652. global $ngg;
  653. ?>
  654. <!-- Slideshow settings -->
  655. <form name="player_options" method="POST" action="<?php echo $this->filepath.'#slideshow'; ?>" >
  656. <?php wp_nonce_field('ngg_settings'); ?>
  657. <input type="hidden" name="page_options" value="slideFx,enableIR,irURL,irWidth,irHeight,irShuffle,irLinkfromdisplay,irShownavigation,irShowicons,irWatermark,irOverstretch,irRotatetime,irTransition,irKenburns,irBackcolor,irFrontcolor,irLightcolor,irScreencolor,irAudio,irXHTMLvalid" />
  658. <h2><?php _e('Slideshow','nggallery'); ?></h2>
  659. <table class="form-table ngg-options">
  660. <tr>
  661. <th><?php _e('Default size (W x H)','nggallery') ?></th>
  662. <td><input type="text" size="3" maxlength="4" name="irWidth" value="<?php echo $ngg->options['irWidth']; ?>" /> x
  663. <input type="text" size="3" maxlength="4" name="irHeight" value="<?php echo $ngg->options['irHeight']; ?>" /></td>
  664. </tr>
  665. <tr>
  666. <th><?php _e('Duration time','nggallery') ?></th>
  667. <td><input type="text" size="3" maxlength="3" name="irRotatetime" value="<?php echo $ngg->options['irRotatetime'] ?>" /> <?php _e('sec.', 'nggallery') ;?></td>
  668. </tr>
  669. <tr>
  670. <th><?php _e('Transition / Fade effect','nggallery') ?></th>
  671. <td>
  672. <select size="1" name="slideFx">
  673. <option value="fade" <?php selected('fade', $ngg->options['slideFx']); ?> ><?php _e('fade', 'nggallery') ;?></option>
  674. <option value="blindX" <?php selected('blindX', $ngg->options['slideFx']); ?> ><?php _e('blindX', 'nggallery') ;?></option>
  675. <option value="cover" <?php selected('cover', $ngg->options['slideFx']); ?> ><?php _e('cover', 'nggallery') ;?></option>
  676. <option value="scrollUp" <?php selected('scrollUp', $ngg->options['slideFx']); ?> ><?php _e('scrollUp', 'nggallery') ;?></option>
  677. <option value="scrollDown" <?php selected('scrollDown', $ngg->options['slideFx']); ?> ><?php _e('scrollDown', 'nggallery') ;?></option>
  678. <option value="shuffle" <?php selected('shuffle', $ngg->options['slideFx']); ?> ><?php _e('shuffle', 'nggallery') ;?></option>
  679. <option value="toss" <?php selected('toss', $ngg->options['slideFx']); ?> ><?php _e('toss', 'nggallery') ;?></option>
  680. <option value="wipe" <?php selected('wipe', $ngg->options['slideFx']); ?> ><?php _e('wipe', 'nggallery') ;?></option>
  681. </select>
  682. <span class="description"><?php _e('See here for more information about the effects :', 'nggallery') ?> <a href="http://jquery.malsup.com/cycle/browser.html" target="_blank" >jQuery Cycle</a></span>
  683. </td>
  684. </tr>
  685. </table>
  686. <h3 class="expert" ><?php _e('Settings for the JW Image Rotator','nggallery') ?></h3>
  687. <p>
  688. NextGEN Galery flash slideshows use the JW Image Rotator Version 3.17 by <a target='_blank' href='http://www.longtailvideo.com/players/jw-image-rotator/'>Long Tail Video</a>.
  689. This file is bundled with NextGEN Gallery 1.9.9 and above. Press the button below to search for it automatically. For earlier versions of NextGEN Gallery, you'll need to
  690. upload the file manually to the <a href='http://codex.wordpress.org/Uploading_Files' target='_blank'>WordPress Uploads directory</a>.
  691. </p>
  692. <?php if (empty($ngg->options['irURL']) && ($ngg->options['enableIR'] == '1')) { ?>
  693. <div id="message" class="error inline">
  694. <p>
  695. <?php _e('The path to JW Image Rotator is not defined, the slideshow will not work.','nggallery'); ?><br />
  696. Press the button below to search for the file.
  697. </p>
  698. </div>
  699. <?php }?>
  700. <table class="expert form-table ngg-options">
  701. <tr>
  702. <th><?php _e('Enable flash slideshow','nggallery') ?></th>
  703. <td><input name="enableIR" type="checkbox" value="1" <?php checked('1', $ngg->options['enableIR']); ?> />
  704. <span class="setting-description"><?php _e('Integrate the flash based slideshow for all flash supported devices','nggallery') ?></span></td>
  705. </tr>
  706. <tr>
  707. <th><?php _e('Path to the JW Image Rotator (URL)','nggallery') ?></th>
  708. <td>
  709. <input type="text" size="50" id="irURL" name="irURL" value="<?php echo $ngg->options['irURL']; ?>" />
  710. <input type="submit" name="irDetect" class="button-secondary" value="<?php _e('Search now','nggallery') ;?> &raquo;"/>
  711. <br /><span class="setting-description"><?php _e('Press the button below to search for the JW Image Rotator','nggallery') ?></span>
  712. </td>
  713. </tr>
  714. <tr>
  715. <th><?php _e('Shuffle mode','nggallery') ?></th>
  716. <td><input name="irShuffle" type="checkbox" value="1" <?php checked('1', $ngg->options['irShuffle']); ?> /></td>
  717. </tr>
  718. <tr class="expert">
  719. <th><?php _e('Show next image on click','nggallery') ?></th>
  720. <td><input name="irLinkfromdisplay" type="checkbox" value="1" <?php checked('1', $ngg->options['irLinkfromdisplay']); ?> /></td>
  721. </tr>
  722. <tr class="expert">
  723. <th><?php _e('Show navigation bar','nggallery') ?></th>
  724. <td><input name="irShownavigation" type="checkbox" value="1" <?php checked('1', $ngg->options['irShownavigation']); ?> /></td>
  725. </tr>
  726. <tr class="expert">
  727. <th><?php _e('Show loading icon','nggallery') ?></th>
  728. <td><input name="irShowicons" type="checkbox" value="1" <?php checked('1', $ngg->options['irShowicons']); ?> /></td>
  729. </tr>
  730. <tr class="expert">
  731. <th><?php _e('Use watermark logo','nggallery') ?></th>
  732. <td><input name="irWatermark" type="checkbox" value="1" <?php checked('1', $ngg->options['irWatermark']); ?> />
  733. <span class="setting-description"><?php _e('You can change the logo at the watermark settings','nggallery') ?></span></td>
  734. </tr>
  735. <tr class="expert">
  736. <th><?php _e('Stretch image','nggallery') ?></th>
  737. <td>
  738. <select size="1" name="irOverstretch">
  739. <option value="true" <?php selected('true', $ngg->options['irOverstretch']); ?> ><?php _e('true', 'nggallery') ;?></option>
  740. <option value="false" <?php selected('false', $ngg->options['irOverstretch']); ?> ><?php _e('false', 'nggallery') ;?></option>
  741. <option value="fit" <?php selected('fit', $ngg->options['irOverstretch']); ?> ><?php _e('fit', 'nggallery') ;?></option>
  742. <option value="none" <?php selected('none', $ngg->options['irOverstretch']); ?> ><?php _e('none', 'nggallery') ;?></option>
  743. </select>
  744. </td>
  745. </tr>
  746. <tr>
  747. <th><?php _e('Transition / Fade effect','nggallery') ?></th>
  748. <td>
  749. <select size="1" name="irTransition">
  750. <option value="fade" <?php selected('fade', $ngg->options['irTransition']); ?> ><?php _e('fade', 'nggallery') ;?></option>
  751. <option value="bgfade" <?php selected('bgfade', $ngg->options['irTransition']); ?> ><?php _e('bgfade', 'nggallery') ;?></option>
  752. <option value="slowfade" <?php selected('slowfade', $ngg->options['irTransition']); ?> ><?php _e('slowfade', 'nggallery') ;?></option>
  753. <option value="circles" <?php selected('circles', $ngg->options['irTransition']); ?> ><?php _e('circles', 'nggallery') ;?></option>
  754. <option value="bubbles" <?php selected('bubbles', $ngg->options['irTransition']); ?> ><?php _e('bubbles', 'nggallery') ;?></option>
  755. <option value="blocks" <?php selected('blocks', $ngg->options['irTransition']); ?> ><?php _e('blocks', 'nggallery') ;?></option>
  756. <option value="fluids" <?php selected('fluids', $ngg->options['irTransition']); ?> ><?php _e('fluids', 'nggallery') ;?></option>
  757. <option value="flash" <?php selected('flash', $ngg->options['irTransition']); ?> ><?php _e('flash', 'nggallery') ;?></option>
  758. <option value="lines" <?php selected('lines', $ngg->options['irTransition']); ?> ><?php _e('lines', 'nggallery') ;?></option>
  759. <option value="random" <?php selected('random', $ngg->options['irTransition']); ?> ><?php _e('random', 'nggallery') ;?></option>
  760. </select>
  761. </td>
  762. </tr>
  763. <tr class="expert">
  764. <th><?php _e('Use slow zooming effect','nggallery') ?></th>
  765. <td><input name="irKenburns" type="checkbox" value="1" <?php checked('1', $ngg->options['irKenburns']); ?> /></td>
  766. </tr>
  767. <tr>
  768. <th><?php _e('Background Color','nggallery') ?></th>
  769. <td><input class="picker" type="text" size="6" maxlength="6" id="irBackcolor" name="irBackcolor" onchange="setcolor('#previewBack', this.value)" value="<?php echo $ngg->options['irBackcolor'] ?>" />
  770. <input type="text" size="1" readonly="readonly" id="previewBack" style="background-color: #<?php echo $ngg->options['irBackcolor'] ?>" /></td>
  771. </tr>
  772. <tr>
  773. <th><?php _e('Texts / Buttons Color','nggallery') ?></th>
  774. <td><input class="picker" type="text" size="6" maxlength="6" id="irFrontcolor" name="irFrontcolor" onchange="setcolor('#previewFront', this.value)" value="<?php echo $ngg->options['irFrontcolor'] ?>" />
  775. <input type="text" size="1" readonly="readonly" id="previewFront" style="background-color: #<?php echo $ngg->options['irFrontcolor'] ?>" /></td>
  776. </tr>
  777. <tr class="expert">
  778. <th><?php _e('Rollover / Active Color','nggallery') ?></th>
  779. <td><input class="picker" type="text" size="6" maxlength="6" id="irLightcolor" name="irLightcolor" onchange="setcolor('#previewLight', this.value)" value="<?php echo $ngg->options['irLightcolor'] ?>" />
  780. <input type="text" size="1" readonly="readonly" id="previewLight" style="background-color: #<?php echo $ngg->options['irLightcolor'] ?>" /></td>
  781. </tr>
  782. <tr class="expert">
  783. <th><?php _e('Screen Color','nggallery') ?></th>
  784. <td><input class="picker" type="text" size="6" maxlength="6" id="irScreencolor" name="irScreencolor" onchange="setcolor('#previewScreen', this.value)" value="<?php echo $ngg->options['irScreencolor'] ?>" />
  785. <input type="text" size="1" readonly="readonly" id="previewScreen" style="background-color: #<?php echo $ngg->options['irScreencolor'] ?>" /></td>
  786. </tr>
  787. <tr class="expert">
  788. <th><?php _e('Background music (URL)','nggallery') ?></th>
  789. <td><input type="text" size="50" id="irAudio" name="irAudio" value="<?php echo $ngg->options['irAudio'] ?>" /></td>
  790. </tr>
  791. <tr class="expert">
  792. <th ><?php _e('Try XHTML validation (with CDATA)','nggallery') ?></th>
  793. <td><input name="irXHTMLvalid" type="checkbox" value="1" <?php checked('1', $ngg->options['irXHTMLvalid']); ?> />
  794. <span class="setting-description"><?php _e('Important : Could causes problem at some browser. Please recheck your page.','nggallery') ?></span></td>
  795. </tr>
  796. </table>
  797. <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
  798. <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
  799. </form>
  800. <?php
  801. }
  802. }
  803. function ngg_get_TTFfont() {
  804. $ttf_fonts = array ();
  805. // Files in wp-content/plugins/nggallery/fonts directory
  806. $plugin_root = NGGALLERY_ABSPATH . 'fonts';
  807. $plugins_dir = @ dir($plugin_root);
  808. if ($plugins_dir) {
  809. while (($file = $plugins_dir->read()) !== false) {
  810. if (preg_match('|^\.+$|', $file))
  811. continue;
  812. if (is_dir($plugin_root.'/'.$file)) {
  813. $plugins_subdir = @ dir($plugin_root.'/'.$file);
  814. if ($plugins_subdir) {
  815. while (($subfile = $plugins_subdir->read()) !== false) {
  816. if (preg_match('|^\.+$|', $subfile))
  817. continue;
  818. if (preg_match('|\.ttf$|', $subfile))
  819. $ttf_fonts[] = "$file/$subfile";
  820. }
  821. }
  822. } else {
  823. if (preg_match('|\.ttf$|', $file))
  824. $ttf_fonts[] = $file;
  825. }
  826. }
  827. }
  828. return $ttf_fonts;
  829. }
  830. function ngg_search_imagerotator() {
  831. global $wpdb;
  832. $upload = wp_upload_dir();
  833. // look first at the old place and move it to wp-content/uploads
  834. if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
  835. @rename(NGGALLERY_ABSPATH . 'imagerotator.swf', $upload['basedir'] . '/imagerotator.swf');
  836. // This should be the new place
  837. if ( file_exists( $upload['basedir'] . '/imagerotator.swf' ) )
  838. return $upload['baseurl'] . '/imagerotator.swf';
  839. // Find the path to the imagerotator via the media library
  840. if ( $path = $wpdb->get_var( "SELECT guid FROM {$wpdb->posts} WHERE guid LIKE '%imagerotator.swf%'" ) )
  841. return $path;
  842. // maybe it's located at wp-content
  843. if ( file_exists( WP_CONTENT_DIR . '/imagerotator.swf' ) )
  844. return WP_CONTENT_URL . '/imagerotator.swf';
  845. // or in the plugin folder
  846. if ( file_exists( WP_PLUGIN_DIR . '/imagerotator.swf' ) )
  847. return WP_PLUGIN_URL . '/imagerotator.swf';
  848. // this is deprecated and will be ereased during a automatic upgrade
  849. if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
  850. return NGGALLERY_URLPATH . 'imagerotator.swf';
  851. return '';
  852. }
  853. /**********************************************************/
  854. // taken from WP Core
  855. function ngg_input_selected( $selected, $current) {
  856. if ( $selected == $current)
  857. return ' selected="selected"';
  858. }
  859. function ngg_input_checked( $checked, $current) {
  860. if ( $checked == $current)
  861. return ' checked="checked"';
  862. }
  863. ?>