示例#1
0
<?php

// Important: Check if the file is the one
// that was registered during the uninstall hook.
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
if (!current_user_can('activate_plugins')) {
    exit;
}
check_admin_referer('bulk-plugins');
global $wpdb;
// UNAPPLYING ALL THE MOLDS
$mold = new WC_Molds();
$molds = $wpdb->get_results('SELECT meta_id FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = "_mold"');
foreach ($molds as $mold) {
    $mold->pm_load_from_db($mold->meta_id);
    $mold->pm_unapply_mold();
}
// DELETING ALL THE MOLDS
$wpdb->query('DELETE FROM ' . $wpdb->prefix . 'postmeta WHERE meta_key = "_mold"');
示例#2
0
    // PAGE TITLE //
    ?>
		<h2><img style="margin-right:2px;vertical-align:bottom;" src="<?php 
    echo bloginfo('wpurl');
    ?>
/wp-content/plugins/woocommerce-molds/assets/images/molds.png">
		<?php 
    if ($_POST['action'] == 'new') {
        echo "" . __('New mold', 'woocommerce-molds') . "</h2>";
        ## We load the temporary database ##
        $mold->pm_load_temporary_save();
    } else {
        if ($_POST['action'] == 'edit') {
            echo "" . __('Edit mold', 'woocommerce-molds') . "</h2>";
            ## We load the database ##
            $mold->pm_load_from_db($_POST['mold_id']);
        }
    }
    ## This is where our form starts ##
    ?>
		<form name="moldForm" action="edit.php?post_type=product&page=woocommerce_molds" method="post" onsubmit="if((document.forms['moldForm']['mold_name'].value=='')||(document.forms['moldForm']['mold_name'].value==null)) { alert('Please enter a name.');document.forms['moldForm']['mold_name'].style.boxShadow = '0px 0px 1px 1px #FF0033';document.forms['moldForm']['mold_name'].focus(); return false;}">
		
			<?php 
    ## We don't forget to stay in the "new" mold page ##
    if ($_POST['action'] == 'new') {
        ?>
				<input id="action" name="action" type="hidden" value="new">
			<?php 
    } else {
        if ($_POST['action'] == 'edit') {
            ?>