Insert Post Ads - Version 1.0

Version Description

  • First release

=

Download this release

Release Info

Developer n7studios
Plugin Icon 128x128 Insert Post Ads
Version 1.0
Comparing to
See all releases

Version 1.0

_modules/dashboard/css/admin.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #wpbeginner a { text-decoration: none; }
2
+ #wpbeginner a.rss { background: url(http://cdn.wpbeginner.com/pluginimages/feed.png) 0 50% no-repeat; padding: 0 15px 0 20px; }
3
+ #wpbeginner a.email { background: url(http://cdn.wpbeginner.com/pluginimages/email.gif) 0 50% no-repeat; padding: 0 15px 0 20px; }
4
+ #wpbeginner a.facebook { background: url(http://cdn.wpbeginner.com/pluginimages/facebook.png) 0 50% no-repeat; padding: 0 0 0 20px; }
_modules/dashboard/dashboard.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard Widget
4
+ */
5
+ class WPBeginnerDashboardWidget {
6
+ /**
7
+ * Constructor
8
+ *
9
+ * @param object $plugin Plugin Object (name, displayName, version, folder, url)
10
+ */
11
+ function __construct($plugin) {
12
+ // Plugin Details
13
+ $this->dashboard = $plugin;
14
+ $this->dashboardURL = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
15
+
16
+ // Hooks
17
+ add_action('admin_enqueue_scripts', array(&$this, 'adminScriptsAndCSS'));
18
+ add_action('wp_dashboard_setup', array(&$this, 'dashboardWidget'));
19
+ add_action('wp_network_dashboard_setup', array(&$this, 'dashboardWidget'));
20
+ }
21
+
22
+ /**
23
+ * Register and enqueue dashboard CSS
24
+ */
25
+ function adminScriptsAndCSS() {
26
+ // CSS
27
+ // This will only enqueue once, despite this hook being called by up to several plugins,
28
+ // as we have set a single, distinct name
29
+ wp_enqueue_style('wpbeginner', $this->dashboardURL.'css/admin.css');
30
+ }
31
+
32
+ /**
33
+ * Adds a dashboard widget to output WPBeginner RSS
34
+ *
35
+ * Checks if another WPBeginner plugin has already created this widget - if so, doesn't duplicate it
36
+ */
37
+ function dashboardWidget() {
38
+ global $wp_meta_boxes;
39
+
40
+ if (isset($wp_meta_boxes['dashboard']['normal']['core']['wpbeginner'])) return; // Another plugin has already registered this widget
41
+ wp_add_dashboard_widget('wpbeginner', __('Latest from WPBeginner', $this->dashboard->name), array(&$this, 'outputDashboardWidget'));
42
+ }
43
+
44
+ /**
45
+ * Called by dashboardWidget(), includes dashboard.php to output the Dashboard Widget
46
+ */
47
+ function outputDashboardWidget() {
48
+ $result = wp_remote_get('http://wpbeginner.com/feed/');
49
+ if (!is_wp_error($result)) {
50
+ if ($result['response']['code'] == 200) {
51
+ $xml = simplexml_load_string($result['body']);
52
+ $rssPosts = $xml->channel;
53
+ }
54
+
55
+ include_once(WP_PLUGIN_DIR.'/'.$this->dashboard->name.'/_modules/dashboard/views/dashboard.php');
56
+ } else {
57
+ include_once(WP_PLUGIN_DIR.'/'.$this->dashboard->name.'/_modules/dashboard/views/dashboard-nodata.php');
58
+ }
59
+ }
60
+ }
61
+ ?>
_modules/dashboard/views/dashboard-nodata.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard Widget (no RSS data available)
4
+ */
5
+ ?>
6
+ <div class="rss-widget">
7
+ <img src="<?php echo $this->dashboardURL; ?>images/logo.png" class="alignleft" style="margin: 0 10px 0 0;" />
8
+ <p><?php _e('Thanks for using our plugins - why not check out some of our other amazing Premium WordPress Plugins?'); ?></p>
9
+ <p><a href="http://www.wpcube.co.uk/?utm_source=wordpress&utm_medium=link&utm_content=dashboard&utm_campaign=general" target="_blank" class="button"><?php _e('Visit WP Cube'); ?></a></p>
10
+ </div>
_modules/dashboard/views/dashboard.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard RSS Feed Widget
4
+ */
5
+ ?>
6
+ <div class="rss-widget">
7
+ <img src="http://cdn.wpbeginner.com/pluginimages/wpbeginner.gif" class="alignright" />
8
+
9
+ <ul>
10
+ <?php
11
+ foreach ($rssPosts->item as $key=>$rssPost) {
12
+ ?>
13
+ <li>
14
+ <a href="<?php echo (string) $rssPost->link; ?>" target="_blank" class="rsswidget"><?php echo (string) $rssPost->title; ?></a>
15
+ <span class="rss-date"><?php echo date('F j, Y', strtotime($rssPost->pubDate)); ?></span>
16
+ </li>
17
+ <?php
18
+ }
19
+ ?>
20
+
21
+ <li>
22
+ <hr />
23
+ <a href="http://feeds2.feedburner.com/wpbeginner" class="rss" target="_blank"><?php _e('Subscribe with RSS', $this->dashboard->name); ?></a>
24
+ <a href="http://www.wpbeginner.com/wordpress-newsletter/" class="email" target="_blank"><?php _e('Subscribe by email', $this->dashboard->name); ?></a>
25
+ <a href="http://facebook.com/wpbeginner/" class="facebook" target="_blank"><?php _e('Join us on Facebook', $this->dashboard->name); ?></a>
26
+ </li>
27
+ </ul>
28
+ </div>
_modules/dashboard/views/sidebar-donate.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Donations Sidebar
4
+ */
5
+ ?>
6
+ <!-- Improve Your Site -->
7
+ <div class="postbox">
8
+ <h3 class="hndle">
9
+ <span><?php _e('Improve Your Site', $this->plugin->name); ?></span>
10
+ </h3>
11
+
12
+ <div class="inside">
13
+ <p>
14
+ <?php _e('Want to take your site to the next level? Look behind the scenes of WPBeginner to see what you can do!', $this->plugin->name); ?>
15
+ </p>
16
+
17
+ <a href="http://www.wpbeginner.com/blueprint/" class="button" target="_blank">
18
+ <?php _e('WPBeginner\'s Blueprint &raquo;', $this->plugin->name); ?>
19
+ </a>
20
+ </div>
21
+ </div>
22
+
23
+ <!-- Donate -->
24
+ <div class="postbox">
25
+ <h3 class="hndle">
26
+ <span><?php _e('Spread The Word', $this->plugin->name); ?></span>
27
+ </h3>
28
+
29
+ <div class="inside">
30
+ <p>
31
+ <?php _e('Want to help make this plugin even better? All donations are used to improve this plugin, so donate $10, $20 or $50 now!', $this->plugin->name); ?>
32
+ </p>
33
+ <p>
34
+ <a href="#" target="_blank">
35
+ <?php _e('Find out more.', $this->plugin->name); ?>
36
+ </a>
37
+ </p>
38
+ <p>
39
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=RK3BGVNS5L4ZW" target="_blank">
40
+ <img src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" alt="<?php _e('Donate to WPBeginner', $this->plugin->name); ?>">
41
+ </a>
42
+ </p>
43
+ </div>
44
+ </div>
css/admin.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ body.post-type-insertpostads #misc-publishing-actions,
2
+ body.post-type-insertpostads #minor-publishing-actions {
3
+ display: none;
4
+ }
insert-post-ads.php ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Insert Post Ads
4
+ * Plugin URI: http://www.wpbeginner.com/
5
+ * Version: 1.0
6
+ * Author: WPBeginner
7
+ * Author URI: http://www.wpbeginner.com/
8
+ * Description: Allows you to insert ads after paragraphs of your post content
9
+ * License: GPL2
10
+ */
11
+
12
+ /* Copyright 2014 WPBeginner
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ /**
29
+ * Insert Post Ads Class
30
+ *
31
+ * @package WPBeginner
32
+ * @subpackage Insert Post Ads
33
+ * @author Tim Carr
34
+ * @version 1.0
35
+ * @copyright WPBeginner
36
+ */
37
+ class InsertPostAds {
38
+ /**
39
+ * Constructor
40
+ */
41
+ public function __construct() {
42
+ // Plugin Details
43
+ $this->plugin = new stdClass;
44
+ $this->plugin->name = 'insert-post-ads'; // Plugin Folder
45
+ $this->plugin->displayName = 'Post Adverts'; // Plugin Name
46
+ $this->plugin->posttype = 'insertpostads';
47
+ $this->plugin->version = '1.0';
48
+ $this->plugin->folder = WP_PLUGIN_DIR.'/'.$this->plugin->name; // Full Path to Plugin Folder
49
+ $this->plugin->url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
50
+
51
+ // Dashboard Submodule
52
+ if (!class_exists('WPBeginnerDashboardWidget')) {
53
+ require_once($this->plugin->folder.'/_modules/dashboard/dashboard.php');
54
+ }
55
+ $this->dashboard = new WPBeginnerDashboardWidget($this->plugin);
56
+
57
+ // Hooks
58
+ add_action('init', array( &$this, 'registerPostTypes'));
59
+ add_action('admin_enqueue_scripts', array(&$this, 'adminScriptsAndCSS'));
60
+ add_action('admin_menu', array(&$this, 'adminPanelsAndMetaBoxes'));
61
+ add_action('plugins_loaded', array(&$this, 'loadLanguageFiles'));
62
+ add_action('save_post', array(&$this, 'save'));
63
+
64
+ // Filters
65
+ add_filter('enter_title_here', array(&$this, 'changeTitlePlaceholder')); // Change title placeholder
66
+ add_filter('post_updated_messages', array(&$this, 'changeUpdatedMessages')); // Appropriate messages for the post type
67
+ add_filter('the_content', array(&$this, 'checkAdvertsRequired'));
68
+ }
69
+
70
+ /**
71
+ * Register Custom Post Type
72
+ */
73
+ function registerPostTypes() {
74
+ register_post_type($this->plugin->posttype, array(
75
+ 'labels' => array(
76
+ 'name' => _x('Post Adverts', 'post type general name'),
77
+ 'singular_name' => _x('Post Advert', 'post type singular name'),
78
+ 'add_new' => _x('Add New', 'insertpostads'),
79
+ 'add_new_item' => __('Add New Post Advert'),
80
+ 'edit_item' => __('Edit Post Advert'),
81
+ 'new_item' => __('New Post Advert'),
82
+ 'view_item' => __('View Post Adverts'),
83
+ 'search_items' => __('Search Post Adverts'),
84
+ 'not_found' => __('No post adverts found'),
85
+ 'not_found_in_trash' => __('No post adverts found in Trash'),
86
+ 'parent_item_colon' => ''
87
+ ),
88
+ 'description' => 'Post Adverts',
89
+ 'public' => false,
90
+ 'publicly_queryable' => false,
91
+ 'exclude_from_search' => true,
92
+ 'show_ui' => true,
93
+ 'show_in_menu' => true,
94
+ 'menu_position' => 20,
95
+ 'menu_icon' => 'dashicons-migrate',
96
+ 'capability_type' => 'post',
97
+ 'hierarchical' => false,
98
+ 'has_archive' => false,
99
+ 'show_in_nav_menus' => false,
100
+ 'supports' => array('title'),
101
+ ));
102
+ }
103
+
104
+ /**
105
+ * Register and enqueue any JS and CSS for the WordPress Administration
106
+ */
107
+ function adminScriptsAndCSS() {
108
+ // JS
109
+ // wp_enqueue_script($this->plugin->name.'-admin', $this->plugin->url.'js/admin.js', array('jquery'), $this->plugin->version, true);
110
+
111
+ // CSS
112
+ wp_enqueue_style($this->plugin->name.'-admin', $this->plugin->url.'css/admin.css', array(), $this->plugin->version);
113
+ }
114
+
115
+ /**
116
+ * Register the plugin settings panel
117
+ */
118
+ function adminPanelsAndMetaBoxes() {
119
+ add_submenu_page('edit.php?post_type='.$this->plugin->posttype, __('Settings', $this->plugin->name), __('Settings', $this->plugin->name), 'manage_options', $this->plugin->name, array(&$this, 'adminPanel'));
120
+ add_meta_box('ipa_meta', __('Advert Code', $this->plugin->name), array( &$this, 'displayMetaBox'), $this->plugin->posttype, 'normal', 'high');
121
+ }
122
+
123
+ /**
124
+ * Output the Administration Panel
125
+ * Save POSTed data from the Administration Panel into a WordPress option
126
+ */
127
+ function adminPanel() {
128
+ // Save Settings
129
+ if (isset($_POST['submit'])) {
130
+ if (isset($_POST[$this->plugin->name])) {
131
+ delete_option($this->plugin->name);
132
+ update_option($this->plugin->name, $_POST[$this->plugin->name]);
133
+ $this->message = __('Post Advert Settings Saved.', $this->plugin->name);
134
+ }
135
+ }
136
+
137
+ // Get latest settings
138
+ $this->settings = get_option($this->plugin->name);
139
+
140
+ // Load Settings Form
141
+ include_once(WP_PLUGIN_DIR.'/'.$this->plugin->name.'/views/settings.php');
142
+ }
143
+
144
+ /**
145
+ * Loads plugin textdomain
146
+ */
147
+ function loadLanguageFiles() {
148
+ load_plugin_textdomain($this->plugin->name, false, $this->plugin->name.'/languages/');
149
+ }
150
+
151
+ /**
152
+ * Displays the meta box on the Custom Post Type
153
+ *
154
+ * @param object $post Post
155
+ */
156
+ function displayMetaBox($post) {
157
+ // Get meta
158
+ $adCode = get_post_meta($post->ID, '_ad_code', true);
159
+ $paragraphNumber = get_post_meta($post->ID, '_paragraph_number', true);
160
+ if (empty($paragraphNumber)) {
161
+ $paragraphNumber = 1;
162
+ }
163
+
164
+ // Nonce field
165
+ wp_nonce_field($this->plugin->name, $this->plugin->name.'_nonce');
166
+ ?>
167
+ <p>
168
+ <textarea name="ad_code" id="ad_code" style="width: 100%; height: 100px; font-family: Courier; font-size: 12px;"><?php echo $adCode; ?></textarea>
169
+ </p>
170
+ <p>
171
+ <label for="paragraph_number"><?php _e('Display the advert after which paragraph:', $this->plugin->name); ?></label>
172
+ <input type="number" name="paragraph_number" value="<?php echo $paragraphNumber; ?>" min="1" max="999" step="1" id="paragraph_number" />
173
+ </p>
174
+ <?php
175
+ }
176
+
177
+ /**
178
+ * Saves the meta box field data
179
+ *
180
+ * @param int $post_id Post ID
181
+ */
182
+ function save($post_id) {
183
+ // Check if our nonce is set.
184
+ if (!isset($_POST[$this->plugin->name.'_nonce'])) {
185
+ return $post_id;
186
+ }
187
+
188
+ // Verify that the nonce is valid.
189
+ if (!wp_verify_nonce($_POST[$this->plugin->name.'_nonce'], $this->plugin->name)) {
190
+ return $post_id;
191
+ }
192
+
193
+ // Check this is the Ad Custom Post Type
194
+ if ($_POST['post_type'] != $this->plugin->posttype) {
195
+ return $post_id;
196
+ }
197
+
198
+ // Check the logged in user has permission to edit this post
199
+ if (!current_user_can('edit_post', $post_id)) {
200
+ return $post_id;
201
+ }
202
+
203
+ // OK to save meta data
204
+ update_post_meta($post_id, '_ad_code', $_POST['ad_code']);
205
+ update_post_meta($post_id, '_paragraph_number', $_POST['paragraph_number']);
206
+ }
207
+
208
+ /**
209
+ * Changes the 'Enter title here' placeholder on the Ad Custom Post Type
210
+ *
211
+ * @param string $title Title
212
+ * @return string Title
213
+ */
214
+ function changeTitlePlaceholder($title) {
215
+ global $post;
216
+ if ($post->post_type == $this->plugin->posttype) {
217
+ $title = __('Advert Title', $this->plugin->name);
218
+ }
219
+
220
+ return $title;
221
+ }
222
+
223
+ /**
224
+ * Updates the saved, deleted, updated messages when saving an Ad Custom Post Type
225
+ *
226
+ * @param array $messages Messages
227
+ * @return array Messages
228
+ */
229
+ function changeUpdatedMessages($messages) {
230
+ $messages[$this->plugin->posttype] = array(
231
+ 1 => __('Advert updated.', $this->plugin->name),
232
+ 2 => __('Advert updated.', $this->plugin->name),
233
+ 3 => __('Advert deleted.', $this->plugin->name),
234
+ 4 => __('Advert updated.', $this->plugin->name),
235
+ 6 => __('Advert published.', $this->plugin->name),
236
+ );
237
+
238
+ return $messages;
239
+ }
240
+
241
+ /**
242
+ * Checks if the current screen on the frontend needs advert(s) adding to it
243
+ */
244
+ function checkAdvertsRequired($content) {
245
+ global $post;
246
+
247
+ // Settings
248
+ $this->settings = get_option($this->plugin->name);
249
+ if (!is_array($this->settings)) {
250
+ return;
251
+ }
252
+ if (count($this->settings) == 0) {
253
+ return;
254
+ }
255
+
256
+ // Check if we are on a singular post type that's enabled
257
+ foreach ($this->settings as $postType=>$enabled) {
258
+ if (is_singular($postType)) {
259
+ return $this->insertAds($content);
260
+ }
261
+ }
262
+
263
+ return $content;
264
+ }
265
+
266
+ /**
267
+ * Inserts advert(s) into content
268
+ *
269
+ * @param string $content Content
270
+ * @return string Content
271
+ */
272
+ function insertAds($content) {
273
+ $ads = new WP_Query(array(
274
+ 'post_type' => $this->plugin->posttype,
275
+ 'post_status' => 'publish',
276
+ 'posts_per_page' => -1,
277
+ ));
278
+ if ($ads->have_posts()) {
279
+ while ($ads->have_posts()) {
280
+ $ads->the_post();
281
+
282
+ $adID = get_the_ID();
283
+ $adCode = get_post_meta($adID, '_ad_code', true);
284
+ $paragraphNumber = get_post_meta($adID, '_paragraph_number', true);
285
+
286
+ $content = $this->insertAdAfterParagraph($adCode, $paragraphNumber , $content);
287
+ }
288
+ }
289
+
290
+ wp_reset_postdata();
291
+ return $content;
292
+ }
293
+
294
+ /**
295
+ * Insert something after a specific paragraph in some content.
296
+ *
297
+ * @param string $insertion Likely HTML markup, ad script code etc.
298
+ * @param int $paragraph_id After which paragraph should the insertion be added. Starts at 1.
299
+ * @param string $content Likely HTML markup.
300
+ *
301
+ * @return string Likely HTML markup.
302
+ */
303
+ function insertAdAfterParagraph( $insertion, $paragraph_id, $content ) {
304
+ $closing_p = '</p>';
305
+ $paragraphs = explode( $closing_p, $content );
306
+ foreach ($paragraphs as $index => $paragraph) {
307
+ // Only add closing tag to non-empty paragraphs
308
+ if ( trim( $paragraph ) ) {
309
+ // Adding closing markup now, rather than at implode, means insertion
310
+ // is outside of the paragraph markup, and not just inside of it.
311
+ $paragraphs[$index] .= $closing_p;
312
+ }
313
+
314
+ // + 1 allows for considering the first paragraph as #1, not #0.
315
+ if ( $paragraph_id == $index + 1 ) {
316
+ $paragraphs[$index] .= '<div style="clear:both;float:left;width:100%;margin:0 0 20px 0;">'. $insertion .'</div>';
317
+ }
318
+ }
319
+ return implode( '', $paragraphs );
320
+ }
321
+ }
322
+
323
+ $insertPostAds = new InsertPostAds();
324
+ ?>
languages/insert-post-ads.pot ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 Insert Post Ads
2
+ # This file is distributed under the same license as the Insert Post Ads package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Insert Post Ads 1.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/insert-post-ads\n"
7
+ "POT-Creation-Date: 2014-04-21 11:59:20+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: _modules/dashboard/dashboard.php:41 views/settings.php:56
16
+ msgid "Latest from WPBeginner"
17
+ msgstr ""
18
+
19
+ #: _modules/dashboard/views/dashboard-nodata.php:8
20
+ msgid ""
21
+ "Thanks for using our plugins - why not check out some of our other amazing "
22
+ "Premium WordPress Plugins?"
23
+ msgstr ""
24
+
25
+ #: _modules/dashboard/views/dashboard-nodata.php:9
26
+ msgid "Visit WP Cube"
27
+ msgstr ""
28
+
29
+ #: _modules/dashboard/views/dashboard.php:23
30
+ msgid "Subscribe with RSS"
31
+ msgstr ""
32
+
33
+ #: _modules/dashboard/views/dashboard.php:24
34
+ msgid "Subscribe by email"
35
+ msgstr ""
36
+
37
+ #: _modules/dashboard/views/dashboard.php:25
38
+ msgid "Join us on Facebook"
39
+ msgstr ""
40
+
41
+ #: _modules/dashboard/views/sidebar-donate.php:9
42
+ msgid "Improve Your Site"
43
+ msgstr ""
44
+
45
+ #: _modules/dashboard/views/sidebar-donate.php:14
46
+ msgid ""
47
+ "Want to take your site to the next level? Look behind the scenes of "
48
+ "WPBeginner to see what you can do!"
49
+ msgstr ""
50
+
51
+ #: _modules/dashboard/views/sidebar-donate.php:18
52
+ msgid "WPBeginner's Blueprint &raquo;"
53
+ msgstr ""
54
+
55
+ #: _modules/dashboard/views/sidebar-donate.php:26
56
+ msgid "Spread The Word"
57
+ msgstr ""
58
+
59
+ #: _modules/dashboard/views/sidebar-donate.php:31
60
+ msgid ""
61
+ "Want to help make this plugin even better? All donations are used to improve "
62
+ "this plugin, so donate $10, $20 or $50 now!"
63
+ msgstr ""
64
+
65
+ #: _modules/dashboard/views/sidebar-donate.php:35
66
+ msgid "Find out more."
67
+ msgstr ""
68
+
69
+ #: _modules/dashboard/views/sidebar-donate.php:40
70
+ msgid "Donate to WPBeginner"
71
+ msgstr ""
72
+
73
+ #: insert-post-ads.php:76
74
+ msgctxt "post type general name"
75
+ msgid "Post Adverts"
76
+ msgstr ""
77
+
78
+ #: insert-post-ads.php:77
79
+ msgctxt "post type singular name"
80
+ msgid "Post Advert"
81
+ msgstr ""
82
+
83
+ #: insert-post-ads.php:78
84
+ msgctxt "insertpostads"
85
+ msgid "Add New"
86
+ msgstr ""
87
+
88
+ #: insert-post-ads.php:79
89
+ msgid "Add New Post Advert"
90
+ msgstr ""
91
+
92
+ #: insert-post-ads.php:80
93
+ msgid "Edit Post Advert"
94
+ msgstr ""
95
+
96
+ #: insert-post-ads.php:81
97
+ msgid "New Post Advert"
98
+ msgstr ""
99
+
100
+ #: insert-post-ads.php:82
101
+ msgid "View Post Adverts"
102
+ msgstr ""
103
+
104
+ #: insert-post-ads.php:83
105
+ msgid "Search Post Adverts"
106
+ msgstr ""
107
+
108
+ #: insert-post-ads.php:84
109
+ msgid "No post adverts found"
110
+ msgstr ""
111
+
112
+ #: insert-post-ads.php:85
113
+ msgid "No post adverts found in Trash"
114
+ msgstr ""
115
+
116
+ #: insert-post-ads.php:119 views/settings.php:2
117
+ msgid "Settings"
118
+ msgstr ""
119
+
120
+ #: insert-post-ads.php:120
121
+ msgid "Advert Code"
122
+ msgstr ""
123
+
124
+ #: insert-post-ads.php:133
125
+ msgid "Post Advert Settings Saved."
126
+ msgstr ""
127
+
128
+ #: insert-post-ads.php:171
129
+ msgid "Display the advert after which paragraph:"
130
+ msgstr ""
131
+
132
+ #: insert-post-ads.php:217
133
+ msgid "Advert Title"
134
+ msgstr ""
135
+
136
+ #: insert-post-ads.php:231 insert-post-ads.php:232 insert-post-ads.php:234
137
+ msgid "Advert updated."
138
+ msgstr ""
139
+
140
+ #: insert-post-ads.php:233
141
+ msgid "Advert deleted."
142
+ msgstr ""
143
+
144
+ #: insert-post-ads.php:235
145
+ msgid "Advert published."
146
+ msgstr ""
147
+
148
+ #: views/settings.php:23
149
+ msgid "Where do you want ads to display?"
150
+ msgstr ""
151
+
152
+ #. Plugin Name of the plugin/theme
153
+ msgid "Insert Post Ads"
154
+ msgstr ""
155
+
156
+ #. #-#-#-#-# insert-post-ads.pot (Insert Post Ads 1.0) #-#-#-#-#
157
+ #. Plugin URI of the plugin/theme
158
+ #. #-#-#-#-# insert-post-ads.pot (Insert Post Ads 1.0) #-#-#-#-#
159
+ #. Author URI of the plugin/theme
160
+ msgid "http://www.wpbeginner.com/"
161
+ msgstr ""
162
+
163
+ #. Description of the plugin/theme
164
+ msgid "Allows you to insert ads after paragraphs of your post content"
165
+ msgstr ""
166
+
167
+ #. Author of the plugin/theme
168
+ msgid "WPBeginner"
169
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Insert Post Ads ===
2
+ Contributors: WPbeginner, smub, iamdpegg, n7studios
3
+ Donate link:http://www.wpbeginner.com/wpbeginner-needs-your-help/
4
+ Tags: ads, adsense, google adsense, insert ads in post, wordpress ads plugin, wp125, adrotate, advertising plugin, banners plugin, post ads, insert post ads
5
+ Requires at least: 3.6
6
+ Tested up to: 3.9
7
+ Stable tag: trunk
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Allows you to insert ads after paragraphs of your post content.
12
+
13
+ == Description ==
14
+
15
+ Content ads get the best click through rate. If you want to increase your CTR and Google AdSense revenue, then you need to start adding ads within your post content.
16
+
17
+ Insert Post ads allow you to automatically insert ads after paragraphs of your post content. This saves you the hassle of manually entering ads in each of your post. This plugin is based on our article about <a href="http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/" title="How to Insert Ads within your Post Content in WordPress" rel="friend">how to insert ads within your post content in WordPress</a>.
18
+
19
+ If you like this plugin and want to learn more about WordPress, then I suggest that you visit <a href="http://www.wpbeginner.com/" title="WPBeginner - Beginners Guide to WordPress" rel="friend">WPBeginner</a>. It is one of the largest free WordPress resource site with tons of <a href="http://www.wpbeginner.com/category/wp-tutorials/" title="Best WordPress tutorials" rel="friend">WordPress Tutorials</a>, and I'm proud to say that I created it. You can also subscribe to my <a href="http://youtube.com/wpbeginner">YouTube channel</a> where I share video tutorials.
20
+
21
+ I often get asked what are the <a href="http://www.wpbeginner.com/category/plugins/" title="best WordPress plugins" rel="friend">best WordPress plugins</a>? Which plugins should I use on my site? What are the must have plugins? I have created a blueprint of all the plugins and tools that I'm using. <a href="http://www.wpbeginner.com/blueprint/" title"Take a look at plugins I am using at WPBeginner" rel="friend">Take a look at plugins I'm using at WPBeginner</a>.
22
+
23
+ If you like this plugin, then please leave a good rating.
24
+
25
+ This plugin should work with most <a href="http://www.wpbeginner.com/wordpress-hosting/" title="Best WordPress Hosting" rel="friend">good WordPress hosting</a> providers however if you need support just ask the questions here (make sure you <a href="http://www.wpbeginner.com/beginners-guide/how-to-properly-ask-for-wordpress-support-and-get-it/" title="How to ask for WordPress support" rel="friend">ask your questions properly</a> if you want a response).
26
+
27
+ Lastly, if you like this plugin then follow WPBeginner on <a href="http://twitter.com/wpbeginner" title="Follow WPBeginner on Twitter">Twitter</a>, <a href="http://facebook.com/wpbeginner" title="Follow WPBeginner on Facebook">Facebook</a>, and <a href="https://plus.google.com/101634180904808003404/" title="Join WPBeginner on Google+">Google+</a>.
28
+
29
+ == Installation ==
30
+
31
+ 1. Upload the `insert-post-ads` folder to the `/wp-content/plugins/` directory
32
+ 2. Active the Insert Post Ads plugin through the 'Plugins' menu in WordPress
33
+ 3. Add your adverts by navigating to the `Post Adverts` in the WordPress Administration menu
34
+ 4. Choose where to insert your newly created Post Adverts by navigating to `Post Adverts > Settings` in the WordPress Administration menu
35
+
36
+ [youtube https://www.youtube.com/watch?v=AXM1QgMODW0]
37
+
38
+ == Screenshots ==
39
+
40
+ 1. Post Advert Screen
41
+ 2. Settings Screen
42
+
43
+ == Frequently Asked Questions ==
44
+
45
+
46
+
47
+ == Changelog ==
48
+
49
+ = 1.0 =
50
+ * First release
51
+
52
+ == Upgrade Notice ==
views/settings.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php echo $this->plugin->displayName; ?> &raquo; <?php _e('Settings', $this->plugin->name); ?></h2>
3
+
4
+ <?php
5
+ if (isset($this->message)) {
6
+ ?>
7
+ <div class="updated fade"><p><?php echo $this->message; ?></p></div>
8
+ <?php
9
+ }
10
+ if (isset($this->errorMessage)) {
11
+ ?>
12
+ <div class="error fade"><p><?php echo $this->errorMessage; ?></p></div>
13
+ <?php
14
+ }
15
+ ?>
16
+
17
+ <div id="poststuff">
18
+ <div id="post-body" class="metabox-holder columns-2">
19
+ <!-- Content -->
20
+ <div id="post-body-content">
21
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
22
+ <div class="postbox">
23
+ <h3 class="hndle"><?php _e('Where do you want ads to display?', $this->plugin->name); ?></h3>
24
+
25
+ <div class="inside">
26
+ <form action="edit.php?post_type=<?php echo $this->plugin->posttype; ?>&page=<?php echo $this->plugin->name; ?>" method="post">
27
+ <p>
28
+ <?php
29
+ $postTypes = get_post_types(array(
30
+ 'public' => true,
31
+ ), 'objects');
32
+ if ($postTypes) {
33
+ foreach ($postTypes as $postType) {
34
+ // Skip attachments
35
+ if ($postType->name == 'attachment') {
36
+ continue;
37
+ }
38
+ ?>
39
+ <label for="<?php echo $postType->name; ?>"><?php echo $postType->labels->name; ?></label>
40
+ <input type="checkbox" name="<?php echo $this->plugin->name; ?>[<?php echo $postType->name; ?>]" value="1" id="<?php echo $postType->name; ?>" <?php echo (isset($this->settings[$postType->name]) ? ' checked' : ''); ?>/>
41
+ <?php
42
+ }
43
+ }
44
+ ?>
45
+ </p>
46
+
47
+ <p>
48
+ <input name="submit" type="submit" name="Submit" class="button button-primary" value="Save settings" />
49
+ </p>
50
+ </form>
51
+ </div>
52
+ </div>
53
+ <!-- /postbox -->
54
+
55
+ <div id="wpbeginner" class="postbox">
56
+ <h3 class="hndle"><?php _e('Latest from WPBeginner', $this->plugin->name); ?></h3>
57
+
58
+ <div class="inside">
59
+ <?php
60
+ $this->dashboard->outputDashboardWidget();
61
+ ?>
62
+ </div>
63
+ </div>
64
+ <!-- /postbox -->
65
+ </div>
66
+ <!-- /normal-sortables -->
67
+ </div>
68
+ <!-- /post-body-content -->
69
+
70
+ <!-- Sidebar -->
71
+ <div id="postbox-container-1" class="postbox-container">
72
+ <?php require_once($this->plugin->folder.'/_modules/dashboard/views/sidebar-donate.php'); ?>
73
+ </div>
74
+ <!-- /postbox-container -->
75
+ </div>
76
+ </div>
77
+ </div>