| 1 |
<?php |
| 2 |
|
| 3 |
function mfbfw_options() { |
| 4 |
|
| 5 |
// Set defaults |
| 6 |
add_option('mfbfw_autoApply', 'on'); |
| 7 |
add_option('mfbfw_imageScale', 'on'); |
| 8 |
add_option('mfbfw_zoomOpacity', 'on'); |
| 9 |
add_option('mfbfw_zoomSpeedIn', '500'); |
| 10 |
add_option('mfbfw_zoomSpeedOut', '500'); |
| 11 |
add_option('mfbfw_overlayShow', 'on'); |
| 12 |
add_option('mfbfw_overlayColor', '#666666'); |
| 13 |
add_option('mfbfw_overlayOpacity', '0.3'); |
| 14 |
add_option('mfbfw_hideOnContentClick', ''); |
| 15 |
add_option('mfbfw_centerOnScroll', 'on'); |
| 16 |
|
| 17 |
// Store plugin options in an array |
| 18 |
$options=array( |
| 19 |
'autoApply' => get_option('mfbfw_autoApply'), |
| 20 |
'imageScale' => get_option('mfbfw_imageScale'), |
| 21 |
'zoomOpacity' => get_option('mfbfw_zoomOpacity'), |
| 22 |
'zoomSpeedIn' => get_option('mfbfw_zoomSpeedIn'), |
| 23 |
'zoomSpeedOut' => get_option('mfbfw_zoomSpeedOut'), |
| 24 |
'overlayShow' => get_option('mfbfw_overlayShow'), |
| 25 |
'overlayColor' => get_option('mfbfw_overlayColor'), |
| 26 |
'overlayOpacity' => get_option('mfbfw_overlayOpacity'), |
| 27 |
'hideOnContentClick' => get_option('mfbfw_hideOnContentClick'), |
| 28 |
'centerOnScroll' => get_option('mfbfw_centerOnScroll') |
| 29 |
); |
| 30 |
|
| 31 |
// Make selects data |
| 32 |
$overlayArray = array(0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1); |
| 33 |
$msArray = array(0,100,200,300,400,500,600,700,800,900,1000,1500); |
| 34 |
|
| 35 |
|
| 36 |
// Start the Options Page |
| 37 |
?> |
| 38 |
|
| 39 |
<div class="wrap"> |
| 40 |
|
| 41 |
<div id="icon-plugins" class="icon32"></div> |
| 42 |
<h2><?php _e('Fancybox for WordPress Options', 'mfbfw'); ?></h2> |
| 43 |
|
| 44 |
<div style="float:right;margin-left:10px;background:#FFFBCC;text-align:center;width:200px;" class="updated"> |
| 45 |
|
| 46 |
<p style="line-height:1.5em;">If you use FancyBox and like it, buy the author a beer!</p> |
| 47 |
|
| 48 |
<form id="donate_form" action="https://www.paypal.com/cgi-bin/webscr" method="post"> |
| 49 |
<input name="cmd" value="_donations" type="hidden"> |
| 50 |
<input name="business" value="janis.skarnelis@gmail.com" type="hidden"> |
| 51 |
<input name="item_name" value="FancyBox" type="hidden"> |
| 52 |
<input name="amount" value="10.00" type="hidden"> |
| 53 |
<input name="no_shipping" value="0" type="hidden"> |
| 54 |
<input name="logo_custom" value="http://donate.png" type="hidden"> |
| 55 |
<input name="no_note" value="1" type="hidden"> |
| 56 |
<input name="currency_code" value="EUR" type="hidden"> |
| 57 |
<input name="tax" value="0" type="hidden"> |
| 58 |
<input name="lc" value="LV" type="hidden"> |
| 59 |
<input name="bn" value="PP-DonationsBF" type="hidden"> |
| 60 |
<input type="image" border="0" src="<?php echo WP_PLUGIN_URL ?>/fancybox-for-wordpress/img/extra_donate.png" name="submit" alt="PayPal - The safer, easier way to pay online!"/> |
| 61 |
</form> |
| 62 |
|
| 63 |
</div> |
| 64 |
|
| 65 |
<div style="clear:right;float:right;margin-left:10px;background:#FFFBCC;text-align:center;width:200px;" class="updated"> |
| 66 |
|
| 67 |
<p style="line-height:1.5em;">The author of this WordPress Plugin also likes beer :P</p> |
| 68 |
|
| 69 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> |
| 70 |
<input type="hidden" name="cmd" value="_s-xclick"/> |
| 71 |
<input type="hidden" name="hosted_button_id" value="3878319"/> |
| 72 |
<input type="image" border="0" src="<?php echo WP_PLUGIN_URL ?>/fancybox-for-wordpress/img/extra_donate.png" name="submit" alt="PayPal - The safer, easier way to pay online!"/> |
| 73 |
<img height="1" width="1" border="0" alt="" src="https://www.paypal.com/es_ES/i/scr/pixel.gif" /> |
| 74 |
</form> |
| 75 |
|
| 76 |
</div> |
| 77 |
|
| 78 |
<div style="clear:right;float:right;margin-left:10px;background:#9DD1F2;border-color:#419ED9;text-align:center;width:200px;" class="updated"> |
| 79 |
|
| 80 |
<p style="line-height:1.5em;"><a href="http://twitter.com/moskis/">Follow me on Twitter for more WordPress Plugins and Themes.</a></p> |
| 81 |
|
| 82 |
<img height="16" width="16" border="0" alt="" src="<?php echo WP_PLUGIN_URL ?>/fancybox-for-wordpress/img/extra_twitter.png" /> |
| 83 |
|
| 84 |
</div> |
| 85 |
|
| 86 |
<h3><?php _e('About', 'mfbfw'); ?></h3> |
| 87 |
|
| 88 |
<p><?php _e('This plugin integrates FancyBox with WordPress without having to edit any file or code. Once activated the plugin will apply FancyBox automatically to all image links, including WordPress galleries. Future versions will include some more options like easier inline content integration and more advanced customization. Enjoy!'); ?></p> |
| 89 |
|
| 90 |
<p><?php _e('If you have problems or questions about FancyBox itself you should <a href="http://groups.google.com/group/fancybox">ask in the FancyBox Google Group</a>. If you want to make suggestions or ask just about this WordPress plugin you can <a href="http://blog.moskis.net/downloads/plugins/fancybox-for-wordpress/">leave a comment here</a>, <a href="http://blog.moskis.net/contactar/">send me an email</a>, or <a href="http://twitter.com/moskis">contact me on twitter</a>.'); ?></p> |
| 91 |
|
| 92 |
<p><?php _e('<a href="http://fancy.klade.lv/home">FancyBox</a> developed by <a href="http://kac.klade.lv/">Janis Skarnelis</a>, ported to WordPress by <a href="http://moskis.net/">José Pardilla</a>. Licensed under the <a target="_blank" href="http://en.wikipedia.org/wiki/MIT_License">MIT License</a>.'); ?></p><br /> |
| 93 |
|
| 94 |
<h3><?php _e('Settings', 'mfbfw'); ?></h3> |
| 95 |
|
| 96 |
<form method="post" action="options.php" id="options"><?php echo wp_nonce_field('update-options'); ?> |
| 97 |
|
| 98 |
<table class="form-table" style="clear:none;"> |
| 99 |
<tbody> |
| 100 |
|
| 101 |
<tr valign="top"> |
| 102 |
<th scope="row"><?php _e('Auto Apply', 'mfbfw'); ?></th> |
| 103 |
<td> |
| 104 |
<fieldset> |
| 105 |
|
| 106 |
<label for="mfbfw_autoApply"> |
| 107 |
<input type="checkbox" name="mfbfw_autoApply" id="mfbfw_autoApply"<?php if (get_option('mfbfw_autoApply') == 'on') echo ' checked="yes"';?> /> |
| 108 |
<?php _e('Apply FancyBox automatically to all links pointing to .jpg, .jpeg, .png or .gif images (default: on)', 'mfbfw'); ?> |
| 109 |
</label><br /> |
| 110 |
<small><em><?php _e('(The link itself must the an image as well, text links will not be affected by this option!)', 'mfbfw'); ?></em></small><br /><br /> |
| 111 |
|
| 112 |
</fieldset> |
| 113 |
</td> |
| 114 |
</tr> |
| 115 |
|
| 116 |
<tr valign="top"> |
| 117 |
<th scope="row"><?php _e('Auto Resize to Fit', 'mfbfw'); ?></th> |
| 118 |
<td> |
| 119 |
<fieldset> |
| 120 |
|
| 121 |
<label for="mfbfw_imageScale"> |
| 122 |
<input type="checkbox" name="mfbfw_imageScale" id="mfbfw_imageScale"<?php if (get_option('mfbfw_imageScale') == 'on') echo ' checked="yes"';?> /> |
| 123 |
<?php _e('Scale images to fit in viewport (default: on)', 'mfbfw'); ?> |
| 124 |
</label><br /><br /> |
| 125 |
|
| 126 |
</fieldset> |
| 127 |
</td> |
| 128 |
</tr> |
| 129 |
|
| 130 |
<tr valign="top"> |
| 131 |
<th scope="row"><?php _e('Zoom Options', 'mfbfw'); ?></th> |
| 132 |
<td> |
| 133 |
<fieldset> |
| 134 |
|
| 135 |
<label for="mfbfw_zoomOpacity"> |
| 136 |
<input type="checkbox" name="mfbfw_zoomOpacity" id="mfbfw_zoomOpacity"<?php if (get_option('mfbfw_zoomOpacity') == 'on') echo ' checked="yes"';?> /> |
| 137 |
<?php _e('Change content transparency when animating (default: on)', 'mfbfw'); ?> |
| 138 |
</label><br /><br /> |
| 139 |
|
| 140 |
<label for="mfbfw_zoomSpeedIn"> |
| 141 |
<select name="mfbfw_zoomSpeedIn" id="mfbfw_zoomSpeedIn"> |
| 142 |
<?php |
| 143 |
foreach($msArray as $key=> $ms) { |
| 144 |
if($options['zoomSpeedIn'] != $ms) $selected = ''; |
| 145 |
else $selected = ' selected'; |
| 146 |
echo "<option value='$ms'$selected>$ms</option>\n"; |
| 147 |
} ?> |
| 148 |
</select> |
| 149 |
<?php _e('Speed in miliseconds of the zooming-in animation (default: 500)', 'mfbfw'); ?> |
| 150 |
</label><br /><br /> |
| 151 |
|
| 152 |
<label for="mfbfw_zoomSpeedOut"> |
| 153 |
<select name="mfbfw_zoomSpeedOut" id="mfbfw_zoomSpeedOut"> |
| 154 |
<?php |
| 155 |
foreach($msArray as $key=> $ms) { |
| 156 |
if($options['zoomSpeedOut'] != $ms) $selected = ''; |
| 157 |
else $selected = ' selected'; |
| 158 |
echo "<option value='$ms'$selected>$ms</option>\n"; |
| 159 |
} ?> |
| 160 |
</select> |
| 161 |
<?php _e('Speed in miliseconds of the zooming-out animation (default: 500)', 'mfbfw'); ?> |
| 162 |
</label><br /><br /> |
| 163 |
|
| 164 |
</fieldset> |
| 165 |
</td> |
| 166 |
</tr> |
| 167 |
|
| 168 |
<tr valign="top"> |
| 169 |
<th scope="row"><?php _e('Overlay Options', 'mfbfw'); ?></th> |
| 170 |
<td> |
| 171 |
<fieldset> |
| 172 |
|
| 173 |
<label for="mfbfw_overlayShow"> |
| 174 |
<input type="checkbox" name="mfbfw_overlayShow" id="mfbfw_overlayShow"<?php if (get_option('mfbfw_overlayShow') == 'on') echo ' checked="yes"';?> /> |
| 175 |
<?php _e('Add overlay (default: on)', 'mfbfw'); ?> |
| 176 |
</label><br /><br /> |
| 177 |
|
| 178 |
<label for="mfbfw_overlayColor"> |
| 179 |
<input type="text" name="mfbfw_overlayColor" id="mfbfw_overlayColor" value="<?php echo get_option('mfbfw_overlayColor'); ?>" size="7" maxlength="7" /> |
| 180 |
<?php _e('HTML color of the overlay (default: #666666)', 'mfbfw'); ?> |
| 181 |
</label><br /><br /> |
| 182 |
|
| 183 |
<label for="mfbfw_overlayOpacity"> |
| 184 |
<select name="mfbfw_overlayOpacity" id="mfbfw_overlayOpacity"> |
| 185 |
<?php |
| 186 |
foreach($overlayArray as $key=> $opacity) { |
| 187 |
if($options['overlayOpacity'] != $opacity) $selected = ''; |
| 188 |
else $selected = ' selected'; |
| 189 |
echo "<option value='$opacity'$selected>$opacity</option>\n"; |
| 190 |
} |
| 191 |
?> |
| 192 |
</select> |
| 193 |
<?php _e('Opacity of overlay. 0 is transparent, 1 is opaque (default: 0.3)', 'mfbfw'); ?> |
| 194 |
</label><br /><br /> |
| 195 |
|
| 196 |
</fieldset> |
| 197 |
</td> |
| 198 |
</tr> |
| 199 |
|
| 200 |
<tr valign="top"> |
| 201 |
<th scope="row"><?php _e('Close on Click', 'mfbfw'); ?></th> |
| 202 |
<td> |
| 203 |
<fieldset> |
| 204 |
|
| 205 |
<label for="mfbfw_hideOnContentClick"> |
| 206 |
<input type="checkbox" name="mfbfw_hideOnContentClick" id="mfbfw_hideOnContentClick"<?php if (get_option('mfbfw_hideOnContentClick') == 'on') echo ' checked="yes"';?> /> |
| 207 |
<?php _e('Close FancyBox by clicking on the image (default: off)', 'mfbfw'); ?> |
| 208 |
</label><br /> |
| 209 |
<small><em><?php _e('(This does NOT conflict with the previous and next image links on FancyBox galleries.)', 'mfbfw'); ?></em></small><br /><br /> |
| 210 |
|
| 211 |
</fieldset> |
| 212 |
</td> |
| 213 |
</tr> |
| 214 |
|
| 215 |
<tr valign="top"> |
| 216 |
<th scope="row"><?php _e('Center on Scroll', 'mfbfw'); ?></th> |
| 217 |
<td> |
| 218 |
<fieldset> |
| 219 |
|
| 220 |
<label for="mfbfw_centerOnScroll"> |
| 221 |
<input type="checkbox" name="mfbfw_centerOnScroll" id="mfbfw_centerOnScroll"<?php if (get_option('mfbfw_centerOnScroll') == 'on') echo ' checked="yes"';?> /> |
| 222 |
<?php _e('Keep image in the center of the browser window when scrolling (default: on)', 'mfbfw'); ?> |
| 223 |
</label><br /><br /> |
| 224 |
|
| 225 |
</fieldset> |
| 226 |
</td> |
| 227 |
</tr> |
| 228 |
|
| 229 |
</tbody> |
| 230 |
</table> |
| 231 |
|
| 232 |
|
| 233 |
<input type="hidden" name="action" value="update" /> |
| 234 |
<input type="hidden" name="page_options" value="mfbfw_autoApply,mfbfw_imageScale,mfbfw_zoomOpacity,mfbfw_zoomSpeedIn,mfbfw_zoomSpeedOut,mfbfw_overlayShow,mfbfw_overlayColor,mfbfw_overlayOpacity,mfbfw_hideOnContentClick,mfbfw_centerOnScroll" /> |
| 235 |
|
| 236 |
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options','mfbfw'); ?>" /></p> |
| 237 |
|
| 238 |
</form> |
| 239 |
|
| 240 |
</div> |
| 241 |
|
| 242 |
<?php } ?> |
| 243 |
|