/** * Load the object and get the current state * * @access public * @since 0.1 * @return $class_object */ public static function get_object() { if (NULL == self::$class_object) { self::$class_object = new self(); } return self::$class_object; }
/** * add the metaboxes on posts and pages * * @access public * @since 0.1 * @uses add_meta_box * @global $post | the current post * @return void */ public function add_meta_boxes($post_type = NULL, $post = NULL) { $post_types = $this->get_custom_post_types(); if (is_null($post_type) or is_null($post) or empty($post_types) or empty($post_types[$post_type])) { return; } $options = get_site_option('inpsyde_multilingual_cpt'); foreach ($post_types as $cpt => $params) { if ($cpt == $post_type) { if (!empty($options['post_types'][$cpt])) { // Do we have linked elements? $linked = mlp_get_linked_elements($post->ID); if (!$linked) { return add_meta_box('multilingual_press_translate', __(sprintf('Multilingual Press: Translate %s', $cpt), 'multilingualpress'), array($this, 'display_meta_box_translate'), $cpt, 'normal', 'high'); } // Register metaboxes add_meta_box('multilingual_press_link', __(sprintf('Multilingual Press: Linked %s', $cpt)), array($this, 'display_cpt_meta_box'), $cpt, 'normal', 'high'); } else { if (is_callable(array('Multilingual_Press_Trasher', 'get_object'))) { remove_filter('post_submitbox_misc_actions', array(Multilingual_Press_Trasher::get_object(), 'post_submitbox_misc_actions')); } if (is_callable(array('Multilingual_Press_Dashboard_Widget', 'get_object'))) { remove_filter('post_submitbox_misc_actions', array(Multilingual_Press_Dashboard_Widget::get_object(), 'post_submitbox_misc_actions')); } } } } }