Exemple #1
0
function pp_register_extension($slug, $label, $basename, $version, $min_pp_version = '0', $min_wp_version = '0')
{
    global $pp_extensions, $pp_min_ext_version;
    $slug = pp_sanitize_key($slug);
    if (!isset($pp_extensions) || !is_array($pp_extensions)) {
        $pp_extensions = array();
    }
    // avoid lockout in case of editing plugin via wp-admin
    if (constant('PP_DEBUG') && is_admin() && ppc_editing_plugin()) {
        return false;
    }
    $register = true;
    $error = false;
    if (!pp_wp_ver($min_wp_version)) {
        require_once dirname(__FILE__) . '/lib/error_pp.php';
        $error = PP_Error::old_wp($label, $min_wp_version);
        $register = false;
    } elseif (version_compare(PPC_VERSION, $min_pp_version, '<')) {
        require_once dirname(__FILE__) . '/lib/error_pp.php';
        $error = PP_Error::old_pp($label, $min_pp_version);
        $register = false;
    } elseif (!empty($pp_min_ext_version[$slug]) && version_compare($version, $pp_min_ext_version[$slug], '<')) {
        if (is_admin()) {
            require_once dirname(__FILE__) . '/lib/error_pp.php';
            $error = PP_Error::old_extension($label, $pp_min_ext_version[$slug]);
            // but still register extension so it can be updated!
        } else {
            $error = true;
            $register = false;
        }
    }
    if ($register) {
        $version = pp_sanitize_word($version);
        $pp_extensions[$slug] = (object) compact('slug', 'version', 'label', 'basename');
    }
    return !$error;
}
Exemple #2
0
function _pp_duplicate_extension($ext_slug, $ext_folder)
{
    require_once PPC_ABSPATH . '/lib/error_pp.php';
    PP_Error::duplicate_extension($ext_slug, $ext_folder);
}
 function ppc_notice($message, $class = 'error fade', $trigger_error = false, $force = false)
 {
     include_once dirname(__FILE__) . '/error_pp.php';
     return PP_Error::notice($message, $class, $trigger_error, $force);
 }