Posts in Page - Version 1.3.0

Version Description

  • File reorganization / housekeeping
  • Admin UI cleanup
  • Security: Fixed directory traversal vulnerability.
  • Added ability to optionally include private posts - Thanks StarsoftAnalysis!
Download this release

Release Info

Developer sewmyheadon
Plugin Icon 128x128 Posts in Page
Version 1.3.0
Comparing to
See all releases

Code changes from version 1.2.4 to 1.3.0

admin/assets/css/post-page_styles.css ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ .postbox .ivy_social li {
4
+ list-style-type:none;
5
+ text-indent:-9999px;
6
+ display:inline;
7
+ }
8
+ .postbox .ivy_social li a {
9
+ display:block;
10
+ float:left;
11
+ width:16px;
12
+ height:16px;
13
+ margin:0 12px;
14
+ }
15
+ .postbox .ivy_social li.ic_fb a {
16
+ background: url("../images/facebook.png") no-repeat top left;
17
+ }
18
+ .postbox .ivy_social li.ic_tw a {
19
+ background: url("../images/twitter.png") no-repeat top left;
20
+ }
21
+ .postbox .ivy_social li.ic_li a {
22
+ background: url("../images/linkedin.png") no-repeat top left;
23
+ }
24
+ .postbox .ivy_social li.ic_mc a {
25
+ background: url("../images/email.png") no-repeat top left;
26
+ }
27
+ .postbox .ivy_social li.ic_rss a {
28
+ background: url("../images/feed.png") no-repeat top left;
29
+ }
30
+
31
+ /* Clearfix */
32
+ .clearfix:before, .clearfix:after {
33
+ content: ""; display: table;
34
+ }
35
+ .clearfix:after {
36
+ clear: both;
37
+ }
38
+ .clearfix {
39
+ *zoom: 1;
40
+ }
41
+
42
+ /* MailChimp Form Embed Code - Slim - 08/17/2011 */
43
+ #mc_embed_signup form {
44
+ display:block; position:relative; text-align:left; padding:10px 0 10px 0;width: 250px;
45
+ }
46
+ #mc_embed_signup h2 {
47
+ font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;
48
+ }
49
+ #mc_embed_signup input {
50
+ border:1px solid #999; -webkit-appearance:none;
51
+ }
52
+ #mc_embed_signup input[type=checkbox] {
53
+ -webkit-appearance:checkbox;
54
+ }
55
+ #mc_embed_signup input[type=radio] {
56
+ -webkit-appearance:radio;
57
+ }
58
+ #mc_embed_signup input:focus {
59
+ border-color:#333;
60
+ }
61
+ #mc_embed_signup .button {
62
+ clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;
63
+ }
64
+ #mc_embed_signup .button:hover {
65
+ background-color:#777;
66
+ }
67
+ #mc_embed_signup .small-meta {
68
+ font-size: 11px;
69
+ }
70
+ #mc_embed_signup .nowrap {
71
+ white-space:nowrap;
72
+ }
73
+ #mc_embed_signup label {
74
+ display:block; font-size:14px; padding-bottom:10px; font-weight:bold;color:#464646
75
+ }
76
+ #mc_embed_signup input.email {
77
+ display:block; padding:8px 0; margin:0 0 10px 0; text-indent:5px; width:58%; min-width:130px;float:left;
78
+ }
79
+ #mc_embed_signup input.button {
80
+ display:block; clear:none; background:#628C29; width:35%; margin:0 0 10px 0; min-width:90px;float:right;text-shadow:0 1px 0 #666;
81
+ }
82
+ #mc_embed_signup div#mce-responses {
83
+ float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
84
+ #mc_embed_signup div.response {
85
+ margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;
86
+ }
87
+ #mc_embed_signup #mce-error-response {
88
+ display:none;
89
+ }
90
+ #mc_embed_signup #mce-success-response {
91
+ color:#529214; display:none;
92
+ }
93
+ #mc_embed_signup label.error {
94
+ display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;
95
+ }
{assets → admin/assets/images}/email.png RENAMED
File without changes
{assets → admin/assets/images}/facebook.png RENAMED
File without changes
{assets → admin/assets/images}/feed.png RENAMED
File without changes
{assets → admin/assets/images}/ic-logo.jpg RENAMED
File without changes
{assets → admin/assets/images}/linkedin.png RENAMED
File without changes
{assets → admin/assets/images}/twitter.png RENAMED
File without changes
{assets → admin/assets/js}/post-page_scripts.js RENAMED
File without changes
admin/views/help-main.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Posts_in_Page
4
+ * @author Eric Amundson <eric@ivycat.com>
5
+ * @copyright Copyright (c) 2017, IvyCat, Inc.
6
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
7
+ *
8
+ */
9
+ ?>
10
+
11
+ <div class="wrap">
12
+
13
+ <div id="icon-options-general" class="icon32"></div>
14
+ <h1><?php esc_attr_e( 'Posts in Page', 'wp_admin_style' ); ?></h1>
15
+
16
+ <div id="poststuff">
17
+
18
+ <div id="post-body" class="metabox-holder columns-2">
19
+
20
+ <!-- main content -->
21
+ <div id="post-body-content">
22
+
23
+ <div class="meta-box-sortables ui-sortable">
24
+
25
+ <div class="postbox">
26
+
27
+ <div class="handlediv" title="Click to toggle"><br></div>
28
+ <!-- Toggle -->
29
+
30
+ <h2 class="hndle"><span><?php esc_attr_e( 'How to use Posts in Page', 'wp_admin_style' ); ?></span>
31
+ </h2>
32
+
33
+ <div class="inside">
34
+
35
+ <p>To 'pull' posts into a page, you can either:</p>
36
+
37
+ <ol>
38
+ <li><a href="#place-a-shortcode-wordpress-editor">Place a shortcode in the WordPress editor</a>, or </li>
39
+ <li><a href="#embed-php-function-wordpress-editor">Embed a PHP function in a theme template file</a></li>
40
+ </ol>
41
+
42
+ <h4 name="place-a-shortcode-wordpress-editor" id="place-a-shortcode-wordpress-editor">Place a Shortcode in the WordPress Editor</h4>
43
+
44
+ <table class="widefat">
45
+ <thead>
46
+ <tr>
47
+ <th>Task</th>
48
+ <th>Shortcode</th>
49
+ <th>Notes</th>
50
+ </tr>
51
+ </thead>
52
+ <tfoot>
53
+ <tr>
54
+ <th>Task</th>
55
+ <th>Shortcode</th>
56
+ <th>Notes</th>
57
+ </tr>
58
+ </tfoot>
59
+ <tbody>
60
+ <tr>
61
+ <td>Add all posts</td>
62
+ <td><code>[ic_add_posts]</code></td>
63
+ <td><?php _e( 'Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.', 'posts-in-page' ); ?></td>
64
+ </tr>
65
+ <tr>
66
+ <td>Show posts by ID</td>
67
+ <td><code>[ic_add_posts ids='1,2,3']</code></td>
68
+ <td><?php _e( 'show one or many posts by specifying the post ID(s) ( specify all post types )', 'posts-in-page' ); ?></td>
69
+ </tr>
70
+ <tr>
71
+ <td>Show posts by Post Type</td>
72
+ <td><code>[ic_add_posts post_type='post_type']</code></td>
73
+ <td><?php _e( 'show posts from a custom post type by specifying the post type slug ( must give post type if not a standard post ) add multiple post types by separating with commas (ex.', 'posts-in-page' ); ?> <code>post_type='post_type1,post_type2'</code>)</td>
74
+ </tr>
75
+ <tr>
76
+ <td>Show specific number of posts</td>
77
+ <td><code>[ic_add_posts showposts='5']</code></td>
78
+ <td><?php _e( 'limit number of posts (or override default setting)', 'posts-in-page' ); ?></td>
79
+ </tr>
80
+ <tr>
81
+ <td>Change post order </td>
82
+ <td><code>[ic_add_posts orderby='title' order='ASC']</code></td>
83
+ <td><?php _e( 'orderby title - supports all WP orderby variables. Order is optional, WP default', 'posts-in-page' ); ?></td>
84
+ </tr>
85
+ <tr>
86
+ <td>Specify categories</td>
87
+ <td><code>[ic_add_posts category='category-slug']</code></td>
88
+ <td><?php _e( 'Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)', 'posts-in-page' ); ?></td>
89
+ </tr>
90
+ <tr>
91
+ <td>Specify tags</td>
92
+ <td><code>[ic_add_posts tag='tag-slug']</code></td>
93
+ <td><?php _e( 'Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separate by commas. tag-1,tag-2, etc (no spaces.)', 'posts-in-page' ); ?></td>
94
+ </tr>
95
+ <tr>
96
+ <td>Specify custom taxonomy</td>
97
+ <td><code>[ic_add_posts tax='taxonomy' term='term']</code></td>
98
+ <td><?php _e( 'limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work', 'posts-in-page' ); ?></td>
99
+ </tr>
100
+ <tr>
101
+ <td>Change output template</td>
102
+ <td><code>[ic_add_posts template='template-in-theme-dir.php']</code></td>
103
+ <td><?php _e( 'In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.', 'posts-in-page' ); ?></td>
104
+ </tr>
105
+ <tr>
106
+ <td>Sticky posts</td>
107
+ <td><code>[ic_add_posts ignore_sticky_posts='no']</code></td>
108
+ <td><?php _e( "Show sticky posts too (they're ignored by default)", 'posts-in-page' ); ?></td>
109
+ </tr>
110
+ <tr>
111
+ <td>Post status</td>
112
+ <td><code>[ic_add_posts post_status='private']</code></td>
113
+ <td><?php _e( "Show posts with the specified status(es); the default is to only show posts with status 'publish'. To choose more than one status, separate them with commas. For example: <code>post_status='private,publish'</code>.", 'posts-in-page' ); ?></td>
114
+ </tr>
115
+ <tr>
116
+ <td>Pagination</td>
117
+ <td><code>[ic_add_posts paginate='yes']</code></td>
118
+ <td><?php _e( 'use pagination links (off by default)', 'posts-in-page' ); ?></td>
119
+ </tr>
120
+ <tr>
121
+ <td>Post offset</td>
122
+ <td><code>[ic_add_posts offset='3']</code></td>
123
+ <td><?php _e( 'Display posts from the 4th one', 'posts-in-page' ); ?></td>
124
+ </tr>
125
+ <tr>
126
+ <td>Dates</td>
127
+ <td><code>[ic_add_posts Date='today']</code></td>
128
+ <td><?php _e( "Show's post associated (published) on specified date period, today, 'today-1' show's posts published yesterday, 'today-2' shows posts published two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available 'month(-n)' and 'year(-n)'", 'posts-in-page' ); ?></td>
129
+ </tr>
130
+ <tr>
131
+ <td>Post IDs</td>
132
+ <td><code>[ic_add_posts exclude_ids='25,15']</code></td>
133
+ <td><?php _e( 'exclude by post ID one or more.', 'posts-in-page' ); ?></td>
134
+ </tr>
135
+ <tr>
136
+ <td>Custom error message</td>
137
+ <td><code>[ic_add_posts none_found='No Posts Found']</code></td>
138
+ <td><?php _e( 'Custom message to display if no posts are found', 'posts-in-page' ); ?></td>
139
+ </tbody>
140
+ </table>
141
+ <p><?php _e( 'Or any combination of the above.', 'posts-in-page' ); ?></p>
142
+
143
+ <h4 name="embed-php-function-wordpress-editor" id="embed-php-function-wordpress-editor"><?php _e( 'Embed a PHP function in a theme template file', 'posts-in-page' ); ?></h4>
144
+
145
+ <p><?php _e( 'If you\'d like to use this plugin to pull posts directly into your theme\'s template files, you can drop the following WordPress function in your template files, replacing the <code>[shortcode]</code> part with your, custom shortcode.', 'posts-in-page' ); ?></p>
146
+
147
+ <pre><code>&lt;?php echo do_shortcode("[shortcode]"); ?&gt;</code></pre>
148
+ </div>
149
+ <!-- .inside -->
150
+
151
+ </div>
152
+ <!-- .postbox -->
153
+
154
+ </div>
155
+ <!-- .meta-box-sortables .ui-sortable -->
156
+
157
+ </div>
158
+ <!-- post-body-content -->
159
+
160
+ <!-- sidebar -->
161
+ <div id="postbox-container-1" class="postbox-container">
162
+
163
+ <div class="meta-box-sortables">
164
+
165
+ <div class="postbox">
166
+
167
+ <div class="handlediv" title="Click to toggle"><br></div>
168
+ <!-- Toggle -->
169
+
170
+ <h2 class="hndle"><span><?php esc_attr_e(
171
+ 'Help & Support', 'wp_admin_style'
172
+ ); ?></span></h2>
173
+
174
+ <div class="inside">
175
+ <div class="meta-box-sortables" style="min-height: 0">
176
+ <div id="ivycat_donate">
177
+ <div class="inside_wrap">
178
+ <h4>Questions, bugs, or great ideas?</h4>
179
+ <ul>
180
+ <li><a href="https://wordpress.org/support/plugin/posts-in-page">Visit our plugin support page</a> or</li>
181
+ <li><a href="https://github.com/ivycat/Posts-in-Page">Contribute on Github</a></li>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ <!-- .inside -->
187
+
188
+ </div>
189
+ <!-- .postbox -->
190
+ <div class="postbox">
191
+
192
+ <div class="handlediv" title="Click to toggle"><br></div>
193
+ <!-- Toggle -->
194
+
195
+ <h2 class="hndle"><span><?php esc_attr_e(
196
+ 'Connect with IvyCat!', 'wp_admin_style'
197
+ ); ?></span></h2>
198
+
199
+ <div class="inside">
200
+ <div class="inside_wrap">
201
+ <!-- Begin MailChimp Signup Form -->
202
+ <div id="mc_embed_signup" class="clearfix">
203
+ <form action="//ivycat.us1.list-manage.com/subscribe/post?u=599f2f6b712f346e11c2930d4&amp;id=6ee02404ab" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
204
+ <label for="mce-EMAIL">Signup for email updates</label>
205
+ <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
206
+ <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
207
+ </form>
208
+ </div>
209
+ <!--End mc_embed_signup-->
210
+
211
+ <hr />
212
+
213
+ <ul class="ivy_social clearfix">
214
+ <li class="ic_fb"><a href="https://www.facebook.com/ivycatweb">Facebook</a></li>
215
+ <li class="ic_tw"><a href="https://twitter.com/ivycatweb">Twitter</a></li>
216
+ <li class="ic_li"><a href="https://www.linkedin.com/company/ivycat-web-services">LinkedIn</a></li>
217
+ <li class="ic_rss"><a href="https://ivycat.com/feed">RSS Feed</a></li>
218
+ <li class="ic_mc"><!-- // MAILCHIMP SUBSCRIBE CODE \\ --><a href="http://eepurl.com/b3_65" target="_blank">Sign up for our free newsletter!</a><!-- \\ MAILCHIMP SUBSCRIBE CODE // --></li>
219
+ </ul>
220
+
221
+ </div>
222
+ </div>
223
+ <!-- .inside -->
224
+
225
+ </div>
226
+ <!-- .postbox -->
227
+
228
+ <div class="postbox">
229
+
230
+ <div class="handlediv" title="Click to toggle"><br></div>
231
+ <!-- Toggle -->
232
+
233
+ <h2 class="hndle"><span><?php esc_attr_e(
234
+ 'Contribute', 'wp_admin_style'
235
+ ); ?></span></h2>
236
+
237
+ <div class="inside">
238
+ <div class="inside_wrap">
239
+ <h4>Help make this plugin better</h4>
240
+ <ul>
241
+ <li><a href="https://wordpress.org/plugins/posts-in-page/">Rate Posts in Page on WordPress.org</a></li>
242
+ <li><a href="https://twitter.com/home/?status=Check%20out%20the%20Posts%20in%20Page%20WordPress%20plugin%20from%20IvyCat!%20http%3A%2F%2Fbit.ly%2F1bmI8pS">Tweet about Posts in Page</a></li>
243
+ </ul>
244
+ </div>
245
+ </div>
246
+ <!-- .inside -->
247
+
248
+ </div>
249
+ <!-- .postbox -->
250
+ <div class="postbox">
251
+
252
+ <div class="handlediv" title="Click to toggle"><br></div>
253
+ <!-- Toggle -->
254
+
255
+ <h2 class="hndle"><span><?php esc_attr_e(
256
+ 'IvyCat Services', 'wp_admin_style'
257
+ ); ?></span></h2>
258
+
259
+ <div class="inside">
260
+ <div class="inside_wrap">
261
+ <h4><a href="https://ivycat.com/contact/">Contact us</a> if you need:</h4>
262
+ <ul class="link-list">
263
+ <li><a href="https://ivycat.com/wordpress/wordpress-support-maintenance/">WordPress Maintenance &amp; Support</a></li>
264
+ <li><a href="http://ivycat.com/web-design/">Web Design &amp; Development</a></li>
265
+ </ul>
266
+ </div>
267
+ </div>
268
+ <!-- .inside -->
269
+
270
+ </div>
271
+ <!-- .postbox -->
272
+ </div>
273
+ <!-- .meta-box-sortables -->
274
+
275
+ </div>
276
+ <!-- #postbox-container-1 .postbox-container -->
277
+
278
+ </div>
279
+ <!-- #post-body .metabox-holder .columns-2 -->
280
+
281
+ <br class="clear">
282
+ </div>
283
+ <!-- #poststuff -->
284
+
285
+ </div> <!-- .wrap -->
assets/desc.php DELETED
@@ -1,89 +0,0 @@
1
- <div id="side-sortables" class="meta-box-sortables ui-sortable">
2
-
3
- <div class="meta-box-sortables" style="min-height: 0">
4
- <div id="ivycat_donate" class="postbox">
5
- <h3 class="hndle"><span>Help &amp; Support</span></h3>
6
- <div class="inside">
7
- <div class="inside_wrap">
8
- <h4>Questions, bugs, or great ideas?</h4>
9
- <p><a href="http://wordpress.org/support/plugin/posts-in-page">Visit our plugin support page</a>.</p>
10
- </div>
11
- </div>
12
- </div>
13
- </div>
14
-
15
- <div class="meta-box-sortables" style="min-height: 0">
16
- <div id="ivycat_connect" class="postbox">
17
- <h3 class="hndle"><span>Connect with IvyCat!</span></h3>
18
- <div class="inside">
19
- <div class="inside_wrap">
20
- <!-- Begin MailChimp Signup Form -->
21
- <div id="mc_embed_signup" class="clearfix">
22
- <form action="http://ivycat.us1.list-manage.com/subscribe/post?u=599f2f6b712f346e11c2930d4&amp;id=6ee02404ab" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
23
- <label for="mce-EMAIL">Signup for email updates</label>
24
- <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
25
- <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
26
- </form>
27
- </div>
28
- <!--End mc_embed_signup-->
29
-
30
- <hr />
31
-
32
- <ul class="ivy_social clearfix">
33
- <li class="ic_fb"><a href="http://www.facebook.com/ivycatweb">Facebook</a></li>
34
- <li class="ic_tw"><a href="http://twitter.com/ivycatweb">Twitter</a></li>
35
- <li class="ic_li"><a href="http://www.linkedin.com/company/ivycat-web-services">LinkedIn</a></li>
36
- <li class="ic_rss"><a href="http://wwww.ivycat.com/feed">RSS Feed</a></li>
37
- <li class="ic_mc"><!-- // MAILCHIMP SUBSCRIBE CODE \\ --><a href="http://eepurl.com/b3_65" target="_blank">Sign up for our free newsletter!</a><!-- \\ MAILCHIMP SUBSCRIBE CODE // --></li>
38
- </ul>
39
-
40
- </div>
41
- </div>
42
- </div>
43
- </div>
44
-
45
- <div class="meta-box-sortables" style="min-height: 0">
46
- <div id="ivycat_donate" class="postbox">
47
- <h3 class="hndle"><span>Contribute!</span></h3>
48
- <div class="inside">
49
- <div class="inside_wrap">
50
- <h4>Wanna help make this plugin better?</h4>
51
- <p>All donations are used to improve our plugins, add features, and support the WordPress community.</p>
52
- <div>
53
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
54
- <input type="hidden" name="cmd" value="_s-xclick">
55
- <input type="hidden" name="hosted_button_id" value="U99TTXD43HJKL">
56
- <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
57
- <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
58
- </form>
59
- </div>
60
- <h4>Other ways you can help:</h4>
61
- <ul>
62
- <li><a href="http://wordpress.org/extend/plugins/page-specific-sidebars/">Rate this plugin on WordPress.org</a></li>
63
- <li><a href="http://twitter.com/home/?status=Check%20out%20the%20Page%20Specific%20Sidebar%20WordPress%20plugin%20from%20IvyCat!%20http%3A%2F%2Fbit.ly%2FOtLVlu">Tweet about this plugin</li>
64
- </ul>
65
- </div>
66
- </div>
67
- </div>
68
- </div>
69
-
70
- <div id="metabox_desc" class="postbox">
71
- <div class="handlediv" title="Click to toggle">
72
- <br>
73
- </div>
74
- <h3 class="hndle">
75
- <span>IvyCat Does WordPress!</span>
76
- </h3>
77
- <div class="inside">
78
- <div class="inside_wrap">
79
- <h4><a href="http://ivycat.com/contact">Contact us</a> if you need:</h4>
80
- <ul class="link-list">
81
- <li>WordPress Development</li>
82
- <li><a href="http://ivycat.com/hosting/web-hosting">WordPress Hosting</a></li>
83
- <li><a href="http://ivycat.com/web-design">Web Design</a></li>
84
- </ul>
85
- </div>
86
- </div>
87
- </div>
88
-
89
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/post-page_styles.css DELETED
@@ -1,234 +0,0 @@
1
- #posts-in-page-settings h2 span {
2
- display:block;
3
- width: 150px;
4
- float: right;
5
- }
6
-
7
- #side-sortables {
8
- min-height: 300px;
9
- padding: 0;
10
- width: 280px;
11
- color: #333333;
12
- }
13
- .postbox {
14
- background-color: #F5F5F5;
15
- background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
16
- border-color: #DFDFDF;
17
- border-radius: 3px 3px 3px 3px;
18
- box-shadow: 0 1px 0 #FFFFFF inset;
19
- min-width: 255px;
20
- position: relative;
21
- border-style: solid;
22
- border-width: 1px;
23
- line-height: 1;
24
- margin-bottom: 20px;
25
- padding: 0;
26
- }
27
- .postbox .handlediv {
28
- cursor: pointer;
29
- float: right;
30
- height: 30px;
31
- width: 27px;
32
- }
33
- .postbox h3 {
34
- font-size: 15px;
35
- font-weight: normal;
36
- line-height: 1;
37
- margin: 0;
38
- padding: 7px 10px;
39
- color: #464646;
40
- font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
41
- text-shadow: 0 1px 0 #FFFFFF;
42
- background-color: #F1F1F1;
43
- background-image: -moz-linear-gradient(center top , #F9F9F9, #ECECEC);
44
- border-bottom-color: #DFDFDF;
45
- box-shadow: 0 1px 0 #FFFFFF;
46
- }
47
- .postbox h4 {
48
- font-size: 14px;
49
- font-weight: bold;
50
- line-height: 1;
51
- margin: 0;
52
- padding: 7px 0;
53
- color: #464646;
54
- text-align: left;
55
- text-shadow: 0 1px 0 #FFFFFF;
56
- }
57
- .postbox .inside {
58
- margin: 6px 0 8px;
59
- position: relative;
60
- line-height: 1.4em;
61
- padding:0 ;
62
- }
63
-
64
- .postbox .inside_wrap{
65
- margin:0 15px;
66
- }
67
- .postbox .inside_wrap ul,
68
- .postbox .inside_wrap p {
69
- margin-top:0;
70
- font-size:13px;margin-bottom:0.7em;
71
- }
72
- .postbox .inside_wrap ul {
73
- list-style:disc;
74
- margin-left:15px;
75
-
76
- }
77
- .postbox ul{
78
- list-style-type: none;
79
- padding: 0;
80
- margin-top: 0;
81
- }
82
- .postbox ul li.img{
83
- text-align: center;
84
- background: #ffffff;
85
- padding: 10px 0 ;
86
- }
87
- .postbox a{
88
- color: #628C29;
89
- text-decoration: none;
90
- }
91
- .postbox a:hover{
92
- color: #8EC73C;
93
- }
94
-
95
- .postbox .ivy_social li {
96
- list-style-type:none;
97
- text-indent:-9999px;
98
- display:inline;
99
- }
100
- .postbox .ivy_social li a {
101
- display:block;
102
- float:left;
103
- width:16px;
104
- height:16px;
105
- margin:0 12px;
106
- }
107
- .postbox .ivy_social li.ic_fb a {
108
- background: url("facebook.png") no-repeat top left;
109
- }
110
- .postbox .ivy_social li.ic_tw a {
111
- background: url("twitter.png") no-repeat top left;
112
- }
113
- .postbox .ivy_social li.ic_li a {
114
- background: url("linkedin.png") no-repeat top left;
115
- }
116
- .postbox .ivy_social li.ic_mc a {
117
- background: url("email.png") no-repeat top left;
118
- }
119
- .postbox .ivy_social li.ic_rss a {
120
- background: url("feed.png") no-repeat top left;
121
- }
122
- #body-wrap {
123
- margin-top: 25px;
124
- }
125
- #body-wrap inside {
126
- padding: 10px;
127
- }
128
- #body-wrap .hndle h3 ul {
129
- margin-bottom: 0;
130
- }
131
- #body-wrap .hndle{
132
- margin-bottom: 10px;
133
- }
134
- #body-wrap .hndle a{
135
- font-size: 18px;
136
- }
137
- #body-wrap .hndle li.current-menu-tab a{
138
- font-size: 21px;
139
- font-weight: bold;
140
- }
141
- #posts-in-page-settings #body-wrap{
142
- width: 55%;
143
- float:left;
144
- }
145
- #posts-in-page-settings #sidebar-wrap{
146
- width: 35%;
147
- float:left;
148
- margin: 25px 0 0 20px;
149
- }
150
- #posts-in-page-settings .top-menu{
151
- width: 100%;
152
- }
153
-
154
- #posts-in-page-settings .top-menu li{
155
- margin-bottom: 0px;
156
- text-align: center;
157
- }
158
- #posts-in-page-settings .settings{
159
- padding: 10px;
160
- }
161
- #posts-in-page-settings .help{
162
- margin-top: 20px;
163
- padding: 10px;
164
- }
165
- .clearfix:before, .clearfix:after {
166
- content: ""; display: table;
167
- }
168
- .clearfix:after {
169
- clear: both;
170
- }
171
- .clearfix {
172
- *zoom: 1;
173
- }
174
- #ivycat_donate form input[type="image"] {
175
- margin:0 auto;
176
- display:block;
177
- }
178
-
179
- /* MailChimp Form Embed Code - Slim - 08/17/2011 */
180
- #mc_embed_signup form {
181
- display:block; position:relative; text-align:left; padding:10px 0 10px 0;width: 250px;
182
- }
183
- #mc_embed_signup h2 {
184
- font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;
185
- }
186
- #mc_embed_signup input {
187
- border:1px solid #999; -webkit-appearance:none;
188
- }
189
- #mc_embed_signup input[type=checkbox] {
190
- -webkit-appearance:checkbox;
191
- }
192
- #mc_embed_signup input[type=radio] {
193
- -webkit-appearance:radio;
194
- }
195
- #mc_embed_signup input:focus {
196
- border-color:#333;
197
- }
198
- #mc_embed_signup .button {
199
- clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFFFFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;
200
- }
201
- #mc_embed_signup .button:hover {
202
- background-color:#777;
203
- }
204
- #mc_embed_signup .small-meta {
205
- font-size: 11px;
206
- }
207
- #mc_embed_signup .nowrap {
208
- white-space:nowrap;
209
- }
210
- #mc_embed_signup label {
211
- display:block; font-size:14px; padding-bottom:10px; font-weight:bold;color:#464646
212
- }
213
- #mc_embed_signup input.email {
214
- display:block; padding:8px 0; margin:0 0 10px 0; text-indent:5px; width:58%; min-width:130px;float:left;
215
- }
216
- #mc_embed_signup input.button {
217
- display:block; clear:none; background:#628C29; width:35%; margin:0 0 10px 0; min-width:90px;float:right;text-shadow:0 1px 0 #666;
218
- }
219
- #mc_embed_signup div#mce-responses {
220
- float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
221
- #mc_embed_signup div.response {
222
- margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;
223
- }
224
- #mc_embed_signup #mce-error-response {
225
- display:none;
226
- }
227
- #mc_embed_signup #mce-success-response {
228
- color:#529214; display:none;
229
- }
230
- #mc_embed_signup label.error {
231
- display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;
232
- }
233
-
234
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/posts_in_page_help_view.php DELETED
@@ -1,49 +0,0 @@
1
- <div class="wrap" id="posts-in-page-settings">
2
- <div id="icon-options-general" class="icon32"></div>
3
- <h2>Posts in Page</h2>
4
- <div id="body-wrap" class="meta-box-sortables ui-sortable">
5
- <div id="metabox_desc" class="postbox">
6
- <div class="handlediv" title="Click to toggle">
7
- <br>
8
- </div>
9
- <div class="hndle">
10
- <h3><ul class="top-menu clearfix">
11
- <li class="menu-item"><a href="#help">Shortcode Usage</a></li>
12
- </ul></h3>
13
- </div>
14
- <div class="group help inside">
15
- <p>To 'pull' posts into a page, you can either:</p>
16
-
17
- <ol>
18
- <li>place a shortcode in the editor window of the page you're editing, or </li>
19
- <li>modify a theme template file using the shortcode in a PHP function.</li>
20
- </ol>
21
-
22
- <h4>Using Shortcodes in the WordPress editor</h4>
23
-
24
- <ul>
25
- <li><code>[ic_add_posts]</code> - Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.</li>
26
- <li><code>[ic_add_posts ids='1,2,3']</code> - show one or many posts by specifying the post ID(s) ( specify all post types )</li>
27
- <li><code>[ic_add_posts post_type='post_type']</code> - show posts from a custom post type by specifying the post type slug ( must give post type if not a standard post ) add multiple post types by separating with commas (ex. <code>post_type='post_type1,post_type2'</code>)</li>
28
- <li><code>[ic_add_posts showposts='5']</code> - limit number of posts (or override default setting)</li>
29
- <li><code>[ic_add_posts orderby='title' order='ASC']</code> - orderby title - supports all WP orderby variables. Order is optional, WP default </li>
30
- <li><code>[ic_add_posts category='category-slug']</code> - Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)</li>
31
- <li><code>[ic_add_posts tag='tag-slug']</code> - Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separate by commas. tag-1,tag-2, etc (no spaces.)</li>
32
- <li><code>[ic_add_posts tax='taxonomy' term='term']</code> - limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work</li>
33
- <li><code>[ic_add_posts template='template-in-theme-dir.php']</code> - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.</li>
34
- </ul>
35
-
36
- <p>Or any combination of the above.</p>
37
-
38
- <h4>Using Shortcodes within a PHP function</h4>
39
-
40
- <p>If you'd like to use this plugin to pull posts directly into your theme's template files, you can drop the following WordPress function in your template files, replacing the <code>[shortcode]</code> part with your, custom shortcode.</p>
41
-
42
- <pre><code>&lt;?php echo do_shortcode("[shortcode]"); ?&gt;</code></pre>
43
- </div>
44
- </div>
45
- </div>
46
- <div id="sidebar-wrap">
47
- <?php require_once 'desc.php'; ?>
48
- </div>
49
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/postspagehelp.css DELETED
File without changes
includes/class-page-posts.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Page Posts Class, main workhorse for the ic_add_posts shortcode.
4
+ */
5
+
6
+ if ( ! function_exists( 'add_action' ) ) {
7
+ wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
8
+ }
9
+
10
+ class ICPagePosts {
11
+
12
+ protected $args = array();
13
+
14
+ public function __construct( $atts ) {
15
+ $this->set_default_args(); //set default args
16
+ $this->set_args( $atts );
17
+ }
18
+
19
+ protected function set_default_args() {
20
+ $this->args = array(
21
+ 'post_type' => 'post',
22
+ 'post_status' => 'publish',
23
+ 'orderby' => 'date',
24
+ 'order' => 'DESC',
25
+ 'paginate' => false,
26
+ 'template' => false,
27
+ 'label_next' => __( 'Next', 'posts-in-page' ),
28
+ 'label_previous' => __( 'Previous', 'posts-in-page' ),
29
+ 'none_found' => '',
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Output's the posts
35
+ *
36
+ * @return string output of template file
37
+ */
38
+ public function output_posts() {
39
+ if ( ! $this->args ) {
40
+ return '';
41
+ }
42
+ $page_posts = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
43
+ $output = '';
44
+ if ( $page_posts->have_posts() ) {
45
+ while ( $page_posts->have_posts() ):
46
+ $output .= self::add_template_part( $page_posts );
47
+ endwhile;
48
+ $output .= ( $this->args['paginate'] ) ? '<div class="pip-nav">' . apply_filters( 'posts_in_page_paginate', $this->paginate_links( $page_posts ) ) . '</div>' : '';
49
+ } else {
50
+ $output = '<div class="post hentry ivycat-post"><span class="pip-not-found">' . esc_html( $this->args['none_found'] ) . '</span></div>';
51
+ }
52
+ wp_reset_postdata();
53
+
54
+ remove_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ) );
55
+
56
+ return $output;
57
+ }
58
+
59
+ protected function paginate_links( $posts ) {
60
+ global $wp_query;
61
+ $page_url = home_url( '/' . $wp_query->post->post_name . '/' );
62
+ $page = isset( $_GET['page'] ) ? $_GET['page'] : 1;
63
+ $total_pages = $posts->max_num_pages;
64
+ $per_page = $posts->query_vars['posts_per_page'];
65
+ $curr_page = ( isset( $posts->query_vars['paged'] ) && $posts->query_vars['paged'] > 0 ) ? $posts->query_vars['paged'] : 1;
66
+ $prev = ( $curr_page && $curr_page > 1 ) ? '<li><a href="' . $page_url . '?page=' . ( $curr_page - 1 ) . '">' . $this->args['label_previous'] . '</a></li>' : '';
67
+ $next = ( $curr_page && $curr_page < $total_pages ) ? '<li><a href="' . $page_url . '?page=' . ( $curr_page + 1 ) . '">' . $this->args['label_next'] . '</a></li>' : '';
68
+ return '<ul>' . $prev . $next . '</ul>';
69
+ }
70
+
71
+
72
+ /**
73
+ * Build additional Arguments for the WP_Query object
74
+ *
75
+ * @param array $atts Attritubes for building the $args array.
76
+ */
77
+ protected function set_args( $atts ) {
78
+ global $wp_query;
79
+ $this->args['posts_per_page'] = get_option( 'posts_per_page' );
80
+ // parse the arguments using the defaults
81
+ $this->args = wp_parse_args( $atts, $this->args );
82
+ // multiple post types are indicated, pass as an array
83
+ if ( strpos( ',', $this->args['post_type'] ) ) {
84
+ $post_types = explode( ',', $this->args['post_type'] );
85
+ $this->args['post_type'] = $post_types;
86
+ }
87
+
88
+ // Show specific posts by ID
89
+ if ( isset( $atts['ids'] ) ) {
90
+ $post_ids = explode( ',', $atts['ids'] );
91
+ $this->args['post__in'] = $post_ids;
92
+ $this->args['posts_per_page'] = count( $post_ids );
93
+ }
94
+
95
+ // Use a specified template
96
+ if ( isset( $atts['template'] ) ) {
97
+ $this->args['template'] = $atts['template'];
98
+ }
99
+
100
+ // get posts in a certain category by name (slug)
101
+ if ( isset( $atts['category'] ) ) {
102
+ $this->args['category_name'] = $atts['category'];
103
+ } elseif ( isset( $atts['cats'] ) ) {
104
+ // get posts in a certain category by id
105
+ $this->args['cat'] = $atts['cats'];
106
+ }
107
+
108
+ // Do a tax query, tax and term a required.
109
+ if ( isset( $atts['tax'] ) ) {
110
+ if ( isset( $atts['term'] ) ) {
111
+ $terms = explode( ',', $atts['term'] );
112
+ $this->args['tax_query'] = array(
113
+ array( 'taxonomy' => $atts['tax'], 'field' => 'slug', 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'] )
114
+ );
115
+ }
116
+ }
117
+
118
+ // get posts with a certain tag
119
+ if ( isset( $atts['tag'] ) ) {
120
+ $this->args['tag'] = $atts['tag'];
121
+ }
122
+
123
+ // override default post_type argument ('publish')
124
+ if ( isset( $atts['post_status'] ) ) {
125
+ $this->args['post_status'] = $atts['post_status'];
126
+ }
127
+
128
+ // exclude posts with certain category by name (slug)
129
+ if ( isset( $atts['exclude_category'] ) ) {
130
+ $category = $atts['exclude_category'];
131
+ if ( strpos( ',', $category ) ) {
132
+ // multiple
133
+ $category = explode( ',', $category );
134
+
135
+ foreach ( $category AS $cat ) {
136
+ $term = get_category_by_slug( $cat );
137
+ $exclude[] = '-' . $term->term_id;
138
+ }
139
+ $category = implode( ',', $exclude );
140
+
141
+ } else {
142
+ // single
143
+ $term = get_category_by_slug( $category );
144
+ $category = '-' . $term->term_id;
145
+ }
146
+
147
+ if ( ! is_null( $this->args['cat'] ) ) {
148
+ // merge lists
149
+ $this->args['cat'] .= ',' . $category;
150
+ }
151
+ $this->args['cat'] = $category;
152
+ // unset our unneeded variables
153
+ unset( $category, $term, $exclude );
154
+ }
155
+
156
+ // show number of posts (default is 10, showposts or posts_per_page are both valid, only one is needed)
157
+ if ( isset( $atts['showposts'] ) ) {
158
+ $this->args['posts_per_page'] = $atts['showposts'];
159
+ }
160
+
161
+ // handle pagination (for code, template pagination is in the template)
162
+ if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
163
+ $this->args['paged'] = $wp_query->query_vars['page'];
164
+ }
165
+
166
+ if ( ! ( isset( $this->args['ignore_sticky_posts'] ) &&
167
+ ( strtolower( $this->args['ignore_sticky_posts'] ) === 'no' ||
168
+ strtolower( $this->args['ignore_sticky_posts'] ) === 'false' ) ) ) {
169
+
170
+ $this->args['post__not_in'] = get_option( 'sticky_posts' );
171
+ }
172
+
173
+ $this->args['ignore_sticky_posts'] = isset( $this->args['ignore_sticky_posts'] ) ? $this->shortcode_bool( $this->args['ignore_sticky_posts'] ) : true;
174
+
175
+ if ( isset( $this->args['more_tag'] ) ) {
176
+ add_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ), 1 );
177
+ }
178
+
179
+ if ( isset( $atts['exclude_ids'] ) ) {
180
+ $exclude_posts = explode( ',', $atts['exclude_ids'] );
181
+ if ( isset( $this->args['post__not_in'] ) ) {
182
+ $this->args['post__not_in'] = array_merge( $this->args['post__not_in'], $exclude_posts );
183
+ } else {
184
+ $this->args['post__not_in'] = $exclude_posts;
185
+ }
186
+ }
187
+
188
+ $current_time_value = current_time( 'timestamp' );
189
+ if ( isset( $atts['date'] ) ) {
190
+ $date_data = explode( '-', $atts['date'] );
191
+ if ( ! isset( $date_data[1] ) ) {
192
+ $date_data[1] = 0;
193
+ }
194
+ switch ( $date_data[0] ) {
195
+ case 'today':
196
+ $today = getdate( $current_time_value - ( $date_data[1] * DAY_IN_SECONDS ) );
197
+ $this->args['date_query'] = array(
198
+ 'year' => $today['year'],
199
+ 'month' => $today['mon'],
200
+ 'day' => $today['mday'],
201
+ );
202
+ break;
203
+ case 'week':
204
+ $week = date( 'W', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
205
+ $year = date( 'Y', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
206
+ $this->args['date_query'] = array(
207
+ 'year' => $year,
208
+ 'week' => $week,
209
+ );
210
+ break;
211
+ case 'month':
212
+ $month = date( 'm', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
213
+ $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
214
+ $this->args['date_query'] = array(
215
+ 'monthnum' => $month,
216
+ 'year' => $year,
217
+ );
218
+ break;
219
+ case 'year':
220
+ $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Years' ), $current_time_value ) );
221
+ $this->args['date_query'] = array(
222
+ 'year' => $year,
223
+ );
224
+ break;
225
+ }
226
+ }
227
+ $this->args = apply_filters( 'posts_in_page_args', $this->args );
228
+ }
229
+
230
+ /**
231
+ * Sets a shortcode boolean value to a real boolean
232
+ *
233
+ * @return bool
234
+ */
235
+ public function shortcode_bool( $var ) {
236
+ $falsey = array( 'false', '0', 'no', 'n' );
237
+ return ( ! $var || in_array( strtolower( $var ), $falsey ) ) ? false : true;
238
+ }
239
+
240
+ /**
241
+ * Tests if a theme has a theme template file that exists
242
+ *
243
+ * @return string|true if template exists, false otherwise.
244
+ */
245
+ protected function has_theme_template() {
246
+
247
+ if ( ! empty( $this->args['template'] ) ) {
248
+
249
+ $template_file = get_stylesheet_directory() . '/' . $this->args['template'];
250
+
251
+ // check for traversal attack by getting the basename without the path and reassembling. If it looks wrong, go with the default
252
+
253
+ $path_parts = pathinfo( $template_file );
254
+
255
+ if ( $template_file != get_stylesheet_directory() . '/' . $path_parts['filename'] . '.' . $path_parts['extension'] ) {
256
+
257
+ $template_file = get_stylesheet_directory() . '/posts_loop_template.php';
258
+
259
+ }
260
+ } else {
261
+ $template_file = get_stylesheet_directory() . '/posts_loop_template.php'; // use default template file
262
+ }
263
+
264
+ return ( file_exists( $template_file ) ) ? $template_file : false;
265
+ }
266
+
267
+ /**
268
+ * Retrieves the post loop template and returns the output
269
+ *
270
+ * @return string results of the output
271
+ */
272
+ protected function add_template_part( $ic_posts, $singles = false ) {
273
+ if ( $singles ) {
274
+ setup_postdata( $ic_posts );
275
+ } else {
276
+ $ic_posts->the_post();
277
+ }
278
+ $output = '';
279
+ ob_start();
280
+ $output .= apply_filters( 'posts_in_page_pre_loop', '' );
281
+ require ( $file_path = self::has_theme_template() )
282
+ ? $file_path // use template file in theme
283
+ : POSTSPAGE_DIR . '/posts_loop_template.php'; // use default plugin template file
284
+ $output .= ob_get_contents();
285
+ $output .= apply_filters( 'posts_in_page_post_loop', '' );
286
+ return ob_get_clean();
287
+ }
288
+
289
+ public function custom_excerpt_more( $more ) {
290
+ $more_tag = $this->args['more_tag'];
291
+ return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . $more_tag . '</a>';
292
+ }
293
+
294
+ }
languages/Posts-in-Page.pot ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2017 IvyCat, Inc.
2
+ # This file is distributed under the GNU General Public License v2.0.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Posts in Page 1.3.0\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/posts_in_page\n"
7
+ "POT-Creation-Date: 2017-02-15 00:16:27+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: 2017-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "X-Generator: grunt-wp-i18n 0.4.9\n"
15
+
16
+ #. Plugin Name of the plugin/theme
17
+ msgid "Posts in Page"
18
+ msgstr ""
19
+
20
+ #: admin/views/help-main.php:30
21
+ msgid "How to use Posts in Page"
22
+ msgstr ""
23
+
24
+ #: admin/views/help-main.php:63
25
+ msgid ""
26
+ "Add all posts to a page (limit to what number posts in WordPress is set "
27
+ "to), essentially adds blog \"page\" to page."
28
+ msgstr ""
29
+
30
+ #: admin/views/help-main.php:68
31
+ msgid ""
32
+ "show one or many posts by specifying the post ID(s) ( specify all post "
33
+ "types )"
34
+ msgstr ""
35
+
36
+ #: admin/views/help-main.php:73
37
+ msgid ""
38
+ "show posts from a custom post type by specifying the post type slug ( must "
39
+ "give post type if not a standard post ) add multiple post types by "
40
+ "separating with commas (ex."
41
+ msgstr ""
42
+
43
+ #: admin/views/help-main.php:78
44
+ msgid "limit number of posts (or override default setting)"
45
+ msgstr ""
46
+
47
+ #: admin/views/help-main.php:83
48
+ msgid ""
49
+ "orderby title - supports all WP orderby variables. Order is optional, WP "
50
+ "default"
51
+ msgstr ""
52
+
53
+ #: admin/views/help-main.php:88
54
+ msgid ""
55
+ "Show posts within a specific category. Uses slugs, can have multiple but "
56
+ "separate by commas. category-1,category2, etc (no spaces.)"
57
+ msgstr ""
58
+
59
+ #: admin/views/help-main.php:93
60
+ msgid ""
61
+ "Show posts using a specific tag. Like categories, it uses slugs, and can "
62
+ "accommodate multiple tags separate by commas. tag-1,tag-2, etc (no "
63
+ "spaces.)"
64
+ msgstr ""
65
+
66
+ #: admin/views/help-main.php:98
67
+ msgid ""
68
+ "limit posts to those that exist in a taxonomy and have a specific term. "
69
+ "Both are required for either one to work"
70
+ msgstr ""
71
+
72
+ #: admin/views/help-main.php:103
73
+ msgid ""
74
+ "In case you want to style your markup, add meta data, etc. Each shortcode "
75
+ "can reference a different template. These templates must exist in the "
76
+ "theme directory."
77
+ msgstr ""
78
+
79
+ #: admin/views/help-main.php:108
80
+ msgid "Show sticky posts too (they're ignored by default)"
81
+ msgstr ""
82
+
83
+ #: admin/views/help-main.php:113
84
+ msgid "use pagination links (off by default)"
85
+ msgstr ""
86
+
87
+ #: admin/views/help-main.php:118
88
+ msgid "Display posts from the 4th one"
89
+ msgstr ""
90
+
91
+ #: admin/views/help-main.php:123
92
+ msgid ""
93
+ "Show's post associated (published) on specified date period, today, "
94
+ "'today-1' show's posts published yesterday, 'today-2' shows posts published "
95
+ "two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available "
96
+ "'month(-n)' and 'year(-n)'"
97
+ msgstr ""
98
+
99
+ #: admin/views/help-main.php:128
100
+ msgid "exclude by post ID one or more."
101
+ msgstr ""
102
+
103
+ #: admin/views/help-main.php:133
104
+ msgid "Custom message to display if no posts are found"
105
+ msgstr ""
106
+
107
+ #: admin/views/help-main.php:136
108
+ msgid "Or any combination of the above."
109
+ msgstr ""
110
+
111
+ #: admin/views/help-main.php:138
112
+ msgid "Embed a PHP function in a theme template file"
113
+ msgstr ""
114
+
115
+ #: admin/views/help-main.php:140
116
+ msgid ""
117
+ "If you'd like to use this plugin to pull posts directly into your theme's "
118
+ "template files, you can drop the following WordPress function in your "
119
+ "template files, replacing the <code>[shortcode]</code> part with your, "
120
+ "custom shortcode."
121
+ msgstr ""
122
+
123
+ #: admin/views/help-main.php:165
124
+ msgid "Help & Support"
125
+ msgstr ""
126
+
127
+ #: admin/views/help-main.php:190
128
+ msgid "Connect with IvyCat!"
129
+ msgstr ""
130
+
131
+ #: admin/views/help-main.php:228
132
+ msgid "Contribute"
133
+ msgstr ""
134
+
135
+ #: admin/views/help-main.php:250
136
+ msgid "IvyCat Services"
137
+ msgstr ""
138
+
139
+ #: includes/class-page-posts.php:26
140
+ msgid "Next"
141
+ msgstr ""
142
+
143
+ #: includes/class-page-posts.php:27
144
+ msgid "Previous"
145
+ msgstr ""
146
+
147
+ #: posts_in_page.php:46
148
+ msgid " Help"
149
+ msgstr ""
150
+
151
+ #: posts_loop_template.php:29
152
+ msgid "<span class=\"%1$s\">Posted in</span> %2$s"
153
+ msgstr ""
154
+
155
+ #: posts_loop_template.php:37
156
+ msgid "<span class=\"%1$s\">Tagged</span> %2$s"
157
+ msgstr ""
158
+
159
+ #: posts_loop_template.php:41
160
+ msgid "Leave a comment"
161
+ msgstr ""
162
+
163
+ #: posts_loop_template.php:41
164
+ msgid "1 Comment"
165
+ msgstr ""
166
+
167
+ #: posts_loop_template.php:41
168
+ msgid "% Comments"
169
+ msgstr ""
170
+
171
+ #: posts_loop_template.php:42
172
+ msgid "Edit"
173
+ msgstr ""
174
+
175
+ #. Plugin URI of the plugin/theme
176
+ msgid "https://ivycat.com/wordpress/wordpress-plugins/posts-in-page/"
177
+ msgstr ""
178
+
179
+ #. Description of the plugin/theme
180
+ msgid ""
181
+ "Easily add one or more posts to any page using simple shortcodes. Supports "
182
+ "categories, tags, custom post types, custom taxonomies, and more."
183
+ msgstr ""
184
+
185
+ #. Author of the plugin/theme
186
+ msgid "IvyCat, Inc."
187
+ msgstr ""
188
+
189
+ #. Author URI of the plugin/theme
190
+ msgid "https://ivycat.com"
191
+ msgstr ""
lib/page_posts.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
- /**
3
- * Page Posts Class, main workhorse for the ic_add_posts shortcode.
4
- */
5
-
6
- if ( !function_exists( 'add_action' ) )
7
- wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
8
-
9
- class ICPagePosts {
10
-
11
- protected $args = array(
12
- 'post_type' => 'post',
13
- 'post_status' => 'publish',
14
- 'orderby' => 'date',
15
- 'order' => 'DESC',
16
- 'paginate' => false,
17
- 'template' => false
18
- ); // set defaults for wp_parse_args
19
-
20
- public function __construct( $atts ) {
21
- self::set_args( $atts );
22
- }
23
-
24
- /**
25
- * Output's the posts
26
- *
27
- * @return string output of template file
28
- */
29
- public function output_posts() {
30
- if ( !$this->args )
31
- return '';
32
- $page_posts = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
33
- $output = '';
34
- if ( $page_posts->have_posts() ):
35
- while ( $page_posts->have_posts() ):
36
- $output .= self::add_template_part( $page_posts );
37
- endwhile;
38
- $output .= ( $this->args['paginate'] ) ? '<div class="pip-nav">' . apply_filters( 'posts_in_page_paginate', $this->paginate_links( $page_posts ) ) . '</div>' : '';
39
- endif;
40
- wp_reset_postdata();
41
-
42
- remove_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ) );
43
-
44
- return $output;
45
- }
46
-
47
- protected function paginate_links( $posts ){
48
- global $wp_query;
49
- $page_url = home_url( '/' . $wp_query->post->post_name . '/' );
50
- $page = isset( $_GET['page'] ) ? $_GET['page'] : 1;
51
- $total_pages = $posts->max_num_pages;
52
- $per_page = $posts->query_vars['posts_per_page'];
53
- $curr_page = ( isset( $posts->query_vars['paged'] ) && $posts->query_vars['paged'] > 0 ) ? $posts->query_vars['paged'] : 1;
54
- $prev = ( $curr_page && $curr_page > 1 ) ? '<li><a href="'.$page_url.'?page='. ( $curr_page-1 ).'">Previous</a></li>' : '';
55
- $next = ( $curr_page && $curr_page < $total_pages ) ? '<li><a href="'.$page_url.'?page='. ( $curr_page+1 ).'">Next</a></li>' : '';
56
- return '<ul>' . $prev . $next . '</ul>';
57
- }
58
-
59
- /**
60
- * Build additional Arguments for the WP_Query object
61
- *
62
- * @param array $atts Attritubes for building the $args array.
63
- */
64
- protected function set_args( $atts ) {
65
- global $wp_query;
66
- $this->args['posts_per_page'] = get_option( 'posts_per_page' );
67
- // parse the arguments using the defaults
68
- $this->args = wp_parse_args( $atts, $this->args );
69
-
70
- // multiple post types are indicated, pass as an array
71
- if( preg_match( '`,`', $this->args['post_type'] ) ){
72
- $post_types = explode( ',', $this->args['post_type'] );
73
- $this->args['post_type'] = $post_types;
74
- }
75
-
76
- // Show specific posts by ID
77
- if ( isset( $atts['ids'] ) ) {
78
- $post_ids = explode( ',', $atts['ids'] );
79
- $this->args['post__in'] = $post_ids;
80
- $this->args['posts_per_page'] = count( $post_ids );
81
- }
82
-
83
- // Use a specified template
84
- if ( isset( $atts['template'] ) )
85
- $this->args['template'] = $atts['template'];
86
-
87
- // get posts in a certain category by name (slug)
88
- if ( isset( $atts['category'] ) ) {
89
- $this->args['category_name'] = $atts['category'];
90
- } elseif ( isset( $atts['cats'] ) ) { // get posts in a certain category by id
91
- $this->args['cat'] = $atts['cats'];
92
- }
93
-
94
- // Do a tex query, tax and term a required.
95
- if( isset( $atts['tax'] ) ) {
96
- if( isset( $atts['term'] ) ){
97
- $terms = explode( ',', $atts['term'] );
98
- $this->args['tax_query'] = array(
99
- array( 'taxonomy' => $atts['tax'], 'field' => 'slug', 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'] )
100
- );
101
- }
102
- }
103
-
104
- // get posts with a certain tag
105
- if ( isset( $atts['tag'] ) ) {
106
- $this->args['tag'] = $atts['tag'];
107
- }
108
-
109
- // exclude posts with certain category by name (slug)
110
- if ( isset( $atts['exclude_category'] ) ) {
111
- $category = $atts['exclude_category'];
112
- if( preg_match( '`,`', $category ) ) { // multiple
113
- $category = explode( ',', $category );
114
-
115
- foreach( $category AS $cat ) {
116
- $term = get_category_by_slug( $cat );
117
- $exclude[] = '-' . $term->term_id;
118
- }
119
- $category = implode( ',', $exclude );
120
-
121
- } else { // single
122
- $term = get_category_by_slug( $category );
123
- $category = '-' . $term->term_id;
124
- }
125
-
126
- if( !is_null( $this->args['cat'] ) ) { // merge lists
127
- $this->args['cat'] .= ',' . $category;
128
- }
129
- $this->args['cat'] = $category;
130
- // unset our unneeded variables
131
- unset( $category, $term, $exclude );
132
- }
133
-
134
- // show number of posts (default is 10, showposts or posts_per_page are both valid, only one is needed)
135
- if ( isset( $atts['showposts'] ) )
136
- $this->args[ 'posts_per_page' ] = $atts['showposts'];
137
-
138
- // handle pagination (for code, template pagination is in the template)
139
- if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
140
- $this->args['paged'] = $wp_query->query_vars['page'];
141
- }
142
-
143
- if ( ! isset( $this->args['ignore_sticky_posts'] ) ) {
144
- $this->args['post__not_in'] = get_option( 'sticky_posts' );
145
- }
146
-
147
- if ( ! isset( $this->args['ignore_sticky_posts'] ) ) {
148
- $this->args['post__not_in'] = get_option( 'sticky_posts' );
149
- }
150
-
151
- if ( isset( $this->args['more_tag'] ) ) {
152
- add_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ), 1 );
153
- }
154
-
155
- $this->args = apply_filters( 'posts_in_page_args', $this->args );
156
-
157
- }
158
-
159
- /**
160
- * Tests if a theme has a theme template file that exists
161
- *
162
- * @return true if template exists, false otherwise.
163
- */
164
- protected function has_theme_template() {
165
- $template_file = ( $this->args['template'] )
166
- ? get_stylesheet_directory() . '/' . $this->args['template'] // use specified template file
167
- : get_stylesheet_directory() . '/posts_loop_template.php'; // use default template file
168
-
169
- return ( file_exists( $template_file ) ) ? $template_file : false;
170
- }
171
-
172
- /**
173
- * Retrieves the post loop template and returns the output
174
- *
175
- * @return string results of the output
176
- */
177
- protected function add_template_part( $ic_posts, $singles=false ) {
178
- if ( $singles ) {
179
- setup_postdata( $ic_posts );
180
- } else {
181
- $ic_posts->the_post();
182
- }
183
- $output = '';
184
- ob_start();
185
- $output .= apply_filters( 'posts_in_page_pre_loop', '' );
186
- require ( $file_path = self::has_theme_template() )
187
- ? $file_path // use template file in theme
188
- : POSTSPAGE_DIR . '/posts_loop_template.php'; // use default plugin template file
189
- $output .= ob_get_contents();
190
- $output .= apply_filters( 'posts_in_page_post_loop', '' );
191
- return ob_get_clean();
192
- }
193
-
194
- public function custom_excerpt_more( $more ) {
195
- $more_tag = $this->args['more_tag'];
196
- return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . $more_tag . '</a>';
197
- }
198
-
199
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
posts_in_page.php CHANGED
@@ -1,43 +1,35 @@
1
  <?php
2
-
3
  /**
4
  * Plugin Name: Posts in Page
5
- * Plugin URI: http://www.ivycat.com/wordpress/wordpress-plugins/posts-in-page/
6
  * Description: Easily add one or more posts to any page using simple shortcodes. Supports categories, tags, custom post types, custom taxonomies, and more.
7
- * Author: IvyCat Web Services
8
- * Author URI: http://www.ivycat.com
9
- * version: 1.2.4
10
  * License: GNU General Public License v2.0
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
- *
13
- * ------------------------------------------------------------------------
14
- * IvyCat Posts in Page, Copyright 2012 - 2015 IvyCat, Inc. (wp@ivycat.com)
15
- *
16
- * This program is free software; you can redistribute it and/or modify
17
- * it under the terms of the GNU General Public License as published by
18
- * the Free Software Foundation; either version 2 of the License, or
19
- * (at your option) any later version.
20
- *
21
- * This program is distributed in the hope that it will be useful,
22
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- * GNU General Public License for more details.
25
- *
26
- * You should have received a copy of the GNU General Public License
27
- * along with this program; if not, write to the Free Software
28
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
  */
30
 
31
- if ( !function_exists( 'add_action' ) )
32
  wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
 
33
 
34
- if ( ! defined( 'POSTSPAGE_DIR' ) )
35
  define( 'POSTSPAGE_DIR', plugin_dir_path( __FILE__ ) );
 
36
 
37
- if ( ! defined( 'POSTPAGE_URL' ) )
38
  define( 'POSTPAGE_URL', plugin_dir_url( __FILE__ ) );
 
39
 
40
- require_once 'lib/page_posts.php';
41
 
42
  class ICAddPostsToPage {
43
 
@@ -45,15 +37,17 @@ class ICAddPostsToPage {
45
  add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page' ) );
46
  add_shortcode( 'ic_add_post', array( &$this, 'post_in_page' ) );
47
  add_action( 'admin_menu', array( &$this, 'plugin_page_init' ) );
48
- add_filter( 'plugin_action_links_'. plugin_basename( __FILE__ ), array( &$this, 'plugin_action_links' ), 10, 4 );
 
49
  }
50
 
51
  /**
52
  * Add settings link on plugins page.
53
  */
54
  public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
55
- if ( is_plugin_active( $plugin_file ) )
56
- $actions[] = '<a href="' . admin_url('options-general.php?page=posts_in_page') . '">' . __( ' Help', 'posts_in_page' ) . '</a>';
 
57
  return apply_filters( 'post_in_page_actions', $actions );
58
  }
59
 
@@ -80,11 +74,12 @@ class ICAddPostsToPage {
80
  * Init plugin, add menu page, and setup hooks to load assets on the plugin options page
81
  */
82
  public function plugin_page_init() {
83
- if ( ! current_user_can( 'administrator' ) )
84
- return;
 
85
 
86
  $hooks = array( );
87
- $hooks[] = add_options_page( __( 'Posts In Page' ), __( 'Posts In Page' ), 'read', 'posts_in_page',
88
  array( $this, 'plugin_page' ) );
89
 
90
  foreach ( $hooks as $hook ) {
@@ -96,15 +91,15 @@ class ICAddPostsToPage {
96
  * Enqueue plugin assets (scripts & styles)
97
  */
98
  public function load_assets( ) {
99
- wp_enqueue_style( 'postpagestyle', POSTPAGE_URL. '/assets/post-page_styles.css' );
100
- wp_enqueue_script( 'postpagescript', POSTPAGE_URL. '/assets/post-page_scripts.js' );
101
  }
102
 
103
  /**
104
  * Plugin Settings page - includes view for the page
105
  */
106
  public function plugin_page( ) {
107
- require_once 'assets/posts_in_page_help_view.php';
108
  }
109
 
110
  }
1
  <?php
 
2
  /**
3
  * Plugin Name: Posts in Page
4
+ * Plugin URI: https://ivycat.com/wordpress/wordpress-plugins/posts-in-page/
5
  * Description: Easily add one or more posts to any page using simple shortcodes. Supports categories, tags, custom post types, custom taxonomies, and more.
6
+ * Version: 1.3.0
7
+ * Author: IvyCat, Inc.
8
+ * Author URI: https://ivycat.com
9
  * License: GNU General Public License v2.0
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+ * Text Domain: posts-in-page
12
+ * Domain Path: /languages
13
+ *
14
+ * @package Posts_in_Page
15
+ * @author Eric Amundson <eric@ivycat.com>
16
+ * @copyright Copyright (c) 2017, IvyCat, Inc.
17
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
 
 
 
 
 
 
 
 
 
 
18
  */
19
 
20
+ if ( ! function_exists( 'add_action' ) ) {
21
  wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
22
+ }
23
 
24
+ if ( ! defined( 'POSTSPAGE_DIR' ) ) {
25
  define( 'POSTSPAGE_DIR', plugin_dir_path( __FILE__ ) );
26
+ }
27
 
28
+ if ( ! defined( 'POSTPAGE_URL' ) ) {
29
  define( 'POSTPAGE_URL', plugin_dir_url( __FILE__ ) );
30
+ }
31
 
32
+ require_once 'includes/class-page-posts.php';
33
 
34
  class ICAddPostsToPage {
35
 
37
  add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page' ) );
38
  add_shortcode( 'ic_add_post', array( &$this, 'post_in_page' ) );
39
  add_action( 'admin_menu', array( &$this, 'plugin_page_init' ) );
40
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( &$this, 'plugin_action_links' ), 10, 4 );
41
+ load_plugin_textdomain( 'posts-in-page', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
42
  }
43
 
44
  /**
45
  * Add settings link on plugins page.
46
  */
47
  public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
48
+ if ( is_plugin_active( $plugin_file ) ) {
49
+ $actions[] = '<a href="' . admin_url( 'options-general.php?page=posts_in_page' ) . '">' . __( ' Help', 'posts-in-page' ) . '</a>';
50
+ }
51
  return apply_filters( 'post_in_page_actions', $actions );
52
  }
53
 
74
  * Init plugin, add menu page, and setup hooks to load assets on the plugin options page
75
  */
76
  public function plugin_page_init() {
77
+ if ( ! current_user_can( 'administrator' ) ) {
78
+ return;
79
+ }
80
 
81
  $hooks = array( );
82
+ $hooks[] = add_options_page( __( 'Posts in Page', 'posts-in-page' ), __( 'Posts in Page', 'posts-in-page' ), 'read', 'posts_in_page',
83
  array( $this, 'plugin_page' ) );
84
 
85
  foreach ( $hooks as $hook ) {
91
  * Enqueue plugin assets (scripts & styles)
92
  */
93
  public function load_assets( ) {
94
+ wp_enqueue_style( 'postpagestyle', POSTPAGE_URL . 'admin/assets/css/post-page_styles.css' );
95
+ wp_enqueue_script( 'postpagescript', POSTPAGE_URL . 'admin/assets/js/post-page_scripts.js' );
96
  }
97
 
98
  /**
99
  * Plugin Settings page - includes view for the page
100
  */
101
  public function plugin_page( ) {
102
+ require_once 'admin/views/help-main.php';
103
  }
104
 
105
  }
posts_loop_template.php CHANGED
@@ -1,35 +1,45 @@
 
 
 
 
 
 
 
 
 
1
  <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
2
  directory so your changes won't be overwritten when the plugin is upgraded. -->
3
 
4
- <!-- Start of Post Wrap -->
5
  <div class="post hentry ivycat-post">
6
- <!-- This is the output of the post TITLE -->
 
7
  <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
8
 
9
- <!-- This is the output of the EXCERPT -->
 
10
  <div class="entry-summary">
11
  <?php the_excerpt(); ?>
12
  </div>
13
 
14
- <!-- This is the output of the META information -->
15
  <div class="entry-utility">
16
  <?php if ( count( get_the_category() ) ) : ?>
17
  <span class="cat-links">
18
- <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
19
  </span>
20
  <span class="meta-sep">|</span>
21
  <?php endif; ?>
22
  <?php
23
  $tags_list = get_the_tag_list( '', ', ' );
24
- if ( $tags_list ):
25
- ?>
26
  <span class="tag-links">
27
- <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
28
  </span>
29
  <span class="meta-sep">|</span>
30
  <?php endif; ?>
31
- <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
32
- <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
33
  </div>
34
  </div>
35
- <!-- // End of Post Wrap -->
1
+ <?php
2
+ /**
3
+ * @package Posts_in_Page
4
+ * @author Eric Amundson <eric@ivycat.com>
5
+ * @copyright Copyright (c) 2017, IvyCat, Inc.
6
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
7
+ */
8
+ ?>
9
+
10
  <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
11
  directory so your changes won't be overwritten when the plugin is upgraded. -->
12
 
13
+ <!-- Post Wrap Start-->
14
  <div class="post hentry ivycat-post">
15
+
16
+ <!-- This outputs the post TITLE -->
17
  <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
18
 
19
+ <!-- This outputs the post EXCERPT. To display full content including images and html,
20
+ replace the_excerpt(); with the_content(); below. -->
21
  <div class="entry-summary">
22
  <?php the_excerpt(); ?>
23
  </div>
24
 
25
+ <!-- This outputs the post META information -->
26
  <div class="entry-utility">
27
  <?php if ( count( get_the_category() ) ) : ?>
28
  <span class="cat-links">
29
+ <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
30
  </span>
31
  <span class="meta-sep">|</span>
32
  <?php endif; ?>
33
  <?php
34
  $tags_list = get_the_tag_list( '', ', ' );
35
+ if ( $tags_list ): ?>
 
36
  <span class="tag-links">
37
+ <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
38
  </span>
39
  <span class="meta-sep">|</span>
40
  <?php endif; ?>
41
+ <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
42
+ <?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
43
  </div>
44
  </div>
45
+ <!-- // Post Wrap End -->
readme.txt CHANGED
@@ -1,10 +1,9 @@
1
  === Posts in Page ===
2
- Contributors: sewmyheadon, ivycat, gehidore, dgilfoy
3
- Donate link: http://www.ivycat.com/contribute/
4
- Tags: shortcode, pages, posts, custom post types
5
  Requires at least: 3.0
6
- Tested up to: 4.1.1
7
- Stable tag: 1.2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -20,7 +19,7 @@ You can get all of the same functionality provided by this plugin by modifying y
20
 
21
  Plugin is depending upon your theme's styling; version 1.x of this plugin _does not_ contain native styles.
22
 
23
- This is a minimal plugin, function over form. If you would like to extend it, or would like us to extend it in later versions, please post feature suggestions in the plugin's [support forum](http://wordpress.org/support/plugin/posts-in-page) or [contact us](http://www.ivycat.com/contact/).
24
 
25
  Give us feedback and contribute to this plugin on its [GitHub page](https://github.com/ivycat/Posts-in-Page)
26
 
@@ -54,6 +53,8 @@ To 'pull' posts into a page, you can either:
54
  * `[ic_add_posts template='template-in-theme-dir.php']` - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.
55
  * `[ic_add_posts ignore_sticky_posts='no']` - Show sticky posts too (they're ignored by default).
56
  * `[ic_add_posts paginate='yes']` - use pagination links (off by default)
 
 
57
 
58
  Or any combination of the above.
59
 
@@ -119,7 +120,7 @@ You bet.
119
 
120
  = Will it make me coffee?
121
 
122
- Not likely, but let us know if it does; then we'll know we have something special.
123
 
124
  == Screenshots ==
125
 
@@ -128,6 +129,12 @@ Not likely, but let us know if it does; then we'll know we have something specia
128
 
129
  == Changelog ==
130
 
 
 
 
 
 
 
131
  = 1.2.4 =
132
  * now you can set `more_tag=""` to remove the `[...] &hellip;` that unfortunetly shows up as `&hellip`
133
 
@@ -177,6 +184,9 @@ Not likely, but let us know if it does; then we'll know we have something specia
177
 
178
  == Upgrade Notice ==
179
 
 
 
 
180
  = 1.2.4 =
181
  * Presentational fixes: clean up whitespace, extra tabs, add in customization of more tag.
182
 
1
  === Posts in Page ===
2
+ Contributors: ivycat, sewmyheadon, anvilzephyr, jasonm4563, pjackson1972
3
+ Tags: shortcode, pages, posts, custom post types, taxonomy, terms
 
4
  Requires at least: 3.0
5
+ Tested up to: 4.0
6
+ Stable tag: 1.3.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
19
 
20
  Plugin is depending upon your theme's styling; version 1.x of this plugin _does not_ contain native styles.
21
 
22
+ This is a minimal plugin, function over form. If you would like to extend it, or would like us to extend it in later versions, please post feature suggestions in the plugin's [support forum](https://wordpress.org/support/plugin/posts-in-page) or [contact us](https://ivycat.com/contact/).
23
 
24
  Give us feedback and contribute to this plugin on its [GitHub page](https://github.com/ivycat/Posts-in-Page)
25
 
53
  * `[ic_add_posts template='template-in-theme-dir.php']` - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.
54
  * `[ic_add_posts ignore_sticky_posts='no']` - Show sticky posts too (they're ignored by default).
55
  * `[ic_add_posts paginate='yes']` - use pagination links (off by default)
56
+ * `[ic_add_posts label_next='Next' label_previous='Previous']` - Customize 'Next' and 'Previous' labels used by pagination
57
+ * `[ic_add_posts post_status='private']` - Show posts with the specified status. By default it shows only posts with 'publish' status. To select multiple statuses, separate them with commas like so: `post_status='private,publish'`.
58
 
59
  Or any combination of the above.
60
 
120
 
121
  = Will it make me coffee?
122
 
123
+ Not likely, but let us know if it does; then we'll *know* we have something special.
124
 
125
  == Screenshots ==
126
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.3.0 =
133
+ * File reorganization / housekeeping
134
+ * Admin UI cleanup
135
+ * Security: Fixed [directory traversal vulnerability](https://www.pluginvulnerabilities.com/2017/02/13/authenticated-local-file-inclusion-lfi-vulnerability-in-posts-in-page/).
136
+ * Added ability to optionally include private posts - Thanks StarsoftAnalysis!
137
+
138
  = 1.2.4 =
139
  * now you can set `more_tag=""` to remove the `[...] &hellip;` that unfortunetly shows up as `&hellip`
140
 
184
 
185
  == Upgrade Notice ==
186
 
187
+ = 1.3.0 =
188
+ * Important security and version updates. Please upgrade.
189
+
190
  = 1.2.4 =
191
  * Presentational fixes: clean up whitespace, extra tabs, add in customization of more tag.
192