HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/madison/public_html/wp-content/plugins/paperio-addons/meta-box/meta-box.php
<?php
/**
 * Metabox Class Fill.
 *
 * @package Paperio
 */
?>
<?php

if( is_admin() ) {
    add_action( 'load-post.php', 'Paperio_Meta_Boxes' );
    add_action( 'load-post-new.php', 'Paperio_Meta_Boxes' );
}

if( ! function_exists( 'Paperio_Meta_Boxes' ) ) :
	function Paperio_Meta_Boxes() {
	    new Paperio_Meta_Box_Class();
	}
endif;

/**
 * The Paperio_Meta_Box_Class Class.
 */

if( ! class_exists( 'Paperio_Meta_Box_Class' ) ) {
	class Paperio_Meta_Box_Class {

		/**
		 * Hook into the appropriate actions when the class is constructed.
		 */
		public function __construct() {
			$this->paperio_metabox_maps();
			add_action( 'add_meta_boxes', array( $this, 'paperio_add_meta_box_for_post' ) );
			add_action( 'add_meta_boxes', array( $this, 'paperio_add_meta_box_for_post_page' ) );
			add_action( 'save_post', array( $this, 'paperio_save_meta_box' ) );
			add_action( 'admin_enqueue_scripts', array( $this, 'paperio_meta_box_script' ) );
		}

		/**
		 * Adds the meta box functions container.
		 */
		public function paperio_metabox_maps() {
			require_once( PAPERIO_ADDONS_DIR_ROOT .'/meta-box/meta-box-maps.php' );
		}

		public function paperio_add_meta_box( $id, $label_name, $post_type ) {
			add_meta_box(
				$id
				,$label_name
				,array( $this, $id )
				,$post_type
				,'normal'
				,'high'
			);
		}
		/**
		 * Adds the meta box for Post.
		 */
		public function paperio_add_meta_box_for_post( $post_type ) {
			$post_types = array( 'post' );     //limit meta box to certain post types
			$flag = false;
			$meta_box_title = '';
	        if ( in_array( $post_type, $post_types ) ) {
	           	$flag = true;
	        }
	        if( $flag == true ) {
	        	$meta_box_title .= __( 'Paperio Post Format Settings', 'paperio-addons' );
		        $this->paperio_add_meta_box( 'paperio_post_single_meta_box', $meta_box_title, $post_type );
		    }
		}

		/**
		 * Adds the meta box for Post and Page.
		 */
		public function paperio_add_meta_box_for_post_page( $post_type ) {
			$post_types = array( 'post', 'page' );     //limit meta box to certain post types
			$flag = false;
			$meta_box_title = '';
	        if ( in_array( $post_type, $post_types ) ) {
	           	$flag = true;
	        }
	        if( $flag == true ) {
	        	if( $post_type == 'page' ) {
	        		$meta_box_title .= __( 'Paperio Page Settings', 'paperio-addons' );
	        	} else {
	        		$meta_box_title .= __( 'Paperio Post Settings', 'paperio-addons' );
	        	}
		        $this->paperio_add_meta_box( 'paperio_single_meta_box', $meta_box_title, $post_type );
		    }
		}

		public function paperio_post_single_meta_box() {
	        global $post;
			echo '<div class="paperio_meta_box_tab_content_single">';
			echo '<div class="paperio_meta_box_tab" id="paperio_tab_single"></div>';
                if( $post->post_type == 'post' ):
                	require_once( PAPERIO_ADDONS_DIR_ROOT .'/meta-box/metabox-tabs/metabox_post_setting.php' );
                endif;
			echo '</div>';
			echo '<div class="clear"></div>';
		}

		public function paperio_single_meta_box() {
	        global $post;
			echo '<div class="paperio_meta_box_tab_content_single">';
			echo '<div class="paperio_meta_box_tab" id="paperio_tab_single"></div>';
				if( $post->post_type == 'post' ):
					require_once( PAPERIO_ADDONS_DIR_ROOT .'/meta-box/metabox-tabs/metabox_post_single_setting.php' );
				else:
					require_once( PAPERIO_ADDONS_DIR_ROOT .'/meta-box/metabox-tabs/metabox_page_single_setting.php' );
				endif;
			echo '</div>';
			echo '<div class="clear"></div>';
		}

		/**
		 * Save the meta when the post is saved.
		 *
		 * @param int $post_id The ID of the post being saved.
		 */
		public function paperio_save_meta_box( $post_id ) {
		
			// If this is an autosave, our form has not been submitted,
	        // so we don't want to do anything.
			if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 
				return $post_id;

			/* OK, its safe for us to save the data now. */
			$data = array();
			foreach ( $_POST as $key => $value ) {
				if ( strstr( $key, 'tz_') ) {
					// Sanitize the user input.
					$data = sanitize_text_field( $_POST[$key] );
					// Update the meta field.
					update_post_meta( $post_id, $key, $data );
				}
			}
		}

		public function paperio_meta_box_script() {
			global $pagenow;
			if( is_admin() && ( $pagenow=='post-new.php' || $pagenow=='post.php' ) ) {
				wp_enqueue_script( 'media-upload' );
				wp_enqueue_script( 'thickbox' );
		   		wp_enqueue_style( 'thickbox' );
		   		wp_register_script( 'paperio-meta_box-js', PAPERIO_ADDONS_ROOT.'meta-box/js/meta-box.js', array('jquery'), '1.0');
				wp_enqueue_script( 'paperio-meta_box-js' );
		   		wp_register_style( 'paperio-meta_box-css', PAPERIO_ADDONS_ROOT . 'meta-box/css/meta-box.css',null, '1.0');
		   		wp_enqueue_style( 'paperio-meta_box-css' );
			}
		}
	}
}