base = DFlip::get_instance();
add_action( 'admin_menu', array( $this, 'settings_menu' ) );
$this->fields = array_merge( array(), $this->base->defaults );
foreach ( $this->fields as $key => $value ) {
if ( isset( $value['choices'] ) && is_array( $value['choices'] ) && isset( $value['choices']['global'] ) ) {
unset( $this->fields[ $key ]['choices']['global'] );
}
}
// Load the metabox hooks and filters.
// add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 100);
// Add action to save metabox config options.
// add_action('save_post', array($this, 'save_meta_boxes'), 10, 2);
}
/**
* Creates menu for the settings page
*
* @since 1.2
*/
public function settings_menu() {
$this->hook = add_submenu_page( 'edit.php?post_type=dflip', __( 'dFlip Settings (Premium)', 'DFLIP' ), __( 'Settings', 'DFLIP' ), 'manage_options', $this->base->plugin_slug . '-settings',
array( $this, 'settings_page' ) );
if ( $this->hook ) {
add_action( 'load-' . $this->hook, array( $this, 'update_settings' ) );
// Load metabox assets.
add_action( 'load-' . $this->hook, array( $this, 'hook_page_assets' ) );
}
}
/**
* Callback to create the settings page
*
* @since 1.2
*/
public function settings_page() {
$tabs = array(
'general' => __( 'General', 'DFLIP' ),
'translate' => __( 'Translate', 'DFLIP' ),
// 'controls' => __( 'Controls' , 'DFLIP' )
);
//create tabs and content
?>
base->plugin_slug . '-setting-metabox-style', plugins_url( 'assets/css/metaboxes.css', $this->base->file ), array(), $this->base->version );
wp_enqueue_style( $this->base->plugin_slug . '-setting-metabox-style' );
// Load necessary metabox scripts.
wp_register_script( $this->base->plugin_slug . '-setting-metabox-script', plugins_url( 'assets/js/metaboxes.js', $this->base->file ), array( 'jquery', 'jquery-ui-tabs' ), $this->base->version );
wp_enqueue_script( $this->base->plugin_slug . '-setting-metabox-script' );
wp_enqueue_media();
}
/**
* Creates the UI for General tab
*
* @since 1.0.0
*
*/
public function general_tab() {
$this->base->create_setting( 'webgl' );
unset( $this->base->defaults['hard']['condition'] );
$this->base->create_setting( 'hard' );
$this->base->create_setting( 'thumb_tag_type' );
$this->base->create_setting( 'texture_size' );
$this->base->create_setting( 'auto_sound' );
$this->base->create_setting( 'enable_download' );
$this->base->create_setting( 'scroll_wheel' );
$this->base->create_setting( 'bg_color' );
$this->base->create_setting( 'bg_image' );
$this->base->create_setting( 'height' );
$this->base->create_setting( 'padding_left' );
$this->base->create_setting( 'padding_right' );
$this->base->create_setting( 'duration' );
$this->base->create_setting( 'single_page_mode' );
$this->base->create_setting( 'zoom_ratio' );
$this->base->create_setting( 'stiffness' );
$this->base->create_setting( 'controls_position' );
$this->base->create_setting( 'more_controls' );
$this->base->create_setting( 'hide_controls' );
$this->base->create_setting( 'range_size' );
$this->base->create_setting( 'autoplay' );
$this->base->create_setting( 'autoplay_duration' );
$this->base->create_setting( 'autoplay_start' );
?>