.
*/
class BREBootstrap3Shortcuts {
function __construct() {
add_action( 'admin_menu', array( &$this, 'admin_menu' ), 50 );
}
function admin_menu() {
$page = add_theme_page( __( 'Bootstrap eCommerce Shortcuts, 3 Cols', 'bre-bootstrap-ecommerce' ), __( 'Shortcuts, 3 Cols', 'bre-bootstrap-ecommerce' ), 'tcp_edit_products', 'pagina_home_settings', array( &$this, 'admin_page' ) );
add_action( "load-$page", array( &$this, 'admin_action' ) );
}
function admin_page() { ?>
updated ) ) : ?>
update_file( 'bre_image_a' );
$this->update_file( 'bre_image_b' );
$this->update_file( 'bre_image_c' );
$this->updated = true;
} elseif ( isset( $_REQUEST['save-pagina_home-remove_image_a'] ) ) {
$this->remove_file( 'bre_image_a' );
} elseif ( isset( $_REQUEST['save-pagina_home-remove_image_b'] ) ) {
$this->remove_file( 'bre_image_b' );
} elseif ( isset( $_REQUEST['save-pagina_home-remove_image_c'] ) ) {
$this->remove_file( 'bre_image_c' );
}
}
function update_file( $id ) {
if ( isset( $_FILES[$id] ) && $_FILES[$id]['name'] !== '' ) {
$this->remove_file( $id );
$file = $_FILES[$id];
if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $file, $upload_overrides );
update_option( $id, $movefile );
}
}
private function remove_file( $id ) {
$path_to_delete = get_option( $id, false );
if ( $path_to_delete !== false ) unlink( $path_to_delete['file'] );
delete_option( $id );
}
}
new BREBootstrap3Shortcuts();
add_shortcode( '3boxes', 'bre_get_the_three_boxes' );
function bre_get_the_three_boxes() {
return bre_the_three_boxes( false );
}
function bre_the_three_boxes( $echo = true ) {
ob_start(); ?>