示例#1
0
define('CRED_COMMERCE_PLUGIN_FOLDER', basename(CRED_COMMERCE_PLUGIN_PATH));
define('CRED_COMMERCE_PLUGIN_URL', plugins_url() . '/' . CRED_COMMERCE_PLUGIN_FOLDER);
define('CRED_COMMERCE_ASSETS_URL', CRED_COMMERCE_PLUGIN_URL . '/assets');
define('CRED_COMMERCE_ASSETS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/assets');
define('CRED_COMMERCE_LOCALE_PATH', CRED_COMMERCE_PLUGIN_FOLDER . '/locale');
define('CRED_COMMERCE_VIEWS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/views');
define('CRED_COMMERCE_VIEWS_PATH2', CRED_COMMERCE_PLUGIN_FOLDER . '/views');
define('CRED_COMMERCE_TEMPLATES_PATH', CRED_COMMERCE_PLUGIN_PATH . '/views/templates');
define('CRED_COMMERCE_TABLES_PATH', CRED_COMMERCE_PLUGIN_PATH . '/views/tables');
define('CRED_COMMERCE_CLASSES_PATH', CRED_COMMERCE_PLUGIN_PATH . '/classes');
define('CRED_COMMERCE_CONTROLLERS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/controllers');
define('CRED_COMMERCE_MODELS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/models');
define('CRED_COMMERCE_LOGS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/logs');
define('CRED_COMMERCE_PLUGINS_PATH', CRED_COMMERCE_PLUGIN_PATH . '/plugins');
// define plugin name (path)
define('CRED_COMMERCE_PLUGIN_NAME', CRED_COMMERCE_PLUGIN_FOLDER . '/' . basename(__FILE__));
define('CRED_COMMERCE_PLUGIN_BASENAME', plugin_basename(__FILE__));
// load on the go resources
require_once CRED_COMMERCE_PLUGIN_PATH . '/onthego-resources/loader.php';
onthego_initialize(CRED_COMMERCE_PLUGIN_PATH . '/onthego-resources', CRED_COMMERCE_PLUGIN_URL . '/onthego-resources/');
//define('CRED_COMMERCE_DEBUG',true);
//define('CRED_COMMERCE_DEV',true);
function cred_commerce_activated()
{
    add_option('cred_commerce_activated', '1');
}
register_activation_hook(__FILE__, 'cred_commerce_activated');
include CRED_COMMERCE_PLUGIN_PATH . '/loader.php';
CREDC_Loader::load('CLASS/CRED_Commerce');
CRED_Commerce::init();
示例#2
0
    public static function addCommerceExtraNotificationEvents($form, $data, $notification)
    {
        ob_start();
        if (!$notification) {
            // used for template, return dummy
            ?>
            <p>
                <label>
                    <input data-cred-bind="{ 
                                    validate: { 
                                        required: {
                                            actions: [
                                                {action: 'validationMessage', domRef: '#notification_event_required-<?php 
            echo $data[0];
            ?>
' },
                                                {action: 'validateSection' }
                                            ]
                                        } 
                                    } 
                                }" type="radio" class="cred-radio-10 cred-commerce-event-type" name="<?php 
            echo $data[1];
            ?>
" value="order_modified" />
                    <span><?php 
            _e('When the purchase status changes to:', 'wp-cred-pay');
            ?>
</span>
                </label>
                <span data-cred-bind="{ action: 'show', condition: '<?php 
            echo $data[1];
            ?>
=order_modified' }">
                    <select class="cred_commerce_when_order_status_changes" name="_cred[notification][notifications][<?php 
            echo $data[0];
            ?>
][event][order_status]">
                        <option value='pending'><?php 
            _e('Pending', 'wp-cred-pay');
            ?>
</option>
                        <option value='failed'><?php 
            _e('Failed', 'wp-cred-pay');
            ?>
</option>
                        <option value='processing'><?php 
            _e('Processing', 'wp-cred-pay');
            ?>
</option>
                        <option value='completed'><?php 
            _e('Completed', 'wp-cred-pay');
            ?>
</option>
                        <option value='on-hold'><?php 
            _e('On-Hold', 'wp-cred-pay');
            ?>
</option>
                        <option value='cancelled'><?php 
            _e('Cancelled', 'wp-cred-pay');
            ?>
</option>
                        <option value='refunded'><?php 
            _e('Refunded', 'wp-cred-pay');
            ?>
</option>
                    </select>
                </span>
            </p>
            <?php 
        } else {
            if (!self::$formdata) {
                $model = CREDC_Loader::get('MODEL/Main');
                self::$formdata = $model->getForm($form->ID, false);
            }
            $order_status = null;
            if (self::$formdata->isCommerce && isset($notification['event']['order_status'])) {
                $order_status = $notification['event']['order_status'];
            }
            // actual notification data
            ?>
            <p>
                <label>
                    <input data-cred-bind="{ 
                                    validate: { 
                                        required: {
                                            actions: [
                                                {action: 'validationMessage', domRef: '#notification_event_required-<?php 
            echo $data[0];
            ?>
' },
                                                {action: 'validateSection' }
                                            ]
                                        } 
                                    } 
                                }" type="radio" class="cred-radio-10 cred-commerce-event-type" name="<?php 
            echo $data[1];
            ?>
" value="order_modified" <?php 
            if ($data[2] == 'order_modified') {
                echo 'checked="checked"';
            }
            ?>
 />
                    <span><?php 
            _e('When the purchase status changes to:', 'wp-cred-pay');
            ?>
</span>
                </label>
                <span data-cred-bind="{ action: 'show', condition: '<?php 
            echo $data[1];
            ?>
=order_modified' }">
                    <select class="cred_commerce_when_order_status_changes" name="_cred[notification][notifications][<?php 
            echo $data[0];
            ?>
][event][order_status]">
                        <option value='pending' <?php 
            if ('pending' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Pending', 'wp-cred-pay');
            ?>
</option>
                        <option value='failed' <?php 
            if ('failed' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Failed', 'wp-cred-pay');
            ?>
</option>
                        <option value='processing' <?php 
            if ('processing' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Processing', 'wp-cred-pay');
            ?>
</option>
                        <option value='completed' <?php 
            if ('completed' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Completed', 'wp-cred-pay');
            ?>
</option>
                        <option value='on-hold' <?php 
            if ('on-hold' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('On-Hold', 'wp-cred-pay');
            ?>
</option>
                        <option value='cancelled' <?php 
            if ('cancelled' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Cancelled', 'wp-cred-pay');
            ?>
</option>
                        <option value='refunded' <?php 
            if ('refunded' == $order_status) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('Refunded', 'wp-cred-pay');
            ?>
</option>
                    </select>
                </span>
            </p>
            <?php 
        }
        echo ob_get_clean();
    }