_settings = $core; $this->_active_ex = $active; $this->_config = $settings['config']; $this->_options = $settings['options']; add_action( 'add_meta_boxes', array( &$this, 'create_meta_boxes' ) ); add_action( 'save_post', array( &$this, 'save_meta_boxes' ) ); add_action('admin_enqueue_scripts', array($this, 'meta_scripts')); }//end __construct method function create_meta_boxes() { if ( function_exists( 'add_meta_box' ) ) { add_meta_box( $this->_config['id'], $this->_config['title'], array($this, 'render_box'), $this->_config['pages'], $this->_config['context'], $this->_config['priority'] ); } }//end create_meta_boxes function function save_meta_boxes( $post_id ) { global $post_type; if ( ! isset( $_POST[$this->_config['id'] . '_noncename'] ) ) { return $post_id; } if ( ! wp_verify_nonce( $_POST[$this->_config['id'] . '_noncename'], plugin_basename( __FILE__ ) ) ) { return $post_id; } if ( $_POST['post_type'] == 'page' ) { if ( ! current_user_can( 'edit_post', $post_id ) ) { return $post_id; } } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $post_id; } add_post_meta( $post_id, 'textfalse', false, true ); new Athena_Save( $this->_options, $post_id, $post_type, $_POST, $this->_active_ex); }//end save_meta_boxes method function render_box() { global $post; wp_enqueue_script( 'bootstrap-datetimepicker' ); wp_enqueue_style( 'fontawesome-css' ); wp_enqueue_style( 'bootstrap-css' ); wp_enqueue_style( 'select2-css' ); wp_enqueue_script( 'bootstrap-js' ); wp_enqueue_script( 'moments-js' ); wp_enqueue_script( 'athena-js' ); wp_enqueue_script( 'select2-js' ); echo '
'; foreach($this->_options as $key => $value){ $saved = get_post_meta($post->ID, $value['id'], true ); if(empty($saved)){ $saved = $value['default']; } new Athena_Fields($value, $saved, $this->_settings); } echo ''; echo '
'; }//end render_box method public function meta_scripts(){ wp_register_style('bootstrap-datetimepicker', ATHENA_URI. 'view/assets/css/bootstrap-datetimepicker.min.css', false); wp_register_style('fontawesome-css', ATHENA_URI.'view/assets/css/font-awesome.min.css', false); wp_register_style('bootstrap-css', ATHENA_URI.'view/assets/css/bootstrap.min.css', false); wp_register_style('select2-css', ATHENA_URI . 'view/assets/css/select2.min.css', false); wp_register_script('bootstrap-js', ATHENA_URI. 'view/assets/js/bootstrap.min.js', array('jquery'), '3.3.7', true); wp_register_script('moments-js', ATHENA_URI. 'view/assets/js/moments.min.js', array(), '2.18.1', true); wp_register_script('bootstrap-datetimepicker', ATHENA_URI. 'view/assets/js/bootstrap-datepicker.min.js', array('jquery', 'moments-js', 'bootstrap-js'), '4.17.42', true); wp_register_script('athena-js', ATHENA_URI . 'view/assets/js/athena-admin.js', array('jquery', 'bootstrap-js', 'moments-js', 'select2-js', 'bootstrap-datetimepicker'), '1.0', true); wp_register_script('select2-js', ATHENA_URI . 'view/assets/js/select2.min.js', array(), '4.0.3'); } }//end Athena_Meta_Gen class }// end class_exists conditional