|
|
|
Wordpress Plugin อยากทราบว่า เราสามารถกำหนดเป็นค่าตายตัวได้หรือไม่ครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$MyUpdateChecker->checkForUpdates();
add_action('admin_menu', 'exit_wow_menu');
$wp_exit_wow_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
wp_enqueue_script('jscolor', $wp_exit_wow_plugin_url.'/js/jscolor.js');
function exit_wow_menu() {
add_options_page('WpLapdance Options', 'wpLapdance', 'manage_options', 'exit-wow', 'exit_wow_options');
}
function exit_wow_options() {
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
?>
<Span style="font-size:20pt;font-weight:bold">WpLapdance Options Page</span> <a href="http://www.wplapdance.com/docs/wplapdancemanual.pdf" target="_blank">Documentation</a>
<br><br>
<script>
function showShow(val){
if (val=="exit_wow_type1"){
document.getElementById('wowregular').style.display = "block";
document.getElementById('wowfancy').style.display = "none";
document.getElementById('wowfancytext').style.display = "none";
document.getElementById('wowregulartext').style.display = "block";
}
if (val=="exit_wow_type2"){
document.getElementById('wowregular').style.display = "none";
document.getElementById('wowfancy').style.display = "block";
document.getElementById('wowfancytext').style.display = "block";
document.getElementById('wowregulartext').style.display = "none";
}
}
</script>
<?php $wp_exit_wow_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) ); ?>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<div style="position:relative;top:0px;left:5px;"><span style="font-size:18pt;font-weight:bold">Step 1</span> Choose Your type of popup and choose your redirect page.</div>
<div style="border:double 3px;width:850px">
<table class="form-table" id="wowmain">
<tr valign="top">
<th scope="row">WpLapdance Redirect</th>
<td><input type="text" name="exit_wow_redirect" value="<?php echo get_option('exit_wow_redirect'); ?>" /><br><br><br></td>
</tr>
<tr valign="top">
<table width="100%">
<tr>
<td align="center"><strong>Regular Popup</strong><img style="border:solid 3px" width="400" height="270" src="<?php echo $wp_exit_wow_plugin_url ?>/images/regular.png"></td>
<td align="center"><strong>Fancy Popup</strong><img style="border:solid 3px" width="400" height="270" src="<?php echo $wp_exit_wow_plugin_url ?>/images/fancy.png"></td>
<tr>
<td align="center"><input type="radio" name="exit_wow_type" onClick="showShow('exit_wow_type1')" value="regular" <?php if (get_option('exit_wow_type') == 'regular'){ echo "checked" ;} ?> /></td>
<td align="center"><input type="radio" name="exit_wow_type" onClick="showShow('exit_wow_type2')" value="fancy" <?php if (get_option('exit_wow_type') == 'fancy'){ echo "checked" ;} ?>/></td>
</table>
</tr>
</table>
<br><br>
</div>
<br><br><br>
<div style="position:relative;top:0px;left:5px;"><span style="font-size:18pt;font-weight:bold">Step 2</span> Configure Your Popup</div>
<div style="border:double 3px;width:550px">
<table class="form-table" id="wowregular" style="<?php if (get_option('exit_wow_type') != 'regular'){ echo "display:none" ;} ?>">
<tr valign="top">
<th scope="row">Message</th>
<td><input type="text" name="exit_wow_message" value="<?php echo get_option('exit_wow_message'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Exclude Pages or Domains</th>
<td><input type="text" name="exit_wow_exclude" value="<?php echo get_option('exit_wow_exclude'); ?>" />
<br>Separated by the | Symbol. If you put your domain name such as www.yourdomain.com, all internal pages will be ignored.
</td>
</tr>
<tr valign="top">
<th scope="row">Delay before the new page shows if they decide to stay on your page.</th>
<td><input type="text" name="exit_wow_delay" value="<?php echo get_option('exit_wow_delay'); ?>" />in Milliseconds. ie 5000 = 5 seconds</td>
</tr>
</table>
<table class="form-table" id="wowfancy" style="<?php if (get_option('exit_wow_type') != 'fancy'){ echo "display:none" ;} ?>">
<tr valign="top">
<th scope="row">Do you want the box to slide down from the top?</th>
<td><input type="radio" name="exit_wow_show" id="exit_wow_show1" value="top" <?php if (get_option('exit_wow_show') == 'top'){ echo "checked" ;} ?> /></td>
</tr>
<tr><td>or</td></tr>
<tr valign="top">
<th scope="row">Show in the middle of the screen?</th>
<td><input type="radio" name="exit_wow_show" id="exit_wow_show2" value="middle" <?php if (get_option('exit_wow_show') == 'middle'){ echo "checked" ;} ?>/></td>
</tr>
<tr valign="top">
<th scope="row">Use Lightbox effect?</th>
<td><input type="checkbox" name="exit_wow_lightbox" <?php if (get_option('exit_wow_lightbox') == 'on'){ echo "checked" ;} ?>/></td>
</tr>
<tr valign="top">
<th scope="row">Do You Want to Load a Your Redirect Page in the Background and Show it When the Popup Opens?</th>
<td><input type="checkbox" name="exit_wow_load_bg" <?php if (get_option('exit_wow_load_bg') == 'on'){ echo "checked" ;} ?>/></td>
</tr>
<tr valign="top">
<th scope="row">Do You Want to Open a new Window?</th>
<td>
<select name="exit_wow_redirect_open">
<option value="_blank" <?php if (get_option('exit_wow_redirect_open')=="_blank"){ echo "Selected"; }?> >yes</option>
<option value="_self" <?php if (get_option('exit_wow_redirect_open')=="_self"){ echo "Selected"; }?> >no</option>
</select>
</td>
<tr valign="top">
<th scope="row">What is the Text You Want to Show for your Redirect Link in The Popup?ie; <span style="color:#ff0000">Click Here for Something Very Special!</span> (leave empty for no link)</th>
<td><input type="text" name="exit_wow_redirect_text" value="<?php echo get_option('exit_wow_redirect_text'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Font Size of Your Redirect Link</th>
<td><input type="text" name="exit_wow_redirect_font_size" value="<?php echo get_option('exit_wow_redirect_font_size'); ?>" />ie; 18</td>
</tr>
<tr valign="top">
<th scope="row">Width</th>
<td><input type="text" name="exit_wow_width" value="<?php echo get_option('exit_wow_width'); ?>" />Pixels</td>
</tr>
<tr valign="top">
<th scope="row">Height</th>
<td><input type="text" name="exit_wow_height" value="<?php echo get_option('exit_wow_height'); ?>" />Pixels</td>
</tr>
<tr valign="top">
<th scope="row">Background Color</th>
<td><input type="text" name="exit_wow_bgcolor" id="exit_wow_bgcolor" class="color{adjust:false}" value="<?php echo get_option('exit_wow_bgcolor'); ?>" /><a id="bgtrans" onClick="document.getElementById('exit_wow_bgcolor').value='transparent'" >transparent</a></td>
</tr>
<tr valign="top">
<th scope="row">Border Style</th>
<td>
<select name="exit_wow_border_style">
<option value="none" <?php if (get_option('exit_wow_border_style')=="none"){ echo "Selected"; }?> >none</option>
<option value="solid" <?php if (get_option('exit_wow_border_style')=="solid"){ echo "Selected"; }?> >Solid</option>
<option value="double" <?php if (get_option('exit_wow_border_style')=="double"){ echo "Selected"; }?>>Double</option>
<option value="dashed" <?php if (get_option('exit_wow_border_style')=="dashed"){ echo "Selected"; }?>>Dashed</option>
</select>
</td>
<tr valign="top">
<th scope="row">Border Thickness</th>
<td><input type="text" name="exit_wow_border_thickness" value="<?php echo get_option('exit_wow_border_thickness'); ?>" />Pixels</td>
</tr>
<tr valign="top">
<th scope="row">border Color</th>
<td><input type="text" name="exit_wow_border_color" class="color" value="<?php echo get_option('exit_wow_border_color'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">Background Image URL</th>
<td><input type="text" name="exit_wow_background_image" value="<?php echo get_option('exit_wow_background_image'); ?>" /></td>
</tr>
<tr valign="top">
<?php if (get_option('exit_wow_content')){ $wow_content=get_option('exit_wow_content');} //else { $wow_content='<a href="#" id="wowclosebutton" style="position:absolute;bottom:25px;right:30px">Close Me</a>'; }?>
<td colspan="2"><?php //the_editor(stripslashes($wow_content),'exit_wow_content','content', true); ?>
<span style="font-size:12pt;font-weight:bold"> Add Your Own HTML Here:</span>
<textarea style="border:solid 3px;overflow:auto" rows='20' cols='57' name='exit_wow_content' tabindex='2' id='exit_wow_content'><?php echo stripslashes($wow_content) ?></textarea>
</td>
</tr>
</table>
</div>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="exit_wow_redirect,exit_wow_message,exit_wow_exclude,exit_wow_delay, exit_wow_type, exit_wow_html, exit_wow_content, exit_wow_width, exit_wow_height, exit_wow_bgcolor, exit_wow_border_style, exit_wow_border_thickness, exit_wow_border_color, exit_wow_lightbox, exit_wow_show, exit_wow_background_image, exit_wow_load_bg, exit_wow_redirect_text, exit_wow_redirect_font_size, exit_wow_redirect_open" />
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
<?php $wp_exit_wow_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) ); ?>
<?php
/*add_filter('admin_head','show_tinyMCE');
function show_tinyMCE() {
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_print_scripts('editor');
if (function_exists('add_thickbox')) add_thickbox();
wp_print_scripts('media-upload');
if (function_exists('wp_tiny_mce')) wp_tiny_mce();
wp_admin_css();
wp_enqueue_script('utils');
do_action("admin_print_styles-post-php");
do_action('admin_print_styles');
remove_all_filters('mce_external_plugins');
}
*/
?>
</form>
<div style="width:500px;height:280px;border:solid 0px;position:relative;top:-300px;left:500px;background-image:url(<?php echo $wp_exit_wow_plugin_url ?>/images/wpldinfobg.png);background-repeat:no-repeat;">
<div id="wowfancytext" style="width:300px;position:relative;left:125px;top:20px;color:#ffffff;font-size:12pt;<?php if (get_option('exit_wow_type') == 'fancy'){ echo "display:block" ;} else {echo 'display:none'; } ?>">
Use this section to put any html in your popup you like. <br>
You Do need to add a close link do so in the following format: <textarea style="width:300px;height:50px;"><a href='#' id="wowclosebutton" style="position:absolute;bottom:5px;right:5px">Close Me</a></textarea></br>
If you want to use video in popup box, assign an id="mywowvideo" to the object tag. This is necessary for Internet Explorer compatibility.</div>
<div id="wowregulartext" style="width:350px;position:relative;left:125px;top:20px;color:#ffffff;font-size:12pt;<?php if (get_option('exit_wow_type') == 'regular'){ echo "display:block;" ;} else {echo 'display:none'; } ?>">
This section is for a standard popup. A little grey box will popup when the user tries to leave. Use the message section to display the message of your choice. Exclude pages or domains will allow the popup to trigger when certain pages are visited. this is usefull for internal links. you can use http://www.yourdomain.com to exclude all internal links. The delay section will delay the showing of the new page for x amount of milliseconds.
</div>
<?php } ?>
บรรทัดที่ 52 ผมสามารถกำหนดเป็นค่าตายตัว โดยการไปอ้างอิงหรือดึงมาจาก Url link โดนอัติโนมัติ ได้หรือไม่ครับ ขอบคุณครับ
Tag : PHP, CakePHP
|
|
|
|
|
|
Date :
2012-01-07 20:18:39 |
By :
แบงค์ |
View :
1209 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
การ Modify Plugin ต้องลองแก้ไขดูครับ ลิงผิด ๆ ถูก ๆ ก้ไม่เสียหายครับ
|
|
|
|
|
Date :
2012-01-08 07:40:56 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|