| 1 |
<?php |
| 2 |
/** |
| 3 |
* Table Preview View |
| 4 |
* |
| 5 |
* @package TablePress |
| 6 |
* @subpackage Views |
| 7 |
* @author Tobias Bäthge |
| 8 |
* @since 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
// Prohibit direct script loading. |
| 12 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' ); |
| 13 |
|
| 14 |
/** |
| 15 |
* Table Preview View class |
| 16 |
* @package TablePress |
| 17 |
* @subpackage Views |
| 18 |
* @author Tobias Bäthge |
| 19 |
* @since 1.0.0 |
| 20 |
*/ |
| 21 |
class TablePress_Preview_Table_View extends TablePress_View { |
| 22 |
|
| 23 |
/** |
| 24 |
* Initialize the View class. |
| 25 |
* |
| 26 |
* @since 1.0.0 |
| 27 |
*/ |
| 28 |
public function __construct() { |
| 29 |
// Intentionally left empty, to void code from parent::__construct(). |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Set up the view with data and do things that are specific for this view. |
| 34 |
* |
| 35 |
* @since 1.0.0 |
| 36 |
* |
| 37 |
* @param string $action Action for this view. |
| 38 |
* @param array $data Data for this view. |
| 39 |
*/ |
| 40 |
public function setup( $action, array $data ) { |
| 41 |
$this->action = $action; |
| 42 |
$this->data = $data; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Render the current view. |
| 47 |
* |
| 48 |
* @since 1.0.0 |
| 49 |
*/ |
| 50 |
public function render() { |
| 51 |
_wp_admin_html_begin(); |
| 52 |
?> |
| 53 |
<title><?php printf( __( '%1$s ‹ %2$s', 'tablepress' ), __( 'Preview', 'tablepress' ), 'TablePress' ); ?></title> |
| 54 |
<style type="text/css"> |
| 55 |
body { |
| 56 |
margin-top: -6px !important; |
| 57 |
} |
| 58 |
</style> |
| 59 |
<?php echo $this->data['head_html']; ?> |
| 60 |
</head> |
| 61 |
<body> |
| 62 |
<div id="tablepress-page"> |
| 63 |
<p> |
| 64 |
<?php _e( 'This is a preview of your table.', 'tablepress' ); ?> <?php _e( 'Because of CSS styling in your theme, the table might look different on your page!', 'tablepress' ); ?> <?php _e( 'The features of the DataTables JavaScript library are also not available or visible in this preview!', 'tablepress' ); ?><br /> |
| 65 |
<?php printf( __( 'To insert the table into a page, post, or text widget, copy the Shortcode %s and paste it into the editor.', 'tablepress' ), '<input type="text" class="table-shortcode table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . " id={$this->data['table_id']} /]" ) . '" readonly="readonly" />' ); ?> |
| 66 |
</p> |
| 67 |
<?php echo $this->data['body_html']; ?> |
| 68 |
</div> |
| 69 |
</body> |
| 70 |
</html> |
| 71 |
<?php |
| 72 |
} |
| 73 |
|
| 74 |
} // class TablePress_Preview_Table_View |
| 75 |
|