예제 #1
0
function hocwp_theme_option_form_after()
{
    $hocwp_root_domain = hocwp_get_root_domain_name(HOCWP_HOMEPAGE);
    ?>
	<div class="page-footer">
		<p>Created by <?php 
    echo $hocwp_root_domain;
    ?>
. If you have any questions, please send us an email via address:
			<em><?php 
    echo HOCWP_EMAIL;
    ?>
</em></p>
	</div>
	<div class="copyright">
		<p>&copy; 2008 - <?php 
    echo date('Y');
    ?>
 <a target="_blank"
		                                               href="<?php 
    echo HOCWP_HOMEPAGE;
    ?>
"><?php 
    echo $hocwp_root_domain;
    ?>
</a>.
			All Rights Reserved.</p>
	</div>
	<?php 
}
 public function check_from_server($args = array())
 {
     $transient_name = hocwp_build_transient_name('hocwp_check_license_from_server_%s', $args);
     if (false === ($valid = get_transient($transient_name))) {
         $customer_email = hocwp_get_value_by_key($args, 'customer_email', hocwp_get_value_by_key($args, 'email', hocwp_get_admin_email()));
         if (!is_email($customer_email)) {
             $customer_email = hocwp_get_admin_email();
         }
         $code = hocwp_get_value_by_key($args, 'license_code', hocwp_get_value_by_key($args, 'code'));
         $domain = hocwp_get_value_by_key($args, 'customer_domain', hocwp_get_value_by_key($args, 'domain', home_url()));
         $use_for = hocwp_get_value_by_key($args, 'use_for');
         if (empty($domain)) {
             $domain = esc_url(hocwp_get_root_domain_name(home_url()));
         }
         $meta_item = array('relation' => 'AND', array('key' => 'customer_domain', 'value' => untrailingslashit(esc_url(hocwp_get_root_domain_name($domain)))), array('key' => 'forever_domain', 'value' => 1, 'type' => 'numeric'));
         if (hocwp_is_localhost()) {
             array_push($meta_item, array('key' => 'customer_email', 'value' => sanitize_email($customer_email)));
         }
         $data = hocwp_api_get_by_meta($meta_item, 'license-api');
         if (hocwp_array_has_value($data)) {
             $valid = true;
         } else {
             $meta_item = array('relation' => 'AND', array('key' => 'customer_email', 'value' => sanitize_email($customer_email)), array('key' => 'forever_email', 'value' => 1, 'type' => 'numeric'), array('key' => 'use_for', 'value' => $use_for));
             $data = hocwp_api_get_by_meta($meta_item, 'license-api');
             if (hocwp_array_has_value($data)) {
                 $valid = true;
             } else {
                 $meta_item = array('relation' => 'AND', array('key' => 'customer_domain', 'value' => esc_url(untrailingslashit($domain))), array('key' => 'customer_email', 'value' => sanitize_email($customer_email)), array('key' => 'license_code', 'value' => $code), array('key' => 'use_for', 'value' => $use_for));
                 $data = hocwp_api_get_by_meta($meta_item, 'license-api');
                 if (hocwp_array_has_value($data)) {
                     $valid = true;
                 }
             }
         }
         set_transient($transient_name, $valid, 15 * MINUTE_IN_SECONDS);
     }
     $valid = (bool) $valid;
     return apply_filters('hocwp_check_license_on_server', $valid, $args);
 }
예제 #3
0
function hocwp_setup_admin_init()
{
    $saved_domain = get_option('hocwp_domain');
    $current_domain = hocwp_get_root_domain_name(get_bloginfo('url'));
    if ($saved_domain != $current_domain) {
        update_option('hocwp_domain', $current_domain);
        hocwp_delete_transient_license_valid();
        do_action('hocwp_change_domain');
    }
}
예제 #4
0
function hocwp_is_my_plugin($plugin_data)
{
    $result = false;
    $author_uri = isset($plugin_data['AuthorURI']) ? $plugin_data['AuthorURI'] : '';
    if (hocwp_get_root_domain_name($author_uri) == hocwp_get_root_domain_name(HOCWP_HOMEPAGE)) {
        $result = true;
    }
    return $result;
}
예제 #5
0
function hocwp_setup_theme_esc_comment_author_url($commentdata)
{
    $comment_author_url = hocwp_get_value_by_key($commentdata, 'comment_author_url');
    if (!empty($comment_author_url)) {
        $commentdata['comment_author_url'] = esc_url(hocwp_get_root_domain_name($comment_author_url));
    }
    return $commentdata;
}
예제 #6
0
function hocwp_theme_generate_license($password, $site_url = '', $domain = '')
{
    if (empty($site_url)) {
        $site_url = get_bloginfo('url');
    }
    $license = new HOCWP_License();
    $license->set_password($password);
    $code = hocwp_generate_serial();
    $license->set_code($code);
    if (empty($domain)) {
        $domain = hocwp_get_root_domain_name($site_url);
    }
    $license->set_domain($domain);
    $license->set_customer_url($site_url);
    $license->generate();
    return $license->get_generated();
}
예제 #7
0
function hocwp_get_domain_name_only($url)
{
    $root = hocwp_get_root_domain_name($url);
    if (hocwp_is_ip($root)) {
        return $root;
    }
    $root = explode('.', $root);
    return array_shift($root);
}
예제 #8
0
function hocwp_lostpassword_form($args = array())
{
    $defaults = hocwp_account_form_default_args();
    $args = wp_parse_args($args, $defaults);
    $data = hocwp_execute_lostpassword();
    $user_login = $data['user_login'];
    $error = $data['error'];
    $message = $data['message'];
    $redirect_to = hocwp_get_value_by_key($args, 'redirect_to', hocwp_get_method_value('redirect_to', 'get'));
    $logo = hocwp_get_value_by_key($args, 'logo', hocwp_get_login_logo_url());
    ?>
	<div class="hocwp-login-box module">
		<div class="module-header text-center">
			<?php 
    if (!empty($logo)) {
        $a = new HOCWP_HTML('a');
        $a->set_href(home_url('/'));
        $a->set_class('logo');
        $img = new HOCWP_HTML('img');
        $img->set_image_alt('');
        $img->set_image_src($logo);
        $a->set_text($img->build());
        $a->output();
    }
    $slogan = new HOCWP_HTML('p');
    $slogan->set_class('slogan');
    $slogan->set_text(sprintf($args['slogan'], hocwp_get_root_domain_name(home_url('/'))));
    $slogan->output();
    if (isset($_POST['submit']) || isset($_POST['wp-submit'])) {
        if (isset($_REQUEST['error']) || $error) {
            $message = hocwp_build_message($message, 'danger');
            echo $message;
        } else {
            if (!empty($message) && !$error || isset($_POST['submit']) && !empty($message)) {
                $message = hocwp_build_message($message, 'success');
                echo $message;
            }
        }
    }
    ?>
		</div>
		<div class="module-body">
			<h4 class="form-title"><?php 
    _e('Reset password', 'hocwp-theme');
    ?>
</h4>

			<form name="lostpasswordform" id="lostpasswordform" action="<?php 
    echo esc_url(wp_lostpassword_url());
    ?>
"
			      method="post">
				<p>
					<label><?php 
    echo hocwp_get_value_by_key($args, 'label_username', __('Username or Email', 'hocwp-theme'));
    ?>
						<br>
						<input type="text" size="20" value="<?php 
    echo esc_attr($user_login);
    ?>
" class="input"
						       id="user_login" name="user_login"></label>
				</p>
				<input type="hidden" name="action" value="lostpassword">
				<input type="hidden" name="redirect_to" value="<?php 
    echo $redirect_to;
    ?>
">

				<p class="submit">
					<input type="submit" name="wp-submit" id="wp-submit" class="button-primary"
					       value="Get New Password" tabindex="100"></p>
			</form>
		</div>
		<div class="module-footer">
			<div class="text-center">
				<p class="form-nav">
					<a href="<?php 
    echo esc_url(wp_login_url());
    ?>
"><?php 
    echo hocwp_get_value_by_key($args, 'label_log_in', __('Login', 'hocwp-theme'));
    ?>
</a>
					<span class="sep">|</span>
					<a href="<?php 
    echo esc_url(wp_lostpassword_url());
    ?>
"
					   title="<?php 
    echo $args['title_lostpassword_link'];
    ?>
"><?php 
    echo $args['text_lostpassword_link'];
    ?>
</a>
				</p>
			</div>
		</div>
	</div>
	<?php 
}