Removed ShareYourCart integration from core. Closes #2937
This commit is contained in:
parent
595cc652db
commit
b1f3af5118
|
@ -1,108 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once( "class.shareyourcart-wp-woocommerce.php" );
|
||||
|
||||
/**
|
||||
* ShareYourCartWooCommerceEx class.
|
||||
*
|
||||
* @extends ShareYourCartWooCommerce
|
||||
*/
|
||||
class ShareYourCartWooCommerceEx extends ShareYourCartWooCommerce {
|
||||
|
||||
public $settings;
|
||||
|
||||
/**
|
||||
* __construct function.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $settings
|
||||
* @return void
|
||||
*/
|
||||
function __construct( $settings ) {
|
||||
$this->settings = $settings;
|
||||
|
||||
// disable analytics for the woocommerce integration
|
||||
$this->SDK_ANALYTICS = false;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Since this class has loaded, the WooCommerce plugin is active.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isCartActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* getSecretKey function.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSecretKey() {
|
||||
return '2cfd496d-7812-44ba-91ce-e43c59f6c680';
|
||||
}
|
||||
|
||||
/**
|
||||
* Since we have already integrated this in our own settings page, leave this function empty.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function showAdminMenu() {}
|
||||
|
||||
/**
|
||||
* Set the field value
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $field
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
protected function setConfigValue( $field, $value ) {
|
||||
|
||||
$this->settings[ $field ] = $value;
|
||||
|
||||
//make sure to update the enabled field as well, based on the account_status
|
||||
switch( $field ){
|
||||
case 'account_status':
|
||||
$this->settings['enabled'] = ( $value == 'active' ? 'yes' : 'no' );
|
||||
break;
|
||||
case "plugin_current_version":
|
||||
//this setting needs to be set globally as well, in order to be recognized by other ShareYourCart integrations,
|
||||
//and to not interfere with one-another
|
||||
parent::setConfigValue( $field, $value );
|
||||
break;
|
||||
}
|
||||
|
||||
//save the config in the DB
|
||||
update_option( 'woocommerce_shareyourcart_settings', $this->settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $field
|
||||
* @return string
|
||||
*/
|
||||
protected function getConfigValue( $field ) {
|
||||
|
||||
$value = ( isset( $this->settings[ $field ] ) ) ? $this->settings[ $field ] : '';
|
||||
|
||||
// search for the global value of this field
|
||||
// as it might have been changed by an external ShareYourCart integration
|
||||
if ( $field == "plugin_current_version" ) {
|
||||
$val = parent::getConfigValue( $field );
|
||||
|
||||
if ( ! empty( $val ) )
|
||||
$value = $val;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/**
|
||||
* ShareYourCart Integration
|
||||
*
|
||||
* Enables ShareYourCart integration.
|
||||
*
|
||||
* @class WC_ShareYourCart
|
||||
* @package WooCommerce
|
||||
* @category Integrations
|
||||
* @author WooThemes
|
||||
*/
|
||||
class WC_ShareYourCart extends WC_Integration {
|
||||
|
||||
public $ShareYourCartWooCommerce;
|
||||
public $enabled;
|
||||
|
||||
public function __construct() {
|
||||
$this->id = 'shareyourcart';
|
||||
$this->method_title = __( 'ShareYourCart', 'woocommerce' );
|
||||
$this->method_description = __( 'Increase your social media exposure by 10 percent! ShareYourCart helps you get more customers by motivating satisfied customers to talk with their friends about your products. For help with ShareYourCart view the <a href="http://docs.woothemes.com/document/shareyourcart/" target="__blank">documentation</a>.', 'woocommerce' );
|
||||
|
||||
// Load the settings.
|
||||
$this->init_form_fields();
|
||||
$this->init_settings();
|
||||
|
||||
if ( $this->enabled == 'yes' ) {
|
||||
|
||||
//the classes need to be initialized
|
||||
$this->init_share_your_cart();
|
||||
}
|
||||
|
||||
//hook to the admin settings page
|
||||
add_action( 'woocommerce_update_options_integration_shareyourcart', array( &$this, 'process_forms') );
|
||||
}
|
||||
|
||||
/**
|
||||
* styles function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function styles() {
|
||||
wp_enqueue_style( 'shareyourcart', plugins_url( 'css/style.css', __FILE__ ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* init_share_your_cart function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function init_share_your_cart() {
|
||||
|
||||
if ( empty( $this->shareYourCartWooCommerce ) ) {
|
||||
// Share your cart api class
|
||||
include_once('class-shareyourcart-woocommerce-extended.php');
|
||||
|
||||
// Init the class
|
||||
$this->shareYourCartWooCommerce = new ShareYourCartWooCommerceEx( $this->settings );
|
||||
|
||||
//by the time we get here, the plugins_loaded hook has allready been called
|
||||
//so call the method manually
|
||||
$this->shareYourCartWooCommerce->pluginsLoadedHook();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* process_forms function.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function process_forms() {
|
||||
|
||||
//after this function completes, WooCommerce will refresh the page, so we need to save the data here
|
||||
$this->init_share_your_cart();
|
||||
|
||||
//stripslashes from button_html
|
||||
if(isset($_POST['button_html']))
|
||||
$_POST['button_html'] = stripslashes($_POST['button_html']);
|
||||
|
||||
//TODO: investigate why the files are not being uploaded
|
||||
|
||||
$this->shareYourCartWooCommerce->getAdminPage($this); //get the admin page ( so that the data is processed, but do not show it )
|
||||
$this->shareYourCartWooCommerce->getButtonCustomizationPage(); //get the customization page ( so that the data is processed, but do not show it )
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Options
|
||||
*
|
||||
* Setup the gateway settings screen.
|
||||
* Override this in your gateway.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function admin_options() {
|
||||
|
||||
$this->init_share_your_cart();
|
||||
|
||||
if ( $this->shareYourCartWooCommerce->isActive() ) {
|
||||
|
||||
// call this manually ( to determine if there needs to be a table update, or not )
|
||||
$this->shareYourCartWooCommerce->install();
|
||||
}
|
||||
|
||||
$this->shareYourCartWooCommerce->showAdminHeader();
|
||||
$this->shareYourCartWooCommerce->showAdminPage($this,true,false); //send this obj to the view, but do not show the footer
|
||||
$this->shareYourCartWooCommerce->showButtonCustomizationPage(null,false,false); //do not show neither the header, nor the footer of this page
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the integration to WooCommerce
|
||||
**/
|
||||
function add_shareyourcart_integration( $integrations ) {
|
||||
if ( ! class_exists('ShareYourCartAPI') ) // Only allow this integration if we're not already using shareyourcart via another plugin
|
||||
$integrations[] = 'WC_ShareYourCart';
|
||||
return $integrations;
|
||||
}
|
||||
add_filter('woocommerce_integrations', 'add_shareyourcart_integration' );
|
|
@ -1,323 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once("class.shareyourcart-wp.php");
|
||||
|
||||
if ( ! class_exists( 'ShareYourCartWooCommerce', false ) ) {
|
||||
|
||||
/**
|
||||
* ShareYourCartWooCommerce class.
|
||||
*
|
||||
* @extends ShareYourCartWordpressPlugin
|
||||
*/
|
||||
class ShareYourCartWooCommerce extends ShareYourCartWordpressPlugin{
|
||||
|
||||
public $_plugin_name = "shareyourcart_woo_commerce";
|
||||
public $_post_user_id = 1;
|
||||
|
||||
/**
|
||||
* processInit function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function processInit() {
|
||||
if ( isset( $_REQUEST['action'] ) ) {
|
||||
switch( $_REQUEST['action'] ) {
|
||||
case $this->_plugin_name:
|
||||
$this->buttonCallback20();
|
||||
break;
|
||||
case $this->_plugin_name.'_coupon':
|
||||
$this->couponCallback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* isCartActive function.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isCartActive() {
|
||||
return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the base class implementation
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function pluginsLoadedHook() {
|
||||
parent::pluginsLoadedHook();
|
||||
|
||||
if ( ! $this->isCartActive() )
|
||||
return;
|
||||
|
||||
add_action( 'init', array( $this, 'processInit' ) );
|
||||
add_action( 'woocommerce_before_single_product', array( $this, 'showProductButton' ) );
|
||||
add_action( 'woocommerce_cart_contents', array( $this, 'showCartButton' ) );
|
||||
add_action( 'woocommerce_checkout_before_customer_details', array( $this, 'showCheckoutButton' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the jQuery sibling selector for the product button
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getProductButtonPosition() {
|
||||
$selector = parent::getProductButtonPosition();
|
||||
return ( ! empty( $selector ) ? $selector : ".summary .price .amount" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the jQuery sibling selector for the cart button
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getCartButtonPosition(){
|
||||
$selector = parent::getCartButtonPosition();
|
||||
return ( ! empty( $selector ) ? $selector : ".cart-subtotal .amount" );
|
||||
}
|
||||
|
||||
/**
|
||||
* getSecretKey function.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSecretKey() {
|
||||
return 'd3ce6c18-7e45-495d-aa4c-8f63edee03a5';
|
||||
}
|
||||
|
||||
/**
|
||||
* isSingleProduct function.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function isSingleProduct() {
|
||||
return is_singular( 'product' );
|
||||
}
|
||||
|
||||
/**
|
||||
* saveCoupon function.
|
||||
*
|
||||
* @access protected
|
||||
* @param mixed $token
|
||||
* @param mixed $coupon_code
|
||||
* @param mixed $coupon_value
|
||||
* @param mixed $coupon_type
|
||||
* @param array $product_unique_ids (default: array())
|
||||
* @return void
|
||||
*/
|
||||
protected function saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type, $product_unique_ids = array() ) {
|
||||
|
||||
// Create coupon
|
||||
$post_id = $this->_saveCouponPost( $coupon_code );
|
||||
|
||||
// Set coupon meta
|
||||
switch ( $coupon_type ) {
|
||||
case 'amount':
|
||||
$discount_type = 'fixed_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'percent':
|
||||
$discount_type = 'percent_product';
|
||||
$free_shipping = 'no';
|
||||
break;
|
||||
case 'free_shipping':
|
||||
$discount_type = 'fixed_product';
|
||||
$coupon_value = 0;
|
||||
$free_shipping = 'yes';
|
||||
break;
|
||||
default :
|
||||
$discount_type = 'fixed_cart';
|
||||
$free_shipping = 'no';
|
||||
}
|
||||
|
||||
update_post_meta( $post_id, 'customer_email', array() );
|
||||
update_post_meta( $post_id, 'minimum_amount', '' );
|
||||
update_post_meta( $post_id, 'exclude_product_categories', array() );
|
||||
update_post_meta( $post_id, 'product_categories', array() );
|
||||
update_post_meta( $post_id, 'free_shipping', $free_shipping );
|
||||
update_post_meta( $post_id, 'apply_before_tax', 'yes' );
|
||||
update_post_meta( $post_id, 'expiry_date', '' );
|
||||
update_post_meta( $post_id, 'usage_limit', 1 );
|
||||
update_post_meta( $post_id, 'exclude_product_ids', '' );
|
||||
update_post_meta( $post_id, 'product_ids', implode(',', $product_unique_ids));
|
||||
update_post_meta( $post_id, 'individual_use', 'yes' );
|
||||
update_post_meta( $post_id, 'coupon_amount', $coupon_value );
|
||||
update_post_meta( $post_id, 'discount_type', $discount_type );
|
||||
|
||||
// parent
|
||||
parent::saveCoupon( $token, $coupon_code, $coupon_value, $coupon_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* applyCoupon function.
|
||||
*
|
||||
* @access public
|
||||
* @param mixed $coupon_code
|
||||
* @return void
|
||||
*/
|
||||
public function applyCoupon( $coupon_code ) {}
|
||||
|
||||
/**
|
||||
* _saveCouponPost function.
|
||||
*
|
||||
* @access private
|
||||
* @param mixed $coupon_code
|
||||
* @return void
|
||||
*/
|
||||
private function _saveCouponPost( $coupon_code ){
|
||||
$new_post = array(
|
||||
'post_title' => $coupon_code,
|
||||
'post_name' => ereg_replace( "[^A-Za-z0-9]", "", $coupon_code ),
|
||||
'post_content' => '',
|
||||
'post_status' => 'publish',
|
||||
'comment_status'=> 'closed',
|
||||
'ping_status' => 'closed',
|
||||
'post_author' => $this->_post_user_id,
|
||||
'post_type' => 'shop_coupon'
|
||||
);
|
||||
|
||||
$post_id = wp_insert_post( $new_post );
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
public function showCheckoutButton() {
|
||||
echo $this->getButton();
|
||||
}
|
||||
|
||||
/**
|
||||
* getButtonCallbackURL function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getButtonCallbackURL() {
|
||||
global $wp_query;
|
||||
|
||||
$callback_url = add_query_arg( 'action', $this->_plugin_name, trailingslashit( home_url() ) );
|
||||
|
||||
if ( $this->isSingleProduct() ) {
|
||||
$callback_url .= '&p='. $wp_query->post->ID;
|
||||
}
|
||||
|
||||
return $callback_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to be used by WooCommerce from version 2.0
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buttonCallback20(){
|
||||
if ( ! $this->isCartActive() )
|
||||
return;
|
||||
|
||||
global $woocommerce;
|
||||
|
||||
$this->_loadWooCommerce();
|
||||
|
||||
$params = array(
|
||||
'callback_url' => get_bloginfo('wpurl').'/?action='.$this->_plugin_name.'_coupon'.(isset($_REQUEST['p']) ? '&product='.$_REQUEST['p'] : '' ),
|
||||
'success_url' => get_bloginfo('wpurl').'/?page_id='.get_option('woocommerce_cart_page_id'),
|
||||
'cancel_url' => get_bloginfo('wpurl').'/?page_id='.get_option('woocommerce_cart_page_id'),
|
||||
);
|
||||
|
||||
//there is no product set, thus send the products from the shopping cart
|
||||
if ( ! isset( $_REQUEST['p'] ) ) {
|
||||
if ( ! isset( $woocommerce->session->cart ) /*&& !is_array( $woocommerce->session->cart )*/ )
|
||||
exit("Cart is empty");
|
||||
|
||||
foreach( $woocommerce->session->cart as $cart_details ) {
|
||||
$params['cart'][] = $this->_getProductDetails20( $cart_details['product_id'] );
|
||||
}
|
||||
} else {
|
||||
$params['cart'][] = $this->_getProductDetails20( $_REQUEST['p'] );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->startSession( $params );
|
||||
} catch( Exception $e ) {
|
||||
//display the error to the user
|
||||
echo $e->getMessage();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to be used by WooCommerce from version 2.0
|
||||
*
|
||||
* @access private
|
||||
* @param mixed $product_id
|
||||
* @return void
|
||||
*/
|
||||
private function _getProductDetails20( $product_id ) {
|
||||
global $woocommerce;
|
||||
|
||||
$product = get_product( $product_id );
|
||||
|
||||
//WooCommerce actually echoes the image
|
||||
ob_start();
|
||||
echo $product->get_image(); // older WooCommerce versions might allready echo, but newer versions don't, so force it anyway
|
||||
$image = ob_get_clean();
|
||||
|
||||
//check is image actually a HTML img entity
|
||||
if ( ( $doc = @DomDocument::loadHTML( $image ) ) !== FALSE ) {
|
||||
$imageTags = $doc->getElementsByTagName('img');
|
||||
|
||||
if ( $imageTags->length > 0 )
|
||||
$src = $imageTags->item(0)->getAttribute('src');
|
||||
|
||||
//replace image only if src has been set
|
||||
if ( ! empty( $src ) )
|
||||
$image = $src;
|
||||
}
|
||||
|
||||
return array(
|
||||
"item_name" => $product->get_title(), //$product->post->post_title,
|
||||
"item_url" => get_permalink( $product_id ),
|
||||
"item_price" => $product->get_price(),
|
||||
"item_picture_url" => $image,
|
||||
"item_unique_id" => $product_id,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* loadSessionData function.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function loadSessionData() {}
|
||||
|
||||
/**
|
||||
* _loadWooCommerce function.
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function _loadWooCommerce(){
|
||||
// Sometimes the WooCommerce Class is not loaded...
|
||||
if ( ! class_exists( 'Woocommerce', false ) ) {
|
||||
require_once( ABSPATH . 'wp-content/plugins/woocommerce/woocommerce.php' );
|
||||
}
|
||||
|
||||
// Important Classes Not included
|
||||
if ( ! function_exists( 'has_post_thumbnail' ) ) {
|
||||
require_once( ABSPATH . 'wp-includes/post-thumbnail-template.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: see why this is not used
|
||||
add_action( ShareYourCartWordpressPlugin::getPluginFile(), array( 'ShareYourCartWooCommerce','uninstallHook' ) );
|
||||
}
|
|
@ -1,382 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* CLASS: Share Your Cart Wordpress Plugin
|
||||
* AUTHOR: Barandi Solutions
|
||||
* COUNTRY: Romania
|
||||
* EMAIL: catalin.paun@barandisolutions.ro
|
||||
* VERSION : 1.0
|
||||
* DESCRIPTION: This class is used as a base class for every wordpress shopping cart plugin we create.
|
||||
* * Copyright (C) 2011 Barandi Solutions
|
||||
*/
|
||||
|
||||
require_once("sdk/class.shareyourcart-base.php");
|
||||
|
||||
if(!class_exists('ShareYourCartWordpressPlugin',false)){
|
||||
|
||||
abstract class ShareYourCartWordpressPlugin extends ShareYourCartBase {
|
||||
|
||||
protected static $_INSTANCES = array();
|
||||
protected static $_VERSION = 7;
|
||||
protected $_PLUGIN_PATH;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param null
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
parent::__construct();
|
||||
|
||||
//if there is installed another plugin with a never version
|
||||
//do not load this one further
|
||||
if(!$this->canLoad()) return;
|
||||
|
||||
//make sure we add this instance
|
||||
self::$_INSTANCES []= $this;
|
||||
$this->_PLUGIN_PATH = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
|
||||
|
||||
//setup the hooks
|
||||
register_activation_hook(self::getPluginFile(), array(&$this,'activateHook'));
|
||||
register_deactivation_hook(self::getPluginFile(), array(&$this,'deactivateHook'));
|
||||
|
||||
//perform the rest of the loading AFTER all plugins have been loaded
|
||||
add_action('plugins_loaded', array(&$this,'pluginsLoadedHook'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract isCartActive
|
||||
* @param null
|
||||
* @return boolean
|
||||
*/
|
||||
protected abstract function isCartActive();
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the plugin version.
|
||||
* @return an integer
|
||||
*
|
||||
*/
|
||||
protected function getPluginVersion(){
|
||||
|
||||
return self::$_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return the project's URL
|
||||
*
|
||||
*/
|
||||
protected function getDomain(){
|
||||
|
||||
return get_bloginfo('url');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return the admin's email
|
||||
*
|
||||
*/
|
||||
protected function getAdminEmail(){
|
||||
|
||||
return get_option('admin_email');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Set the field value
|
||||
*
|
||||
*/
|
||||
protected function setConfigValue($field,$value){
|
||||
update_option('_shareyourcart_'.$field,$value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the field value
|
||||
*
|
||||
*/
|
||||
protected function getConfigValue($field){
|
||||
return get_option('_shareyourcart_'.$field);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the path to the main file of the plugin
|
||||
*
|
||||
*/
|
||||
public static function getPluginFile(){
|
||||
global $plugin;
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the upload directory
|
||||
*
|
||||
*/
|
||||
public function getUploadDir(){
|
||||
$dir = wp_upload_dir();
|
||||
|
||||
return (!empty($dir['path']) ? $dir['path'] : parent::getUploadDir());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Execute the SQL statement
|
||||
*
|
||||
*/
|
||||
protected function executeNonQuery($sql){
|
||||
|
||||
if(substr($sql,0,12) == "CREATE TABLE"){
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
|
||||
//if this is a create table command, use the special function which compares tables
|
||||
dbDelta($sql);
|
||||
|
||||
} else {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
//use the normal query
|
||||
$wpdb->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the row returned from the SQL
|
||||
*
|
||||
* @return an associative array containing the data of the row OR NULL
|
||||
* if there is none
|
||||
*/
|
||||
protected function getRow($sql){
|
||||
|
||||
global $wpdb;
|
||||
|
||||
//get the row as an associative array
|
||||
return $wpdb->get_row($sql,ARRAY_A);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the table name based on the key
|
||||
*
|
||||
*/
|
||||
protected function getTableName($key){
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->base_prefix.$key;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Insert the row into the specified table
|
||||
*
|
||||
*/
|
||||
protected function insertRow($tableName,$data){
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->insert($tableName,$data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Create url for the specified file. The file must be specified in relative path
|
||||
* to the base of the plugin
|
||||
*/
|
||||
protected function createUrl($file){
|
||||
//get the real file path
|
||||
$file = realpath($file);
|
||||
|
||||
//calculate the relative path from this file
|
||||
$file = SyC::relativepath(dirname(__FILE__),$file);
|
||||
|
||||
//append the relative path to the current file's URL
|
||||
return WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).$file;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Part of the initialization process, this is used to check if the cart is
|
||||
* really active
|
||||
*
|
||||
*/
|
||||
public function pluginsLoadedHook() {
|
||||
|
||||
//if the cart is not loaded, do not load this plugin further
|
||||
if(!$this->isCartActive()) return;
|
||||
|
||||
add_action('wp_head', array(&$this,'showPageHeader'));
|
||||
add_action('admin_menu', array(&$this,'showAdminMenu'));
|
||||
|
||||
//add the shortcodes ONLY if they where not added before, by another plugin
|
||||
global $shortcode_tags;
|
||||
if(!array_key_exists('shareyourcart',$shortcode_tags)){
|
||||
add_shortcode('shareyourcart', array(&$this,'getButton'));
|
||||
add_shortcode('shareyourcart_button', array(&$this,'getButton'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the activate hook called by WordPress. It is used for both install and activate
|
||||
*
|
||||
*/
|
||||
public function activateHook() {
|
||||
|
||||
if(!$this->isCartActive()) return;
|
||||
|
||||
$message = '';
|
||||
|
||||
//the db version is old, so install it again
|
||||
if(version_compare($this->getConfigValue('db_version'),self::$_DB_VERSION)!=0){
|
||||
|
||||
$this->install($message);
|
||||
} else { //if the version are equal, simply activate the plugin
|
||||
|
||||
$this->activate($message);
|
||||
}
|
||||
|
||||
//TODO: perhaps we can show the message somehow to the user. For now, just log it
|
||||
error_log($message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the deactivate hook called by WordPress.
|
||||
*
|
||||
*/
|
||||
public function deactivateHook() {
|
||||
|
||||
if(!$this->isCartActive()) return;
|
||||
|
||||
$message = '';
|
||||
|
||||
$this->deactivate($message);
|
||||
|
||||
//TODO: perhaps we can show the message somehow to the user. For now, just log it
|
||||
error_log($message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* When installing the new wordpress plugin, make sure to move the old data
|
||||
*
|
||||
*/
|
||||
public function install(&$message = null) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$old_table_name = $this->getTableName('shareyourcart_settings');
|
||||
if($wpdb->get_var("show tables like '$old_table_name'") == $old_table_name) {
|
||||
|
||||
//get the old app_key and client_id
|
||||
$settings = $wpdb->get_row("SELECT app_key, client_id FROM ".$wpdb->base_prefix."shareyourcart_settings LIMIT 1");
|
||||
if($settings) {
|
||||
|
||||
$this->setConfigValue('appKey', $settings->app_key);
|
||||
$this->setConfigValue('clientId', $settings->client_id);
|
||||
}
|
||||
|
||||
//remove the old table
|
||||
$wpdb->query("DROP TABLE $old_table_name");
|
||||
}
|
||||
|
||||
parent::install($message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This is the deactivate hook called by WordPress.
|
||||
*
|
||||
*/
|
||||
public static function uninstallHook() {
|
||||
|
||||
//this hook is required by WordPress to be static
|
||||
//so call uninstall on the first instance
|
||||
if(!empty(self::$_INSTANCES)){
|
||||
|
||||
self::$_INSTANCES[0]->uninstall();
|
||||
} else {
|
||||
|
||||
//log the error
|
||||
error_log("There is no instance created when calling uninstall hook");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show the admin menu
|
||||
* @param null
|
||||
* @return boolean
|
||||
*/
|
||||
public function showAdminMenu() {
|
||||
|
||||
//this is a single call function
|
||||
if(!$this->isFirstCall(__FUNCTION__)) return;
|
||||
|
||||
//first, check the SDK status
|
||||
$this->checkSDKStatus();
|
||||
|
||||
//see if we need to show the update notification
|
||||
$notification = null;
|
||||
if($this->hasNewerVersion())
|
||||
$notification = "<span class='update-plugins count-$warning_count'><span class='update-count'>" . number_format_i18n(1) . "</span></span>";
|
||||
|
||||
$page = add_menu_page(
|
||||
__('Share your cart settings'),
|
||||
__('ShareYourCart').$notification,
|
||||
1,
|
||||
basename(__FILE__),
|
||||
array(&$this, 'showAdminPage'),
|
||||
$this->_PLUGIN_PATH .'sdk/img/shareyourcart.png'
|
||||
);
|
||||
add_action( 'admin_head-'.$page, array(&$this, 'showAdminHeader'));
|
||||
|
||||
if($this->isActive())
|
||||
{
|
||||
//show the rest of the menu ONLY if the plugin is active
|
||||
$page = add_submenu_page(
|
||||
basename(__FILE__),
|
||||
__('Button'),
|
||||
__('Customize Button'),
|
||||
1,
|
||||
basename(__FILE__).'-button',
|
||||
array(&$this, 'showButtonCustomizationPage'));
|
||||
add_action( 'admin_head-'. $page, array(&$this, 'showAdminHeader'));
|
||||
|
||||
$page = add_submenu_page(
|
||||
basename(__FILE__),
|
||||
__('Documentation'),
|
||||
__('Documentation'),
|
||||
1,
|
||||
basename(__FILE__).'-documentation',
|
||||
array(&$this, 'showDocumentationPage'));
|
||||
add_action( 'admin_head-'. $page, array(&$this, 'showAdminHeader'));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Called when a new coupon is generated
|
||||
*
|
||||
*/
|
||||
public function couponCallback(){
|
||||
|
||||
//since there are a lot of plugins for wordpress, first make sure this plugin
|
||||
//is active
|
||||
if(!$this->isCartActive()) {
|
||||
|
||||
throw new Exception(SyC::t('sdk','Shopping Cart is not active'));
|
||||
}
|
||||
|
||||
parent::couponCallback();
|
||||
|
||||
//since this is actually an API, exit
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
} //END IF
|
||||
?>
|
|
@ -1,57 +0,0 @@
|
|||
/*use our own save buttons, in order to determine what actions the user made*/
|
||||
p.submit .button-primary{
|
||||
display:none
|
||||
}
|
||||
|
||||
/* disable extra padding */
|
||||
.wrap {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.form-table td{
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
margin-bottom: 9px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.api-status {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.syc-configuration {
|
||||
width: 60%;
|
||||
}
|
||||
.configure-button-container {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.buttonTextarea {
|
||||
width: auto;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.buttonOption {
|
||||
height: 170px;
|
||||
background-position: right -54px;
|
||||
}
|
||||
|
||||
body .buttonCheckbox {
|
||||
margin: 0 9px 0 0;
|
||||
}
|
||||
|
||||
.buttonOptions {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#visual-options>fieldset {
|
||||
margin: 0 0 20px;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
.button_iframe iframe {
|
||||
width: 58px;
|
||||
height: 230px;
|
||||
position: fixed;
|
||||
top:360px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.button_iframe-normal iframe {
|
||||
float:right;
|
||||
height: 58px;
|
||||
width: 230px;
|
||||
position:relative;
|
||||
z-index:1000;
|
||||
}
|
||||
|
||||
.button_iframe-normal.button_height {
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
#shareyourcart_button {
|
||||
margin: .5em 0 0;
|
||||
overflow: hidden;
|
||||
}
|
|
@ -1,595 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* CLASS: Share Your Cart API
|
||||
* AUTHOR: Barandi Solutions
|
||||
* COUNTRY: Romania
|
||||
* EMAIL: catalin.paun@barandisolutions.ro
|
||||
* VERSION : 1.0
|
||||
* DESCRIPTION: This class is used as a wrapper to communicate to the ShareYourCart API.
|
||||
* * Copyright (C) 2011 Barandi Solutions
|
||||
*/
|
||||
|
||||
if(!class_exists('ShareYourCartAPI',false)){
|
||||
|
||||
class ShareYourCartAPI {
|
||||
|
||||
protected $SHAREYOURCART_URL = "www.shareyourcart.com";
|
||||
protected $SHAREYOURCART_SANDBOX_URL = "sandbox.shareyourcart.com";
|
||||
protected $SHAREYOURCART_API;
|
||||
protected $SHAREYOURCART_API_REGISTER;
|
||||
protected $SHAREYOURCART_API_RECOVER;
|
||||
protected $SHAREYOURCART_API_ACTIVATE;
|
||||
protected $SHAREYOURCART_API_DEACTIVATE;
|
||||
protected $SHAREYOURCART_API_CREATE;
|
||||
protected $SHAREYOURCART_API_VALIDATE;
|
||||
protected $SHAREYOURCART_API_STATUS;
|
||||
protected $SHAREYOURCART_API_TRANSLATION;
|
||||
protected $SHAREYOURCART_CONFIGURE;
|
||||
protected $SHAREYOURCART_BUTTON_JS;
|
||||
protected $SHAREYOURCART_BUTTON_URL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param null
|
||||
*/
|
||||
function __construct() {
|
||||
|
||||
$is_live = true;
|
||||
|
||||
//check if the current object has a secret key function
|
||||
//this is for backward compatibility
|
||||
if(method_exists ($this,'getSecretKey')){
|
||||
$secretKey = $this->getSecretKey();
|
||||
if(empty($secretKey)){
|
||||
throw new Exception(SyC::t('sdk',"You must specify a valid secret key"));
|
||||
}
|
||||
|
||||
//check if the secret key is a sandbox one
|
||||
if(strpos($secretKey,"sndbx_") === 0){
|
||||
$this->SHAREYOURCART_URL = $this->SHAREYOURCART_SANDBOX_URL;
|
||||
$is_live = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->SHAREYOURCART_API = (isset($_SERVER['HTTPS']) && !strcasecmp($_SERVER['HTTPS'],'on') ? 'https://' : 'http://') . $this->SHAREYOURCART_URL;
|
||||
$this->SHAREYOURCART_REGISTER = $this->SHAREYOURCART_API.'/account/create';
|
||||
$this->SHAREYOURCART_API_REGISTER = $this->SHAREYOURCART_API.'/account/create';
|
||||
$this->SHAREYOURCART_API_RECOVER = $this->SHAREYOURCART_API.'/account/recover';
|
||||
$this->SHAREYOURCART_API_ACTIVATE = $this->SHAREYOURCART_API.'/account/activate';
|
||||
$this->SHAREYOURCART_API_DEACTIVATE = $this->SHAREYOURCART_API.'/account/deactivate';
|
||||
$this->SHAREYOURCART_API_CREATE = $this->SHAREYOURCART_API.'/session/create';
|
||||
$this->SHAREYOURCART_API_VALIDATE = $this->SHAREYOURCART_API.'/session/validate';
|
||||
$this->SHAREYOURCART_API_STATUS = $this->SHAREYOURCART_API.'/sdk';
|
||||
$this->SHAREYOURCART_API_TRANSLATION = $this->SHAREYOURCART_API.'/sdk/translation';
|
||||
$this->SHAREYOURCART_CONFIGURE = $this->SHAREYOURCART_API.'/configure';
|
||||
$this->SHAREYOURCART_BUTTON_JS = $this->SHAREYOURCART_API.'/js/'.($is_live ? 'button.js' : 'button_sandbox.js');
|
||||
$this->SHAREYOURCART_BUTTON_URL = $this->SHAREYOURCART_API.'/button';
|
||||
}
|
||||
|
||||
/**
|
||||
* startSession
|
||||
* @param array $params
|
||||
* @return array $data
|
||||
*/
|
||||
public function startSession($params) {
|
||||
//make sure the session is started
|
||||
if(session_id() == '')
|
||||
session_start();
|
||||
|
||||
$session = curl_init($this->SHAREYOURCART_API_CREATE);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
// If the operation was not succesfull, print the error
|
||||
if($httpCode != 200)
|
||||
throw new Exception($response);
|
||||
|
||||
// Decode the result
|
||||
$results = json_decode($response, true);
|
||||
|
||||
// Find the token
|
||||
if(isset($results['token'])) {
|
||||
|
||||
// Link the token with the current cart ( held in session id )
|
||||
$data = array(
|
||||
'token' => $results['token'],
|
||||
'session_id' => session_id(),
|
||||
);
|
||||
|
||||
// A token was obtained, so redirect the browser
|
||||
header("Location: $results[session_url]", true, 302);
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
//show the raw response received ( for debug purposes )
|
||||
throw new Exception($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* make sure the coupon is valid
|
||||
* @param null
|
||||
*/
|
||||
public function assertCouponIsValid($token, $coupon_code, $coupon_value, $coupon_type) {
|
||||
|
||||
// Verifies POST information
|
||||
if(!isset($token, $coupon_code, $coupon_value, $coupon_type)) {
|
||||
|
||||
throw new Exception(SyC::t('sdk',"At least one of the parameters is missing."));
|
||||
}
|
||||
|
||||
// Urlencode and concatenate the POST arguments
|
||||
$params = array(
|
||||
'token' => $token,
|
||||
'coupon_code' => $coupon_code,
|
||||
'coupon_value' => $coupon_value,
|
||||
'coupon_type'=> $coupon_type,
|
||||
);
|
||||
|
||||
// Make the API call
|
||||
$session = curl_init($this->SHAREYOURCART_API_VALIDATE);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
//if the operation was not succesfull, print the error
|
||||
if($httpCode != 200)
|
||||
throw new Exception(SyC::t('sdk',"Coupon Invalid: {coupon}", array('{coupon}' => $response)));
|
||||
|
||||
$results = json_decode($response, true);
|
||||
|
||||
//if the result is not valid, print it
|
||||
if(!isset($results['valid']) || !($results['valid'] === true))
|
||||
throw new Exception(SyC::t('sdk',"Coupon Invalid: {coupon}", array('{coupon}' => $response)));
|
||||
}
|
||||
|
||||
/**
|
||||
* register
|
||||
* @param string $secretKey
|
||||
* @param string $domain
|
||||
* @param string $email
|
||||
* @param string $message
|
||||
* @return array json_decode
|
||||
*/
|
||||
public function register($secretKey, $domain, $email, &$message = null) {
|
||||
|
||||
// Urlencode and concatenate the POST arguments
|
||||
$params = array(
|
||||
'secret_key' => $secretKey,
|
||||
'domain' => $domain,
|
||||
'email' => $email,
|
||||
);
|
||||
|
||||
// Make the API call
|
||||
$session = curl_init($this->SHAREYOURCART_API_REGISTER);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
// If the operation was not succesfull, return FALSE
|
||||
if($httpCode != 200) {
|
||||
if(isset($message)) $message = $response;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//if the caller is expecting a message
|
||||
//let him know what happened
|
||||
if(isset($message)){
|
||||
|
||||
$message = SyC::t('sdk','The account has been registered');
|
||||
}
|
||||
|
||||
// Return the response after decoding it
|
||||
return json_decode($response, true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* recover
|
||||
* @param string $secretKey
|
||||
* @param string $domain
|
||||
* @param string $email
|
||||
* @param string $message
|
||||
* @return boolean
|
||||
*/
|
||||
public function recover($secretKey, $domain, $email, &$message = null) {
|
||||
|
||||
// Urlencode and concatenate the POST arguments
|
||||
$params = array(
|
||||
'secret_key' => $secretKey,
|
||||
'domain' => $domain,
|
||||
'email' => $email,
|
||||
);
|
||||
|
||||
// Make the API call
|
||||
$session = curl_init($this->SHAREYOURCART_API_RECOVER);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
//if the operation was not succesfull, return FALSE
|
||||
if($httpCode != 200) {
|
||||
if(isset($message)) $message = $response;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//if the caller is expecting a message
|
||||
//let him know what happened
|
||||
if(isset($message)){
|
||||
|
||||
$message = (!empty($response) ? $response : SyC::t('sdk',"An email has been sent with your credentials at {email}",array('{email}' => $email)));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* setAccountStatus
|
||||
* @param string $secretKey
|
||||
* @param string $clientId
|
||||
* @param string $appKey
|
||||
* @param string $activate
|
||||
* @param string $message
|
||||
* @return boolean
|
||||
*/
|
||||
public function setAccountStatus($secretKey, $clientId, $appKey, $activate = true, &$message = null) {
|
||||
|
||||
// Urlencode and concatenate the POST arguments
|
||||
$params = array(
|
||||
'secret_key' => $secretKey,
|
||||
'client_id' => $clientId,
|
||||
'app_key' => $appKey,
|
||||
);
|
||||
|
||||
//make the API call
|
||||
$session = curl_init($activate ? $this->SHAREYOURCART_API_ACTIVATE : $this->SHAREYOURCART_API_DEACTIVATE);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
// Notify the caller
|
||||
if($httpCode != 200) {
|
||||
if(isset($message)) $message = $response;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//if the caller is expecting a message
|
||||
//let him know what happened
|
||||
if(isset($message)){
|
||||
|
||||
$message = (!empty($response) ? $response : ($activate ? SyC::t('sdk','The account has been enabled') : SyC::t('sdk','The account has been disabled')));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* setAccountStatus
|
||||
* @param string $secretKey
|
||||
* @param string $clientId
|
||||
* @param string $appKey
|
||||
* @param string $message
|
||||
* @return array or FALSE
|
||||
*/
|
||||
public function getSDKStatus($secretKey=null, $clientId=null, $appKey=null, &$message = null)
|
||||
{
|
||||
$params = array();
|
||||
|
||||
if(isset($secretKey)) $params['secret_key'] = $secretKey;
|
||||
if(isset($clientId)) $params['client_id'] = $clientId;
|
||||
if(isset($appKey)) $params['app_key'] = $appKey;
|
||||
|
||||
//make the API call
|
||||
$session = curl_init($this->SHAREYOURCART_API_STATUS);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
// Notify the caller
|
||||
if($httpCode != 200) {
|
||||
if(isset($message)) $message = $response;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decode the result
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns an array of messages for the SDK, in the specified language
|
||||
*
|
||||
*/
|
||||
public function getSDKTranslation($lang, &$message = null)
|
||||
{
|
||||
$params = array('lang' => $lang);
|
||||
|
||||
//make the API call
|
||||
$session = curl_init($this->SHAREYOURCART_API_TRANSLATION);
|
||||
|
||||
// Tell curl to use HTTP POST
|
||||
curl_setopt($session, CURLOPT_POST, true);
|
||||
// Tell curl that this is the body of the POST
|
||||
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($params,'','&'));
|
||||
// Tell curl not to return headers, but do return the response
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$response = curl_exec($session);
|
||||
$httpCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
|
||||
curl_close($session);
|
||||
|
||||
// Notify the caller
|
||||
if($httpCode != 200) {
|
||||
if(isset($message)) $message = $response;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decode the result
|
||||
return json_decode($response, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* This class should contain all the static methods in the SDK
|
||||
*
|
||||
*/
|
||||
class SyC
|
||||
{
|
||||
static $_messages;
|
||||
static $_language = 'en';
|
||||
static $loadLanguage = array('SyC','loadFileLanguage'); //variable that holds the name of the function used to load a particular language
|
||||
|
||||
/**
|
||||
*
|
||||
* Change the language the SDK should be displayed in
|
||||
*
|
||||
*/
|
||||
public static function setLanguage($newLanguage = null){
|
||||
self::$_language = $newLanguage;
|
||||
|
||||
//reset the old messages, so that they are reloaded
|
||||
self::$_messages = null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the language that is currently loaded
|
||||
*
|
||||
*/
|
||||
public static function getLanguage(){
|
||||
return self::$_language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the checksum of the currently loaded translation
|
||||
*/
|
||||
public static function getLanguageChecksum($category = 'sdk')
|
||||
{
|
||||
//load the translation from file if not done so
|
||||
if(!isset(self::$_messages)){
|
||||
|
||||
//load the language
|
||||
self::$_messages = call_user_func(self::$loadLanguage,self::$_language,$category);
|
||||
}
|
||||
|
||||
return md5(json_encode(self::$_messages));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the language
|
||||
*/
|
||||
public static function reloadLanguage()
|
||||
{
|
||||
self::$_messages = null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate the specified message
|
||||
*
|
||||
*/
|
||||
public static function t($category,$message,$params=array())
|
||||
{
|
||||
//load the translation from file if not done so
|
||||
if(!isset(self::$_messages)){
|
||||
|
||||
//load the language
|
||||
self::$_messages = call_user_func(self::$loadLanguage,self::$_language,$category);
|
||||
}
|
||||
|
||||
//check if the text has a valid translation
|
||||
if(isset(self::$_messages[$message]) && !empty(self::$_messages[$message])){
|
||||
$message = self::$_messages[$message];
|
||||
}
|
||||
|
||||
//return the translated message, with the parameters replaced
|
||||
return $params!==array() ? strtr($message,$params) : $message;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* change the language loader method
|
||||
*
|
||||
*/
|
||||
public static function setLanguageLoader($loader)
|
||||
{
|
||||
//make sure the loader is ok
|
||||
if(!is_callable($loader))
|
||||
throw new Exception(SyC::t('sdk',"The language loader is not a valid callback"));
|
||||
|
||||
self::$loadLanguage = $loader;
|
||||
|
||||
//reset the old messages, so that they are reloaded with the new loader
|
||||
self::$_messages = null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Function to load a language from the hard-drive.
|
||||
*
|
||||
*/
|
||||
public static function loadFileLanguage($lang, $category)
|
||||
{
|
||||
//The language is the folder name, and the category is the name of the file
|
||||
$messageFile = dirname(__FILE__).DIRECTORY_SEPARATOR.'messages'.DIRECTORY_SEPARATOR.$lang.DIRECTORY_SEPARATOR.$category.'.php';
|
||||
|
||||
$messages = null;
|
||||
if(is_file($messageFile))
|
||||
{
|
||||
$messages=include($messageFile);
|
||||
}
|
||||
|
||||
//make sure we have an array for this variable
|
||||
if(!is_array($messages)) $messages=array();
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
public static function relativepath($from, $to, $ps = '/' ,$ds = DIRECTORY_SEPARATOR)
|
||||
{
|
||||
$arFrom = explode($ds, rtrim($from, $ds));
|
||||
$arTo = explode($ds, rtrim($to, $ds));
|
||||
|
||||
while(count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0]))
|
||||
{
|
||||
array_shift($arFrom);
|
||||
array_shift($arTo);
|
||||
}
|
||||
return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* rel2Abs
|
||||
* @param string $src
|
||||
* @return string
|
||||
*/
|
||||
public static function rel2Abs($rel, $base) {
|
||||
|
||||
/* return if already absolute URL */
|
||||
if (parse_url($rel, PHP_URL_SCHEME) != '')
|
||||
return $rel;
|
||||
|
||||
/* queries and anchors */
|
||||
if ($rel[0] == '#' || $rel[0] == '?')
|
||||
return $base . $rel;
|
||||
|
||||
/* parse base URL and convert to local variables:
|
||||
$scheme, $host, $path */
|
||||
extract(parse_url($base));
|
||||
|
||||
/* remove non-directory element from path */
|
||||
$path = preg_replace('#/[^/]*$#', '', @$path);
|
||||
|
||||
/* destroy path if relative url points to root */
|
||||
if ($rel[0] == '/')
|
||||
$path = '';
|
||||
|
||||
/* dirty absolute URL */
|
||||
$abs = "$host$path/$rel";
|
||||
|
||||
/* replace '//' or '/./' or '/foo/../' with '/' */
|
||||
$re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#');
|
||||
for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) {
|
||||
|
||||
}
|
||||
|
||||
/* absolute URL is ready! */
|
||||
return $scheme . '://' . $abs;
|
||||
}
|
||||
|
||||
/**
|
||||
* htmlIndent
|
||||
* @param string $src
|
||||
* @return string
|
||||
*/
|
||||
public static function htmlIndent($src) {
|
||||
|
||||
//replace all leading spaces with
|
||||
//Attention: this will render wrong html if you split a tag on more lines!
|
||||
return preg_replace_callback('/(^|\n)( +)/', create_function('$match', 'return str_repeat(" ", strlen($match[0]));'
|
||||
), $src);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns TRUE if haystack starts with needle
|
||||
*/
|
||||
public static function startsWith($haystack, $needle)
|
||||
{
|
||||
$length = strlen($needle);
|
||||
return (substr($haystack, 0, $length) === $needle);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns TRUE if haystack ends with needle
|
||||
*/
|
||||
public static function endsWith($haystack, $needle)
|
||||
{
|
||||
return (substr($haystack, strlen($haystack) - strlen($needle)) === $needle);
|
||||
}
|
||||
}
|
||||
|
||||
} //END IF
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,406 +0,0 @@
|
|||
.shareyourcart-button-orange {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 15px 20px !important;
|
||||
text-align: center !important;
|
||||
border: 1px solid #a15400;
|
||||
width: 170px;
|
||||
color: #623505 !important;
|
||||
font-size: 16px !important;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 1px 1px #ffce97 !important;
|
||||
|
||||
background-color: #fcc436 !important;
|
||||
background-image: -moz-linear-gradient(top, #fcc436, #ff7a01) !important;
|
||||
background-image: -o-linear-gradient(top, #fcc436, #ff7a01) !important;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcc436), to(#ff7a01)) !important;
|
||||
|
||||
background-image: linear-gradient(top, #fcc436, #ff7a01) !important;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcc436', EndColorStr='#ff7a01') !important;
|
||||
|
||||
border-radius: 10px !important;
|
||||
-moz-border-radius: 10px !important;
|
||||
-webkit-border-radius: 10px !important;
|
||||
|
||||
box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
|
||||
-moz-box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
|
||||
-webkit-box-shadow: 0 2px 2px #bfc7cb, inset 0 1px 0px #fee6a9;
|
||||
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.shareyourcart-button-blue {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding: 15px 20px !important;
|
||||
text-align: center !important;
|
||||
border: 1px solid #688da9;
|
||||
width: 170px;
|
||||
color: #005fa9 !important;
|
||||
|
||||
font-size: 16px !important;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 1px 1px #fcfdfe !important;
|
||||
|
||||
background-color: #cde5f5 !important;
|
||||
background-image: -moz-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
|
||||
background-image: -o-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf5fb), to(#b3d8ef)) !important;
|
||||
background-image: -webkit-linear-gradient(top, #ebf5fb, #b3d8ef) !important;
|
||||
background-image: linear-gradient(top, #ebf5fb, #b3d8ef) !important;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ebf5fb', EndColorStr='#b3d8ef');
|
||||
|
||||
border-radius: 10px !important;
|
||||
-moz-border-radius: 10px !important;
|
||||
-webkit-border-radius: 10px !important;
|
||||
|
||||
box-shadow: 0 2px 2px #fcfdfe, inset 0 1px 0px #fcfdfe;
|
||||
-moz-box-shadow: 0 2px 2px #fcfdfe, inset 0 1px 0px #fcfdfe;
|
||||
-webkit-box-shadow: inset 0 1px 0px #fcfdfe;
|
||||
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.shareyourcart-button-orange:hover
|
||||
{
|
||||
background-color: #fff449 !important;
|
||||
background-image: -moz-linear-gradient(top, #fff449, #ff9c01) !important;
|
||||
background-image: -o-linear-gradient(top, #fff449, #ff9c01) !important;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff449), to(#ff9c01)) !important;
|
||||
background-image: -webkit-linear-gradient(top, #fff449, #ff9c01) !important;
|
||||
background-image: linear-gradient(top, #fff449, #ff9c01) !important;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fff449', EndColorStr='#ff9c01');
|
||||
|
||||
text-shadow: 0 1px 1px #fff !important;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.shareyourcart-button-blue:hover
|
||||
{
|
||||
background-color: #fff449;
|
||||
background-image: -moz-linear-gradient(top, #f4fbff, #d1e6ef) !important;
|
||||
background-image: -o-linear-gradient(top, #f4fbff, #d1e6ef) !important;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f4fbff), to(#d1e6ef)) !important;
|
||||
background-image: -webkit-linear-gradient(top, #f4fbff, #d1e6ef) !important;
|
||||
background-image: linear-gradient(top, #f4fbff, #d1e6ef) !important;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef') !important;
|
||||
|
||||
text-shadow: 0 1px 1px #fff;
|
||||
cursor:pointer;
|
||||
}
|
||||
.shareyourcart-button-blue:hover, .shareyourcart-button-blue:visited{
|
||||
color: #005fa9;
|
||||
}
|
||||
|
||||
.shareyourcart-button-orange:active {
|
||||
background-image: -moz-linear-gradient(top, #ff7a01, #fcc436);
|
||||
background-image: -o-linear-gradient(top, #ff7a01, #fcc436);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#ff7a01), to(#fcc436));
|
||||
background-image: -webkit-linear-gradient(top, #ff7a01, #fcc436);
|
||||
background-image: linear-gradient(top, #ff7a01, #fcc436);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#ff7a01', EndColorStr='#fcc436');
|
||||
|
||||
box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
-moz-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
-webkit-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
}
|
||||
|
||||
.shareyourcart-button-blue:active {
|
||||
background-image: -moz-linear-gradient(top, #d1e6ef, #f4fbff);
|
||||
background-image: -o-linear-gradient(top, #d1e6ef, #f4fbff);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#d1e6ef), to(#f4fbff));
|
||||
background-image: -webkit-linear-gradient(top, #d1e6ef, #f4fbff);
|
||||
background-image: linear-gradient(top, #d1e6ef, #f4fbff);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#d1e6ef', EndColorStr='#f4fbff');
|
||||
|
||||
box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
-moz-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
-webkit-box-shadow: 0 0 2px #888, inset 0 1px 0px #fee6a9;
|
||||
}
|
||||
|
||||
.shareyourcart-button-orange p, .shareyourcart-button-blue p{
|
||||
margin: 0px;
|
||||
padding: 0px !important;
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.shareyourcart-button-orange small, .shareyourcart-button-blue small{
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.shareyourcart-button-orange img, .shareyourcart-button-blue img{
|
||||
float: left;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* PLUGIN OPTIONS STYLE*/
|
||||
.shareyourcart-logo{
|
||||
margin-top: 15px;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#button_skin{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.form-table th{
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.form-table a {
|
||||
color:blue;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.form-table a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
div.updated p, div.error p{
|
||||
margin: 1em 0px;
|
||||
}
|
||||
|
||||
.regular-text {
|
||||
width:320px;
|
||||
}
|
||||
|
||||
li#toplevel_page_shareyourcart .wp-menu-toggle{
|
||||
width:0px;
|
||||
}
|
||||
|
||||
.form-table {
|
||||
width:90%;
|
||||
}
|
||||
|
||||
.form-table-api {
|
||||
width:80%;
|
||||
}
|
||||
|
||||
.table-small {
|
||||
width:45%;
|
||||
}
|
||||
|
||||
.table-small tr th {
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.table-small tr td {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
padding-bottom:8px;
|
||||
padding-top:12px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
padding-top: 7px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table tr td {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.buttonOption {
|
||||
float:left;
|
||||
width:33%;
|
||||
height: 290px;
|
||||
background: url('../img/spacer.png') right top repeat-y;
|
||||
}
|
||||
|
||||
.buttonOption.last {
|
||||
background: none;
|
||||
}
|
||||
|
||||
label {
|
||||
float:none !important;
|
||||
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #F9F9F9;
|
||||
border: 1px dashed #2F6FAB;
|
||||
color: black;
|
||||
line-height: 1.1em;
|
||||
padding: 1em;
|
||||
font-family: sans-serif;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin:0;
|
||||
background-color:#d8d7cf;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.syc-slogan {
|
||||
float: left;
|
||||
font-size: 18px;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.syc-update-nag {
|
||||
line-height: 19px;
|
||||
padding: 5px 0;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
/*margin: 0 15px;*/
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
/*border-top-width: 0;
|
||||
border-top-style: none;*/
|
||||
-moz-border-radius: 0 0 3px 3px;
|
||||
-webkit-border-bottom-right-radius: 3px;
|
||||
-webkit-border-bottom-left-radius: 3px;
|
||||
-khtml-border-bottom-right-radius: 3px;
|
||||
-khtml-border-bottom-left-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
|
||||
background-color: #FFFBCC;
|
||||
border-color: #E6DB55;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.clr {
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.wrap {
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.api-status {
|
||||
line-height: 25px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.api-button {
|
||||
width: 120px;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.api-link {
|
||||
color: #1122CC;
|
||||
font-weight:bold;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.api-link:hover {
|
||||
color: #1122CC;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #118C11;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #F71414;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.buttonOptionLabel {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.buttonOptionRadio {
|
||||
margin:7px 5px 13px 0px;
|
||||
}
|
||||
|
||||
.buttonTextarea {
|
||||
width:280px;
|
||||
height:230px;
|
||||
}
|
||||
|
||||
.buttonCheckbox {
|
||||
margin:4px 4px 5px 0;
|
||||
}
|
||||
|
||||
.configure-button-container{
|
||||
margin: auto;
|
||||
margin-top: 10px;
|
||||
width: 212px;
|
||||
}
|
||||
|
||||
#button-container{
|
||||
margin: auto;
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.button_iframe iframe
|
||||
{
|
||||
width: 58px;
|
||||
height: 230px;
|
||||
position: fixed;
|
||||
top:360px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.button_iframe-normal iframe
|
||||
{
|
||||
float:right;
|
||||
height: 58px;
|
||||
width: 230px;
|
||||
position:relative;
|
||||
z-index:99999;
|
||||
}
|
||||
|
||||
|
||||
/* ------- VERTICAL BUTTON STYLING -------------*/
|
||||
.vertical{
|
||||
-webkit-transform: rotate(-90deg);
|
||||
-moz-transform: rotate(-90deg);
|
||||
-o-transform: rotate(-90deg);
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
||||
position: absolute !important;
|
||||
right: -165px;
|
||||
position: fixed;
|
||||
height: 235px;
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.vertical-left
|
||||
{
|
||||
-webkit-transform: rotate(-90deg);
|
||||
-moz-transform: rotate(-90deg);
|
||||
-o-transform: rotate(-90deg);
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
||||
position: absolute !important;
|
||||
left: -85px;
|
||||
position: fixed;
|
||||
}
|
||||
/* ------- VERTICAL BUTTON STYLING -------------*/
|
||||
|
||||
/* -------- UPDATE MESSAGES --------------- */
|
||||
|
||||
.wrap div.updated, .wrap div.error {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
padding: 0 .6em;
|
||||
margin: 5px 0 15px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
||||
background-color: lightYellow;
|
||||
border-color: #E6DB55;
|
||||
}
|
||||
|
||||
/* -------- FINISH UPDATE MESSAGES --------------- */
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
.shareyourcart-button-orange{color: #623505 !important;}
|
||||
|
||||
.shareyourcart-button-orange p,
|
||||
.shareyourcart-button-blue p
|
||||
{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
margin-bottom: 0px !important;
|
||||
line-height: 17px;
|
||||
}
|
||||
.shareyourcart-button-orange small,
|
||||
.shareyourcart-button-blue small
|
||||
{
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
.vertical{right: 0px;}
|
||||
.vertical-left{left:0px;}
|
||||
|
||||
|
||||
/* IE NEEDED STYLES (because ie doesn't display the button vertical on hover) */
|
||||
.shareyourcart-button-blue.vertical:hover,
|
||||
.shareyourcart-button-blue.vertical:active,
|
||||
.shareyourcart-button-orange.vertical:hover,
|
||||
.shareyourcart-button-orange.vertical:active
|
||||
{
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef')
|
||||
progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
||||
}
|
||||
|
||||
.shareyourcart-button-blue.vertical-left:hover,
|
||||
.shareyourcart-button-blue.vertical-left:active,
|
||||
.shareyourcart-button-orange.vertical-left:hover,
|
||||
.shareyourcart-button-orange.vertical-left:active
|
||||
{
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f4fbff', EndColorStr='#d1e6ef')
|
||||
progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
.button_iframe iframe {
|
||||
width: 58px;
|
||||
height: 230px;
|
||||
position: fixed;
|
||||
top:360px;
|
||||
right:0px;
|
||||
}
|
||||
|
||||
.button_iframe-normal iframe {
|
||||
height: 78px;
|
||||
width: 230px;
|
||||
position:relative;
|
||||
z-index:1000;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.button_iframe-normal[data-syc-skin="light"] iframe, .button_iframe-normal[data-syc-skin="dark"] iframe{
|
||||
height: 25px;
|
||||
width: 125px;
|
||||
}
|
||||
|
||||
.button_iframe-normal.button_height {
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.button_iframe-normal.button_height[data-syc-skin="light"],.button_iframe-normal.button_height[data-syc-skin="dark"] {
|
||||
height: 27px;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 781 B |
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
|
@ -1,36 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<script type="text/javascript">
|
||||
if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view']);
|
||||
</script>
|
||||
<?php echo SyC::t('sdk','Create a ShareYourCart account'); ?>
|
||||
<form method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" <?php if( $_SERVER['REQUEST_METHOD'] !== 'POST' || isset($_POST['syc-terms-agreement'])){ echo 'checked="checked"'; } ?> type="checkbox" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/toogle-terms-agreement-click']);"><label for="syc-terms-agreement"><?php echo SyC::t('sdk','I agree with the {brand} terms & conditions',array('{brand}' => '<a href="http://www.shareyourcart.com/terms" target="_blank" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/create-view/logo-terms-click\']);">ShareYourCart</a>')); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="syc-create-account" value="<?php echo SyC::t('sdk','Create account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/create-view/save-click']);"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo $html;?>
|
||||
</form>
|
|
@ -1,31 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<script type="text/javascript">
|
||||
if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view']);
|
||||
</script>
|
||||
<?php echo SyC::t('sdk','Enter the domain and email you used when you created the ShareYourCart account'); ?>
|
||||
<form method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="syc-recover-account" value="<?php echo SyC::t('sdk','Recover my account'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/recover-view/save-click']);" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo $html;?>
|
||||
</form>
|
|
@ -1,38 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $this->getUrl(dirname(__FILE__).'/../css/admin-style.css'); ?>" />
|
||||
|
||||
<?php //check if there is an admin-style outside of the SDK, and include that one as well
|
||||
|
||||
$_reflection_ = new ReflectionClass(get_class($this));
|
||||
$_file_ = dirname($_reflection_->getFileName())."/css/admin-style.css";
|
||||
|
||||
//check if there is a file in the specified location
|
||||
if(file_exists($_file_)):?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $this->getUrl($_file_); ?>" />
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<?php if($this->SHAREYOURCART_URL == "www.shareyourcart.com" && $this->SDK_ANALYTICS): //only if in production mode anonymously monitor the usage ?>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-2900571-7']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
<?php endif; ?>
|
||||
|
||||
window.onload = function() {
|
||||
document.getElementById('syc-form').addEventListener('submit', changetext, false);
|
||||
};
|
||||
|
||||
var changetext = function(){
|
||||
var textarea = document.getElementById('syc_button_textarea').value;
|
||||
document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea);
|
||||
}
|
||||
</script>
|
|
@ -1,123 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied');
|
||||
|
||||
$admin_base_url = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||
|
||||
//in case we need to refresh the page
|
||||
if($refresh)
|
||||
{
|
||||
//recreate the url ( but before that make sure there is no syc-account parameter in it )
|
||||
unset($_GET['syc-account']);
|
||||
$url = $admin_base_url.'?'.http_build_query($_GET,'','&');
|
||||
|
||||
@header("HTTP/1.1 302 Found");
|
||||
@header("Location: $url");
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; url=$url\">"; //it can happen that the headers have allready been sent, so use the html version as well
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if(_gaq) _gaq.push(['_trackPageview', '/admin-view']);
|
||||
</script>
|
||||
<div class="wrap">
|
||||
<?php if($show_header):?>
|
||||
|
||||
<?php echo $this->getUpdateNotification(); ?>
|
||||
|
||||
<h2>
|
||||
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/logo-click']);">
|
||||
<img src="<?php echo $this->getUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
|
||||
</a>
|
||||
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
|
||||
|
||||
<?php
|
||||
if(isset($this->adminFix)) echo "<br /><br /><br /><br /><br />";
|
||||
else echo "<br class=\"clr\" /> ";
|
||||
?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(!empty($status_message) || !empty($error_message)): ?>
|
||||
<div class="updated settings-error"><p><strong>
|
||||
<?php
|
||||
$message = @$error_message;
|
||||
|
||||
//is there a status message?
|
||||
if(!empty($status_message))
|
||||
{
|
||||
//put the status message on a new line
|
||||
if(!empty($message)) $message .= "<br /><br />";
|
||||
|
||||
$message .= $status_message;
|
||||
}
|
||||
|
||||
echo $message;
|
||||
?>
|
||||
</strong></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><?php echo SyC::t('sdk','{brand} helps you get more customers by motivating satisfied customers to talk with their friends about your products. Each customer that promotes your products, via social media, will receive a coupon that they can apply to their shopping cart in order to get a small discount.',array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin-view/logo-click\']);">ShareYourCart™</a>')); ?></p>
|
||||
|
||||
<br />
|
||||
<div id="acount-options">
|
||||
<form method="POST" name="account-form">
|
||||
<fieldset>
|
||||
<div class="api-status" align="right">
|
||||
<?php echo SyC::t('sdk','API Status:'); ?>
|
||||
<?php if($this->isActive()) : ?>
|
||||
<span class="green"><?php echo SyC::t('sdk','Enabled'); ?></span>
|
||||
<?php else :?>
|
||||
<span class="red"><?php echo SyC::t('sdk','Disabled'); ?></span>
|
||||
<?php endif;?>
|
||||
<br />
|
||||
<?php if($this->isActive()) : ?>
|
||||
<input type="submit" value="<?php echo SyC::t('sdk','Disable'); ?>" name="disable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/disable-click']);" />
|
||||
<?php else :?>
|
||||
<input type="submit" value="<?php echo SyC::t('sdk','Enable'); ?>" name="enable-API" class="api-button" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/enable-click']);" />
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<table class="form-table-api" name="shareyourcart_settings">
|
||||
<tr>
|
||||
<th scope="row"><?php echo SyC::t('sdk','Client ID'); ?></th>
|
||||
<td><input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo $this->getClientId(); ?>"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo SyC::t('sdk','App Key'); ?></th>
|
||||
<td><input type="text" name="app_key" id="app_key" class="regular-text" value="<?php echo $this->getAppKey(); ?>"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><a href="<?php echo $admin_base_url.'?'.http_build_query(array_merge($_GET,array('syc-account'=>'recover')),'','&')?>" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/recover-click']);"><?php echo SyC::t('sdk',"Can't access your account?"); ?></a> <strong><?php echo SyC::t('sdk','or'); ?></strong> <?php echo SyC::t('sdk','New to ShareYourCart™?'); ?> <a href="<?php echo $admin_base_url.'?'.http_build_query(array_merge($_GET,array('syc-account'=>'create')),'','&')?>" id="account-recovery" class="api-link" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/create-account-click']);"><?php echo SyC::t('sdk','Create an account'); ?></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo $html;?>
|
||||
<div class="submit"><input type="submit" name="syc-account-form" class="button" value="<?php echo SyC::t('sdk','Save'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/save-click']);"></div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if($this->isActive()): //show the configure part only if it is active ?>
|
||||
<br/>
|
||||
<fieldset>
|
||||
<p><?php echo SyC::t('sdk','You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.'); ?></p>
|
||||
<br />
|
||||
<form action="<?php echo $this->SHAREYOURCART_CONFIGURE; ?>" method="POST" id="configure-form" target="_blank">
|
||||
|
||||
<div class="configure-button-container" align="center">
|
||||
<input type="submit" value="<?php echo SyC::t('sdk','Configure'); ?>" id="configure-button" class="shareyourcart-button-orange" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin-view/configure-click']);" />
|
||||
<input type="hidden" name="app_key" value="<?php echo $this->getAppKey(); ?>" />
|
||||
<input type="hidden" name="client_id" value="<?php echo $this->getClientId(); ?>" />
|
||||
<input type="hidden" name="email" value="<?php echo $this->getAdminEmail(); ?>" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<?php if($show_footer):?>
|
||||
<br />
|
||||
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
|
||||
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; //show only if the cart is active ?>
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button <?php if (isset($is_product_page) && $is_product_page) echo "product_button"; ?>" <?php echo (isset($callback_url) && !empty($callback_url)) ? "data-syc-callback_url=$callback_url" : ''; ?> data-syc-layout="custom" <?php if(!empty($position_after)): echo "data-syc-position-after=\"$position_after\""; elseif(!empty($position_before)): echo "data-syc-position-before=\"$position_before\""; endif; ?> <?php if(!empty($language)): echo "data-syc-language=\"$language\""; endif; ?>>
|
||||
<?php echo $button_html;?>
|
||||
</a>
|
||||
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
|
||||
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
|
||||
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
|
||||
})();
|
||||
</script> -->
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
if(!class_exists('ShareYourCartBase',false)) die('Access Denied');
|
||||
|
||||
// If only the hover is uploaded
|
||||
if((!$button_img or !$button_img_width or !$button_img_height) and ($button_img_hover and $button_img_hover_width and $button_img_hover_height)) {
|
||||
$button_img = $button_img_hover;
|
||||
$button_img_width = $button_img_hover_width;
|
||||
$button_img_height = $button_img_hover_height;
|
||||
$button_img_hover = null;
|
||||
$button_img_hover_width = null;
|
||||
$button_img_hover_height = null;
|
||||
}
|
||||
|
||||
$callbackDataAttr = '';
|
||||
|
||||
if(isset($callback_url) && !empty($callback_url)) {
|
||||
$callbackDataAttr = 'data-syc-callback_url="' . $callback_url .'"';
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button <?php if (isset($is_product_page) && $is_product_page) echo "product_button"; ?>" <?php echo $callbackDataAttr; ?> data-syc-layout="custom" <?php if(!empty($position_after)): echo "data-syc-position-after=\"$position_after\""; elseif(!empty($position_before)): echo "data-syc-position-before=\"$position_before\""; endif; ?> <?php if(!empty($language)): echo "data-syc-language=\"$language\""; endif; ?>>
|
||||
|
||||
</a>
|
||||
|
||||
<style>
|
||||
.shareyourcart-button {
|
||||
display: block;
|
||||
background: url('<?php echo $button_img;?>') left top;
|
||||
width: <?php echo $button_img_width; ?>px;
|
||||
height: <?php echo $button_img_height; ?>px;
|
||||
text-indent: -9999px;
|
||||
}
|
||||
|
||||
<?php
|
||||
if($button_img_hover and $button_img_hover_width and $button_img_hover_height) {
|
||||
?>
|
||||
.shareyourcart-button:hover {
|
||||
background-image: url('<?php echo $button_img_hover; ?>');
|
||||
width: <?php echo $button_img_hover_width; ?>px;
|
||||
height: <?php echo $button_img_hover_height; ?>px;
|
||||
}
|
||||
body:after {
|
||||
content: url(<?php echo $button_img_hover; ?>);
|
||||
background-image: url(<?php echo $button_img_hover; ?>);
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
left: -999em;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</style>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
|
||||
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
|
||||
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
|
||||
})();
|
||||
</script> -->
|
|
@ -1,158 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
|
||||
<script type="text/javascript">
|
||||
if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view']);
|
||||
</script>
|
||||
<div class="wrap">
|
||||
<?php if($show_header):?>
|
||||
|
||||
<?php echo $this->getUpdateNotification(); ?>
|
||||
|
||||
<h2>
|
||||
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/logo-click']);">
|
||||
<img src="<?php echo $this->getUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
|
||||
</a>
|
||||
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
|
||||
<br clear="all" />
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($status_message)): ?>
|
||||
<div class="updated settings-error"><p><strong>
|
||||
<?php echo $status_message; ?>
|
||||
</strong></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="visual-options">
|
||||
<form method="POST" enctype="multipart/form-data" id="syc-form">
|
||||
<fieldset>
|
||||
|
||||
<div class="buttonOption">
|
||||
|
||||
<input class="buttonOptionRadio" type="radio" value="1" id="button_type_1" <?php if ($current_button_type == '1'||$current_button_type == '') echo 'checked' ?> name="button_type" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/default-click']);" />
|
||||
<label class="buttonOptionLabel" for="button_type_1"><?php echo SyC::t('sdk','Use Standard Button'); ?></label>
|
||||
<br /><br />
|
||||
<table class="form-table shareyourcart_button_standard" name="shareyourcart_button_standard">
|
||||
<tr align="center">
|
||||
<th scope="row"><?php echo SyC::t('sdk','Button skin'); ?></th>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<select name="button_skin" id="button_skin" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-skin-click']);">
|
||||
<option name="orange" <?php echo $current_skin == 'orange' ? 'selected="selected"' : ''; ?> value="orange"><?php echo SyC::t('sdk','Orange'); ?></option>
|
||||
<option name="blue" <?php echo $current_skin == 'blue' ? 'selected="selected"' : ''; ?> value="blue"><?php echo SyC::t('sdk','Blue'); ?></option>
|
||||
<option name="light" <?php echo $current_skin == 'light' ? 'selected="selected"' : ''; ?> value="light"><?php echo SyC::t('sdk','Light'); ?></option>
|
||||
<option name="dark" <?php echo $current_skin == 'dark' ? 'selected="selected"' : ''; ?> value="dark"><?php echo SyC::t('sdk','Dark'); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<th scope="row"><?php echo SyC::t('sdk','Button position'); ?></th>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<select name="button_position" id="button_position" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/button-position-click']);">
|
||||
<option name="normal" <?php echo $current_position == 'normal' ? 'selected="selected"' : ''; ?> value="normal"><?php echo SyC::t('sdk','Normal'); ?></option>
|
||||
<option name="floating" <?php echo $current_position == 'floating' ? 'selected="selected"' : ''; ?> value="floating"><?php echo SyC::t('sdk','Floating'); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr align="center"> since we switched to <a> on the button, this does not seem to be needed anymore
|
||||
<td>
|
||||
<input class="buttonCheckbox" name="show_on_single_row" <?php echo $show_on_single_row ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-single-row-click']);"><?php echo SyC::t('sdk','Check this if you want the button to be shown on it\'s own row'); ?></input>
|
||||
</td>
|
||||
</tr> -->
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="buttonOption">
|
||||
<input class="buttonOptionRadio" type="radio" value="2" id="button_type_2" name="button_type" <?php if ($current_button_type == '2') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/image-button-click']);"/>
|
||||
<label class="buttonOptionLabel" for="button_type_2"><?php echo SyC::t('sdk','Use Image Button'); ?></label>
|
||||
<br /><?php if (empty($button_img)){ ?><br /><?php } ?>
|
||||
<table class="form-table shareyourcart_button_image" name="shareyourcart_button_image">
|
||||
<tr align="center">
|
||||
<th><label><?php echo SyC::t('sdk','Image:'); ?></label></th>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<?php if (!empty($button_img)): ?>
|
||||
<img src="<?php echo $button_img ?>" height="40" />
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
|
||||
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img" id="button-img" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-normal-img-click']);" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr align="center">
|
||||
<th><label><?php echo SyC::t('sdk','Hover image:'); ?></label></th>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<?php if (!empty($button_img_hover)): ?>
|
||||
<img src="<?php echo $button_img_hover ?>" height="40" />
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
|
||||
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img-hover" id="button-img-hover" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/upload-hover-img-click']);" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="buttonOption last">
|
||||
<input class="buttonOptionRadio" type="radio" value="3" id="button_type_3" name="button_type" <?php if ($current_button_type == '3') echo 'checked' ?> onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/custom-button-click']);"/>
|
||||
<label class="buttonOptionLabel" for="button_type_3"><?php echo SyC::t('sdk','Build your own HTML button'); ?></label>
|
||||
<table class="form-table shareyourcart_button_html" name="shareyourcart_button_html">
|
||||
<tr>
|
||||
<td>
|
||||
<textarea id="syc_button_textarea" class="buttonTextarea" rows="7" cols="56" name="button_html"><?php echo ($button_html!=''?$button_html:'<button>'.SyC::t('sdk','Get a {value} discount',array('{value}' => '<div class="shareyourcart-discount"></div>')).'</button>'); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php echo $html; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<br clear="all" />
|
||||
|
||||
<hr />
|
||||
<br />
|
||||
<table class="form-table table-small" name="shareyourcart_settings">
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Show button by default on: '); ?></th>
|
||||
<td>
|
||||
<input class="buttonCheckbox" name="show_on_product" <?php echo $show_on_product ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-product-click']);"><?php echo SyC::t('sdk','Product page'); ?></input>
|
||||
<br />
|
||||
<input class="buttonCheckbox" name="show_on_checkout" <?php echo $show_on_checkout ? 'checked="checked"' : ''; ?> type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-checkout-click']);"><?php echo SyC::t('sdk','Checkout page'); ?></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Position product button after: '); ?></th>
|
||||
<td>
|
||||
<input name="product_button_position" class="regular-text" value="<?php echo $this->getProductButtonPosition(); ?>" /><p><?php echo SyC::t('sdk','<strong>jQuery selector</strong>. Start with <strong>{elem}</strong> to position the button before the actual object',array('{elem}' => "/*before*/")); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Position cart button after: '); ?></th>
|
||||
<td>
|
||||
<input name="cart_button_position" class="regular-text" value="<?php echo $this->getCartButtonPosition(); ?>" /><p><?php echo SyC::t('sdk','<strong>jQuery selector</strong>. Start with <strong>{elem}</strong> to position the button before the actual object',array('{elem}' => "/*before*/")); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="submit"><input type="submit" class="button" name="syc-visual-form" id="syc-visual-form" value="<?php echo SyC::t('sdk','Save'); ?>" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/save-click']);"></div>
|
||||
|
||||
</fieldset>
|
||||
<br />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if($show_footer):?>
|
||||
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
|
||||
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<a href="<?php echo $this->SHAREYOURCART_BUTTON_URL ?>" class="shareyourcart-button <?php if (isset($is_product_page) && $is_product_page) echo "product_button"; ?> <?php echo ( $this->getConfigValue('button_position') == 'floating' ? 'button_iframe' : 'button_iframe-normal');?> <?php echo ( !$this->getConfigValue('dont_set_height') ? 'button_height' : ''); ?>" <?php echo (isset($callback_url) && !empty($callback_url)) ? "data-syc-callback_url=$callback_url" : ''; ?> data-syc-skin="<?php echo $this->getConfigValue('button_skin');?>" data-syc-orientation="<?php echo $this->getConfigValue('button_position'); ?>" <?php if(!empty($position_after)): echo "data-syc-position-after=\"$position_after\""; elseif(!empty($position_before)): echo "data-syc-position-before=\"$position_before\""; endif; ?> <?php if(!empty($language)): echo "data-syc-language=\"$language\""; endif; ?> >
|
||||
ShareYourCart Discount
|
||||
</a>
|
||||
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
|
||||
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
|
||||
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
|
||||
})();
|
||||
</script> -->
|
|
@ -1,86 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
|
||||
<script type="text/javascript">
|
||||
if(_gaq) _gaq.push(['_trackPageview', '/admin/documentation']);
|
||||
</script>
|
||||
<div class="wrap">
|
||||
<?php if($show_header):?>
|
||||
|
||||
<?php echo $this->getUpdateNotification(); ?>
|
||||
|
||||
<h2>
|
||||
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/documentation/logo-click']);">
|
||||
<img src="<?php echo $this->getUrl(dirname(__FILE__).'/../img/shareyourcart-logo.png'); ?>"/>
|
||||
</a>
|
||||
<div class="syc-slogan"><?php echo SyC::t('sdk','Increase your social media exposure by 10%!'); ?></div>
|
||||
<br clear="all" />
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="doc-content">
|
||||
<h2><?php echo SyC::t('sdk','Standard Button'); ?></h2>
|
||||
<p><?php echo SyC::t('sdk','In order to see the {brand} button on a <strong>post</strong> or <strong>page</strong> you can use the following shortcode:', array( '{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart™</a>')); ?></p>
|
||||
<pre><code>[shareyourcart]</code></pre>
|
||||
|
||||
<p><?php echo SyC::t('sdk','If you want to use the {brand} button directly in a <strong>theme</strong> or <strong>page template</strong> you have to use the following function call:', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart™</a>')); ?></p>
|
||||
<pre><code>echo do_shortcode('[shareyourcart]');</code></pre>
|
||||
<h3><?php echo SyC::t('sdk','Remarks'); ?></h3>
|
||||
<ol>
|
||||
|
||||
<?php if (!(isset($action_url) && !empty($action_url))): //if no shopping cart is active ?>
|
||||
<li><p><?php echo SyC::t('sdk','For the button to work, you need to specify the following properties in the meta description area'); ?></p>
|
||||
<pre><code><?php echo SyC::htmlIndent(nl2br(htmlspecialchars('<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:og="http://ogp.me/ns#"
|
||||
xmlns:syc="http://www.shareyourcart.com">
|
||||
<head>
|
||||
<meta property="og:image" content="http://www.example.com/product-image.jpg"/>
|
||||
<meta property="syc:price" content="$10" />
|
||||
<meta property="og:description"
|
||||
content="
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Proin feugiat nunc quis nibh congue luctus.
|
||||
Maecenas ac est nec turpis fermentum imperdiet.
|
||||
"/>
|
||||
...
|
||||
</head>
|
||||
...
|
||||
</html>'))); ?></code></pre></li>
|
||||
<li><?php echo SyC::t('sdk','This plugin allows you to easilly set the above meta properties directly in the post or page edit form'); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<li><p><?php echo SyC::t('sdk','To position the {brand} button, you need to override the following CSS classes', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart™</a>')); ?></p>
|
||||
<ul>
|
||||
<li><?php echo SyC::t('sdk','{css_class} for the horrizontal button', array('{css_class}' => '<code>button_iframe-normal</code>')); ?></li>
|
||||
<li><?php echo SyC::t('sdk','{css_class} for the vertical button', array('{css_class}' => '<code>button_iframe</code>')); ?></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
||||
<h2><?php echo SyC::t('sdk','Custom Button'); ?></h2>
|
||||
<p><?php echo SyC::t('sdk','If you want to fully style the {brand} button, use instead the following HTML code', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart™</a>')); ?></p>
|
||||
|
||||
<?php $custom_button = '<button class="shareyourcart-button" data-syc-layout="custom"';
|
||||
if (isset($action_url) && !empty($action_url)){
|
||||
//if there is no action url, it means none of the supported shopping carts are active,
|
||||
//so there would be no need for the callback attribute
|
||||
$custom_button .= ' data-syc-callback_url="'.$action_url.'" ';
|
||||
}
|
||||
|
||||
$custom_button .= '>
|
||||
Get a <div class="shareyourcart-discount" ></div> discount
|
||||
</button>'; ?>
|
||||
<pre><code><?php echo SyC::htmlIndent(nl2br(htmlspecialchars($custom_button))); ?></code></pre>
|
||||
|
||||
<?php if (isset($action_url) && !empty($action_url)): //only show if a known shopping cart is active ?>
|
||||
<h3><?php echo SyC::t('sdk','Remarks'); ?></h3>
|
||||
<p><?php echo SyC::t('sdk','If you want to use the {brand} button on a product\'s page, you need to <strong>append</strong> {product-property} to the {callback-url} value, where {product-property} is the product\'s id', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/logo-click\']);">ShareYourCart™</a>', '{product-property}' => '<code>&p=<product_id></code>', '{callback-url}' => '<strong>data-syc-callback_url</strong>')); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($show_footer):?>
|
||||
<h2><?php echo SyC::t('sdk','Contact'); ?></h2>
|
||||
<p><?php echo SyC::t('sdk',"If you've got 30 seconds, we'd {link-1} love to know what ideal outcome you'd like ShareYourCart to help bring to your business</a>, or if you have a private question, you can {link-2} contact us directly</a>", array('{link-1}' => '<a href="http://shareyourcart.uservoice.com" target="_blank" title="forum" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/forum-click\']);">', '{link-2}' => '<a href="http://www.shareyourcart.com/contact" target="_blank" class="api-link" onclick=" if(_gaq) _gaq.push([\'_trackPageview\', \'/admin/documentation/contact-click\']);">')); ?></p>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
|
@ -1,40 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $this->getUrl(dirname(__FILE__).'/../css/style.css'); ?>" />
|
||||
<!--[if lt IE 9]>
|
||||
<link rel="stylesheet" href="<?php echo $this->getUrl(dirname(__FILE__).'/../css/ie.css'); ?>" type="text/css"/>
|
||||
<![endif]-->
|
||||
|
||||
<?php //check if there is a style outside of the SDK, and include that one as well
|
||||
|
||||
$_reflection_ = new ReflectionClass(get_class($this));
|
||||
$_file_ = dirname($_reflection_->getFileName())."/css/style.css";
|
||||
|
||||
//check if there is a file in the specified location
|
||||
if(file_exists($_file_)):?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $this->getUrl($_file_); ?>" />
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<meta property="syc:client_id" content="<?php echo $this->getClientId(); ?>" />
|
||||
<meta property="syc:callback_url" content="<?php echo $this->getButtonCallbackURL(); ?>" />
|
||||
|
||||
<?php if($this->isActive() & is_array($data)): ?>
|
||||
|
||||
<meta property="og:title" content="<?php echo htmlspecialchars(@$data['item_name']); ?>" />
|
||||
<meta property="og:url" content="<?php echo @$data['item_url'] ?>" />
|
||||
<meta property="og:description" content="<?php echo htmlspecialchars(@$data['item_description']); ?>" />
|
||||
<meta property="og:image" content="<?php echo @$data['item_picture_url'] ?>" />
|
||||
<meta property="syc:price" content="<?php echo @$data['item_price'] ?>" />
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var a = document.createElement('script'); a.type = 'text/javascript'; a.async = true;
|
||||
a.src = '<?php echo $this->SHAREYOURCART_BUTTON_JS; ?>';
|
||||
var b = document.getElementsByTagName('script')[0]; b.parentNode.insertBefore(a, b);
|
||||
})();
|
||||
</script>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<div class="wrap">
|
||||
|
||||
<p><?php echo SyC::t('sdk','Here you can enter the details that will be used by {brand}', array('{brand}' => '<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart™">ShareYourCart™</a>')); ?></p>
|
||||
|
||||
<br />
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th valign="top" scope="row" style="padding-top:6px;"><label for="syc_price"><?php echo SyC::t('sdk','Product Price:'); ?></label></th>
|
||||
<td><input type="text" name="syc_price" id="syc_price" class="regular-text" style="width:450px;" value="<?php echo $price; ?>"/><br />
|
||||
<p class="howto"><?php echo SyC::t('sdk','Include the currency sign as well. I.e: $10'); ?></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top" scope="row"><label for="syc_description"><?php SyC::t('sdk','Description:'); ?></label></th>
|
||||
<td><textarea name="syc_description" id="syc_description" class="regular-text" style="width:450px; height:200px;"><?php echo $description; ?></textarea>
|
||||
<p class="howto"><?php echo SyC::t('sdk','Leave blank to use the main description'); ?></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="middle" scope="row"><?php echo SyC::t('sdk','Product Image:'); ?></th>
|
||||
<td valign="middle"><p class="howto"><?php echo SyC::t('sdk',"Use wordpress' featured image functionality. You can find it on the right side."); ?></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="syc_nonce" id="syc_nonce" value="<?php echo wp_create_nonce( $this->_PLUGIN_PATH ); ?>" />
|
||||
</div>
|
|
@ -1,6 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<?php if($this->hasNewerVersion()): //if there is a newer version, show the upgrade message?>
|
||||
<div class="syc-update-nag">
|
||||
<strong><?php echo SyC::t('sdk','{link}ShareYourCart {version}</a> is available! {link}Please update now</a>.', array('{version}' => $this->getConfigValue('latest_version'), '{link}' => '<a href="'.$this->getConfigValue("download_url").'" target="_blank">')); ?></strong>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -1,34 +0,0 @@
|
|||
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' ); ?>
|
||||
|
||||
<?php echo SyC::t('sdk','Create a ShareYourCart account'); ?>
|
||||
|
||||
<form method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo (isset($_POST['domain']) ? $_POST['domain'] : $this->getDomain()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="email" id="email" class="regular-text" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : $this->getAdminEmail()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input class="buttonCheckbox" name="syc-terms-agreement" id="syc-terms-agreement" <?php if( $_SERVER['REQUEST_METHOD'] !== 'POST' || isset($_POST['syc-terms-agreement'])){ echo 'checked="checked"'; } ?> type="checkbox"><label for="syc-terms-agreement"><?php echo SyC::t('sdk','I agree with the {brand} terms & conditions',array('{brand}' => '<a href="http://www.shareyourcart.com/terms" target="_blank">ShareYourCart</a>')); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" class="button" name="syc-create-account" value="<?php echo SyC::t('sdk','Create account'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
|
@ -1,26 +0,0 @@
|
|||
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' ); ?>
|
||||
|
||||
<?php echo SyC::t('sdk','Enter the domain and email you used when you created the ShareYourCart account'); ?>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="domain"><?php echo SyC::t('sdk','Domain:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="domain" id="domain" class="regular-text" value="<?php echo isset( $_POST['domain'] ) ? $_POST['domain'] : $this->getDomain(); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="email"><?php echo SyC::t('sdk','Email:'); ?></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="email" id="email" class="regular-text" value="<?php echo isset( $_POST['email'] ) ? $_POST['email'] : $this->getAdminEmail(); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" class="button" name="syc-recover-account" value="<?php echo SyC::t('sdk','Recover my account'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -1,13 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
window.onload = function() {
|
||||
document.getElementById('syc-form').addEventListener('submit', changetext, false);
|
||||
};
|
||||
|
||||
var changetext = function(){
|
||||
var textarea = document.getElementById('syc_button_textarea').value;
|
||||
document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea);
|
||||
}
|
||||
</script>
|
|
@ -1,114 +0,0 @@
|
|||
<?php if ( ! class_exists( 'ShareYourCartBase', false ) ) die( 'Access Denied' );
|
||||
|
||||
$GLOBALS['hide_save_button'] = true;
|
||||
|
||||
$wcIntegration = $html; //the object is sent under the $html parameter
|
||||
|
||||
//since this is a post, and is related to recovering or creating a new account, perform some special operations
|
||||
if ($refresh || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $_REQUEST['syc-account'] ))){
|
||||
|
||||
$redirect = remove_query_arg( 'saved' );
|
||||
$redirect = remove_query_arg( 'wc_error', $redirect );
|
||||
$redirect = remove_query_arg( 'wc_message', $redirect );
|
||||
|
||||
//remove the syc-account argument only if the SDK commanded as such
|
||||
if($refresh) $redirect = remove_query_arg( 'syc-account', $redirect );
|
||||
|
||||
if ( !empty($error_message) ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error_message ) ), $redirect );
|
||||
|
||||
wp_safe_redirect( $redirect );
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
|
||||
<?php if ( $show_header ) : ?>
|
||||
|
||||
<?php echo $this->getUpdateNotification(); ?>
|
||||
|
||||
<?php if ( ! $this->getClientId() && ! $this->getAppKey() ) : //show the get started message ?>
|
||||
|
||||
<div id="wc_get_started">
|
||||
<span class="main"><?php _e('Setup your ShareYourCart account', 'woocommerce'); ?></span>
|
||||
<span><?php echo $wcIntegration->method_description; ?></span>
|
||||
<p><a href="<?php echo add_query_arg( 'syc-account', 'create', admin_url( 'admin.php?page=woocommerce&tab=integration§ion=shareyourcart' ) ); ?>" class="button button-primary"><?php _e('Create an account', 'woocommerce'); ?></a> <a href="<?php echo add_query_arg( 'syc-account', 'recover', admin_url( 'admin.php?page=woocommerce&tab=integration§ion=shareyourcart' ) ); ?>" class="button"><?php _e('Can\'t access your account?', 'woocommerce'); ?></a></p>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<h3>
|
||||
<a href="http://www.shareyourcart.com" target="_blank" title="Shareyourcart" class="shareyourcart-logo">
|
||||
<img src="<?php echo $this->createUrl(dirname(__FILE__).'/../sdk/img/shareyourcart-logo.png'); ?>"/>
|
||||
</a>
|
||||
</h3>
|
||||
<?php echo wpautop( $wcIntegration->method_description );?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(!empty($status_message) || !empty($error_message)): ?>
|
||||
<div class="updated settings-error"><p><strong>
|
||||
<?php
|
||||
$message = @$error_message;
|
||||
|
||||
//is there a status message?
|
||||
if(!empty($status_message))
|
||||
{
|
||||
//put the status message on a new line
|
||||
if(!empty($message)) $message .= "<br /><br />";
|
||||
|
||||
$message .= $status_message;
|
||||
}
|
||||
|
||||
echo $message;
|
||||
?>
|
||||
</strong></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<h3>Account Options</h3>
|
||||
<div id="acount-options">
|
||||
<table class="form-table">
|
||||
<tr valign="top">
|
||||
<th class="titledesc" scope="row">
|
||||
<?php echo SyC::t('sdk','API Status:'); ?>
|
||||
<?php if ( $this->isActive() ) echo SyC::t('sdk','Enabled'); else echo SyC::t('sdk','Disabled'); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php if($this->isActive()) : ?>
|
||||
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Disable'); ?>" name="disable-API" />
|
||||
<?php else :?>
|
||||
<input class="button" type="submit" value="<?php echo SyC::t('sdk','Enable'); ?>" name="enable-API" />
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Client ID'); ?></th>
|
||||
<td class="forminp"><input type="text" name="client_id" id="client_id" class="regular-text" value="<?php echo $this->getClientId(); ?>"/></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','App Key'); ?></th>
|
||||
<td class="forminp"><input type="text" name="app_key" id="app_key" class="regular-text" value="<?php echo $this->getAppKey(); ?>"/></td>
|
||||
</tr>
|
||||
<?php if($this->isActive()) : ?>
|
||||
<tr valign="top">
|
||||
<th class="titledesc" scope="row"><?php echo SyC::t('sdk','Configuration'); ?></th>
|
||||
<td>
|
||||
|
||||
<a href="<?php echo $this->SHAREYOURCART_CONFIGURE; ?>?app_key=<?php echo $this->getAppKey(); ?>&client_id=<?php echo $this->getClientId(); ?>&email=<?php echo $this->getAdminEmail(); ?>" class="button" target="_blank"><?php _e('Configure', 'woocommerce'); ?></a>
|
||||
|
||||
<p class="description"><?php echo SyC::t('sdk','You can choose how much of a discount to give (in fixed amount, percentage, or free shipping) and to which social media channels it should it be applied. You can also define what the advertisement should say, so that it fully benefits your sales.'); ?></p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
</table>
|
||||
|
||||
<div class="submit">
|
||||
<input type="submit" class="button button-primary" name="syc-account-form" value="<?php _e('Save changes', 'woocommerce'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -1,123 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<?php if(!$this->isActive()) return; //if the plugin is not active, do not show this page ?>
|
||||
<div class="wrap">
|
||||
<h3>Button options</h3>
|
||||
<div id="visual-options">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th class="titledesc" scope="row"><?php _e( 'Button style', 'woocommerce' ); ?></th>
|
||||
<td class="forminp">
|
||||
<fieldset>
|
||||
<legend class="screen-reader-text"><span><?php _e( 'Button style', 'woocommerce' ); ?></span></legend>
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" value="1" id="button_type_1" <?php if ($current_button_type == '1'||$current_button_type == '') echo 'checked' ?> name="button_type" class="tog" />
|
||||
<?php echo SyC::t('sdk','Use Standard Button'); ?>
|
||||
</label>
|
||||
</p>
|
||||
<ul style="margin-left: 18px;" class="shareyourcart_button_standard">
|
||||
<li>
|
||||
<label for="button_skin">
|
||||
<?php echo SyC::t('sdk','Button skin'); ?>:
|
||||
<select name="button_skin" id="button_skin">
|
||||
<option name="orange" <?php echo $current_skin == 'orange' ? 'selected="selected"' : ''; ?> value="orange"><?php echo SyC::t('sdk','Orange'); ?></option>
|
||||
<option name="blue" <?php echo $current_skin == 'blue' ? 'selected="selected"' : ''; ?> value="blue"><?php echo SyC::t('sdk','Blue'); ?></option>
|
||||
<option name="light" <?php echo $current_skin == 'light' ? 'selected="selected"' : ''; ?> value="light"><?php echo SyC::t('sdk','Light'); ?></option>
|
||||
<option name="dark" <?php echo $current_skin == 'dark' ? 'selected="selected"' : ''; ?> value="dark"><?php echo SyC::t('sdk','Dark'); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="button_position">
|
||||
<?php echo SyC::t('sdk','Button position'); ?>:
|
||||
<select name="button_position" id="button_position">
|
||||
<option name="normal" <?php echo $current_position == 'normal' ? 'selected="selected"' : ''; ?> value="normal"><?php echo SyC::t('sdk','Normal'); ?></option>
|
||||
<option name="floating" <?php echo $current_position == 'floating' ? 'selected="selected"' : ''; ?> value="floating"><?php echo SyC::t('sdk','Floating'); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" value="2" id="button_type_2" name="button_type" <?php if ($current_button_type == '2') echo 'checked' ?> class="tog" />
|
||||
<?php echo SyC::t('sdk','Use Image Button'); ?>
|
||||
</label>
|
||||
</p>
|
||||
<ul style="margin-left: 18px;" class="shareyourcart_button_image">
|
||||
<li>
|
||||
<label>
|
||||
<?php echo SyC::t('sdk','Image'); ?>:
|
||||
<?php if ( ! empty( $button_img ) ): ?>
|
||||
<img src="<?php echo $button_img ?>" height="40" /><br/>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
|
||||
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img" id="button-img" />
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<?php echo SyC::t('sdk','Hover Image'); ?>:
|
||||
<?php if ( ! empty( $button_img_hover ) ): ?>
|
||||
<img src="<?php echo $button_img_hover ?>" height="40" /><br/>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
|
||||
<input type="file" accept="image/gif, image/jpeg, image/jpg, image/png" name="button-img-hover" id="button-img-hover" />
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" value="3" id="button_type_3" name="button_type" <?php if ($current_button_type == '3') echo 'checked' ?> class="tog" />
|
||||
<?php echo SyC::t('sdk','Custom HTML button'); ?>
|
||||
</label>
|
||||
</p>
|
||||
<ul style="margin-left: 18px;" class="shareyourcart_button_html">
|
||||
<li>
|
||||
<label>
|
||||
<?php echo SyC::t('sdk','HTML'); ?>:
|
||||
<textarea style="vertical-align:top" id="syc_button_textarea" class="buttonTextarea" rows="3" cols="56" name="button_html"><?php echo ($button_html!=''?$button_html:'<button>'.SyC::t('sdk','Get a {value} discount',array('{value}' => '<div class="shareyourcart-discount"></div>')).'</button>'); ?></textarea>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo $html; ?>
|
||||
|
||||
<fieldset>
|
||||
<table class="form-table " name="shareyourcart_settings">
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Show button by default on: '); ?></th>
|
||||
<td>
|
||||
<input class="buttonCheckbox" name="show_on_product" <?php echo $show_on_product ? 'checked="checked"' : ''; ?> type='checkbox'><?php echo SyC::t('sdk','Product page'); ?></input>
|
||||
<br />
|
||||
<input class="buttonCheckbox" name="show_on_checkout" <?php echo $show_on_checkout ? 'checked="checked"' : ''; ?> type='checkbox'><?php echo SyC::t('sdk','Checkout page'); ?></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Position product button after: '); ?></th>
|
||||
<td>
|
||||
<input name="product_button_position" class="regular-text" value="<?php echo $this->getProductButtonPosition(); ?>" />
|
||||
<span class="description"><?php echo SyC::t('sdk','<strong>jQuery selector</strong>. Start with <strong>{elem}</strong> to position the button before the actual object',array('{elem}' => "/*before*/")); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><?php echo SyC::t('sdk','Position cart button after: '); ?></th>
|
||||
<td>
|
||||
<input name="cart_button_position" class="regular-text" value="<?php echo $this->getCartButtonPosition(); ?>" />
|
||||
<span class="description"><?php echo SyC::t('sdk','<strong>jQuery selector</strong>. Start with <strong>{elem}</strong> to position the button before the actual object',array('{elem}' => "/*before*/")); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<div class="submit">
|
||||
<input type="submit" class="button button-primary" name="syc-visual-form" value="<?php _e('Save changes', 'woocommerce'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,6 +0,0 @@
|
|||
<?php if(!class_exists('ShareYourCartBase',false)) die('Access Denied'); ?>
|
||||
<?php if($this->hasNewerVersion()): //if there is a newer version, show the upgrade message?>
|
||||
<div class="updated syc-update-nag">
|
||||
<p><strong><?php echo SyC::t('sdk','{link}ShareYourCart {version}</a> is available! {link}Please update now</a>.', array('{version}' => $this->getConfigValue('latest_version'), '{link}' => '<a href="'.$this->getConfigValue("download_url").'" target="_blank">')); ?></strong></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -167,6 +167,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
|
||||
= 2.1 - x =
|
||||
* Refactor - Taken out Piwik integration, use http://wordpress.org/extend/plugins/woocommerce-piwik-integration/ from now on
|
||||
* Refactor - Taken out ShareYourCart integration, use http://wordpress.org/extend/plugins/shareyourcart/ from now on
|
||||
|
||||
= 2.0.9 - 02/05/2013 =
|
||||
* Feature - Added is_product_taxonomy() conditonal.
|
||||
|
|
|
@ -322,7 +322,6 @@ class Woocommerce {
|
|||
// Include Core Integrations - these are included sitewide
|
||||
include_once( 'classes/integrations/google-analytics/class-wc-google-analytics.php' );
|
||||
include_once( 'classes/integrations/sharethis/class-wc-sharethis.php' );
|
||||
include_once( 'classes/integrations/shareyourcart/class-wc-shareyourcart.php' );
|
||||
include_once( 'classes/integrations/sharedaddy/class-wc-sharedaddy.php' );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue