| 1 |
<?php |
| 2 |
/** |
| 3 |
* Author: Alin Marcu |
| 4 |
* Author URI: https://deconf.com |
| 5 |
* Copyright 2013 Alin Marcu |
| 6 |
* License: GPLv2 or later |
| 7 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
if ( ! defined( 'ABSPATH' ) ) |
| 12 |
exit(); |
| 13 |
|
| 14 |
if ( ! class_exists( 'CAWP_Backend_Item_Reports' ) ) { |
| 15 |
|
| 16 |
final class CAWP_Backend_Item_Reports { |
| 17 |
|
| 18 |
private $cawp; |
| 19 |
|
| 20 |
public function __construct() { |
| 21 |
$this->cawp = CAWP(); |
| 22 |
|
| 23 |
if ( CAWP_Tools::check_roles( $this->cawp->config->options['access_back'] ) && 1 == $this->cawp->config->options['backend_item_reports'] ) { |
| 24 |
/** |
| 25 |
* Add custom column in Posts List |
| 26 |
*/ |
| 27 |
add_filter( 'manage_posts_columns', array( $this, 'add_columns' ), 99 ); |
| 28 |
/** |
| 29 |
* Populate custom column in Posts List |
| 30 |
*/ |
| 31 |
add_action( 'manage_posts_custom_column', array( $this, 'add_icons' ), 99, 2 ); |
| 32 |
/** |
| 33 |
* Add custom column in Pages List |
| 34 |
*/ |
| 35 |
add_filter( 'manage_pages_columns', array( $this, 'add_columns' ), 99 ); |
| 36 |
/** |
| 37 |
* Populate custom column in Pages List |
| 38 |
*/ |
| 39 |
add_action( 'manage_pages_custom_column', array( $this, 'add_icons' ), 99, 2 ); |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
public function add_icons( $column, $id ) { |
| 44 |
global $wp_version; |
| 45 |
|
| 46 |
if ( 'cawp_stats' != $column ) { |
| 47 |
return; |
| 48 |
} |
| 49 |
|
| 50 |
echo '<a id="cawp-' . $id . '" title="' . get_the_title( $id ) . '" href="#' . $id . '" class="cawp-icon dashicons-before dashicons-chart-line"> </a>'; |
| 51 |
} |
| 52 |
|
| 53 |
public function add_columns( $columns ) { |
| 54 |
return array_merge( $columns, array( 'cawp_stats' => '<span class="dashicons dashicons-analytics" title="Clicky Analytics"></span>' ) ); |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
|