-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreviewizer.php
More file actions
78 lines (69 loc) · 1.64 KB
/
Copy pathpreviewizer.php
File metadata and controls
78 lines (69 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
Plugin Name: Previewizer
Plugin URI: null
Description: This plugin adds a split pane view for previewing posts as you add content or design them.
Version: 0.0.1
Author: Bill Columbia
Author URI: http://billcolumbia.com
License: MIT
License URI: http://opensource.org/licenses/MIT
*/
/**
*
*/
class Previewizer {
/**
* Adds actions (Previewizer.init) to WordPress life cycle
*
* @return true
*/
function __construct()
{
add_action( 'admin_enqueue_scripts', array( $this, 'setup_assets' ) );
}
public function not_post_context( $hook )
{
if ( 'post-new.php' != $hook && 'post.php' != $hook )
{
return true;
}
}
public $meow;
/**
* Intializes plugin
*
* @return true
*/
public function setup_assets( $hook )
{
if ( $this->not_post_context( $hook ) )
{
return;
}
// Add Previewizer Script to WordPress Admin
wp_enqueue_script(
'previewizer', // handle
plugins_url( '../previewizer/previewizer.js', __FILE__ ), // src
array( 'jquery', 'jquery-ui-resizable' ), // dependencies
'0.0.1', // version
true
);
// Add Previewizer Styles to WordPress Admin
wp_enqueue_style(
'previewizer', // handle
plugins_url( '../previewizer/previewizer.css', __FILE__ ), // src
false,// dependencies
'0.0.1',// version
'all'
);
$this->meow = $hook;
add_action( 'admin_footer', array( $this, 'append_markup' ) );
}
public function append_markup()
{
echo '<div class="previewizer-panel"></div>';
echo '<pre>' . $this->meow . '</pre>';
}
}
$previewizer = new Previewizer();