* @package CSSJockey WordPress Framework * @author Mohit Aneja (cssjockey.com) * @version FW-20150208 */ $help_support_value[] = '<a href="' . cjtheme_item_info('quick_start_guide_url') . '" target="_blank">' . __('Quick Start Guide', 'cjtheme') . '</a>'; $help_support_value[] = '<a href="' . cjtheme_item_info('documentation_url') . '" target="_blank">' . __('Documentation', 'cjtheme') . '</a>'; $help_support_value[] = '<a href="' . cjtheme_item_info('support_forum_url') . '" target="_blank">' . __('Support Fourm', 'cjtheme') . '</a>'; if (isset($_REQUEST['cjmsg']) && $_REQUEST['cjmsg'] == 'pc-no-match') { echo cjtheme_show_message('error', sprintf(__('Could not reset your license for this installation. <br><a target="_blank" href="%s">Click here</a> to create a support ticket.', 'cjtheme'), cjtheme_item_info('support_forum_url'))); } $cjtheme_purchase_code = ''; $eon = sha1('cjtheme_verify_epc' . site_url()); $eov = get_option($eon); if ($eov != '') { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="btn btn-success btn-sm" style=" margin-right: 10px;"><i class="fa fa-check-circle"></i> ' . __('Verified & Active', 'cjtheme') . '</span>' . sprintf('<a href="%s" class="btn btn-danger btn-sm cj-confirm" data-confirm="%s">Reset License</a>', cjtheme_string(cjtheme_callback_url('core_welcome')) . 'cjtheme_action=reset-license', __("Are you sure?\nThis will reset your license for this installation.\nYou may use this license again on any installation.", 'cjtheme')), 'options' => ''); } else { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="label label-danger" style="padding:5px 10px; font-size:14px; font-weight:normal;"><i class="fa fa-times-circle"></i> ' . __('Not Verified', 'cjtheme') . '</span>', 'options' => ''); } if (cjtheme_is_local()) { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="label label-default" style="padding:5px 10px; font-size:14px; font-weight:normal;"><i class="fa fa-info-circle"></i> ' . __('Local Server', 'cjtheme') . '</span><span class="margin-10-left italic red">' . __('You will be asked to validate your purchase code to use this product on live server.', 'cjtheme') . '</span>', 'options' => ''); } if (cjtheme_item_info('item_id') == 'NA') { $cjtheme_purchase_code = null; $contribute = null; } else { $contribute = array('type' => 'info', 'id' => 'contribute', 'label' => __('Contribute', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('<p>You can contribute to support further development and new features for this product.</p> <p><a target="_blank" class="btn btn-danger" href="%s">Contribute</a></p>', 'cjtheme'), 'http://cssjockey.com/contribute'), 'options' => ''); } $localization_string = sprintf(__('You can download <a class="bold" target="_blank" href="%s">Loco Translate WordPress Plugin (FREE)</a> to easily create language files within your WordPress dashboard without using Poedit software.', 'cjtheme'), 'https://wordpress.org/plugins/loco-translate/'); $cjtheme_form_options['welcome'] = array(array('type' => 'sub-heading', 'id' => 'welcome_heading', 'label' => '', 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('%s Information', 'cjtheme'), ucwords(cjtheme_item_info('item_type'))), 'options' => ''), array('type' => 'info', 'id' => 'product_type', 'label' => __('Product Type', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('WordPress %s', 'cjtheme'), ucwords(cjtheme_item_info('item_type'))), 'options' => ''), array('type' => 'info', 'id' => 'product_name', 'label' => __('Product Name', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => cjtheme_item_info('item_name'), 'options' => ''), array('type' => 'info', 'id' => 'product_id', 'label' => __('Product ID', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => cjtheme_item_info('item_id'), 'options' => ''), array('type' => 'info', 'id' => 'version', 'label' => __('Installed Version', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => cjtheme_item_info('item_version'), 'options' => ''), $cjtheme_purchase_code, array('type' => 'info', 'id' => 'license', 'label' => __('License & Terms of use', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('<a target="_blank" href="%s">Click here</a> to view license and terms of use.', 'cjtheme'), cjtheme_item_info('license_url')), 'options' => ''), array('type' => 'info', 'id' => 'help_support', 'label' => __('Help & Support', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => implode(' • ', $help_support_value), 'options' => ''), array('type' => 'info', 'id' => 'translate', 'label' => __('Localization', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => $localization_string, 'options' => ''), $contribute); cjtheme_admin_form_raw($cjtheme_form_options['welcome']); do_action('cjtheme_after_welcome_panel');
function cjtheme_verify_epcp() { global $wpdb, $current_user; $cjtheme_eon = sha1('cjtheme_verify_epc' . site_url()); $cjtheme_eov = get_option($cjtheme_eon); $item_info = cjtheme_item_info(); $cssjockey_api_url = 'http://api.cssjockey.com/'; $errors = null; $success = null; $error_msg = null; $success_msg = null; // Handle local install if (isset($_POST['cjtheme_verify_purchase_code'])) { if ($_POST['cjtheme_purchase_code'] == '') { $errors[] = __('Please enter purchase code for this product.', 'cjtheme'); } if (is_null($errors)) { $pdata = array('cj_action' => 'verify_envato_code', 'purchase_code' => $_POST['cjtheme_purchase_code'], 'item_id' => $item_info['item_id'], 'textdomain' => $item_info['page_slug'], 'site_url' => site_url()); $response = wp_remote_post($cssjockey_api_url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $pdata, 'cookies' => array())); if (is_wp_error($response)) { $error_message = $response->get_error_message(); $errors[] = $error_message; } else { $result = json_decode($response['body']); if (isset($result->success)) { update_option($cjtheme_eon, $_POST['cjtheme_purchase_code']); $location = cjtheme_callback_url('core_welcome'); wp_redirect($location); exit; } if (isset($result->error)) { $errors['envato'] = $result->error; } } } if (!is_null($errors)) { $error_msg = '<p class="red">' . implode('<br>', $errors) . '</p>'; } } if (!cjtheme_is_local() && cjtheme_item_info('item_id') != 'NA') { $display[] = '<div id="verify-purchase-code" class="updated push-notification-message">'; $display[] = '<div class="notification-icon">'; $display[] = '<img src="http://api.cssjockey.com/files/leaf-64.png" />'; $display[] = '</div>'; $display[] = '<div class="notification-content">'; $display[] = '<h3 style="margin:0 0 10px 0; line-height:1;">' . $item_info['item_name'] . '</h3>'; $display[] = $success_msg; $display[] = '<p>' . sprintf(__('Verify purchase code to enable automatic upgrades and use this %s on this installation.', 'cjtheme'), $item_info['item_type']) . '</p>'; $display[] = '<form action="" method="post">'; $display[] = $error_msg; $display[] = '<p><input name="cjtheme_purchase_code" type="text" value="' . cjtheme_post_default('cjtheme_purchase_code', '') . '" class="verify-input" /></p>'; $display[] = '<p>'; $display[] = '<button name="cjtheme_verify_purchase_code" class="button-primary" style="margin-right:10px;" type="submit">' . __('Verify & Activate License', 'cjtheme') . '</button>'; $display[] = sprintf(__('<a target="_blank" href="%s">Where can I find my Purchase Code?</a>', 'cjtheme'), 'https://help.market.envato.com/hc/en-us/articles/202822600-Where-can-I-find-my-Purchase-Code-'); $display[] = '</p>'; $display[] = '</form>'; $display[] = '</div>'; $display[] = '</div>'; } else { $display[] = ''; } if ($cjtheme_eov == '') { echo implode(null, $display); } }