PluginProbe
Wp-Insert / 1.3.1
Wp-Insert v1.3.1
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / includes / ads.php

ads.php in Wp-Insert 1.3.1, at includes/ads.php

214 lines 16.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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/jquery/ui.core.js"></script>
57 <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/jquery/ui.draggable.js"></script>
58 <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/jquery/jquery.corner.js"></script>
59 <?php require_once (dirname(__FILE__) . '/postpicker.php'); ?>
60
61 <script type="text/javascript" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/js/common.js"></script>
62 <style type="text/css">
63 .GreyOutLayer
64 {
65 position: absolute;
66 top: 0px;
67 left: 0px;
68 width: 100%;
69 height: 100%;
70 bottom: 0px;
71 background-color: #666;
72 z-index: 100;
73 filter: progid:DXImageTransform.Microsoft.Alpha(opacity = 30);
74 opacity: 0.30;
75 }
76
77 #popUpMaster{position:relative;padding:10px 0 0 10px;display:none}
78 #popUpTopLft{position:absolute;left:0px;top:0}
79 #popUpTop{position:absolute;left:10px;top:0;height:36px;z-index:9}
80 #popUpTopRgt{position:absolute;right:0px;top:0;z-index:9}
81 #popUpLft{position:absolute;left:0px;top:30px;width:17px;}
82 #popUpRgt{position:absolute;right:0px;top:36px;width:26px;}
83 #popUpBtmLft{position:absolute;left:0px;bottom:0px;}
84 #popUpBtm{position:absolute;left:17px;bottom:0px;height:20px}
85 #popUpBtmRgt{position:absolute;right:0px;bottom:0px;}
86 #content{background:#F2F2F2;height:520px;width:725px;margin:0px;z-index:100;position:absolute;top:26px;right:15px;}
87 .closePopUp{display:block;position:absolute;right:10px;top:4px;width:20px;height:18px;z-index:10;text-decoration:none;background:none}
88 #popUpMaster h4{position:absolute;top:0;left:0;z-index:10;padding:0;margin:6px 0 0 10px;color:#333333;text-shadow:0 1px 0 #FFFFFF;
89 font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:15px;cursor:move;background:nonImage.gif;
90 width:100%}
91 </style>
92
93 <div id="poststuff" class="metabox-holder has-right-sidebar">
94 <div id="side-info-column" class="inner-sidebar">
95 <?php do_meta_boxes('adWidgets','advanced',null); ?>
96 </div>
97 <div id="post-body" class="has-sidebar">
98 <div id="post-body-content" class="has-sidebar-content">
99 <?php do_meta_boxes('inPostAds','advanced',null); ?>
100 <input type="hidden" name="action" value="update" />
101 <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); ?>" />
102 <p class="submit">
103 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
104 </p>
105 <p>
106 <a href="http://www.smartlogix.co.in/"><img src="http://www.smartlogix.co.in/ads/random/rotate.php" border="0" /></a>
107 </p>
108 </div>
109 </div>
110 <br class="clear"/>
111 </div>
112 </form>
113 </div>
114 <script type="text/javascript">
115 //<![CDATA[
116 jQuery(document).ready( function($) {
117 // close postboxes that should be closed
118 jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
119 jQuery('.postbox').addClass('closed');
120 // postboxes setup
121 postboxes.add_postbox_toggles('wp-insert');
122 });
123 //]]>
124 </script>
125 </div>
126 <?php
127 }
128
129 function wp_insert_in_post_ad_parameters($in_post_adID) {
130 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,';
131 }
132
133 function wp_insert_in_post_ad_HTML($in_post_adID) { ?>
134 <div>
135 <?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')"/>
136 <?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 } ?>
137 <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"'; ?> />
138 <p>
139 <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_content">Ad Code:</label>
140 <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>
141 </p>
142 <p>
143 <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids">Exclude On Posts/Pages:</label><div class="clear"></div>
144 <input style="float:left; width:60%; margin: 0 6px;" 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" id="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids" />
145 <img style="float:left; margin-top:4px; cursor: pointer;" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/images/search-16x16.png" width="16px" height="16px" onclick="ShowPostPicker('wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_ids')" />
146 <div class="clear"></div>
147 </p>
148 <p>
149 <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_home">Exclude On Home Page:</label>
150 <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"'; ?> />
151 </p>
152 <p>
153 <label for="wp_insert_in_post_ad_<?php echo $in_post_adID; ?>_exclude_archives">Exclude On Archives Pages:</label>
154 <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"'; ?> />
155 </p>
156 </div>
157 <?php }
158
159 function wp_insert_in_post_ad_top_1_HTML() { wp_insert_in_post_ad_HTML("top_1"); }
160 //function wp_insert_in_post_ad_top_2_HTML() { wp_insert_in_post_ad_HTML("top_2"); }
161 function wp_insert_in_post_ad_bottom_1_HTML() { wp_insert_in_post_ad_HTML("bottom_1"); }
162 //function wp_insert_in_post_ad_bottom_2_HTML() { wp_insert_in_post_ad_HTML("bottom_2"); }
163 function wp_insert_in_post_ad_left_1_HTML() { wp_insert_in_post_ad_HTML("left_1"); }
164 //function wp_insert_in_post_ad_left_2_HTML() { wp_insert_in_post_ad_HTML("left_2"); }
165 function wp_insert_in_post_ad_right_1_HTML() { wp_insert_in_post_ad_HTML("right_1"); }
166 //function wp_insert_in_post_ad_right_2_HTML() { wp_insert_in_post_ad_HTML("right_2"); }
167 function wp_insert_in_post_ad_middle_1_HTML() { wp_insert_in_post_ad_HTML("middle_1"); }
168 //function wp_insert_in_post_ad_middle_2_HTML() { wp_insert_in_post_ad_HTML("middle_2"); }
169
170 function wp_insert_ad_widget_parameters($widgetID) {
171 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,';
172 }
173
174 function ad_widget_HTML($widgetID) { ?>
175 <div>
176 <?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')"/>
177 <?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 } ?>
178 <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"'; ?> />
179 <p>
180 <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_title">Title:</label>
181 <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"/>
182 </p>
183 <p>
184 <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_content">Ad Code:</label>
185 <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>
186 </p>
187 <p>
188 <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids">Exclude On Posts/Pages:</label><div class="clear"></div>
189 <input style="float:left; width:60%; margin: 0 6px;" 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" id="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids" />
190 <img style="float:left; margin-top:4px; cursor: pointer;" src="<?php echo WP_PLUGIN_URL; ?>/wp-insert/images/search-16x16.png" width="16px" height="16px" onclick="ShowPostPicker('wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_ids')" />
191 <div class="clear"></div>
192 </p>
193 <p>
194 <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_home">Exclude On Home Page:</label>
195 <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"'; ?> />
196 </p>
197 <p>
198 <label for="wp_insert_ad_widget_<?php echo $widgetID; ?>_exclude_archives">Exclude On Archives Pages:</label>
199 <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"'; ?> />
200 </p>
201 </div>
202 <?php }
203
204 function wp_insert_ad_widget_1_HTML() { ad_widget_HTML(1); }
205 function wp_insert_ad_widget_2_HTML() { ad_widget_HTML(2); }
206 function wp_insert_ad_widget_3_HTML() { ad_widget_HTML(3); }
207 function wp_insert_ad_widget_4_HTML() { ad_widget_HTML(4); }
208 function wp_insert_ad_widget_5_HTML() { ad_widget_HTML(5); }
209 function wp_insert_ad_widget_6_HTML() { ad_widget_HTML(6); }
210 function wp_insert_ad_widget_7_HTML() { ad_widget_HTML(7); }
211 function wp_insert_ad_widget_8_HTML() { ad_widget_HTML(8); }
212 function wp_insert_ad_widget_9_HTML() { ad_widget_HTML(9); }
213 function wp_insert_ad_widget_10_HTML() { ad_widget_HTML(10); }
214 ?>