Esempio n. 1
0
/**
 * Plugin Setup (On First Time Activation)
 *
 * Does the initial setup when plugin is going to activate first time,
 * stest default values for the plugin options.
 *
 * @package Social Deals Engine
 * @since 1.0.0
 */
function wps_deals_default_settings()
{
    global $wps_deals_options;
    //get values for created pages
    $pages = get_option('wps_deals_set_pages');
    //default for all created pages
    $mainpage = $checkout = $myaccountpage = $shoppage = '';
    //check pages are created or not
    if (!empty($pages)) {
        //check if checkout page is created then set to default
        if (isset($pages['checkout_page'])) {
            $checkout = $pages['checkout_page'];
        }
        //check if checkout page is created then set to default
        if (isset($pages['main_page'])) {
            $mainpage = $pages['main_page'];
        }
        //check my account page is created then set to default
        if (isset($pages['my_account_page'])) {
            $myaccountpage = $pages['my_account_page'];
        }
        //check home page is created then set to default
        if (isset($pages['shop_page'])) {
            $shoppage = $pages['shop_page'];
        }
    }
    $wps_deals_options = array('del_all_options' => '', 'disable_twitter_bootstrap' => '', 'deals_size' => 'large', 'deals_home' => 'rand', 'deals_size_archive' => 'medium', 'deals_size_single' => 'medium', 'deals_btn_color' => 'blue', 'deals_columns' => 'deals-col-6', 'deals_columns_archive' => 'deals-col-6', 'disable_more_deals' => '', 'ending_deals_in' => '5', 'upcoming_deals_in' => '5', 'deals_per_page' => '10', 'default_deals_orderby' => 'date-asc', 'payment_gateways' => array('paypal'), 'paypal_merchant_email' => '', 'enable_testmode' => '', 'enable_debug' => '', 'from_email' => get_option('blogname') . ' <' . get_option('admin_email') . '>', 'buyer_email_subject' => __('Purchase Receipt', 'wpsdeals'), 'buyer_email_body' => sprintf(__('Dear {%s}' . "\n\n" . 'Thank you for your purchase. Please click on the link(s) below to download your files.' . "\n\n" . 'Product Details : {%s}' . "\n\n" . 'Total: {%s}' . "\n\n" . 'Thank you', 'wpsdeals'), 'first_name', 'product_details', 'total'), 'notif_email_address' => get_option('admin_email'), 'disable_seller_notif' => '', 'seller_email_subject' => __('New deal purchase', 'wpsdeals'), 'seller_email_body' => sprintf(__('Hello' . "\n\n" . 'A deals purchase has been made.' . "\n\n" . 'Deals sold: {%s}' . "\n\n" . 'Purchased by: {%s}' . "\n\n" . 'Total: {%s}' . "\n\n" . 'Payment Method: {%s}' . "\n\n" . 'Thank you', 'wpsdeals'), 'product_details', 'username', 'total', 'payment_method'), 'reset_password_email_subject' => __('Reset Password', 'wpsdeals'), 'reset_password_email' => sprintf(__('Someone requested that the password be reset for the following account:' . "\n\n" . 'Username: {%s}' . "\n\n" . 'If this was a mistake, just ignore this email and nothing will happen.' . "\n\n" . 'To reset your password, visit the following address:' . "\n\n" . '{%s}', 'wpsdeals'), 'user_name', 'reset_link'), 'currency' => 'USD', 'payment_checkout_page' => $checkout, 'deals_main_page' => $mainpage, 'my_account_page' => $myaccountpage, 'shop_page' => $shoppage, 'show_login_register' => '', 'disable_guest_checkout' => '', 'currency_position' => 'before', 'thounsands_seperator' => ',', 'decimal_seperator' => '.', 'decimal_places' => '2', 'social_buttons' => array('facebook'), 'add_to_cart_text' => __('Add to Cart', 'wpsdeals'), 'redirect_to_checkout' => '', 'link_expiration' => '', 'per_page' => '10', 'enable_terms' => '', 'terms_label' => '', 'terms_content' => '', 'update_order_email_subject' => __('Order Update', 'wpsdeals'), 'update_order_email' => sprintf(__('Order ID : {%s}' . "\n\n" . 'Order Date : {%s}' . "\n\n" . 'Your order has been updated to the following status.' . "\n\n" . 'New status: {%s}', 'wpsdeals'), 'order_id', 'order_date', 'status'), 'tw_user_name' => '', 'custom_css' => '', 'paypal_api_user' => '', 'paypal_api_pass' => '', 'paypal_api_sign' => '', 'file_download_limit' => '', 'enable_facebook' => '', 'fb_app_id' => '', 'fb_app_secret' => '', 'fb_language' => 'en_US', 'fb_redirect_url' => '', 'fb_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/facebook.png', 'enable_gplus' => '', 'gplus_client_id' => '', 'gplus_client_secret' => '', 'gplus_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/google_plus.png', 'enable_twitter' => '', 'tw_consumer_key' => '', 'tw_consumer_secrets' => '', 'tw_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/twitter.png', 'enable_linkedin' => '', 'li_app_id' => '', 'li_app_secret' => '', 'li_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/linkedin.png', 'enable_yahoo' => '', 'yh_consumer_key' => '', 'yh_consumer_secrets' => '', 'yh_app_id' => '', 'yh_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/yahoo.png', 'enable_foursquare' => '', 'fs_client_id' => '', 'fs_client_secrets' => '', 'fs_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/foursquare.png', 'enable_windowslive' => '', 'wl_client_id' => '', 'wl_client_secrets' => '', 'wl_icon_url' => WPS_DEALS_SOCIAL_URL . '/images/windowslive.png', 'social_order' => array('facebook', 'twitter', 'googleplus', 'linkedin', 'yahoo', 'foursquare', 'windowslive'), 'default_payment_gateway' => 'paypal', 'caching' => '', 'cheque_title' => __('Cheque Payment', 'wpsdeals'), 'cheque_customer_msg' => __('Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'wpsdeals'), 'login_heading' => __('Login with Social Media', 'wpsdeals'), 'login_redirect_url' => '', 'email_template' => '', 'enable_billing' => '', 'purchase_limit_label' => __('Sold Out', 'wpsdeals'), 'deals_thank_you_page_endpoint' => __('social-deals-thank-you-page', 'wpsdeals'), 'deals_cancel_page_endpoint' => __('social-deals-cancel-page', 'wpsdeals'), 'edit_account_endpoint' => __('edit-account', 'wpsdeals'), 'edit_address_endpoint' => __('edit-address', 'wpsdeals'), 'lost_password_endpoint' => __('lost-password', 'wpsdeals'), 'view_orders_endpoint' => __('view-orders', 'wpsdeals'), 'create_an_account_endpoint' => __('create-an-account', 'wpsdeals'), 'enable_lightbox' => '1');
    $default_options = apply_filters('wps_deals_options_values', $wps_deals_options);
    //update default options
    update_option('wps_deals_options', $default_options);
    //overwrite global variable when option is update
    $wps_deals_options = wps_deals_get_settings();
}
/**
 * Deals page IDs
 * 
 * Handles to return page id from settings
 *
 * @package Social Deals Engine
 * @since 1.0.0
 */
function wps_deals_get_page_id($page)
{
    $wps_deals_options = wps_deals_get_settings();
    $pageid = !empty($page) && isset($wps_deals_options[$page]) && !empty($wps_deals_options[$page]) ? $wps_deals_options[$page] : '-1';
    return apply_filters('wps_deals_get_page_id', $pageid);
}