Version Description
- Code cleanup
Download this release
Release Info
Developer | jchristopher |
Plugin | Attachments |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
- attachments.php +39 -24
- readme.txt +7 -3
attachments.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Attachments
|
4 |
Plugin URI: http://mondaybynoon.com/wordpress-attachments/
|
5 |
Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
6 |
-
Version: 1.5.
|
7 |
Author: Jonathan Christopher
|
8 |
Author URI: http://mondaybynoon.com/
|
9 |
*/
|
@@ -31,13 +31,13 @@ if( !defined( 'IS_ADMIN' ) )
|
|
31 |
define( 'IS_ADMIN', is_admin() );
|
32 |
|
33 |
|
|
|
34 |
// ===========
|
35 |
// = GLOBALS =
|
36 |
// ===========
|
37 |
|
38 |
global $wpdb;
|
39 |
|
40 |
-
|
41 |
// environment check
|
42 |
$wp_version = get_bloginfo( 'version' );
|
43 |
if( !version_compare( PHP_VERSION, '5.2', '>=' ) || !version_compare( $wp_version, '3.0', '>=' ) )
|
@@ -59,6 +59,7 @@ if( !version_compare( PHP_VERSION, '5.2', '>=' ) || !version_compare( $wp_versio
|
|
59 |
// =========
|
60 |
// = HOOKS =
|
61 |
// =========
|
|
|
62 |
if( IS_ADMIN )
|
63 |
{
|
64 |
add_action( 'admin_menu', 'attachments_init' );
|
@@ -67,6 +68,7 @@ if( IS_ADMIN )
|
|
67 |
add_action( 'admin_menu', 'attachments_menu' );
|
68 |
add_action( 'admin_footer', 'attachments_footer_js' );
|
69 |
add_action( 'in_plugin_update_message-attachments/attachments.php', 'attachments_update_message' );
|
|
|
70 |
|
71 |
load_plugin_textdomain( 'attachments', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
72 |
}
|
@@ -88,11 +90,13 @@ function attachments_update_message()
|
|
88 |
<div style="color: #f00;padding-top:4px;">Attachments Pro is now available!</div>
|
89 |
<div style="font-weight:normal;padding-top:8px;">
|
90 |
<p><a href="http://mondaybynoon.com/store/attachments-pro/">Attachments Pro</a> is Attachments' big brother. With it come a number of often-requested features such as:</p>
|
91 |
-
<ul style="list-style:disc;
|
92 |
-
<li>Multiple Attachments instances on edit screens</li>
|
93 |
-
<li>Customizable field labels and meta box title</li>
|
94 |
-
<li>Unlimited number of fields per Attachment</li>
|
95 |
-
<li>Ability to define rules limiting the availability of Attachments on edit screens</li>
|
|
|
|
|
96 |
</ul>
|
97 |
<p>Attachments has always been and <em>will always be free</em>. <a href="http://mondaybynoon.com/store/attachments-pro/">Attachments Pro</a> is <strong>available now</strong>. To find out more about the new features already added, and to stay up-to-date on what's to come, <a href="http://mondaybynoon.com/store/attachments-pro/">have a look at the details</a>. From there, you can make formal support and feature requests.</p>
|
98 |
</div>
|
@@ -127,8 +131,6 @@ function attachments_cmp($a, $b)
|
|
127 |
}
|
128 |
|
129 |
|
130 |
-
|
131 |
-
|
132 |
/**
|
133 |
* Creates the markup for the WordPress admin options page
|
134 |
*
|
@@ -141,8 +143,6 @@ function attachments_options()
|
|
141 |
}
|
142 |
|
143 |
|
144 |
-
|
145 |
-
|
146 |
/**
|
147 |
* Creates the entry for Attachments Options under Settings in the WordPress Admin
|
148 |
*
|
@@ -155,8 +155,6 @@ function attachments_menu()
|
|
155 |
}
|
156 |
|
157 |
|
158 |
-
|
159 |
-
|
160 |
/**
|
161 |
* Inserts HTML for meta box, including all existing attachments
|
162 |
*
|
@@ -232,7 +230,6 @@ function attachments_add()
|
|
232 |
<?php }
|
233 |
|
234 |
|
235 |
-
|
236 |
/**
|
237 |
* Creates meta box on all Posts and Pages
|
238 |
*
|
@@ -263,7 +260,6 @@ function attachments_meta_box()
|
|
263 |
}
|
264 |
|
265 |
|
266 |
-
|
267 |
/**
|
268 |
* Echos JavaScript that sets some required global variables
|
269 |
*
|
@@ -281,7 +277,6 @@ function attachments_init_js()
|
|
281 |
}
|
282 |
|
283 |
|
284 |
-
|
285 |
/**
|
286 |
* Fired when Post or Page is saved. Serializes all attachment data and saves to post_meta
|
287 |
*
|
@@ -396,7 +391,6 @@ function attachments_save($post_id)
|
|
396 |
}
|
397 |
|
398 |
|
399 |
-
|
400 |
/**
|
401 |
* Retrieves all Attachments for provided Post or Page
|
402 |
*
|
@@ -405,6 +399,7 @@ function attachments_save($post_id)
|
|
405 |
* @author Jonathan Christopher
|
406 |
* @author JR Tashjian
|
407 |
*/
|
|
|
408 |
function attachments_get_attachments( $post_id=null )
|
409 |
{
|
410 |
global $post;
|
@@ -481,7 +476,12 @@ function attachments_get_attachments( $post_id=null )
|
|
481 |
}
|
482 |
|
483 |
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
485 |
function attachments_footer_js()
|
486 |
{
|
487 |
$uri = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : NULL ;
|
@@ -497,18 +497,12 @@ function attachments_footer_js()
|
|
497 |
}
|
498 |
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
/**
|
506 |
* This is the main initialization function, it will invoke the necessary meta_box
|
507 |
*
|
508 |
* @return void
|
509 |
* @author Jonathan Christopher
|
510 |
*/
|
511 |
-
|
512 |
function attachments_init()
|
513 |
{
|
514 |
global $pagenow;
|
@@ -532,4 +526,25 @@ function attachments_init()
|
|
532 |
}
|
533 |
|
534 |
attachments_meta_box();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
}
|
3 |
Plugin Name: Attachments
|
4 |
Plugin URI: http://mondaybynoon.com/wordpress-attachments/
|
5 |
Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
6 |
+
Version: 1.5.8
|
7 |
Author: Jonathan Christopher
|
8 |
Author URI: http://mondaybynoon.com/
|
9 |
*/
|
31 |
define( 'IS_ADMIN', is_admin() );
|
32 |
|
33 |
|
34 |
+
|
35 |
// ===========
|
36 |
// = GLOBALS =
|
37 |
// ===========
|
38 |
|
39 |
global $wpdb;
|
40 |
|
|
|
41 |
// environment check
|
42 |
$wp_version = get_bloginfo( 'version' );
|
43 |
if( !version_compare( PHP_VERSION, '5.2', '>=' ) || !version_compare( $wp_version, '3.0', '>=' ) )
|
59 |
// =========
|
60 |
// = HOOKS =
|
61 |
// =========
|
62 |
+
|
63 |
if( IS_ADMIN )
|
64 |
{
|
65 |
add_action( 'admin_menu', 'attachments_init' );
|
68 |
add_action( 'admin_menu', 'attachments_menu' );
|
69 |
add_action( 'admin_footer', 'attachments_footer_js' );
|
70 |
add_action( 'in_plugin_update_message-attachments/attachments.php', 'attachments_update_message' );
|
71 |
+
add_filter( 'plugin_row_meta', 'attachments_filter_plugin_row_meta', 10, 2 );
|
72 |
|
73 |
load_plugin_textdomain( 'attachments', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
74 |
}
|
90 |
<div style="color: #f00;padding-top:4px;">Attachments Pro is now available!</div>
|
91 |
<div style="font-weight:normal;padding-top:8px;">
|
92 |
<p><a href="http://mondaybynoon.com/store/attachments-pro/">Attachments Pro</a> is Attachments' big brother. With it come a number of often-requested features such as:</p>
|
93 |
+
<ul style="list-style:disc;padding-left:20px;margin-bottom:13px;overflow:hidden;zoom:1;">
|
94 |
+
<li style="width:48%;padding-right:2%;float:left;">Multiple Attachments instances on edit screens</li>
|
95 |
+
<li style="width:48%;padding-right:2%;float:left;">Customizable field labels and meta box title</li>
|
96 |
+
<li style="width:48%;padding-right:2%;float:left;">Unlimited number of fields per Attachment</li>
|
97 |
+
<li style="width:48%;padding-right:2%;float:left;">Ability to define rules limiting the availability of Attachments on edit screens</li>
|
98 |
+
<li style="width:48%;padding-right:2%;float:left;">Limit the number of Attachments that can be added</li>
|
99 |
+
<li style="width:48%;padding-right:2%;float:left;">Limit Attach-able Media items by file/mime type</li>
|
100 |
</ul>
|
101 |
<p>Attachments has always been and <em>will always be free</em>. <a href="http://mondaybynoon.com/store/attachments-pro/">Attachments Pro</a> is <strong>available now</strong>. To find out more about the new features already added, and to stay up-to-date on what's to come, <a href="http://mondaybynoon.com/store/attachments-pro/">have a look at the details</a>. From there, you can make formal support and feature requests.</p>
|
102 |
</div>
|
131 |
}
|
132 |
|
133 |
|
|
|
|
|
134 |
/**
|
135 |
* Creates the markup for the WordPress admin options page
|
136 |
*
|
143 |
}
|
144 |
|
145 |
|
|
|
|
|
146 |
/**
|
147 |
* Creates the entry for Attachments Options under Settings in the WordPress Admin
|
148 |
*
|
155 |
}
|
156 |
|
157 |
|
|
|
|
|
158 |
/**
|
159 |
* Inserts HTML for meta box, including all existing attachments
|
160 |
*
|
230 |
<?php }
|
231 |
|
232 |
|
|
|
233 |
/**
|
234 |
* Creates meta box on all Posts and Pages
|
235 |
*
|
260 |
}
|
261 |
|
262 |
|
|
|
263 |
/**
|
264 |
* Echos JavaScript that sets some required global variables
|
265 |
*
|
277 |
}
|
278 |
|
279 |
|
|
|
280 |
/**
|
281 |
* Fired when Post or Page is saved. Serializes all attachment data and saves to post_meta
|
282 |
*
|
391 |
}
|
392 |
|
393 |
|
|
|
394 |
/**
|
395 |
* Retrieves all Attachments for provided Post or Page
|
396 |
*
|
399 |
* @author Jonathan Christopher
|
400 |
* @author JR Tashjian
|
401 |
*/
|
402 |
+
|
403 |
function attachments_get_attachments( $post_id=null )
|
404 |
{
|
405 |
global $post;
|
476 |
}
|
477 |
|
478 |
|
479 |
+
/**
|
480 |
+
* Outputs Attachments JS into the footer
|
481 |
+
*
|
482 |
+
* @return void
|
483 |
+
* @author Jonathan Christopher
|
484 |
+
*/
|
485 |
function attachments_footer_js()
|
486 |
{
|
487 |
$uri = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : NULL ;
|
497 |
}
|
498 |
|
499 |
|
|
|
|
|
|
|
|
|
|
|
500 |
/**
|
501 |
* This is the main initialization function, it will invoke the necessary meta_box
|
502 |
*
|
503 |
* @return void
|
504 |
* @author Jonathan Christopher
|
505 |
*/
|
|
|
506 |
function attachments_init()
|
507 |
{
|
508 |
global $pagenow;
|
526 |
}
|
527 |
|
528 |
attachments_meta_box();
|
529 |
+
}
|
530 |
+
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Modifies the plugin meta line on the WP Plugins page
|
534 |
+
*
|
535 |
+
* @return $plugin_meta Array of plugin meta data
|
536 |
+
* @author Jonathan Christopher
|
537 |
+
*/
|
538 |
+
function attachments_filter_plugin_row_meta( $plugin_meta, $plugin_file )
|
539 |
+
{
|
540 |
+
if( strstr( $plugin_file, 'attachments/attachments.php' ) )
|
541 |
+
{
|
542 |
+
$plugin_meta[2] = '<a title="Attachments Pro" href="http://mondaybynoon.com/store/attachments-pro/">Attachments Pro</a>';
|
543 |
+
$plugin_meta[3] = 'Visit <a title="Iron to Iron" href="http://irontoiron.com/">' . __( 'Iron to Iron', 'attachmentspro' ) . '</a>';
|
544 |
+
return $plugin_meta;
|
545 |
+
}
|
546 |
+
else
|
547 |
+
{
|
548 |
+
return $plugin_meta;
|
549 |
+
}
|
550 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mondaybynoon.com/donate/
|
|
4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2.1
|
7 |
-
Stable tag: 1.5.
|
8 |
|
9 |
Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
|
10 |
|
@@ -15,9 +15,10 @@ Attachments allows you to simply append any number of items from your WordPress
|
|
15 |
Attachments Pro brings a number of frequently requested features:
|
16 |
|
17 |
* Multiple Attachments instances on edit screens
|
18 |
-
* Customizable
|
19 |
-
* Unlimited number of fields per Attachment
|
20 |
* Ability to define rules limiting the availability of Attachments on edit screens
|
|
|
|
|
21 |
|
22 |
**Much more information** available about [Attachments Pro](http://mondaybynoon.com/store/attachments-pro/)
|
23 |
|
@@ -59,6 +60,9 @@ Attachments uses WordPress' built in Media library for uploads and storage.
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
62 |
= 1.5.7 =
|
63 |
* Translation update
|
64 |
|
4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2.1
|
7 |
+
Stable tag: 1.5.8
|
8 |
|
9 |
Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
|
10 |
|
15 |
Attachments Pro brings a number of frequently requested features:
|
16 |
|
17 |
* Multiple Attachments instances on edit screens
|
18 |
+
* Customizable, limitless fields and labels
|
|
|
19 |
* Ability to define rules limiting the availability of Attachments on edit screens
|
20 |
+
* Limit the number of Attachments that can be added
|
21 |
+
* Limit Attach-able Media items by file/mime type
|
22 |
|
23 |
**Much more information** available about [Attachments Pro](http://mondaybynoon.com/store/attachments-pro/)
|
24 |
|
60 |
|
61 |
== Changelog ==
|
62 |
|
63 |
+
= 1.5.8 =
|
64 |
+
* Code cleanup
|
65 |
+
|
66 |
= 1.5.7 =
|
67 |
* Translation update
|
68 |
|