*/
class Yup_360_Product_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Register the stylesheets for the admin area.
*
* @since 1.0.0
*/
public function enqueue_styles() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Yup_360_Product_Loader as all of the hooks are defined
* in that particular class.
*
* The Yup_360_Product_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/yup-360-product-admin.css', array(), $this->version, 'all' );
}
/**
* Register the JavaScript for the admin area.
*
* @since 1.0.0
*/
public function enqueue_scripts() {
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Yup_360_Product_Loader as all of the hooks are defined
* in that particular class.
*
* The Yup_360_Product_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/yup-360-product-admin.js', array( 'jquery' ), $this->version, false );
}
/**
* Register the Taxonomy 360 view.
*
* @since 1.0.0
*/
public function register360View(){
//add_meta_box( 'product_360_id', __('Product 360 View', 'textdomain' ), $this->product_360_callback ,'product' ,'side','core');
add_meta_box(
'yup_render_view_meta_box_id',
esc_html__( 'Product 360 View', 'text-domain' ),
array( $this, 'yup_render_view_meta_box'),
'product',
'side',
'core'
);
}
public function yup_render_view_meta_box() {
global $post;
echo 'Check the box if you want to display product view in 360.
';
// Noncename needed to verify where the data originated
echo '';
// Get the location data if its already been entered
$prd360 = get_post_meta($post->ID, '_enableView', true);
$_totalFrames = get_post_meta($post->ID, '_totalFrames', true);
$_endFrames = get_post_meta($post->ID, '_endFrames', true);
$_currentFrames = get_post_meta($post->ID, '_currentFrames', true);
$_filePrefix = get_post_meta($post->ID, '_filePrefix', true);
$_fileExt = get_post_meta($post->ID, '_fileExt', true);
$_heightFrame = get_post_meta($post->ID, '_heightFrame', true);
$_widthFrame = get_post_meta($post->ID, '_widthFrame', true);
$_navigationFrame = get_post_meta($post->ID, '_navigationFrame', true);
$_responsiveFrame = get_post_meta($post->ID, '_responsiveFrame', true);
// Echo out the field
?>
/> Replace Product View with 360
/> Navigation
/> Responsive
ID; } // Is the user allowed to edit the post or page? if ( !current_user_can( 'edit_post', $post->ID )) return $post->ID; if( isset( $_POST[ '_enableView' ] ) ) { update_post_meta( $post_id, '_enableView', 'yes' ); } else { update_post_meta( $post_id, '_enableView', '' ); } // Checks for input and sanitizes/saves if needed if( isset( $_POST[ '_totalFrames' ] ) ) { update_post_meta( $post_id, '_totalFrames', sanitize_text_field( $_POST[ '_totalFrames' ] ) ); }else{ update_post_meta( $post_id, '_totalFrames', '32' ); } if( isset( $_POST[ '_endFrames' ] ) ) { update_post_meta( $post_id, '_endFrames', sanitize_text_field( $_POST[ '_endFrames' ] ) ); }else{ update_post_meta( $post_id, '_endFrames', '32' ); } if( isset( $_POST[ '_currentFrames' ] ) ) { update_post_meta( $post_id, '_currentFrames', sanitize_text_field( $_POST[ '_currentFrames' ] ) ); }else{ update_post_meta( $post_id, '_currentFrames', '1' ); } if( isset( $_POST[ '_filePrefix' ] ) ) { update_post_meta( $post_id, '_filePrefix', sanitize_text_field( $_POST[ '_filePrefix' ] ) ); }else{ update_post_meta( $post_id, '_filePrefix', '' ); } if( isset( $_POST[ '_fileExt' ] ) ) { update_post_meta( $post_id, '_fileExt', sanitize_text_field( $_POST[ '_fileExt' ] ) ); }else{ update_post_meta( $post_id, '_fileExt', '.png' ); } if( isset( $_POST[ '_heightFrame' ] ) ) { update_post_meta( $post_id, '_heightFrame', sanitize_text_field( $_POST[ '_heightFrame' ] ) ); }else{ update_post_meta( $post_id, '_heightFrame', '1000' ); } if( isset( $_POST[ '_widthFrame' ] ) ) { update_post_meta( $post_id, '_widthFrame', sanitize_text_field( $_POST[ '_widthFrame' ] ) ); }else{ update_post_meta( $post_id, '_widthFrame', '1000' ); } if( isset( $_POST[ '_navigationFrame' ] ) ) { update_post_meta( $post_id, '_navigationFrame', 'true' ); } else { update_post_meta( $post_id, '_navigationFrame', '' ); } if( isset( $_POST[ '_responsiveFrame' ] ) ) { update_post_meta( $post_id, '_responsiveFrame', 'true' ); } else { update_post_meta( $post_id, '_responsiveFrame', '' ); } } }