Ejemplo n.º 1
0
function hocwp_get_login_logo_url()
{
    $user_login = hocwp_option_get_object_from_list('user_login');
    $url = '';
    if (hocwp_object_valid($user_login)) {
        $option = $user_login->get();
        $logo = hocwp_get_value_by_key($option, 'logo');
        $logo = hocwp_sanitize_media_value($logo);
        $url = $logo['url'];
    }
    if (empty($url)) {
        $theme_setting = hocwp_option_get_object_from_list('theme_setting');
        if (hocwp_object_valid($theme_setting)) {
            $option = $theme_setting->get();
            $logo = hocwp_get_value_by_key($option, 'logo');
            $logo = hocwp_sanitize_media_value($logo);
            $url = $logo['url'];
        }
    }
    return $url;
}
Ejemplo n.º 2
0
function hocwp_get_option($base_name)
{
    $option = hocwp_option_get_object_from_list($base_name);
    if (hocwp_object_valid($option)) {
        return $option->get();
    }
    return array();
}
 public function __construct()
 {
     $this->set_hashed_password(HOCWP_HASHED_PASSWORD);
     $this->set_key('');
     $this->set_type('theme');
     $this->set_use_for(get_option('template'));
     $this->set_domain(home_url());
     $this->set_customer_url(home_url('/'));
     $this->set_customer_email(get_option('admin_email'));
     $option = hocwp_option_get_object_from_list('theme_license');
     if (hocwp_object_valid($option)) {
         $this->set_option($option);
     }
     if (hocwp_object_valid($option)) {
         $this->set_option_name($option->get_option_name());
     }
 }
Ejemplo n.º 4
0
function hocwp_theme_invalid_license_redirect()
{
    $option = hocwp_option_get_object_from_list('theme_license');
    $transient_name = hocwp_build_transient_name('hocwp_invalid_theme_license_%s', '');
    if (hocwp_object_valid($option) && !$option->is_this_page()) {
        global $pagenow;
        $admin_page = hocwp_get_current_admin_page();
        if (('themes.php' != $pagenow || 'themes.php' == $pagenow && !empty($admin_page)) && hocwp_can_redirect()) {
            if (is_admin() || !is_admin() && !is_user_logged_in()) {
                set_transient('hocwp_invalid_theme_license', 1);
                wp_redirect($option->get_page_url());
                exit;
            }
        } else {
            if (false === get_transient($transient_name)) {
                add_action('admin_notices', 'hocwp_setup_theme_invalid_license_message');
            }
        }
    } else {
        if (false === get_transient($transient_name)) {
            add_action('admin_notices', 'hocwp_setup_theme_invalid_license_message');
        }
    }
}