| 1 |
<?php |
| 2 |
// Prevent direct file access |
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* This class handles the posts table shortcode registration. |
| 9 |
* |
| 10 |
* @package Posts_Table_Search_And_Sort |
| 11 |
* @author Barn2 Media <info@barn2.co.uk> |
| 12 |
* @license GPL-3.0 |
| 13 |
* @link https://barn2.co.uk |
| 14 |
* @copyright 2016-2018 Barn2 Media Ltd |
| 15 |
*/ |
| 16 |
class Posts_Data_Table_Shortcode { |
| 17 |
|
| 18 |
const SHORTCODE = 'posts_data_table'; |
| 19 |
|
| 20 |
public static function register_shortcode() { |
| 21 |
add_shortcode( self::SHORTCODE, array( __CLASS__, 'do_shortcode' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Handles our posts data table shortcode. |
| 26 |
* |
| 27 |
* @param array $atts The shortcode attributes specified by the user. |
| 28 |
* @param string $content The content between the open and close shortcode tags (not used) |
| 29 |
* @return string The shortcode output |
| 30 |
*/ |
| 31 |
public static function do_shortcode( $atts, $content = '' ) { |
| 32 |
// Parse attributes |
| 33 |
$atts = shortcode_atts( Posts_Data_Table_Simple::$default_args, $atts, self::SHORTCODE ); |
| 34 |
|
| 35 |
// Create table and return output |
| 36 |
$table = new Posts_Data_Table_Simple(); |
| 37 |
return $table->get_table( $atts ); |
| 38 |
} |
| 39 |
|
| 40 |
} |