PluginProbe
Vimeography: Vimeo Video Gallery WordPress Plugin / 2.2
Vimeography: Vimeo Video Gallery WordPress Plugin v2.2
2.4.9 2.4.8 trunk 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.6 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.6.7 0.6.8 0.6.8.1 0.6.9 0.6.9.1 0.6.9.2 0.7 0.8 All 103 releases
← All changes | lib/init.php +39 -70 trunk2.2 View file →
@@ -1,21 +1,17 @@
1 1 <?php
2 2
3 3 // Exit if accessed directly
4 -if (!defined('ABSPATH')) {
5 - exit();
6 -}
4 +if ( ! defined( 'ABSPATH' ) ) exit;
7 5
8 -class Vimeography_Init extends Vimeography
9 -{
10 - public function __construct()
11 - {
12 - add_action('init', array($this, 'vimeography_load_text_domain'));
13 - add_action('init', array($this, 'vimeography_written_block_robots'));
14 - add_action('init', array($this, 'vimeography_add_gallery_helper'));
6 +class Vimeography_Init extends Vimeography {
7 + public function __construct() {
8 + add_action( 'init', array($this, 'vimeography_load_text_domain') );
9 + add_action( 'init', array($this, 'vimeography_written_block_robots') );
10 + add_action( 'init', array($this, 'vimeography_add_gallery_helper') );
15 11
16 - add_action('wp_head', array($this, 'output_referrer_tag'));
17 - add_action('admin_head', array($this, 'output_referrer_tag'));
12 + add_action( 'wp_head', array( $this, 'output_referrer_tag' ) );
13 + add_action( 'admin_head', array( $this, 'output_referrer_tag') );
18 14 }
19 15
20 16 /**
21 17 * Adds a referrer policy to the user's site so that
@@ -23,13 +19,12 @@
23 19 * of this domain name being the referring domain.
24 20 *
25 21 * @return void
26 22 */
27 - public function output_referrer_tag()
28 - {
29 - $enable = apply_filters('vimeography.privacy.enable_referrer', false);
23 + public function output_referrer_tag() {
24 + $enable = apply_filters( 'vimeography.privacy.enable_referrer', false );
30 25
31 - if ($enable) {
26 + if ( $enable ) {
32 27 echo '<meta name="referrer" content="origin">';
33 28 }
34 29
35 30 return;
@@ -34,19 +29,15 @@
34 29
35 30 return;
36 31 }
37 32
33 +
38 34 /**
39 35 * Localization
40 36 * @return [type] [description]
41 37 */
42 - public function vimeography_load_text_domain()
43 - {
44 - load_plugin_textdomain(
45 - 'vimeography',
46 - false,
47 - dirname(VIMEOGRAPHY_BASENAME) . '/languages/'
48 - );
38 + public function vimeography_load_text_domain() {
39 + load_plugin_textdomain('vimeography', false, dirname( VIMEOGRAPHY_BASENAME ) . '/languages/');
49 40 }
50 41
51 42 /**
52 43 * Writes to the user's ACTUAL robots.txt file (if it exists) to block directories.
@@ -53,29 +44,24 @@
53 44 *
54 45 * @access public
55 46 * @return void
56 47 */
57 - public function vimeography_written_block_robots()
58 - {
48 + public function vimeography_written_block_robots() {
59 49 // Let's check if the user has a custom robots.txt file.
60 - if (file_exists(ABSPATH . '/robots.txt')) {
50 + if ( file_exists( ABSPATH . '/robots.txt' ) ) {
61 51 // See if our rule already exists inside of it.
62 - $robotstxt = file_get_contents(ABSPATH . '/robots.txt');
63 - $blocked_asset_path = str_ireplace(
64 - site_url(),
65 - '',
66 - VIMEOGRAPHY_ASSETS_URL
67 - );
52 + $robotstxt = file_get_contents( ABSPATH . '/robots.txt' );
53 + $blocked_asset_path = str_ireplace( site_url(), '', VIMEOGRAPHY_ASSETS_URL );
68 54
69 55 $disallow_value = $blocked_asset_path === false ? "true" : "false";
70 56
71 - if (strpos($robotstxt, 'Disallow: ' . $disallow_value)) {
57 + if ( strpos( $robotstxt, 'Disallow: ' . $disallow_value ) ) {
72 58 // Write our rule.
73 - $robotstxt .= "\nDisallow: " . $blocked_asset_path . "\n";
59 + $robotstxt .= "\nDisallow: " . $blocked_asset_path."\n";
74 60 file_put_contents(ABSPATH . '/robots.txt', $robotstxt);
75 61 }
76 62 }
77 - return true;
63 + return TRUE;
78 64 }
79 65
80 66 /**
81 67 * [vimeography_add_gallery_helper description]
@@ -80,32 +66,18 @@
80 66 /**
81 67 * [vimeography_add_gallery_helper description]
82 68 * @return [type] [description]
83 69 */
84 - public function vimeography_add_gallery_helper()
85 - {
86 - if (
87 - in_array(VIMEOGRAPHY_CURRENT_PAGE, array(
88 - 'post.php',
89 - 'page.php',
90 - 'page-new.php',
91 - 'post-new.php'
92 - ))
93 - ) {
94 - add_action('admin_footer', array(&$this, 'vimeography_add_mce_popup'));
70 + public function vimeography_add_gallery_helper() {
71 + if ( in_array(VIMEOGRAPHY_CURRENT_PAGE, array('post.php', 'page.php', 'page-new.php', 'post-new.php')) ) {
72 + add_action('admin_footer', array(&$this, 'vimeography_add_mce_popup'));
95 73 }
96 74
97 - if (get_user_option('rich_editing') == 'true') {
98 - add_filter('mce_external_plugins', array(
99 - &$this,
100 - 'vimeography_add_editor_plugin'
101 - ));
102 - add_filter('mce_buttons', array(
103 - &$this,
104 - 'vimeography_register_editor_button'
105 - ));
75 + if ( get_user_option('rich_editing') == 'true' ) {
76 + add_filter( 'mce_external_plugins', array(&$this, 'vimeography_add_editor_plugin' ));
77 + add_filter( 'mce_buttons', array(&$this, 'vimeography_register_editor_button') );
106 78 }
107 - return true;
79 + return TRUE;
108 80 }
109 81
110 82 /**
111 83 * Action target that displays the popup to insert a form to a post/page.
@@ -112,17 +84,16 @@
112 84 *
113 85 * @access public
114 86 * @return void
115 87 */
116 - public function vimeography_add_mce_popup()
117 - {
118 - $mustache = new Mustache_Engine(array(
119 - 'loader' => new Mustache_Loader_FilesystemLoader(
120 - VIMEOGRAPHY_PATH . 'lib/admin/templates'
88 + public function vimeography_add_mce_popup() {
89 + $mustache = new Mustache_Engine(
90 + array(
91 + 'loader' => new Mustache_Loader_FilesystemLoader(VIMEOGRAPHY_PATH . 'lib/admin/templates'),
121 92 )
122 - ));
93 + );
123 94 require_once VIMEOGRAPHY_PATH . 'lib/admin/controllers/vimeography/mce.php';
124 - $view = new Vimeography_MCE();
95 + $view = new Vimeography_MCE;
125 96 $template = $mustache->loadTemplate('vimeography/mce');
126 97 echo $template->render($view);
127 98 }
128 99
@@ -130,12 +101,10 @@
130 101 * [vimeography_add_editor_plugin description]
131 102 * @param [type] $plugin_array [description]
132 103 * @return [type] [description]
133 104 */
134 - public function vimeography_add_editor_plugin($plugin_array)
135 - {
136 - $plugin_array['vimeography'] =
137 - VIMEOGRAPHY_URL . 'lib/admin/assets/js/mce.js';
105 + public function vimeography_add_editor_plugin( $plugin_array ) {
106 + $plugin_array['vimeography'] = VIMEOGRAPHY_URL . 'lib/admin/assets/js/mce.js';
138 107 return $plugin_array;
139 108 }
140 109
141 110 /**
@@ -142,10 +111,10 @@
142 111 * [vimeography_register_editor_button description]
143 112 * @param [type] $buttons [description]
144 113 * @return [type] [description]
145 114 */
146 - public function vimeography_register_editor_button($buttons)
147 - {
148 - array_push($buttons, "|", "vimeography");
115 + public function vimeography_register_editor_button($buttons) {
116 + array_push( $buttons, "|", "vimeography" );
149 117 return $buttons;
150 118 }
119 +
151 120 }