Version Description
*[Fixed] Bug which caused columns to not include properly
Download this release
Release Info
Developer | tschutter |
Plugin | Admin Columns |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- classes/api.php +0 -17
- classes/storage_model.php +24 -53
- classes/storage_model/comment.php +2 -0
- classes/storage_model/link.php +2 -0
- classes/storage_model/media.php +2 -0
- classes/storage_model/post.php +2 -0
- classes/storage_model/user.php +2 -0
- classes/upgrade.php +1 -5
- classes/utility.php +2 -0
- codepress-admin-columns.php +2 -2
- readme.txt +5 -1
classes/api.php
CHANGED
@@ -6,20 +6,3 @@
|
|
6 |
* @since 2.0.0
|
7 |
* @todo: build API
|
8 |
*/
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Flush cache of storage model
|
13 |
-
*
|
14 |
-
* @since 2.0.0
|
15 |
-
*/
|
16 |
-
function cac_flush_cache_manual( $cpac ) {
|
17 |
-
if ( isset( $_REQUEST['cpac_flush'] ) ) {
|
18 |
-
|
19 |
-
// flush this transient so new custom columns get added.
|
20 |
-
foreach ( $cpac->storage_models as $storage_model ) {
|
21 |
-
$storage_model->flush_cache();
|
22 |
-
}
|
23 |
-
}
|
24 |
-
}
|
25 |
-
add_action( 'cac/loaded', 'cac_flush_cache_manual' );
|
6 |
* @since 2.0.0
|
7 |
* @todo: build API
|
8 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/storage_model.php
CHANGED
@@ -39,6 +39,13 @@ abstract class CPAC_Storage_Model {
|
|
39 |
*/
|
40 |
public $page;
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Get default columns
|
44 |
*
|
@@ -197,59 +204,32 @@ abstract class CPAC_Storage_Model {
|
|
197 |
}
|
198 |
|
199 |
/**
|
200 |
-
*
|
201 |
-
|
202 |
* Goes through all files in 'classes/column' and includes each file.
|
203 |
*
|
204 |
-
*
|
205 |
*
|
206 |
-
* @return array Column Classnames
|
207 |
*/
|
208 |
-
function
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
// An empty transient means we need to rebuild rebuild it.
|
213 |
-
// Get custom columns from the classes/column directory.
|
214 |
-
if ( empty( $columns[ $this->type ] ) ) {
|
215 |
-
|
216 |
-
$file = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( CPAC_DIR . 'classes/column' ) );
|
217 |
-
|
218 |
-
while( $file->valid() ) {
|
219 |
-
|
220 |
-
if ( ! $file->isDot() && ! $file->isDir() ) {
|
221 |
-
|
222 |
-
// build classname from filename
|
223 |
-
$name = implode( '_', array_map( 'ucfirst', explode( '-', basename( $file->key(), '.php' ) ) ) );
|
224 |
-
$relative_file_path = str_replace( ABSPATH, '', $file->key() );
|
225 |
|
226 |
-
|
227 |
-
if ( ! $file->getSubPath() ) {
|
228 |
-
$columns[ $this->type ]["CPAC_Column_{$name}"] = $relative_file_path;
|
229 |
-
}
|
230 |
|
231 |
-
|
232 |
-
elseif ( $this->type == $file->getSubPath() ) {
|
233 |
|
234 |
-
|
235 |
-
$columns[ $this->type ]["CPAC_Column_{$type}_{$name}"] = $relative_file_path;
|
236 |
-
}
|
237 |
-
}
|
238 |
|
239 |
-
|
240 |
-
|
241 |
|
242 |
-
|
243 |
}
|
244 |
|
245 |
-
|
246 |
-
return array();
|
247 |
-
|
248 |
-
// hooks for adding custom columns by addons
|
249 |
-
// $columns classname | include_path
|
250 |
-
$columns = apply_filters( "cac/columns/custom/type={$this->type}", $columns[ $this->type ], $this );
|
251 |
-
|
252 |
-
return $columns;
|
253 |
}
|
254 |
|
255 |
/**
|
@@ -327,9 +307,9 @@ abstract class CPAC_Storage_Model {
|
|
327 |
|
328 |
$columns = array();
|
329 |
|
330 |
-
foreach ( $this->
|
331 |
|
332 |
-
include_once
|
333 |
|
334 |
if ( ! class_exists( $classname ) )
|
335 |
continue;
|
@@ -585,13 +565,4 @@ abstract class CPAC_Storage_Model {
|
|
585 |
|
586 |
return add_query_arg( array( 'page' => 'codepress-admin-columns', 'cpac_key' => $this->key ), admin_url( 'options-general.php' ) );
|
587 |
}
|
588 |
-
|
589 |
-
/**
|
590 |
-
* Flush Cache
|
591 |
-
*
|
592 |
-
* @since 2.0.0
|
593 |
-
*/
|
594 |
-
function flush_cache() {
|
595 |
-
delete_transient( 'cpac_custom_columns' . $this->key );
|
596 |
-
}
|
597 |
}
|
39 |
*/
|
40 |
public $page;
|
41 |
|
42 |
+
/**
|
43 |
+
* Custom Column
|
44 |
+
*
|
45 |
+
* @since 2.0.1
|
46 |
+
*/
|
47 |
+
protected $custom_columns;
|
48 |
+
|
49 |
/**
|
50 |
* Get default columns
|
51 |
*
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
+
* Set custom columns
|
208 |
+
*
|
209 |
* Goes through all files in 'classes/column' and includes each file.
|
210 |
*
|
211 |
+
* since 2.0.1
|
212 |
*
|
213 |
+
* @return array Column Classnames | Filepaths
|
214 |
*/
|
215 |
+
protected function set_custom_columns() {
|
216 |
+
$columns = array(
|
217 |
+
'CPAC_Column_Custom_Field' => CPAC_DIR . 'classes/column/custom-field.php'
|
218 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
+
$iterator = new DirectoryIterator( CPAC_DIR . 'classes/column/' . $this->type );
|
|
|
|
|
|
|
221 |
|
222 |
+
foreach( $iterator as $leaf ) {
|
|
|
223 |
|
224 |
+
if ( $leaf->isDot() ) continue;
|
|
|
|
|
|
|
225 |
|
226 |
+
// build classname from filename
|
227 |
+
$class_name = implode( '_', array_map( 'ucfirst', explode( '-', basename( $leaf->getFilename(), '.php' ) ) ) );
|
228 |
|
229 |
+
$columns[ 'CPAC_Column_' . ucfirst( $this->type ) . '_' . $class_name ] = $leaf->getPathname();
|
230 |
}
|
231 |
|
232 |
+
$this->custom_columns = apply_filters( 'cac/columns/custom/type=' . $this->type, $columns, $this );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
|
235 |
/**
|
307 |
|
308 |
$columns = array();
|
309 |
|
310 |
+
foreach ( $this->custom_columns as $classname => $path ) {
|
311 |
|
312 |
+
include_once $path;
|
313 |
|
314 |
if ( ! class_exists( $classname ) )
|
315 |
continue;
|
565 |
|
566 |
return add_query_arg( array( 'page' => 'codepress-admin-columns', 'cpac_key' => $this->key ), admin_url( 'options-general.php' ) );
|
567 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
}
|
classes/storage_model/comment.php
CHANGED
@@ -14,6 +14,8 @@ class CPAC_Storage_Model_Comment extends CPAC_Storage_Model {
|
|
14 |
$this->type = 'comment';
|
15 |
$this->page = 'edit-comments';
|
16 |
|
|
|
|
|
17 |
// headings
|
18 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
19 |
|
14 |
$this->type = 'comment';
|
15 |
$this->page = 'edit-comments';
|
16 |
|
17 |
+
$this->set_custom_columns();
|
18 |
+
|
19 |
// headings
|
20 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
21 |
|
classes/storage_model/link.php
CHANGED
@@ -14,6 +14,8 @@ class CPAC_Storage_Model_Link extends CPAC_Storage_Model {
|
|
14 |
$this->type = 'link';
|
15 |
$this->page = 'link-manager';
|
16 |
|
|
|
|
|
17 |
// headings
|
18 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
19 |
|
14 |
$this->type = 'link';
|
15 |
$this->page = 'link-manager';
|
16 |
|
17 |
+
$this->set_custom_columns();
|
18 |
+
|
19 |
// headings
|
20 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
21 |
|
classes/storage_model/media.php
CHANGED
@@ -14,6 +14,8 @@ class CPAC_Storage_Model_Media extends CPAC_Storage_Model {
|
|
14 |
$this->type = 'media';
|
15 |
$this->page = 'upload';
|
16 |
|
|
|
|
|
17 |
// headings
|
18 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
19 |
|
14 |
$this->type = 'media';
|
15 |
$this->page = 'upload';
|
16 |
|
17 |
+
$this->set_custom_columns();
|
18 |
+
|
19 |
// headings
|
20 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
21 |
|
classes/storage_model/post.php
CHANGED
@@ -14,6 +14,8 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
|
|
14 |
$this->type = 'post';
|
15 |
$this->page = 'edit';
|
16 |
|
|
|
|
|
17 |
// Headings
|
18 |
|
19 |
// Since 3.1
|
14 |
$this->type = 'post';
|
15 |
$this->page = 'edit';
|
16 |
|
17 |
+
$this->set_custom_columns();
|
18 |
+
|
19 |
// Headings
|
20 |
|
21 |
// Since 3.1
|
classes/storage_model/user.php
CHANGED
@@ -14,6 +14,8 @@ class CPAC_Storage_Model_User extends CPAC_Storage_Model {
|
|
14 |
$this->type = 'user';
|
15 |
$this->page = 'users';
|
16 |
|
|
|
|
|
17 |
// headings
|
18 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
19 |
|
14 |
$this->type = 'user';
|
15 |
$this->page = 'users';
|
16 |
|
17 |
+
$this->set_custom_columns();
|
18 |
+
|
19 |
// headings
|
20 |
add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ) );
|
21 |
|
classes/upgrade.php
CHANGED
@@ -70,11 +70,7 @@ class CPAC_Upgrade {
|
|
70 |
|
71 |
// run every upgrade
|
72 |
if ( $version < CPAC_VERSION ) {
|
73 |
-
|
74 |
-
// flush this transient so new custom columns get added.
|
75 |
-
foreach ( $this->cpac->storage_models as $storage_model ) {
|
76 |
-
$storage_model->flush_cache();
|
77 |
-
}
|
78 |
}
|
79 |
|
80 |
// run only when updating from v1 to v2
|
70 |
|
71 |
// run every upgrade
|
72 |
if ( $version < CPAC_VERSION ) {
|
73 |
+
// nothing yet
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
// run only when updating from v1 to v2
|
classes/utility.php
CHANGED
@@ -34,3 +34,5 @@ function cpac_admin_notice() {
|
|
34 |
*/
|
35 |
add_filter( 'cac/display_licence/addon=cac-filtering', '__return_false' );
|
36 |
add_filter( 'cac/display_licence/addon=cac-custom-fields', '__return_false' );
|
|
|
|
34 |
*/
|
35 |
add_filter( 'cac/display_licence/addon=cac-filtering', '__return_false' );
|
36 |
add_filter( 'cac/display_licence/addon=cac-custom-fields', '__return_false' );
|
37 |
+
|
38 |
+
|
codepress-admin-columns.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
|
4 |
Plugin Name: Codepress Admin Columns
|
5 |
-
Version: 2.0.
|
6 |
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
7 |
Author: Codepress
|
8 |
Author URI: http://www.codepresshq.com
|
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
29 |
|
30 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
31 |
|
32 |
-
define( 'CPAC_VERSION', '2.0.
|
33 |
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // this is the latest version which requires an upgrade
|
34 |
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
|
35 |
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
|
2 |
/*
|
3 |
|
4 |
Plugin Name: Codepress Admin Columns
|
5 |
+
Version: 2.0.1
|
6 |
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
7 |
Author: Codepress
|
8 |
Author URI: http://www.codepresshq.com
|
29 |
|
30 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
31 |
|
32 |
+
define( 'CPAC_VERSION', '2.0.1' ); // current plugin version
|
33 |
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // this is the latest version which requires an upgrade
|
34 |
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
|
35 |
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 3.6
|
7 |
-
Stable tag: 2.0.
|
8 |
|
9 |
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
10 |
|
@@ -248,6 +248,10 @@ add_filter( 'cpac_get_column_value_custom_field', 'my_custom_field_value', 10, 5
|
|
248 |
|
249 |
== Changelog ==
|
250 |
|
|
|
|
|
|
|
|
|
251 |
= 2.0.0 =
|
252 |
* [Notice] Database needs an update, make sure to backup first
|
253 |
* [Changed] Sortorder licence is now an Pro Add-on
|
4 |
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 2.0.1
|
8 |
|
9 |
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
|
10 |
|
248 |
|
249 |
== Changelog ==
|
250 |
|
251 |
+
|
252 |
+
= 2.0.1 =
|
253 |
+
*[Fixed] Bug which caused columns to not include properly
|
254 |
+
|
255 |
= 2.0.0 =
|
256 |
* [Notice] Database needs an update, make sure to backup first
|
257 |
* [Changed] Sortorder licence is now an Pro Add-on
|