| 1 |
<?php |
| 2 |
require_once (dirname(__FILE__) . '/adwidgets.php'); |
| 3 |
require_once (dirname(__FILE__) . '/inpostads.php'); |
| 4 |
// action function for above hook |
| 5 |
function smart_add_menu() { |
| 6 |
add_menu_page('Wp-Insert', 'Wp-Insert', 8, __FILE__); |
| 7 |
add_submenu_page(__FILE__, 'wp-insert', 'Manage Ads', 8, __FILE__, 'wp_insert_add_adspage'); |
| 8 |
add_submenu_page(__FILE__, 'wp-insert', 'Manage Feeds', 8, 'Manage Feeds', 'smart_add_feedspage'); |
| 9 |
add_submenu_page(__FILE__, 'wp-insert', 'Tracking Codes', 8, 'Tracking Codes', 'smart_add_analytics'); |
| 10 |
add_submenu_page(__FILE__, 'wp-insert', 'WYSIWYG Editor', 8, 'WYSIWYG Editor', 'smart_add_wysiwyg_pages'); |
| 11 |
add_submenu_page(__FILE__, 'wp-insert', 'Syntax Highlighting', 8, 'Syntax Highlighting', 'smart_add_syntaxhighlighting_pages'); |
| 12 |
//add_submenu_page(__FILE__, 'wp-insert', 'Tracking Codes', 8, 'Manage Feeds', 'wp_insert_add_trackingpage'); |
| 13 |
//ensure, that the needed javascripts been loaded to allow drag/drop, expand/collapse and hide/show of boxes |
| 14 |
wp_enqueue_script('common'); |
| 15 |
wp_enqueue_script('wp-lists'); |
| 16 |
wp_enqueue_script('postbox'); |
| 17 |
//$columns[$screen] = 2; |
| 18 |
} |
| 19 |
|
| 20 |
function wp_insert_add_adspage() { |
| 21 |
global $screen_layout_columns; |
| 22 |
|
| 23 |
add_meta_box('wp_insert_ad_widget_1', 'Ad Widget : 1', 'wp_insert_ad_widget_1_HTML', 'adWidgets'); |
| 24 |
add_meta_box('wp_insert_ad_widget_2', 'Ad Widget : 2', 'wp_insert_ad_widget_2_HTML', 'adWidgets'); |
| 25 |
add_meta_box('wp_insert_ad_widget_3', 'Ad Widget : 3', 'wp_insert_ad_widget_3_HTML', 'adWidgets'); |
| 26 |
add_meta_box('wp_insert_ad_widget_4', 'Ad Widget : 4', 'wp_insert_ad_widget_4_HTML', 'adWidgets'); |
| 27 |
add_meta_box('wp_insert_ad_widget_5', 'Ad Widget : 5', 'wp_insert_ad_widget_5_HTML', 'adWidgets'); |
| 28 |
add_meta_box('wp_insert_ad_widget_6', 'Ad Widget : 6', 'wp_insert_ad_widget_6_HTML', 'adWidgets'); |
| 29 |
add_meta_box('wp_insert_ad_widget_7', 'Ad Widget : 7', 'wp_insert_ad_widget_7_HTML', 'adWidgets'); |
| 30 |
add_meta_box('wp_insert_ad_widget_8', 'Ad Widget : 8', 'wp_insert_ad_widget_8_HTML', 'adWidgets'); |
| 31 |
add_meta_box('wp_insert_ad_widget_9', 'Ad Widget : 9', 'wp_insert_ad_widget_9_HTML', 'adWidgets'); |
| 32 |
add_meta_box('wp_insert_ad_widget_10', 'Ad Widget : 10', 'wp_insert_ad_widget_10_HTML', 'adWidgets'); |
| 33 |
|
| 34 |
add_meta_box('wp_insert_in_post_ad_top_1', 'Ad - Above Post Content', 'wp_insert_in_post_ad_top_1_HTML', 'inPostAds'); |
| 35 |
//add_meta_box('wp_insert_in_post_ad_top_2', 'Ad - Above Post Content : 2', 'wp_insert_in_post_ad_top_2_HTML', 'inPostAds'); |
| 36 |
add_meta_box('wp_insert_in_post_ad_bottom_1', 'Ad - Below Post Content', 'wp_insert_in_post_ad_bottom_1_HTML', 'inPostAds'); |
| 37 |
//add_meta_box('wp_insert_in_post_ad_bottom_2', 'Ad - Below Post Content : 2', 'wp_insert_in_post_ad_bottom_2_HTML', 'inPostAds'); |
| 38 |
add_meta_box('wp_insert_in_post_ad_left_1', 'Ad - Left of Post Content', 'wp_insert_in_post_ad_left_1_HTML', 'inPostAds'); |
| 39 |
//add_meta_box('wp_insert_in_post_ad_left_2', 'Ad - Left of Post Content : 2', 'wp_insert_in_post_ad_left_2_HTML', 'inPostAds'); |
| 40 |
add_meta_box('wp_insert_in_post_ad_right_1', 'Ad - Right of Post Content', 'wp_insert_in_post_ad_right_1_HTML', 'inPostAds'); |
| 41 |
//add_meta_box('wp_insert_in_post_ad_right_2', 'Ad - Right of Post Content : 2', 'wp_insert_in_post_ad_right_2_HTML', 'inPostAds'); |
| 42 |
add_meta_box('wp_insert_in_post_ad_middle_1', 'Ad - Middle of Post Content', 'wp_insert_in_post_ad_middle_1_HTML', 'inPostAds'); |
| 43 |
//add_meta_box('wp_insert_in_post_ad_middle_2', 'Ad - Middle of Post Content : 2', 'wp_insert_in_post_ad_middle_2_HTML', 'inPostAds'); |
| 44 |
?> |
| 45 |
<div id="post_ads_container" class="wrap"> |
| 46 |
<?php screen_icon('options-general'); ?> |
| 47 |
<h2>WP-INSERT : Manage Ads</h2> |
| 48 |
<div class="updated fade below-h2" id="message" style="opacity:0;display:none;"><p>Changes have been made to this page. Please click <b>Save Changes</b> to make them permanent</p></div> |
| 49 |
<?php show_support_options(); ?> |
| 50 |
<form method="post" action="options.php"> |
| 51 |
<?php |
| 52 |
wp_nonce_field('update-options'); |
| 53 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
| 54 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
| 55 |
?> |
| 56 |
<script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/common.js"></script> |
| 57 |
<div id="poststuff" class="metabox-holder has-right-sidebar"> |
| 58 |
<div id="side-info-column" class="inner-sidebar"> |
| 59 |
<?php do_meta_boxes('adWidgets','advanced',null); ?> |
| 60 |
</div> |
| 61 |
<div id="post-body" class="has-sidebar"> |
| 62 |
<div id="post-body-content" class="has-sidebar-content"> |
| 63 |
<?php do_meta_boxes('inPostAds','advanced',null); ?> |
| 64 |
<input type="hidden" name="action" value="update" /> |
| 65 |
<input type="hidden" name="page_options" value="<?php wp_insert_in_post_ad_parameters('middle_1'); wp_insert_in_post_ad_parameters('middle_2'); wp_insert_in_post_ad_parameters('right_1'); wp_insert_in_post_ad_parameters('right_2'); wp_insert_in_post_ad_parameters('left_1'); wp_insert_in_post_ad_parameters('left_2'); wp_insert_in_post_ad_parameters('bottom_1'); wp_insert_in_post_ad_parameters('bottom_2'); wp_insert_in_post_ad_parameters('top_1'); wp_insert_in_post_ad_parameters('top_2'); wp_insert_ad_widget_parameters(1); wp_insert_ad_widget_parameters(2); wp_insert_ad_widget_parameters(3); wp_insert_ad_widget_parameters(4); wp_insert_ad_widget_parameters(5); wp_insert_ad_widget_parameters(6); wp_insert_ad_widget_parameters(7); wp_insert_ad_widget_parameters(8); wp_insert_ad_widget_parameters(9); wp_insert_ad_widget_parameters(10); ?>" /> |
| 66 |
<p class="submit"> |
| 67 |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> |
| 68 |
</p> |
| 69 |
<p> |
| 70 |
<a href="http://www.smartlogix.co.in/"><img src="http://www.smartlogix.co.in/ads/random/rotate.php" border="0" /></a> |
| 71 |
</p> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
<br class="clear"/> |
| 75 |
</div> |
| 76 |
</form> |
| 77 |
</div> |
| 78 |
<script type="text/javascript"> |
| 79 |
//<![CDATA[ |
| 80 |
jQuery(document).ready( function($) { |
| 81 |
// close postboxes that should be closed |
| 82 |
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); |
| 83 |
jQuery('.postbox').addClass('closed'); |
| 84 |
// postboxes setup |
| 85 |
postboxes.add_postbox_toggles('wp-insert'); |
| 86 |
}); |
| 87 |
//]]> |
| 88 |
</script> |
| 89 |
</div> |
| 90 |
<?php |
| 91 |
} |
| 92 |
|
| 93 |
function wp_insert_in_post_ad_parameters($in_post_adID) { |
| 94 |
echo 'wp_insert_in_post_ad_'.$in_post_adID.'_enable,wp_insert_in_post_ad_'.$in_post_adID.'_content,wp_insert_in_post_ad_'.$in_post_adID.'_exclude_ids,wp_insert_in_post_ad_'.$in_post_adID.'_exclude_home,wp_insert_in_post_ad_'.$in_post_adID.'_exclude_archives,'; |
| 95 |
} |
| 96 |
|
| 97 |
function wp_insert_in_post_ad_HTML($in_post_adID) { ?> |
| 98 |
<div> |
| 99 |
<?php if(get_option('wp_insert_in_post_ad_'.$in_post_adID.'_enable')) { ?><input type="button" id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable_button', '#wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable')"/> |
| 100 |
<?php } else { ?><input type="button" id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable_button', '#wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable')"/><?php } ?> |
| 101 |
<input style="display:none;" id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_in_post_ad_'.$in_post_adID.'_enable')) echo ' checked="checked"'; ?> /> |
| 102 |
<p> |
| 103 |
<label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content">Ad Code:</label> |
| 104 |
<textarea id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" class="widefat" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_content'); ?></textarea> |
| 105 |
</p> |
| 106 |
<p> |
| 107 |
<label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids">Exclude On Posts/Pages:</label> |
| 108 |
<input id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids" class="widefat" type="text" value="<?php echo get_option('wp_insert_in_post_ad_'.$in_post_adID.'_exclude_ids'); ?>" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids"/> |
| 109 |
</p> |
| 110 |
<p> |
| 111 |
<label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home">Exclude On Home Page:</label> |
| 112 |
<input id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home" type="checkbox" value="1"<?php if(get_option('wp_insert_in_post_ad_'.$in_post_adID.'_exclude_home')) echo ' checked="checked"'; ?> /> |
| 113 |
</p> |
| 114 |
<p> |
| 115 |
<label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_archives">Exclude On Archives Pages:</label> |
| 116 |
<input id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_archives" name="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_archives" type="checkbox" value="1"<?php if(get_option('wp_insert_in_post_ad_'.$in_post_adID.'_exclude_archives')) echo ' checked="checked"'; ?> /> |
| 117 |
</p> |
| 118 |
</div> |
| 119 |
<?php } |
| 120 |
|
| 121 |
function wp_insert_in_post_ad_top_1_HTML() { wp_insert_in_post_ad_HTML("top_1"); } |
| 122 |
//function wp_insert_in_post_ad_top_2_HTML() { wp_insert_in_post_ad_HTML("top_2"); } |
| 123 |
function wp_insert_in_post_ad_bottom_1_HTML() { wp_insert_in_post_ad_HTML("bottom_1"); } |
| 124 |
//function wp_insert_in_post_ad_bottom_2_HTML() { wp_insert_in_post_ad_HTML("bottom_2"); } |
| 125 |
function wp_insert_in_post_ad_left_1_HTML() { wp_insert_in_post_ad_HTML("left_1"); } |
| 126 |
//function wp_insert_in_post_ad_left_2_HTML() { wp_insert_in_post_ad_HTML("left_2"); } |
| 127 |
function wp_insert_in_post_ad_right_1_HTML() { wp_insert_in_post_ad_HTML("right_1"); } |
| 128 |
//function wp_insert_in_post_ad_right_2_HTML() { wp_insert_in_post_ad_HTML("right_2"); } |
| 129 |
function wp_insert_in_post_ad_middle_1_HTML() { wp_insert_in_post_ad_HTML("middle_1"); } |
| 130 |
//function wp_insert_in_post_ad_middle_2_HTML() { wp_insert_in_post_ad_HTML("middle_2"); } |
| 131 |
|
| 132 |
function wp_insert_ad_widget_parameters($widgetID) { |
| 133 |
echo 'wp_insert_ad_widget_'.$widgetID.'_enable,wp_insert_ad_widget_'.$widgetID.'_title,wp_insert_ad_widget_'.$widgetID.'_content,wp_insert_ad_widget_'.$widgetID.'_exclude_ids,wp_insert_ad_widget_'.$widgetID.'_exclude_home,wp_insert_ad_widget_'.$widgetID.'_exclude_archives,'; |
| 134 |
} |
| 135 |
|
| 136 |
function ad_widget_HTML($widgetID) { ?> |
| 137 |
<div> |
| 138 |
<?php if(get_option('wp_insert_ad_widget_'.$widgetID.'_enable')) { ?><input type="button" id="wp_insert_ad_widget_<?php echo $widgetID; ?>_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_ad_widget_<?php echo $widgetID; ?>_enable_button', '#wp_insert_ad_widget_<?php echo $widgetID; ?>_enable')"/> |
| 139 |
<?php } else { ?><input type="button" id="wp_insert_ad_widget_<?php echo $widgetID; ?>_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_ad_widget_<?php echo $widgetID; ?>_enable_button', '#wp_insert_ad_widget_<?php echo $widgetID; ?>_enable')"/><?php } ?> |
| 140 |
<input style="display:none;" id="wp_insert_ad_widget_<?php echo $widgetID; ?>_enable" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_ad_widget_'.$widgetID.'_enable')) echo ' checked="checked"'; ?> /> |
| 141 |
<p> |
| 142 |
<label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_title">Title:</label> |
| 143 |
<input id="wp_insert_ad_widget_<?php echo $widgetID; ?>_title" class="widefat" type="text" value="<?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_title'); ?>" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_title"/> |
| 144 |
</p> |
| 145 |
<p> |
| 146 |
<label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_content">Ad Code:</label> |
| 147 |
<textarea id="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" class="widefat" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_content" cols="20" rows="16"><?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_content'); ?></textarea> |
| 148 |
</p> |
| 149 |
<p> |
| 150 |
<label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids">Exclude On Posts/Pages:</label> |
| 151 |
<input id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids" class="widefat" type="text" value="<?php echo get_option('wp_insert_ad_widget_'.$widgetID.'_exclude_ids'); ?>" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids"/> |
| 152 |
</p> |
| 153 |
<p> |
| 154 |
<label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home">Exclude On Home Page:</label> |
| 155 |
<input id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home" type="checkbox" value="1"<?php if(get_option('wp_insert_ad_widget_'.$widgetID.'_exclude_home')) echo ' checked="checked"'; ?> /> |
| 156 |
</p> |
| 157 |
<p> |
| 158 |
<label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_archives">Exclude On Archives Pages:</label> |
| 159 |
<input id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_archives" name="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_archives" type="checkbox" value="1"<?php if(get_option('wp_insert_ad_widget_'.$widgetID.'_exclude_archives')) echo ' checked="checked"'; ?> /> |
| 160 |
</p> |
| 161 |
</div> |
| 162 |
<?php } |
| 163 |
|
| 164 |
function wp_insert_ad_widget_1_HTML() { ad_widget_HTML(1); } |
| 165 |
function wp_insert_ad_widget_2_HTML() { ad_widget_HTML(2); } |
| 166 |
function wp_insert_ad_widget_3_HTML() { ad_widget_HTML(3); } |
| 167 |
function wp_insert_ad_widget_4_HTML() { ad_widget_HTML(4); } |
| 168 |
function wp_insert_ad_widget_5_HTML() { ad_widget_HTML(5); } |
| 169 |
function wp_insert_ad_widget_6_HTML() { ad_widget_HTML(6); } |
| 170 |
function wp_insert_ad_widget_7_HTML() { ad_widget_HTML(7); } |
| 171 |
function wp_insert_ad_widget_8_HTML() { ad_widget_HTML(8); } |
| 172 |
function wp_insert_ad_widget_9_HTML() { ad_widget_HTML(9); } |
| 173 |
function wp_insert_ad_widget_10_HTML() { ad_widget_HTML(10); } |
| 174 |
?> |