diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/TODO.md b/TODO.md old mode 100644 new mode 100755 diff --git a/software-license-manager/LICENSE.md b/software-license-manager/LICENSE.md old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/includes/index.html b/software-license-manager/admin/includes/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/software-license-manager/admin/includes/slm-list-table-class.php b/software-license-manager/admin/includes/slm-list-table-class.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-subscriptio.php b/software-license-manager/admin/includes/subscriptio/slm-subscriptio.php old mode 100644 new mode 100755 similarity index 100% rename from software-license-manager/includes/slm-subscriptio.php rename to software-license-manager/admin/includes/subscriptio/slm-subscriptio.php diff --git a/software-license-manager/admin/includes/woocommerce/includes/emails.php b/software-license-manager/admin/includes/woocommerce/includes/emails.php old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/includes/woocommerce/includes/helper.php b/software-license-manager/admin/includes/woocommerce/includes/helper.php old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/includes/woocommerce/includes/meta-boxes.php b/software-license-manager/admin/includes/woocommerce/includes/meta-boxes.php old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/includes/woocommerce/includes/purchase.php b/software-license-manager/admin/includes/woocommerce/includes/purchase.php old mode 100644 new mode 100755 index 736bc79..8fe95b9 --- a/software-license-manager/admin/includes/woocommerce/includes/purchase.php +++ b/software-license-manager/admin/includes/woocommerce/includes/purchase.php @@ -32,17 +32,14 @@ function wc_slm_on_complete_purchase($order_id) { */ function wc_slm_create_license_keys($order_id) { - $_order = new WC_Order($order_id); - $order_id = new WC_Order( $order_id ); - - // write_log('order info '. $order_id); - // die(); + $_order = new WC_Order($order_id); + $order_id = new WC_Order( $order_id ); global $purchase_id; - $purchase_id_ = $order_id->id; - $user_id = $_order->get_user_id(); - $user_info = get_userdata($user_id); - $get_user_meta = get_user_meta($user_id); + $purchase_id_ = $order_id->id; + $user_id = $_order->get_user_id(); + $user_info = get_userdata($user_id); + $get_user_meta = get_user_meta($user_id); $payment_meta['user_info']['first_name'] = $get_user_meta['billing_first_name'][0]; $payment_meta['user_info']['last_name'] = $get_user_meta['billing_last_name'][0]; $payment_meta['user_info']['email'] = $get_user_meta['billing_email'][0]; @@ -52,6 +49,7 @@ function wc_slm_create_license_keys($order_id) { $licenses = array(); $items = $_order->get_items(); + foreach ($items as $item => $values) { $download_id = $product_id = $values['product_id']; $product = new WC_Product($product_id); @@ -123,47 +121,33 @@ function wc_slm_create_license_keys($order_id) { // Build parameters $api_params = array(); - $api_params['slm_action'] = 'slm_create_new'; - $api_params['secret_key'] = KEY_API; - $api_params['first_name'] = (isset($payment_meta['user_info']['first_name'])) ? $payment_meta['user_info']['first_name'] : ''; - $api_params['last_name'] = (isset($payment_meta['user_info']['last_name'])) ? $payment_meta['user_info']['last_name'] : ''; - $api_params['email'] = (isset($payment_meta['user_info']['email'])) ? $payment_meta['user_info']['email'] : ''; - $api_params['company_name'] = $payment_meta['user_info']['company']; - $api_params['purchase_id_'] = $purchase_id_; - $api_params['product_ref'] = '16'; - - /** - * set product id as txn - * @since 1.0.2 - * can be set to order id by $order_id var instead of $product_id - * @since 1.0.7 txn_id change from $product_id to $order_id - * @ref https://wordpress.org/support/topic/qty-1-generates-same-license - */ - $api_params['txn_id'] = $purchase_id_; - // $api_params['max_allowed_domains'] = $sites_allowed; //unique per product - $api_params['max_allowed_domains'] = $amount_of_licenses; //unique per product - $api_params['max_allowed_devices'] = $amount_of_licenses_devices; //unique per product + $api_params['slm_action'] = 'slm_create_new'; + $api_params['secret_key'] = KEY_API; + $api_params['first_name'] = (isset($payment_meta['user_info']['first_name'])) ? $payment_meta['user_info']['first_name'] : ''; + $api_params['last_name'] = (isset($payment_meta['user_info']['last_name'])) ? $payment_meta['user_info']['last_name'] : ''; + $api_params['email'] = (isset($payment_meta['user_info']['email'])) ? $payment_meta['user_info']['email'] : ''; + $api_params['company_name'] = $payment_meta['user_info']['company']; + $api_params['purchase_id_'] = $purchase_id_; + $api_params['product_ref'] = $product_id; // TODO: get product id + $api_params['txn_id'] = $purchase_id_; + $api_params['max_allowed_domains'] = $amount_of_licenses; + $api_params['max_allowed_devices'] = $amount_of_licenses_devices; $api_params['date_created'] = date('Y-m-d'); $api_params['date_expiry'] = $renewal_period; // Send query to the license manager server - $url = 'http://' . WOO_SLM_API_URL . '?' . http_build_query($api_params); - $url = str_replace(array('http://', 'https://'), '', $url); - $url = 'http://' . $url; - $response = wp_remote_get($url, array('timeout' => 20, 'sslverify' => false)); - $license_key = wc_slm_get_license_key($response); + $url = 'http://' . WOO_SLM_API_URL . '?' . http_build_query($api_params); + $url = str_replace(array('http://', 'https://'), '', $url); + $url = 'http://' . $url; + $response = wp_remote_get($url, array('timeout' => 20, 'sslverify' => false)); + $license_key = wc_slm_get_license_key($response); // Collect license keys if ($license_key) { $licenses[] = array( - 'item' => $item_name, - 'key' => $license_key, - /** - * Add Expire Date - * @since 1.0.7 - * @author AvdP (Albert van der Ploeg) - */ - 'expires' => $renewal_period, + 'item' => $item_name, + 'key' => $license_key, + 'expires' => $renewal_period, ); } } @@ -213,12 +197,11 @@ function wc_slm_payment_note($order_id, $licenses) { if ($licenses && count($licenses) != 0) { $message = __('License Key(s) generated', 'wc-slm'); - foreach ($licenses as $license) { - $message .= '
' . $license['item'] . ': ' . $license['key']; } - } else { + } + else { $message = __('License Key(s) could not be created.', 'wc-slm'); } @@ -228,10 +211,7 @@ function wc_slm_payment_note($order_id, $licenses) { /** * Assign generated license keys to payments - * - * @since 1.0.0 - * @return void - */ +*/ function wc_slm_assign_licenses($order_id, $licenses) { if (count($licenses) != 0) { @@ -311,35 +291,3 @@ function wc_get_payment_transaction_id($order_id) { return get_post_meta($order_id, '_transaction_id', true); } -/** - * add license details to user account details - * @since 1.0.3 - */ -//add_action('woocommerce_order_details_after_order_table', 'wc_slm_lic_order_meta', 10, 1); - -function wc_slm_lic_order_meta($order) { - $licenses = get_post_meta($order->post->ID, '_wc_slm_payment_licenses', true); - - if ($licenses && count($licenses) != 0) { - $output = '

' . __('Your Licenses', 'wc-slm') . ':

'; - foreach ($licenses as $license) { - $output .= ''; - if (isset($license['item']) && isset($license['key'])) { - - if ($output) { - $output .= '
'; - } - $output .= ''; - $output .= ''; - } else { - $output .= 'No item and key assigned'; - } - $output .= ''; - } - $output .= '
' . __('Item', 'wc-slm') . '' . __('License', 'wc-slm') . '
' . $license['item'] . '' . $license['key'] . '
'; - } - - if (isset($output)) { - echo $output; - } -} \ No newline at end of file diff --git a/software-license-manager/admin/includes/woocommerce/license.txt b/software-license-manager/admin/includes/woocommerce/license.txt old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/includes/woocommerce/wc-software-license-manager.php b/software-license-manager/admin/includes/woocommerce/wc-software-license-manager.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-third-party-integration.php b/software-license-manager/admin/includes/wpestores/slm-wpestores.php old mode 100644 new mode 100755 similarity index 99% rename from software-license-manager/includes/slm-third-party-integration.php rename to software-license-manager/admin/includes/wpestores/slm-wpestores.php index 0cdf087..205aeb0 --- a/software-license-manager/includes/slm-third-party-integration.php +++ b/software-license-manager/admin/includes/wpestores/slm-wpestores.php @@ -1,7 +1,9 @@ isset($_POST['enable_debug']) ? '1':'', 'slm_woo' => isset($_POST['slm_woo']) ? '1':'', 'slm_subscriptio' => isset($_POST['slm_subscriptio']) ? '1':'', + 'slm_wpestores' => isset($_POST['slm_wpestores']) ? '1':'', ); update_option('slm_plugin_options', $options); @@ -138,8 +139,15 @@ function wp_lic_mgr_general_settings() { value="1"/>
Subscriptio is a WooCommerce extension that allows you to sell subscriptions. Subscriptio adds recurring payments capability to WooCommerce so you can sell products like magazine subscriptions, online memberships, e-learning packages and any other tangible or intangible products. Learn More - + + WP eStores Support + + value="1"/>
+ WordPress eStore Plugin – Complete Solution to Sell Digital Products from Your WordPress Blog Securely + + diff --git a/software-license-manager/admin/slm-list-licenses-class.php b/software-license-manager/admin/slm-list-licenses-class.php old mode 100644 new mode 100755 diff --git a/software-license-manager/admin/slm-manage-licenses.php b/software-license-manager/admin/slm-manage-licenses.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/class-software-license-manager-activator.php b/software-license-manager/includes/class-software-license-manager-activator.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/class-software-license-manager-deactivator.php b/software-license-manager/includes/class-software-license-manager-deactivator.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/class-software-license-manager-slm-installer.php b/software-license-manager/includes/class-software-license-manager-slm-installer.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/index.php b/software-license-manager/includes/index.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-api-listener.php b/software-license-manager/includes/slm-api-listener.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-api-utility.php b/software-license-manager/includes/slm-api-utility.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-debug-logger.php b/software-license-manager/includes/slm-debug-logger.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-error-codes.php b/software-license-manager/includes/slm-error-codes.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-init-time-tasks.php b/software-license-manager/includes/slm-init-time-tasks.php old mode 100644 new mode 100755 diff --git a/software-license-manager/includes/slm-meta-boxes.php b/software-license-manager/includes/slm-meta-boxes.php old mode 100644 new mode 100755 index 00ed4e1..f3f2a3f --- a/software-license-manager/includes/slm-meta-boxes.php +++ b/software-license-manager/includes/slm-meta-boxes.php @@ -61,4 +61,162 @@ function save_variation_fields( $variation_id, $i) { $text_field = stripslashes( $_POST['amount_of_licenses_devices'][$i] ); update_post_meta( $variation_id, 'amount_of_licenses_devices', esc_attr( $text_field ) ); -} \ No newline at end of file +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter +add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' ); +function add_my_custom_product_data_tab( $product_data_tabs ) { + $product_data_tabs['my-custom-tab'] = array( + 'label' => __( 'License', 'woocommerce' ), + 'target' => 'my_custom_product_data', + 'class' => array( 'show_if_simple', 'show_if_variable' ), + ); + return $product_data_tabs; +} + + + + + +// functions you can call to output text boxes, select boxes, etc. +add_action('woocommerce_product_data_panels', 'woocom_custom_product_data_fields'); + +function woocom_custom_product_data_fields() { + global $post; + + // Note the 'id' attribute needs to match the 'target' parameter set above + ?>
'amount_of_licenses_devices', + 'label' => __( 'Amount of devices', 'woocommerce' ), + 'wrapper_class' => 'show_if_simple', //show_if_simple or show_if_variable + 'placeholder' => 'Custom text field', + 'desc_tip' => 'true', + 'description' => __( 'Enter the custom value here.', 'woocommerce' ) + ) + ); + + // Number Field + woocommerce_wp_text_input( + array( + 'id' => '_number_field', + 'label' => __( 'Custom Number Field', 'woocommerce' ), + 'placeholder' => '', + 'description' => __( 'Enter the custom value here.', 'woocommerce' ), + 'type' => 'number', + 'custom_attributes' => array( + 'step' => 'any', + 'min' => '15' + ) + ) + ); + + // Checkbox + woocommerce_wp_checkbox( + array( + 'id' => '_checkbox', + 'label' => __('Custom Checkbox Field', 'woocommerce' ), + 'description' => __( 'Check me!', 'woocommerce' ) + ) + ); + + // Select + woocommerce_wp_select( + array( + 'id' => '_select', + 'label' => __( 'Custom Select Field', 'woocommerce' ), + 'options' => array( + 'one' => __( 'Custom Option 1', 'woocommerce' ), + 'two' => __( 'Custom Option 2', 'woocommerce' ), + 'three' => __( 'Custom Option 3', 'woocommerce' ) + ) + ) + ); + + // Textarea + woocommerce_wp_textarea_input( + array( + 'id' => '_textarea', + 'label' => __( 'Custom Textarea', 'woocommerce' ), + 'placeholder' => '', + 'description' => __( 'Enter the value here.', 'woocommerce' ) + ) + ); + ?>
+ +