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

/wordpress/wp-content/plugins/nextgen-smooth-gallery/nggSmooth.php

http://ownerpress.googlecode.com/
PHP | 487 lines | 383 code | 72 blank | 32 comment | 38 complexity | fe243b97cf30898044d006fa63fe993f MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, GPL-2.0, GPL-3.0, LGPL-2.1
  1. <?php
  2. /*
  3. Plugin Name: NextGEN Smooth Gallery
  4. Plugin URI: http://uninuni.com/wordpress-plugin-nextgen-smooth-gallery/
  5. Description: The amazing galery viewer from <a href="http://smoothgallery.jondesign.net/">JonDesign's SmoothGallery</a> for NextGEN Gallery.
  6. Author: Bruno Guimaraes
  7. Author URI: http://uninuni.com/
  8. Version: 1.2
  9. #####################################################################
  10. ############## Upgrading JonDesign's SmoothGallery ################
  11. #####################################################################
  12. The current version used is 2.0
  13. Unless the new version has major changes, you should:
  14. 1. Replace the content of the folder /nextgen-smooth/SmoothGallery/ with the new one
  15. 2. /nextgen-smooth/SmoothGallery/css/
  16. Look for #myGallery and change to .myGallery on all .css
  17. 3. /nextgen-smooth/SmoothGallery/scripts/jd.gallery.js
  18. Replace: title: this.galleryData[num].linkTitle
  19. with: title: this.galleryData[num].linkTitle, target: this.galleryData[num].linkTarget
  20. 4. Bug on 2.0: This combination shows the carousel on a blank frame:
  21. showArrows = false
  22. showCarousel = true
  23. embedLinks = true
  24. */
  25. //#################################################################
  26. // Restrictions
  27. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
  28. include "nggSmoothSharedFunctions.php";
  29. class Smooth_Gallery {
  30. //#################################################################
  31. // The Real Deal
  32. function is_using_frames() {
  33. global $data_ngs;
  34. return $data_ngs["use_frames"];
  35. }
  36. function nggSmoothFindStringBetween($text, $begin, $end) {
  37. if ( ($posBegin = stripos($text, $begin )) === false) return Array($text, "");
  38. if ( ($posEnd = stripos($text, $end, $posBegin)) === false) return Array($text, "");
  39. $textBegin = substr($text, 0, $posBegin);
  40. $textMiddle = substr($text, $posBegin, $posEnd - $posBegin + strlen($end) );
  41. $textEnd = substr($text, $posEnd + strlen($end) , strlen($text));
  42. return Array($textBegin, $textMiddle, $textEnd);
  43. }
  44. function nggSmoothReplace($content) {
  45. global $wpdb, $data_ngs;
  46. list($begin, $middle, $end) = $this->nggSmoothFindStringBetween($content, "[smooth", "]");
  47. if ($begin == $content) return $content;
  48. // New Way [smooth=id:; width:; height:; timed:; delay:; transition:; arrows:; info:; carousel:; text:; open:; links:;]
  49. $middleValues = substr($middle, 0, -1); // Remove last brackets
  50. $middleValues = explode("=", $middleValues);
  51. $middleValues = explode(";", $middleValues[1]);
  52. $final = Array();
  53. foreach($middleValues as $value) {
  54. list($key, $value) = explode(":", $value);
  55. if (trim($key) != "")
  56. $final[trim(strtolower($key))] = trim($value);
  57. }
  58. $info = $this->get_values($final);
  59. $info["galleryID"] = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '".$info["galleryID"]."' ");
  60. if (! $info["galleryID"]) $info["galleryID"] = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '".$info["galleryID"]."' ");
  61. if (! $info["galleryID"]) return $begin . $middle . $end;
  62. if ( $info["galleryID"]) {
  63. if ($info["use_frames"])
  64. $middle = $this->nggSmoothFrame($info);
  65. else
  66. $middle = nggSmoothShow($info);
  67. }
  68. return $this->nggSmoothReplace($begin . $middle . $end); // More than one gallery per post
  69. }
  70. function nggSmoothFrame($info) {
  71. global $data_ngs;
  72. if($info["width"] == "") $info["width"] = $data_ngs["width"];
  73. if($info["height"]== "") $info["height"] = $data_ngs["height"];
  74. $frame_url = "/wp-content/plugins/". plugin_basename( dirname(__FILE__)) ."/nggSmoothFrame.php?galleryID=".$info["galleryID"]."&width=".$info["width"]."&height=".$info["height"]."&timed=".$info["timed"]."&showArrows=".$info["showArrows"]."&showCarousel=".$info["showCarousel"]."&embedLinks=".$info["embedLinks"]."&delay=".$info["delay"]."&defaultTransition=".$info["defaultTransition"]."&showInfopane=".$info["showInfopane"]."&textShowCarousel=".$info["textShowCarousel"]."&showCarouselOpen=".$info["showCarouselOpen"]."&margin=&align="; // margin and align goes to the IFrame
  75. // Increases frame width and height by 3px in order to display the complete image on the inside.
  76. return "<p style=\"".nggSmoothAlign($info['align'], $info['margin'], "iframe")."\">
  77. <iframe width=\"". ($info["width"]+3) ."px\" height=\"". ($info["height"]+3) ."px\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" name=\"smooth_frame_".rand()."\" src=\"" . BASE_URL . $frame_url . "\"></iframe>
  78. </p>";
  79. }
  80. function admin_menu() {
  81. add_menu_page('Gallery (Smooth)', 'Gallery (Smooth)', 8, plugin_basename( dirname(__FILE__)), array($this, 'general_page')); // add_options_page
  82. add_submenu_page( plugin_basename( dirname(__FILE__)), 'Specific Options', 'Specific Options', 8, 'specific_smooth', array($this, 'specific_page'));
  83. add_submenu_page( plugin_basename( dirname(__FILE__)), 'Soon...', 'Soon...', 8, 'soon_smooth', array($this, 'soon_page'));
  84. }
  85. function soon_page() { ?>
  86. <fieldset class="options" style="padding:20px; margin-top:20px;">
  87. <legend> Soon... </legend>
  88. <ol style="list-style-position:inside; padding-left:12px; list-style-type:decimal;">
  89. <li>Smooth with NextGen Albuns </li>
  90. <li>Smooth with Wordpress Gallery </li>
  91. <li>Smooth with PHP array </li>
  92. <li>Thumbnail Generator </li>
  93. <li>Open with lightbox </li>
  94. <li>Info Zone </li>
  95. <ul style="list-style-position:inside; padding-left:20px; list-style-type:disc;">
  96. <li>Set Opacity </li>
  97. <li>Choose Title from gallery name or alttext (NextGen) </li>
  98. <li>Change font, color, size from title and description </li>
  99. </ul>
  100. <li>Choose to open images on same/new window </li>
  101. </ol>
  102. </fieldset>
  103. <?php }
  104. function save_request() {
  105. global $data_ngs, $_REQUEST;
  106. $data_ngs['width'] = (int) $_REQUEST['width'];
  107. $data_ngs['height'] = (int) $_REQUEST['height'];
  108. $data_ngs['timed'] = (bool) $_REQUEST['timed'];
  109. $data_ngs['showArrows'] = (bool) $_REQUEST['showArrows'];
  110. $data_ngs['showCarousel'] = (bool) $_REQUEST['showCarousel'];
  111. $data_ngs['embedLinks'] = (bool) $_REQUEST['embedLinks'];
  112. $data_ngs['use_frames'] = (bool) $_REQUEST['use_frames'];
  113. $data_ngs['delay'] = (int) $_REQUEST['delay'];
  114. $data_ngs['defaultTransition'] = (string) $_REQUEST['defaultTransition'];
  115. $data_ngs['showInfopane'] = (bool) $_REQUEST['showInfopane'];
  116. $data_ngs['textShowCarousel'] = (string) $_REQUEST['textShowCarousel'];
  117. $data_ngs['showCarouselOpen'] = (bool) $_REQUEST['showCarouselOpen'];
  118. $data_ngs['margin'] = (int) $_REQUEST['margin'];
  119. $data_ngs['align'] = (string) $_REQUEST['align'];
  120. }
  121. function get_values($final) {
  122. global $data_ngs;
  123. $info = array();
  124. $info["galleryID"] = (int) ( (array_key_exists("id" , $final))? $final["id"] :$data_ngs["id"] );
  125. $info["width"] = (int) ( (array_key_exists("width" , $final))? $final["width"] :$data_ngs["width"] );
  126. $info["height"] = (int) ( (array_key_exists("height" , $final))? $final["height"] :$data_ngs["height"] );
  127. $info["timed"] = (bool) ( (array_key_exists("timed" , $final))?($final["timed"] =='false'?0:1):$data_ngs["timed"] );
  128. $info["showArrows"] = (bool) ( (array_key_exists("arrows" , $final))?($final["arrows"] =='false'?0:1):$data_ngs["showArrows"] );
  129. $info["showCarousel"] = (bool) ( (array_key_exists("carousel" , $final))?($final["carousel"]=='false'?0:1):$data_ngs["showCarousel"] );
  130. $info["embedLinks"] = (bool) ( (array_key_exists("links" , $final))?($final["links"] =='false'?0:1):$data_ngs["embedLinks"] );
  131. $info["use_frames"] = (bool) ( (array_key_exists("frames" , $final))?($final["frames"] =='false'?0:1):$data_ngs["use_frames"] );
  132. $info["delay"] = (int) ( (array_key_exists("delay" , $final))? $final["delay"] :$data_ngs["delay"] );
  133. $info["defaultTransition"] = (string) ( (array_key_exists("transition", $final))? $final["transition"] :$data_ngs["defaultTransition"] );
  134. $info["showInfopane"] = (bool) ( (array_key_exists("info" , $final))?($final["info"] =='false'?0:1):$data_ngs["showInfopane"] );
  135. $info["textShowCarousel"] = (string) ( (array_key_exists("text" , $final))? $final["text"] :$data_ngs["textShowCarousel"] );
  136. $info["showCarouselOpen"] = (bool) ( (array_key_exists("open" , $final))?($final["open"] =='false'?0:1):$data_ngs["showCarouselOpen"] );
  137. $info["margin"] = (int) ( (array_key_exists("margin" , $final))? $final["margin"] :$data_ngs["margin"] );
  138. $info["align"] = (string) ( (array_key_exists("align" , $final))? $final["align"] :$data_ngs["align"] );
  139. return $info;
  140. }
  141. function specific_page() {
  142. global $data_ngs, $wpdb;
  143. if ($_REQUEST["enviar"])
  144. $this->save_request();
  145. $code = "[smooth=id: yyy;";
  146. $code .= " width:" . $data_ngs['width'] . ";";
  147. $code .= " height:" . $data_ngs['height'] . ";";
  148. $code .= " timed:" . ($data_ngs['timed'] ?'true':'false') . ";";
  149. $code .= " arrows:" . ($data_ngs['showArrows'] ?'true':'false') . ";";
  150. $code .= " carousel:" . ($data_ngs['showCarousel']?'true':'false') . ";";
  151. $code .= " links:" . ($data_ngs['embedLinks'] ?'true':'false') . ";";
  152. $code .= " info:" . ($data_ngs['showInfopane']?'true':'false') . ";";
  153. $code .= " align:" . $data_ngs['align'] . ";";
  154. $code .= " frames:" . ($data_ngs['use_frames'] ?'true':'false') . ";";
  155. if ($data_ngs['timed']) {
  156. $code .= " delay:" . $data_ngs['delay'] . ";";
  157. $code .= " transition:" . $data_ngs['defaultTransition'] . ";";
  158. }
  159. if ($data_ngs['showCarousel']) {
  160. $code .= " open:" . ($data_ngs['showCarouselOpen']?'true':'false') . ";";
  161. $code .= " text:" . $data_ngs['textShowCarousel'] . ";";
  162. }
  163. if ($data_ngs['align'] == "float_right" || $data_ngs['align'] == "float_left")
  164. $code .= " margin:" . $data_ngs['margin'] . ";";
  165. $code .= "]";
  166. $code_2 = "<?php \n \$content = \"" . $code . "\"; \n smooth_show(\$content); \n?>";
  167. ?>
  168. <div class="wrap">
  169. <h2>NextGen Smooth Gallery</h2>
  170. <?php $this->donation(); ?>
  171. <form method="post">
  172. <div>
  173. <fieldset class="options" style="padding:20px; margin-top:20px;">
  174. <legend> Specific Options </legend>
  175. Allows a gallery to have a behavior other that the General one.
  176. <br/><br/>
  177. <?php $this->opcoes_tela_antes(); ?>
  178. <div class="submit">
  179. <input type="submit" name="enviar" value="Generate Code">
  180. </div>
  181. <hr style="width:90%; border:1px solid #DFDFDF;">
  182. <br/><b>Warning: </b>There is a bug on JonDesign's SmoothGallery 2.0 that shows the carousel on a blank frame with the options: arrows: false; carousel: true; links: true;<br/><br/>
  183. <hr style="width:90%; border:1px solid #DFDFDF;">
  184. <br/>You have two options:
  185. <br><br><b>1. Write on your post</b> (You must replace 'yyy' with your Gallery Id)<br>
  186. <textarea style="width:700px; height:130px;"><?php echo $code; ?></textarea>
  187. <br><br><b>2. Write on any php page</b> (You must replace 'yyy' with your Gallery Id)<br>
  188. <textarea style="width:700px; height:130px;"><?php echo $code_2; ?></textarea>
  189. <hr style="width:90%; border:1px solid #DFDFDF;">
  190. <br/>If you remove, for example, "width:300, " the General option will be used on that item.
  191. </fieldset>
  192. </div>
  193. <?php $this->example_show($code); ?>
  194. </form>
  195. </div>
  196. <?php }
  197. function general_page() {
  198. global $data_ngs, $data_ngs_default, $wpdb;
  199. $msg = "";
  200. if ($_REQUEST["enviar"] == "Back to Default") {
  201. $data_ngs = $data_ngs_default;
  202. update_option('dataNextGenSmooth', $data_ngs);
  203. $msg = "Data saved successfully.";
  204. } elseif ($_REQUEST["enviar"]) {
  205. $this->save_request();
  206. update_option('dataNextGenSmooth', $data_ngs);
  207. $msg = "Data saved successfully.";
  208. }
  209. if ($msg != '') echo '<div id="message"class="updated fade"><p>' . $msg . '</p></div>';
  210. $code = "[smooth=id:yyy;]";
  211. ?>
  212. <div class="wrap">
  213. <h2>NextGen Smooth Gallery</h2>
  214. <?php $this->donation(); ?>
  215. <form method="post">
  216. <div>
  217. <fieldset class="options" style="padding:20px; margin-top:20px;">
  218. <legend> General Options </legend>
  219. <?php $this->opcoes_tela_antes(); ?>
  220. <div class="submit" style="clear:both;">
  221. <input type="submit" name="enviar" value="Save">
  222. <input type="submit" name="enviar" value="Back to Default">
  223. </div>
  224. <hr style="width:90%; border:1px solid #DFDFDF;">
  225. <br/><b>Warning: </b>There is a bug on JonDesign's SmoothGallery 2.0 that shows the carousel on a blank frame with the options: arrows: false; carousel: true; links: true;<br/><br/>
  226. <hr style="width:90%; border:1px solid #DFDFDF;">
  227. <br><br><b>Write on your post</b> (You must replace 'yyy' with your Gallery Id)<br>
  228. <textarea style="width:700px; height:60px;"><?php echo $code; ?></textarea>
  229. </fieldset>
  230. </div>
  231. <?php $this->example_show($code); ?>
  232. </form>
  233. </div>
  234. <?php
  235. }
  236. function example_show($code) {
  237. global $_REQUEST, $data_ngs, $wpdb;
  238. $gal_id = $_REQUEST['gal_id'];
  239. $gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC");
  240. $select = "";
  241. if(is_array($gallerylist))
  242. foreach($gallerylist as $gallery) {
  243. $selected = ($gallery->gid == $gal_id )? ' selected="selected"' : "";
  244. $select .= '<option value="'.$gallery->gid.'"'.$selected.' >('.$gallery->gid.') '.$gallery->title.'</option>'."\n";
  245. }
  246. if ($gal_id)
  247. $real_deal = $this->nggSmoothReplace( str_replace("yyy", $gal_id, $code) );
  248. ?>
  249. <div>
  250. <fieldset class="options" style="padding:20px; margin-top:20px; margin-bottom:20px;">
  251. <legend> Example </legend>
  252. This is how your gallery will look like with the options above (after you <b>save</b> them). <br/><br/>
  253. <div class="submit">
  254. <div class="alignleft actions">
  255. <select id="gal_id" name="gal_id" style="width:250px;">;
  256. <option value="0"> Choose a gallery </option>
  257. <?php echo $select; ?>
  258. </select>
  259. <input type="submit" id="enviar" name="enviar" value="Select" class="button-secondary" />
  260. </div>
  261. </div>
  262. <br/>
  263. <?php echo $real_deal; ?>
  264. </fieldset>
  265. </div>
  266. <?php }
  267. function donation() { ?>
  268. <div style="width:100%; text-align:right;">
  269. <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  270. <input type="hidden" name="cmd" value="_donations">
  271. <input type="hidden" name="business" value="parisoto@gmail.com">
  272. <input type="hidden" name="item_name" value="Wordpress Plugin: NextGen Smooth Gallery">
  273. <input type="hidden" name="no_shipping" value="0">
  274. <input type="hidden" name="no_note" value="1">
  275. <input type="hidden" name="currency_code" value="USD">
  276. <input type="hidden" name="tax" value="0">
  277. <input type="hidden" name="bn" value="PP-DonationsBF">
  278. <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  279. <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
  280. </form>
  281. </div>
  282. <?php }
  283. function opcoes_tela_antes() {
  284. global $data_ngs; ?>
  285. <div style="">
  286. <div style="width:120px; float:left;"> Width </div>
  287. <div style="width:120px; float:left;"> <input type="text" name="width" value="<?php echo $data_ngs['width']?>" style="width:60px;">px </div>
  288. </div>
  289. <div style="clear:left; padding-top:10px;">
  290. <div style="width:120px; float:left;"> Height </div>
  291. <div style="width:120px; float:left;"> <input type="text" name="height" value="<?php echo $data_ngs['height']?>" style="width:60px;">px </div>
  292. </div>
  293. <div style="clear:both; padding-top:10px;">
  294. <div style="width:120px; float:left;"> Timed </div>
  295. <div style="width:120px; float:left;"> <input type="checkbox" id="timed" name="timed" <?php echo ($data_ngs['timed']? "checked=\"checked\"": "") ?> onClick="if(this.checked){document.getElementById('timed_options').style.display='';} else{document.getElementById('timed_options').style.display='none';};" > </div>
  296. </div>
  297. <fieldset id="timed_options" class="options" style="padding:20px; margin-top:0px; display:<?php echo ($data_ngs['timed']?'':'none')?>;">
  298. <legend> Timed Options </legend>
  299. <div style="clear:both;">
  300. <div style="width:120px; float:left;"> Delay </div>
  301. <div style="width:120px; float:left;"> <input type="text" name="delay" value="<?php echo $data_ngs['delay']?>" style="width:60px;">ms </div>
  302. </div>
  303. <div style="clear:both; padding-top:10px;">
  304. <div style="width:120px; float:left;"> Transition </div>
  305. <div style="width:120px; float:left;">
  306. <select name="defaultTransition">
  307. <option value="fade" <?php echo ($data_ngs['defaultTransition'] == "fade" ? "selected":"") ?>> Fade </option>
  308. <option value="crossfade" <?php echo ($data_ngs['defaultTransition'] == "crossfade" ? "selected":"") ?>> Cross Fade </option>
  309. <option value="fadebg" <?php echo ($data_ngs['defaultTransition'] == "fadebg" ? "selected":"") ?>> Fade BackGround </option>
  310. <option value="fadeslideleft" <?php echo ($data_ngs['defaultTransition'] == "fadeslideleft" ? "selected":"") ?>> Fade Slide Left </option>
  311. <option value="continuousvertical" <?php echo ($data_ngs['defaultTransition'] == "continuousvertical" ? "selected":"") ?>> Continuous Vertical </option>
  312. <option value="continuoushorizontal" <?php echo ($data_ngs['defaultTransition'] == "continuoushorizontal"? "selected":"") ?>> Continuous Horizontal </option>
  313. </select>
  314. </div>
  315. </div>
  316. </fieldset>
  317. <div style="clear:both; padding-top:10px;">
  318. <div style="width:120px; float:left;"> Show Arrows </div>
  319. <div style="width:120px; float:left;"> <input type="checkbox" name="showArrows" <?php echo ($data_ngs['showArrows']? "checked=\"checked\"": "") ?>> </div>
  320. </div>
  321. <div style="clear:both; padding-top:10px;">
  322. <div style="width:120px; float:left;"> Show Info Pane </div>
  323. <div style="width:120px; float:left;"> <input type="checkbox" name="showInfopane" <?php echo ($data_ngs['showInfopane']? "checked=\"checked\"": "") ?>> </div>
  324. </div>
  325. <div style="clear:both; padding-top:10px;">
  326. <div style="width:120px; float:left;"> Show Carousel </div>
  327. <div style="width:120px; float:left;"> <input type="checkbox" name="showCarousel" <?php echo ($data_ngs['showCarousel']? "checked=\"checked\"": "") ?> onClick="if(this.checked){document.getElementById('carousel_options').style.display='';} else{document.getElementById('carousel_options').style.display='none';};"> </div>
  328. </div>
  329. <fieldset id="carousel_options" class="options" style="padding:20px; margin-top:0px; display:<?php echo ($data_ngs['showCarousel']?'':'none') ?>;">
  330. <legend> Carousel Options </legend>
  331. <div style="clear:both;">
  332. <div style="width:120px; float:left;"> Text</div>
  333. <div style="width:120px; float:left;"> <input type="text" name="textShowCarousel" value="<?php echo$data_ngs['textShowCarousel']?>" style="width:120px;"> </div>
  334. </div>
  335. <div style="clear:both; padding-top:10px;">
  336. <div style="width:120px; float:left;"> Opened </div>
  337. <div style="width:120px; float:left;"> <input type="checkbox" name="showCarouselOpen" <?php echo ($data_ngs['showCarouselOpen']? "checked=\"checked\"": "") ?>> </div>
  338. </div>
  339. </fieldset>
  340. <div style="clear:both; padding-top:10px;">
  341. <div style="width:120px; float:left;"> Embed Links </div>
  342. <div style="width:120px; float:left;"> <input type="checkbox" name="embedLinks" <?php echo ($data_ngs['embedLinks']? "checked=\"checked\"": "") ?>> </div>
  343. </div>
  344. <div style="clear:both; padding-top:10px;">
  345. <div style="width:120px; float:left;"> Align </div>
  346. <div style="width:120px; float:left;">
  347. <select name="align">
  348. <option value="left" <?php echo ($data_ngs['align'] == "left" ? "selected":"") ?> onClick="document.getElementById('align_options').style.display='none';"> Left </option>
  349. <option value="right" <?php echo ($data_ngs['align'] == "right" ? "selected":"") ?> onClick="document.getElementById('align_options').style.display='none';"> Right </option>
  350. <option value="center" <?php echo ($data_ngs['align'] == "center" ? "selected":"") ?> onClick="document.getElementById('align_options').style.display='none';"> Center </option>
  351. <option value="float_left" <?php echo ($data_ngs['align'] == "float_left" ? "selected":"") ?> onClick="document.getElementById('align_options').style.display='';" > Float Left </option>
  352. <option value="float_right" <?php echo ($data_ngs['align'] == "float_right" ? "selected":"") ?> onClick="document.getElementById('align_options').style.display='';" > Float Right </option>
  353. </select>
  354. </div>
  355. </div>
  356. <fieldset id="align_options" class="options" style="padding:20px; margin-top:0px; display:<?php if ( ($data_ngs['align']=='float_left') || ($data_ngs['align']=='float_right') ) { echo '';} else {echo 'none';}?>;">
  357. <legend> Align Options </legend>
  358. <div style="clear:both; padding-top:10px;">
  359. <div style="width:120px; float:left;"> Margin </div>
  360. <div style="width:120px; float:left;"> <input type="text" name="margin" value="<?php echo $data_ngs['margin']?>" style="width:60px;">px </div>
  361. </div>
  362. </fieldset>
  363. <div style="clear:both; padding-bottom:8px;"></div>
  364. <div class="submit">
  365. <div style="clear:both; padding-bottom:50px;">
  366. <div style="width:120px; float:left;"> IFrames </div>
  367. <div style="width:40px; float:left;"> <input type="checkbox" name="use_frames" <?php echo ($data_ngs['use_frames']? "checked=\"checked\"": "") ?>> </div>
  368. <div style=" float:left; width:700px;">
  369. Jon Design's Smooth Gallery is known for not working properly along other JS libraries like prototype and jquery (some of your plugins might use them).
  370. <br/><br/>If your gallery is taking forever to load or not showing up, try to check this option.
  371. <br/>Checking 'IFrames' makes your gallery appear inside an IFrame, therefore overcoming this problem.
  372. </div>
  373. </div>
  374. </div>
  375. <?php }
  376. }
  377. function smooth_show($content) {
  378. global $smooth_gallery;
  379. echo $smooth_gallery->nggSmoothReplace($content);
  380. }
  381. $smooth_gallery = new Smooth_Gallery();
  382. add_action('admin_menu' , array($smooth_gallery, 'admin_menu'));
  383. add_filter('the_content', array($smooth_gallery, 'nggSmoothReplace'));
  384. add_filter('the_excerpt', array($smooth_gallery, 'nggSmoothReplace'));
  385. // Hook wp_head to add css
  386. if (! $smooth_gallery->is_using_frames) add_action('wp_head' , 'nggSmoothHead');
  387. if ($_REQUEST["page"] == "specific_smooth" ) add_action('admin_head', 'nggSmoothHeadAdmin');
  388. if ($_REQUEST["page"] == "soon_smooth" ) add_action('admin_head', 'nggSmoothHeadAdmin');
  389. if ($_REQUEST["page"] == plugin_basename( dirname(__FILE__))) add_action('admin_head', 'nggSmoothHeadAdmin');
  390. ?>