1 | <?php |
||
22 | abstract class GravityView_Plugin_and_Theme_Hooks { |
||
23 | |||
24 | /** |
||
25 | * @type string Optional. Class that should be exist in a plugin or theme. Used to check whether plugin is active. |
||
26 | * @since 1.15.2 |
||
27 | */ |
||
28 | protected $class_name = false; |
||
29 | |||
30 | /** |
||
31 | * @type string Optional. Function that should be exist in a plugin or theme. Used to check whether plugin is active. |
||
32 | * @since 1.15.2 |
||
33 | */ |
||
34 | protected $function_name = false; |
||
35 | |||
36 | /** |
||
37 | * @type string Optional. Constant that should be defined by plugin or theme. Used to check whether plugin is active. |
||
38 | * @since 1.15.2 |
||
39 | */ |
||
40 | protected $constant_name = false; |
||
41 | |||
42 | /** |
||
43 | * Define the keys to be parsed by the `gravityview/data/parse/meta_keys` hook |
||
44 | * @see GravityView_View_Data::parse_post_meta |
||
45 | * @since 1.15.2 |
||
46 | * @type array |
||
47 | */ |
||
48 | protected $content_meta_keys = array(); |
||
49 | |||
50 | /** |
||
51 | * Define script handles used by the theme or plugin to be parsed by the `gravityview/data/parse/meta_keys` hook |
||
52 | * @see GravityView_Admin::remove_conflicts |
||
53 | * @since 1.15.2 |
||
54 | * @type array |
||
55 | */ |
||
56 | protected $script_handles = array(); |
||
57 | |||
58 | /** |
||
59 | * Define style handles used by the theme or plugin to be parsed by the `gravityview/data/parse/meta_keys` hook |
||
60 | * @see GravityView_Admin::remove_conflicts |
||
61 | * @since 1.15.2 |
||
62 | * @type array |
||
63 | */ |
||
64 | protected $style_handles = array(); |
||
65 | |||
66 | /** |
||
67 | * Define features in the admin editor used by the theme or plugin to be used when registering the GravityView post type |
||
68 | * @see \GV\Entry::get_endpoint_name |
||
69 | * @since 1.15.2 |
||
70 | * @type array |
||
71 | */ |
||
72 | protected $post_type_support = array(); |
||
73 | |||
74 | /** |
||
75 | * GravityView_Theme_Support constructor. |
||
76 | * @return void |
||
|
|||
77 | */ |
||
78 | public function __construct() { |
||
81 | |||
82 | /** |
||
83 | * Fired when all themes and plugins have been loaded. |
||
84 | * This makes sure we can reliably detect functions and classes. |
||
85 | * @internal |
||
86 | * @return void |
||
87 | */ |
||
88 | public function _wp_loaded() { |
||
91 | |||
92 | /** |
||
93 | * Check whether plugin or theme exists. If so, add hooks. |
||
94 | * This is to reduce load time, since `apply_filters()` isn't free. |
||
95 | * If the class name or function name or constant exists for a plugin or theme, add hooks |
||
96 | * If the class/function/definition aren't speicifed add the hooks |
||
97 | * |
||
98 | * @since 1.15.2 |
||
99 | * @return void |
||
100 | */ |
||
101 | private function maybe_add_hooks() { |
||
110 | |||
111 | /** |
||
112 | * Add filters for meta key and script/style handles, if defined. |
||
113 | * @since 1.15.2 |
||
114 | * @return void |
||
115 | */ |
||
116 | protected function add_hooks() { |
||
133 | |||
134 | /** |
||
135 | * Merge plugin or theme post type support definitions with existing support values |
||
136 | * |
||
137 | * @since 1.15.2 |
||
138 | * |
||
139 | * @param array $supports Array of features associated with a functional area of the edit screen. |
||
140 | * @param boolean $is_hierarchical Do Views support parent/child relationships? See `gravityview_is_hierarchical` filter. |
||
141 | * |
||
142 | * @return array Array of features associated with a functional area of the edit screen, merged with existing values |
||
143 | */ |
||
144 | public function merge_post_type_support( $supports = array(), $is_hierarchical = false ) { |
||
148 | |||
149 | /** |
||
150 | * Merge plugin or theme styles with existing no-conflict styles |
||
151 | * |
||
152 | * @since 1.15.2 |
||
153 | * |
||
154 | * @param array $handles Array of style handles, as registered with WordPress |
||
155 | * |
||
156 | * @return array Handles, merged with existing styles |
||
157 | */ |
||
158 | public function merge_noconflict_styles( $handles ) { |
||
162 | |||
163 | /** |
||
164 | * Merge plugin or theme scripts with existing no-conflict scripts |
||
165 | * |
||
166 | * @since 1.15.2 |
||
167 | * |
||
168 | * @param array $handles Array of script handles, as registered with WordPress |
||
169 | * |
||
170 | * @return array Handles, merged with existing scripts |
||
171 | */ |
||
172 | public function merge_noconflict_scripts( $handles ) { |
||
176 | |||
177 | /** |
||
178 | * Merge plugin or theme meta keys that store shortcode data with existing keys to check |
||
179 | * |
||
180 | * @since 1.15.2 |
||
181 | * |
||
182 | * @param array $handles Array of meta keys to check for existence of shortcodes |
||
183 | * @param int $post_id The ID being checked by GravityView |
||
184 | * |
||
185 | * @return array Meta key array, merged with existing meta keys |
||
186 | */ |
||
187 | public function merge_content_meta_keys( $meta_keys = array(), $post_id = 0 ) { |
||
190 | |||
191 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.