addVersion() публичный статический Метод

Register a version of a class.
public static addVersion ( string $generalClass, string $versionedClass, string $version )
$generalClass string Class name without version numbers, e.g. 'PluginUpdateChecker'.
$versionedClass string Actual class name, e.g. 'PluginUpdateChecker_1_2'.
$version string Version number, e.g. '1.2'.
Пример #1
0
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_2', '2.2');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_2', '2.2');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_2', '2.2');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_2', '2.2');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker', false)) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_2
    {
    }
}
if (!class_exists('PluginUpdate', false)) {
    class PluginUpdate extends PluginUpdate_2_2
    {
    }
}
if (!class_exists('PluginInfo', false)) {
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_3_0', '3.0');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_3_0', '3.0');
PucFactory::addVersion('PluginInfo', 'PluginInfo_3_0', '3.0');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_3_0', '3.0');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker', false)) {
    class PluginUpdateChecker extends PluginUpdateChecker_3_0
    {
    }
}
if (!class_exists('PluginUpdate', false)) {
    class PluginUpdate extends PluginUpdate_3_0
    {
    }
}
if (!class_exists('PluginInfo', false)) {
         */
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
//RH require_once(dirname(__FILE__) . '/github-checker.php');
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_0', '2.0');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_0', '2.0');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_0', '2.0');
//RH PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_0', '2.0');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker')) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_0
    {
    }
}
if (!class_exists('PluginUpdate')) {
    class PluginUpdate extends PluginUpdate_2_0
    {
    }
}
         * @param string $version Version number, e.g. '1.2'.
         */
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_1_5', '1.5');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_1_3', '1.3');
PucFactory::addVersion('PluginInfo', 'PluginInfo_1_3', '1.3');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker')) {
    class PluginUpdateChecker extends PluginUpdateChecker_1_5
    {
    }
}
if (!class_exists('PluginUpdate')) {
    class PluginUpdate extends PluginUpdate_1_3
    {
    }
}
if (!class_exists('PluginInfo')) {
Пример #5
0
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_1', '2.1');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_1', '2.1');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_1', '2.1');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_1', '2.1');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker', false)) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_1
    {
    }
}
if (!class_exists('PluginUpdate', false)) {
    class PluginUpdate extends PluginUpdate_2_1
    {
    }
}
if (!class_exists('PluginInfo', false)) {
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_0', '2.0');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_0', '2.0');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_0', '2.0');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_0', '2.0');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker')) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_0
    {
    }
}
if (!class_exists('PluginUpdate')) {
    class PluginUpdate extends PluginUpdate_2_0
    {
    }
}
if (!class_exists('PluginInfo')) {
         * @param string $version Version number, e.g. '1.2'.
         */
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_1_6', '1.6');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_1_6', '1.6');
PucFactory::addVersion('PluginInfo', 'PluginInfo_1_6', '1.6');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker')) {
    class PluginUpdateChecker extends PluginUpdateChecker_1_6
    {
    }
}
if (!class_exists('PluginUpdate')) {
    class PluginUpdate extends PluginUpdate_1_6
    {
    }
}
if (!class_exists('PluginInfo')) {
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_2_3', '2.3');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_2_3', '2.3');
PucFactory::addVersion('PluginInfo', 'PluginInfo_2_3', '2.3');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_2_3', '2.3');
/**
 * Create non-versioned variants of the update checker classes. This allows for backwards
 * compatibility with versions that did not use a factory, and it simplifies doc-comments.
 */
if (!class_exists('PluginUpdateChecker', false)) {
    class PluginUpdateChecker extends PluginUpdateChecker_2_3
    {
    }
}
if (!class_exists('PluginUpdate', false)) {
    class PluginUpdate extends PluginUpdate_2_3
    {
    }
}
if (!class_exists('PluginInfo', false)) {
        }
        protected static function compareVersions($a, $b)
        {
            return -version_compare($a, $b);
        }
        /**
         * Register a version of a class.
         *
         * @access private This method is only for internal use by the library.
         *
         * @param string $generalClass Class name without version numbers, e.g. 'PluginUpdateChecker'.
         * @param string $versionedClass Actual class name, e.g. 'PluginUpdateChecker_1_2'.
         * @param string $version Version number, e.g. '1.2'.
         */
        public static function addVersion($generalClass, $versionedClass, $version)
        {
            if (!isset(self::$classVersions[$generalClass])) {
                self::$classVersions[$generalClass] = array();
            }
            self::$classVersions[$generalClass][$version] = $versionedClass;
            self::$sorted = false;
        }
    }
}
require_once dirname(__FILE__) . '/github-checker.php';
//Register classes defined in this file with the factory.
PucFactory::addVersion('PluginUpdateChecker', 'PluginUpdateChecker_3_1', '3.1');
PucFactory::addVersion('PluginUpdate', 'PluginUpdate_3_1', '3.1');
PucFactory::addVersion('PluginInfo', 'PluginInfo_3_1', '3.1');
PucFactory::addVersion('PucGitHubChecker', 'PucGitHubChecker_3_1', '3.1');