Ejemplo n.º 1
0
	function epanel_ajax_callback() {
		global $wpdb; // this is how you get access to the database
	
		if($_POST['type']){
			$save_type = $_POST['type'];
		}else $save_type = null;
	
		//Uploads
		if($save_type == 'upload'){
		
			$clickedID = $_POST['data']; // Acts as the name
			$filename = $_FILES[$clickedID];
	       	$filename['name'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', $filename['name']); 
		
			$override['test_form'] = false;
			$override['action'] = 'wp_handle_upload';    
			$uploaded_file = wp_handle_upload($filename,$override);
		 
			$upload_tracking[] = $clickedID;
			
			epanel_update_option( $clickedID , $uploaded_file['url'] );

			if(!empty($uploaded_file['error'])) {echo 'Upload Error: ' . $uploaded_file['error']; }	
			else { echo $uploaded_file['url']; } // Is the Response
		}
		elseif($save_type == 'image_reset'){
			
				$id = $_POST['data']; // Acts as the name
				epanel_update_option($id, null);
				
	
		}
	
		die();
	}
Ejemplo n.º 2
0
function reset_layout_to_default(){
	
	$dlayout = new EPANEL_WPLayout;
	
	$layout_map = $dlayout->default_layout_setup();

	epanel_update_option('layout', $layout_map);
}
Ejemplo n.º 3
0
function epanel_process_reset_options() {


	foreach(get_option_array() as $menuitem => $options ){
		foreach($options as $optionid => $o ){
			if( $o['type']=='reset' && epanel_option($optionid) ){

					call_user_func($o['callback']);
				
					// Set the 'reset' option back to not set !important 
					epanel_update_option($optionid, null);
				
					wp_redirect( admin_url( 'admin.php?page=epanel&reset=true&opt_id='.$optionid ) );
					exit;

			}

		}
	}

}