HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: /home/madepabj/hc-cosmetics.com/wp-content/themes/dbea/framework/sns-metabox.php
<?php
/**
 * Registering meta boxes
 *
 * All the definitions of meta boxes are listed below with comments.
 * Please read them CAREFULLY.
 *
 * You also should read the changelog to know what has been changed before updating.
 *
 * For more information, please visit:
 * @link http://metabox.io/docs/registering-meta-boxes/
 */
add_filter( 'rwmb_meta_boxes', 'dbea_register_meta_boxes' );
/**
 * Register meta boxes
 *
 * Remember to change "your_prefix" to actual prefix in your project
 *
 * @param array $meta_boxes List of meta boxes
 *
 * @return array
 */
function dbea_register_meta_boxes( $meta_boxes ){
	/**
	 * prefix of meta keys (optional)
	 * Use underscore (_) at the beginning to make keys hidden
	 * Alt.: You also can make prefix empty to disable it
	 */
	// Better has an underscore as last sign
	$prefix = 'dbea_';
	global $wpdb, $dbea_opt;
	$revsliders =array();
	$revsliders[0] = esc_html__("Don't use", "dbea");
	if ( class_exists('RevSlider') ) {
		$query = $wpdb->prepare("
			SELECT * 
			FROM {$wpdb->prefix}revslider_sliders 
			ORDER BY %s"
			, "ASC");
	    $get_sliders = $wpdb->get_results($query);
	    if($get_sliders) {
		    foreach($get_sliders as $slider) {
			   $revsliders[$slider->alias] = $slider->title;
		   }
	    }
	}
	$default_layout = 'm-r';
	if ( isset($dbea_opt['blog_layout']) ) $default_layout = $dbea_opt['blog_layout'];
	$siderbars = array();
	foreach ($GLOBALS['wp_registered_sidebars'] as $sidebars) {
		$siderbars[ $sidebars['id']] = $sidebars['name'];
	}
	// Layout config
	$meta_boxes[] = array(
		// Meta box id, UNIQUE per meta box. Optional since 4.1.5
		'id'         => 'sns_productcfg',
		// Meta box title - Will appear at the drag and drop handle bar. Required.
		'title'      => esc_html__( 'Product Config', 'dbea' ),
		// Post types, accept custom post types as well - DEFAULT is 'post'. Can be array (multiple post types) or string (1 post type). Optional.
		'post_types' => array( 'product' ),
		// Where the meta box appear: normal (default), advanced, side. Optional.
		'context'    => 'normal',
		// Order of meta box: high (default), low. Optional.
		'priority'   => 'high',
		// Auto save: true, false (default). Optional.
		// 'autosave'   => true,
		// List of meta fields

		'fields'     => array(
            array(
                'id'       => "{$prefix}breadcrumbbg",
                'type'     => 'image_advanced',
                'name'     => esc_html__("Background image for Breadcrumb", 'dbea'),
                'desc'	   => esc_html__('Just apply when Show Product Title in the Breadcrumb', 'dbea'),
            ),
			array(
				'name'    => esc_html__( 'Gallery Thumbnail Type', 'dbea' ),
				'id'       => "{$prefix}woo_gallery_type",
				'type'     => 'select',
				'std'  => '',
				'options'  => array(
					''  => esc_html__( 'Default', 'dbea' ),
					'h'  => esc_html__( 'Horizontal', 'dbea' ),
					'v'  => esc_html__( 'Vertical', 'dbea' ),
					'n1'      => esc_html__( 'None - Use scrolling layout', 'dbea' ),
					'n2'      => esc_html__( 'None - Use top slider layout', 'dbea' ),
				)
			),
			array(
				'id'    => "{$prefix}product_video",
				'name'  => esc_html__( 'Product Video', 'dbea' ),
				'type'  => 'oembed',
				// Allow to clone? Default is false
				'clone' => false,
				'desc'		  => esc_html__( 'Enter your video iframw url(youtube, video), ex: https://www.youtube.com/embed/jjwA6gc3nEY', 'dbea' ),
				// Input size
				'size'  => 50,
			),
			array(
				'name'    => esc_html__( 'Use Variation Thumbnail for Variable product', 'dbea' ),
				'id'       => "{$prefix}use_variation_thumb",
				'type'     => 'select',
				'std'  => 0,
				'options'  => array(
					0  => esc_html__( 'No', 'dbea' ),
					1  => esc_html__( 'Yes', 'dbea' ),
				),
				'desc'		=> esc_html__('Just applies for Variable Product', 'dbea'),
			),
			array(
				'name'    	=> esc_html__( 'Want to show Extra info?', 'dbea' ),
				'id'       	=> "{$prefix}extra_info",
				'type'     	=> 'text',
				'std'  		=> '',
				'desc'		=> esc_html__('Enter the value is slug of Post WCode, On Post WCode you can build any info.', 'dbea'),
			),
		)
	);
	// Layout config
	$meta_boxes[] = array(
		// Meta box id, UNIQUE per meta box. Optional since 4.1.5
		'id'         => 'sns_layout',
		// Meta box title - Will appear at the drag and drop handle bar. Required.
		'title'      => esc_html__( 'Layout Config', 'dbea' ),
		// Post types, accept custom post types as well - DEFAULT is 'post'. Can be array (multiple post types) or string (1 post type). Optional.
		'post_types' => array( 'page' ),
		// Where the meta box appear: normal (default), advanced, side. Optional.
		'context'    => 'normal',
		// Order of meta box: high (default), low. Optional.
		'priority'   => 'high',
		// Auto save: true, false (default). Optional.
		// 'autosave'   => true,
		// List of meta fields

		'fields'     => array(
			// Layout Type
			array(
				'name'        => esc_html__( 'Layout Type', 'dbea' ),
				'id'          => "{$prefix}layouttype",
				'type'        => 'layouttype',
				// Array of 'value' => 'Label' pairs for select box
				'options'     => array(
					'm' => esc_html__( 'Without Sidebar', 'dbea' ),
					'l-m' => esc_html__( 'Use Left Sidebar', 'dbea' ),
					'm-r' => esc_html__( 'Use Right Sidebar', 'dbea' ),
				),
				// Select multiple values, optional. Default is false.
				'multiple'    => false,
				'std'         => $default_layout,
				'placeholder' => esc_html__( '--- Select a layout type ---', 'dbea' ),
			),
			// Left Sidebar
			array(
				'name'  => esc_html__( 'Left Sidebar', 'dbea' ),
				'id'    => "{$prefix}leftsidebar",
				'type'  => 'select',
				'options'	=> $siderbars,
				'multiple'	=> false,
				'std'		=> 'left-sidebar',
				'placeholder' => esc_html__( '--- Select a sidebar ---', 'dbea' ),
			),
			// Right Sidebar
			array(
				'name'  => esc_html__( 'Right Sidebar', 'dbea' ),
				'id'    => "{$prefix}rightsidebar",
				'type'  => 'select',
				'options'	=> $siderbars,
				'multiple'	=> false,
				'std'		=> 'right-sidebar',
				'placeholder' => esc_html__( '--- Select a sidebar ---', 'dbea' ),
			),
			
		)
	);
	
	$menus = get_terms('nav_menu', array( 'hide_empty' => false ));
	$menu_options[''] = __('Default Menu...', 'dbea');
	foreach ( $menus as $menu ){
		$menu_options[$menu->term_id] = $menu->name;
	}
	
	// Page config
	$meta_boxes[] = array(
		// Meta box id, UNIQUE per meta box. Optional since 4.1.5
		'id'         => 'sns_pageconfig',
		// Meta box title - Will appear at the drag and drop handle bar. Required.
		'title'      => esc_html__( 'Page Config', 'dbea' ),
		// Post types, accept custom post types as well - DEFAULT is 'post'. Can be array (multiple post types) or string (1 post type). Optional.
		'post_types' => array( 'page' ),
		// Where the meta box appear: normal (default), advanced, side. Optional.
		'context'    => 'normal',
		// Order of meta box: high (default), low. Optional.
		'priority'   => 'high',
		// Auto save: true, false (default). Optional.
		// 'autosave'   => true,
		// List of meta fields

		'fields'     => array(
			array(
				'name'    => esc_html__( 'Want use custom logo?', 'dbea' ),
				'id'      => "{$prefix}header_logo",
				'type'    => 'image_advanced',
				'desc'		=> esc_html__('It priority more than Logon in theme option', 'dbea'),
			),
			array(
				'name'    => esc_html__( 'Header Style', 'dbea' ),
				'id'       => "{$prefix}header_style",
				'type'     => 'select',
				'std'  => '',
				'options'  => array(
					''   	  => esc_html__( 'Default', 'dbea' ),
					'style1'  => esc_html__( 'Style1', 'dbea' ),
				),
				'desc'		=> esc_html__('Select Header style. ', 'dbea'),
			),
			array(
				'name'    => esc_html__( 'Want to use extra width for header?', 'dbea' ),
				'id'      => "{$prefix}header_extrawidth",
				'type'    => 'select',
				'options' => array(
					'2' => esc_html__( 'No', 'dbea' ),
					'1' => esc_html__( 'Yes', 'dbea' ),
				),
				'multiple'	=> false,
				'std'         => '2',
			),
			array(
				'name'    => esc_html__( 'Enable Sticky Menu', 'dbea' ),
				'id'       => "{$prefix}use_stickmenu",
				'type'     => 'select',
				'std'  => '',
				'options'  => array(
					''   	  => esc_html__( 'Default', 'dbea' ),
					true  => esc_html__( 'Yes', 'dbea' ),
					false  => esc_html__( 'No', 'dbea' ),
				),
			),
			array(
				'name'    => esc_html__( 'Enable Search Category for Live Ajax Search', 'dbea' ),
				'id'       => "{$prefix}enable_search_cat",
				'type'     => 'select',
				'std'  => '',
				'options'  => array(
					''   	  => esc_html__( 'Default', 'dbea' ),
					true  => esc_html__( 'Yes', 'dbea' ),
					false  => esc_html__( 'No', 'dbea' ),
				),
			),
			array(
				'name'    => esc_html__( 'Use Slideshow', 'dbea' ),
				'id'      => "{$prefix}useslideshow",
				'type'    => 'radio',
				'options' => array(
					'1' => esc_html__( 'Yes', 'dbea' ),
					'2' => esc_html__( 'No', 'dbea' ),
				),
				'std'         => '2',
			),
			array(
				'name'    => esc_html__( 'Select Slideshow', 'dbea' ),
				'id'      => "{$prefix}revolutionslider",
				'type'    => 'select',
				'options' =>  $revsliders ,
				'std'         => '',
			),
			array(
				'name'    => esc_html__( 'Show Title', 'dbea' ),
				'id'      => "{$prefix}showtitle",
				'type'    => 'radio',
				'options' => array(
					'1' => esc_html__( 'Yes', 'dbea' ),
					'2' => esc_html__( 'No', 'dbea' ),
				),
				'std'         => '1',
			),
			array(
				'name'    => esc_html__( 'Show Breadcrumbs?', 'dbea' ),
				'id'      => "{$prefix}showbreadcrump",
				'type'    => 'select',
				'options' => array(
					'' => esc_html__( 'Default', 'dbea' ),
					'1' => esc_html__( 'Yes', 'dbea' ),
					'3' => esc_html__( 'Yes - But dont show background image', 'dbea' ),
					'2' => esc_html__( 'No', 'dbea' ),
				),
				'multiple'	=> false,
				'std'         => '',
				'desc' => esc_html__( 'Dont apply for Front page.', 'dbea' ),
			),
			array(
				'name'    => esc_html__( 'Want use Background image for Breadcrumbs?', 'dbea' ),
				'id'      => "{$prefix}breadcrumbbg",
				'type'    => 'image_advanced',
			),
			array(
				'name'    => esc_html__( 'Want to use extra width for main content?', 'dbea' ),
				'id'      => "{$prefix}content_extrawidth",
				'type'    => 'select',
				'options' => array(
					'2' => esc_html__( 'No', 'dbea' ),
					'1' => esc_html__( 'Yes', 'dbea' ),
				),
				'multiple'	=> false,
				'std'         => '2',
			),
			array(
				'name'    => esc_html__( 'Footer Style', 'dbea' ),
				'id'       => "{$prefix}footer_layout",
				'type'     => 'select',
				'std'  => '',
				'options'  => array(
					''  => esc_html__( 'Default', 'dbea' ),
					'1'  => esc_html__( 'Style 1', 'dbea' ),
					'blank'  => esc_html__( 'Blank', 'dbea'),
				),
				'desc'		=> esc_html__('Select Footer layout. "Default" to use in Theme Options.', 'dbea'),
			),
			array(
				'name'    => esc_html__( 'Config Theme Color for this page?', 'dbea' ),
				'id'      => "{$prefix}page_themecolor",
				'type'    => 'radio',
				'options' => array(
					'1' => esc_html__( 'Yes', 'dbea' ),
					'2' => esc_html__( 'No', 'dbea' ),
				),
				'std'         => '2',
			),
			array(
				'name' => esc_html__( 'Sellect Theme Color', 'dbea' ),
				'id'   => "{$prefix}theme_color",
				'type' => 'color',
				'desc' => esc_html__( 'It will priority than Theme Color in Theme Option panel', 'dbea' ),
			),
			array(
				'name'    	=> esc_html__( 'Want to use page class?', 'dbea' ),
				'id'       	=> "{$prefix}page_class",
				'type'     	=> 'text',
				'std'  		=> '',
				'desc'		=> esc_html__('It is a class css to add some special style, and just for this page', 'dbea'),
			),
		)
	);
	// Post format - Gallery
	$meta_boxes[] = array(
	    	'id' => 'sns-post-gallery',
		    'title' =>  esc_html__('Gallery Settings','dbea'),
	    	'description' => '',
    		'pages'      => array( 'post' ), // Post type
	    	'context'    => 'normal',
		    'priority'   => 'high',
	    	'fields' => array(
			     array(
			        'name'		=> 'Gallery Images',
			        'desc'	    => 'Upload Images for post Gallery ( Limit is 15 Images ).',
			        'type'      => 'image_advanced',
			        'id'	    => "{$prefix}post_gallery",
	         		'max_file_uploads' => 15 
	        	)
			)
	);
	// Post format - Video
    $meta_boxes[] = array(
		'id' => 'sns-post-video',
		'title' => esc_html__('Featured Video','dbea'),
		'description' => '',
		'pages'      => array( 'post' ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'fields' => array( 
		    array(
				'id'    => "{$prefix}post_video",
				'name'  => esc_html__( 'Video', 'dbea' ),
				'type'  => 'oembed',
				// Allow to clone? Default is false
				'clone' => false,
				// Input size
				'size'  => 50,
			)
		)
	);
	// Post format - Audio
    $meta_boxes[] = array(
		'id' => 'sns-post-audio',
		'title' => esc_html__('Featured Audio','dbea'),
		'description' => '',
		'pages'      => array( 'post' ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'fields' => array( 
		    array(
				'id'    => "{$prefix}post_audio",
				'name'  => esc_html__( 'Audio', 'dbea' ),
				'type'  => 'oembed',
				// Allow to clone? Default is false
				'clone' => false,
				// Input size
				'size'  => 50,
			)
		)
	);
	// Post format - quote
    $meta_boxes[] = array(
		'id' => 'sns-post-quote',
		'title' => esc_html__('Featured Quote','dbea'),
		'description' => '',
		'pages'      => array( 'post' ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'fields' => array( 
		    array(
				'id'    => "{$prefix}post_quotecontent",
				'name'  => esc_html__( 'Quote Content', 'dbea' ),
				'type'  => 'textarea',
				// Allow to clone? Default is false
				'clone' => false,
			),
			array(
				'id'      => "{$prefix}post_quoteauthor",
				'name'    => esc_html__( 'Quote author', 'dbea' ),
				'type'    => 'text',
				'clone' => false,
			),
		)
	);
	// Post format - Link
    $meta_boxes[] = array(
		'id' => 'sns-post-link',
		'title' => esc_html__('Link Settings','dbea'),
		'description' => '',
		'pages'      => array( 'post' ), // Post type
		'context'    => 'normal',
		'priority'   => 'high',
		'fields' => array( 
		    array(
				'id'    => "{$prefix}post_linkurl",
				'name'  => esc_html__( 'Link URL', 'dbea' ),
				'type'  => 'text',
				// Allow to clone? Default is false
				'clone' => false,
			),
			array(
				'id'      => "{$prefix}post_linktitle",
				'name'    => esc_html__( 'Link Title', 'dbea' ),
				'type'    => 'text',
				'clone' => false,
			),
		)
	);

	return $meta_boxes;
}


if ( class_exists( 'RWMB_Field' ) ) {
	class RWMB_Layouttype_Field extends RWMB_Select_Field {
		static function admin_enqueue_scripts(){
			wp_enqueue_style( 'dbea-imgselect', DBEA_THEME_URI . '/framework/meta-box/img-select.css' );
		}
	}
	// Js for metabox fields action
	add_action( 'admin_print_scripts', 'dbea_metabox_adminjs');
    function dbea_metabox_adminjs(){
		wp_enqueue_script('dbea-imgselect', DBEA_THEME_URI . '/framework/meta-box/sns-metabox.js', array('jquery'), '', true);
	}
}