PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / trunk
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts vtrunk
2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 All 28 releases
← All changes | includes/class.snippet.php +20 -19 2.6.0trunk View file →
@@ -9,14 +9,13 @@
9 9 protected $id;
10 10
11 11 protected $type;
12 12
13 - public function __construct(WP_Post $snippet) {
13 + public function __construct( WP_Post $snippet ) {
14 14 $this->id = $snippet->ID;
15 15
16 - //todo: to refactor
16 + // todo: to refactor
17 17 $this->type = WINP_Helper::get_snippet_type( $this->id );
18 -
19 18 }
20 19
21 20 public static function get_snippet( $post_id ) {
22 21 $post_id = (int) $post_id;
@@ -23,10 +22,10 @@
23 22
24 23 if ( ! $post_id ) {
25 24 $snippet = get_post( $post_id );
26 25
27 - if($snippet) {
28 - return new self($snippet);
26 + if ( $snippet ) {
27 + return new self( $snippet );
29 28 }
30 29 }
31 30
32 31 return null;
@@ -35,13 +34,16 @@
35 34 public function is_allowed() {
36 35 // If the user has prohibited the insertion of unfiltered HTML,
37 36 // we prohibit the execution of snippets.
38 37 if ( ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
39 - && ! in_array( $this->type, [
40 - WINP_SNIPPET_TYPE_TEXT,
41 - WINP_SNIPPET_TYPE_AD,
42 - WINP_SNIPPET_TYPE_CSS
43 - ] ) ) {
38 + && ! in_array(
39 + $this->type,
40 + [
41 + WINP_SNIPPET_TYPE_TEXT,
42 + WINP_SNIPPET_TYPE_AD,
43 + WINP_SNIPPET_TYPE_CSS,
44 + ]
45 + ) ) {
44 46 return false;
45 47 }
46 48
47 49 return true;
@@ -46,25 +48,24 @@
46 48
47 49 return true;
48 50 }
49 51
50 - public function get_meta($key) {
51 - return get_post_meta( $this->id, WINP_Plugin::app()->getPrefix() . $key, true );
52 + public function get_meta( $key ) {
53 + return get_post_meta( $this->id, 'wbcr_inp_' . $key, true );
52 54 }
53 55
54 56 public function get_scope() {
55 - return $this->get_meta('snippet_scope');
56 -
57 + return $this->get_meta( 'snippet_scope' );
57 58 }
58 59
59 60 public function get_content() {
60 - return $this->get_meta('snippet_code');
61 + return $this->get_meta( 'snippet_code' );
61 62 }
62 63
63 64 public function is_active() {
64 65 // WPML Compatibility
65 66 if ( defined( 'WPML_PLUGIN_FILE' ) ) {
66 - $wpml_langs = $this->get_meta('snippet_wpml_lang');
67 + $wpml_langs = $this->get_meta( 'snippet_wpml_lang' );
67 68
68 69 if ( $wpml_langs !== '' && defined( 'ICL_LANGUAGE_CODE' ) ) {
69 70 if ( ! in_array( ICL_LANGUAGE_CODE, explode( ',', $wpml_langs ) ) ) {
70 71 return false;
@@ -71,8 +72,8 @@
71 72 }
72 73 }
73 74 }
74 75
75 - //todo: протестировать
76 - return $this->get_meta('snippet_activate');
76 + // todo: протестировать
77 + return $this->get_meta( 'snippet_activate' );
77 78 }
78 -}
79 +}