1 | <?php |
||
37 | final class Metabox |
||
38 | { |
||
39 | |||
40 | /** |
||
41 | * Subway visibility meta value, |
||
42 | * |
||
43 | * @since 2.0.9 |
||
44 | * @const string VISIBILITY_METAKEY |
||
45 | */ |
||
46 | const VISIBILITY_METAKEY = 'subway_visibility_meta_key'; |
||
47 | |||
48 | /** |
||
49 | * Registers and update metabox with its intended method below. |
||
50 | * |
||
51 | * @since 2.0.9 |
||
52 | * @return void |
||
|
|||
53 | */ |
||
54 | public function __construct() |
||
71 | |||
72 | /** |
||
73 | * Initialize metabox |
||
74 | * |
||
75 | * @since 2.0.9 |
||
76 | * @access public |
||
77 | * @return void |
||
78 | */ |
||
79 | public static function initMetabox() |
||
83 | |||
84 | /** |
||
85 | * Initialize metabox |
||
86 | * |
||
87 | * @since 2.0.9 |
||
88 | * @access public |
||
89 | * @return void |
||
90 | */ |
||
91 | public function addMetabox() |
||
106 | |||
107 | /** |
||
108 | * This method displays the Subway Visibility checkbox. |
||
109 | * |
||
110 | * @param object $post Contains data from the current post. |
||
111 | * |
||
112 | * @since 2.0.9 |
||
113 | * @access public |
||
114 | * @return void |
||
115 | */ |
||
116 | public function visibilityMetabox( $post ) |
||
159 | |||
160 | /** |
||
161 | * This method verify if nonce is valid then updates a post_meta. |
||
162 | * |
||
163 | * @param integer $post_id Contains ID of the current post. |
||
164 | * |
||
165 | * @since 2.0.9 |
||
166 | * @access public |
||
167 | * @return boolean false Returns false if nonce is not valid. |
||
168 | */ |
||
169 | public function saveVisibilityMetabox( $post_id = '' ) |
||
229 | |||
230 | /** |
||
231 | * This method runs the methods that handles the update for a post_meta. |
||
232 | * |
||
233 | * @param integer $post_id Contains ID of the current post. |
||
234 | * |
||
235 | * @since 2.0.9 |
||
236 | * @access public |
||
237 | * @return boolean false Returns false if nonce is not valid. |
||
238 | */ |
||
239 | public function saveMetaboxValues( $post_id ) |
||
244 | |||
245 | /** |
||
246 | * Initialize metabox arguments. |
||
247 | * |
||
248 | * @param array $args The arguments for the get_post_types(). |
||
249 | * @param string $output Your desired output for the data. |
||
250 | * |
||
251 | * @since 2.0.9 |
||
252 | * @access public |
||
253 | * @return void |
||
254 | */ |
||
255 | public static function getPostTypes( $args = '', $output = '' ) |
||
268 | |||
269 | /** |
||
270 | * This method verify if nonce is valid. |
||
271 | * |
||
272 | * @param mixed $nonce the name of a metabox nonce. |
||
273 | * |
||
274 | * @since 2.0.9 |
||
275 | * @access public |
||
276 | * @return boolean true Returns true if nonce is valid. |
||
277 | */ |
||
278 | public function isNonceValid( $nonce ) |
||
286 | |||
287 | /** |
||
288 | * Checks if a post is set to private. |
||
289 | * |
||
290 | * @param integer $post_id Contains ID of the current post. |
||
291 | * |
||
292 | * @since 2.0.9 |
||
293 | * @access public |
||
294 | * @return boolean true Returns true if post is private. Otherwise false. |
||
295 | */ |
||
296 | public static function isPostPrivate( $post_id ) |
||
319 | |||
320 | /** |
||
321 | * Checks if a post is set to public. |
||
322 | * |
||
323 | * @param integer $post_id Contains ID of the current post. |
||
324 | * |
||
325 | * @since 2.0.9 |
||
326 | * @access public |
||
327 | * @return boolean true Returns true if post is public. Otherwise false. |
||
328 | */ |
||
329 | public static function isPostPublic( $post_id ) |
||
341 | |||
342 | } |
||
343 |
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.