本文整理汇总了PHP中Version::get_habariversion方法的典型用法代码示例。如果您正苦于以下问题:PHP Version::get_habariversion方法的具体用法?PHP Version::get_habariversion怎么用?PHP Version::get_habariversion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version::get_habariversion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_data
/**
* Returns all theme information -- dir, path, theme.xml, screenshot url
* @return array An array of Theme data
**/
public static function get_all_data()
{
if ( !isset( self::$all_data ) ) {
foreach ( self::get_all() as $theme_dir => $theme_path ) {
$themedata = array();
$themedata['dir'] = $theme_dir;
$themedata['path'] = $theme_path;
$themedata['theme_dir'] = $theme_path;
$themedata['info'] = simplexml_load_file( $theme_path . '/theme.xml' );
if ( $themedata['info']->getName() != 'pluggable' || (string) $themedata['info']->attributes()->type != 'theme' ) {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
$themedata['info']->description = '<span class="error">' . _t( 'This theme is a legacy theme that is not compatible with Habari ' ) . Version::get_habariversion() . '. <br><br>Please update your theme.</span>';
$themedata['info']->license = '';
}
else {
foreach ( $themedata['info'] as $name=>$value ) {
$themedata[$name] = (string) $value;
}
if ( $screenshot = Utils::glob( $theme_path . '/screenshot.{png,jpg,gif}', GLOB_BRACE ) ) {
$themedata['screenshot'] = Site::get_url( 'habari' ) . dirname( str_replace( HABARI_PATH, '', $theme_path ) ) . '/' . basename( $theme_path ) . "/" . basename( reset( $screenshot ) );
}
else {
$themedata['screenshot'] = Site::get_url( 'admin_theme' ) . "/images/screenshot_default.png";
}
}
self::$all_data[$theme_dir] = $themedata;
}
}
return self::$all_data;
}
示例2: __construct
/**
* @param string $url URL to request
* @param string $method Request method to use (default 'GET')
* @param int $timeout
* @internal param int $timeuot Timeout in seconds (default 180)
*/
public function __construct($url, $method = 'GET', $timeout = 180)
{
$this->method = strtoupper($method);
$this->url = $url;
$this->set_timeout($timeout);
// load the proxy configuration, if it exists
$default = new \stdClass();
$proxy = Config::get('proxy', $default);
if (isset($proxy->server)) {
$this->set_config(array('proxy' => (array) $proxy));
}
// populate the default proxy exceptions list, since we can't up there
$this->config['proxy']['exceptions'] = array_merge($this->config['proxy']['exceptions'], array('localhost', '127.0.0.1', '::1'));
// these next two could be duplicates of 'localhost' and 127.0.0.1 / ::1 if you're on localhost - that's ok
if (isset($_SERVER['SERVER_NAME'])) {
$this->config['proxy']['exceptions'][] = $_SERVER['SERVER_NAME'];
}
if (isset($_SERVER['SERVER_ADDR'])) {
$this->config['proxy']['exceptions'][] = $_SERVER['SERVER_ADDR'];
}
$this->user_agent .= '/' . Version::get_habariversion();
$this->add_header(array('User-Agent' => $this->user_agent));
// if they've manually specified that we should not use curl, use sockets instead
if (Config::get('remote_request_processor') == 'socket') {
$this->processor = new SocketRequestProcessor();
} else {
// otherwise, see if we can use curl and fall back to sockets if not
if (function_exists('curl_init') && !(ini_get('safe_mode') || ini_get('open_basedir'))) {
$this->processor = new CURLRequestProcessor();
} else {
$this->processor = new SocketRequestProcessor();
}
}
}
示例3: check
/**
* Perform a check of all beaconids.
* Notifies update_check plugin hooks when checking so that they can add their beaconids to the list.
* @return array An array of update beacon information for components that have updates
*/
public static function check()
{
try {
$instance = self::instance();
if (count($instance->beacons) == 0) {
Update::add('Habari', '7a0313be-d8e3-11db-8314-0800200c9a66', Version::get_habariversion());
Plugins::act('update_check');
}
$request = new RemoteRequest(UPDATE_URL, 'POST');
$request->set_params(array_map(create_function('$a', 'return $a["version"];'), $instance->beacons));
$request->set_timeout(10);
$result = $request->execute();
if (Error::is_error($result)) {
throw $result;
}
$updatedata = $request->get_response_body();
if (Error::is_error($updatedata)) {
throw $updatedata;
}
$instance->update = new SimpleXMLElement($updatedata);
foreach ($instance->update as $beacon) {
$beaconid = (string) $beacon['id'];
foreach ($beacon->update as $update) {
// Do we have this beacon? If not, don't process it.
if (empty($instance->beacons[$beaconid])) {
continue;
}
// If the remote update info version is newer...
if (version_compare($update['version'], $instance->beacons[$beaconid]['version']) > 0) {
// If this version is more recent than all other newer versions...
if (empty($instance->beacons[$beaconid]['latest_version']) || version_compare((string) $update['version'], $instance->beacons[$beaconid]['latest_version']) > 0) {
$instance->beacons[$beaconid]['latest_version'] = (string) $update['version'];
}
if (isset($instance->beacons[$beaconid]['severity'])) {
$instance->beacons[$beaconid]['severity'][] = (string) $update['severity'];
array_unique($instance->beacons[$beaconid]['severity']);
} else {
$instance->beacons[$beaconid]['severity'] = array((string) $update['severity']);
}
$instance->beacons[$beaconid]['url'] = (string) $beacon['url'];
$instance->beacons[$beaconid]['changes'][(string) $update['version']] = (string) $update;
}
}
}
return array_filter($instance->beacons, array('Update', 'filter_unchanged'));
} catch (Exception $e) {
return $e;
}
}
示例4: create_rss_wrapper
/**
* Creates a basic RSS-format XML structure with channel and items elements
* @return SimpleXMLElement The requested RSS document
*/
public function create_rss_wrapper()
{
$xml = new SimpleXMLElement('<?xml version="1.0"?><rss></rss>');
$xml->addAttribute('version', '2.0');
$channel = $xml->addChild('channel');
$title = $channel->addChild('title', htmlspecialchars(Options::get('title')));
$link = $channel->addChild('link', Site::get_url('habari'));
$tagline = Options::get('tagline', '');
// get the tagline or an empty string if it doesn't exist - the description tag is required
$description = $channel->addChild('description', htmlspecialchars($tagline));
$pubDate = $channel->addChild('lastBuildDate', Post::get()->pubdate->format(DATE_RSS));
$generator = $channel->addChild('generator', 'Habari ' . Version::get_habariversion() . ' http://habariproject.org/');
Plugins::act('rss_create_wrapper', $xml);
return $xml;
}
示例5: create_atom_wrapper
/**
* Creates a basic Atom-format XML structure
*
* @param string $alternate the IRI of an alternate version.
* @param string $self The preferred URI for retrieving Atom Feed Documents representing this Atom feed.
* @param string $id a permanent, universally unique identifier for an the feed.
* @param HabariDateTime $updated The most recent update in the collection to which this feed applies.
*
* @return SimpleXMLElement The requested Atom document
*/
public function create_atom_wrapper( $alternate, $self, $id, $updated = null )
{
// Store handler vars since we'll be using them a lot.
$handler_vars = Controller::get_handler_vars();
// Retrieve the current matched rule and store its name and argument values.
$rr = URL::get_matched_rule();
$rr_name = $rr->name;
$rr_args = $rr->named_arg_values;
// Build the namespaces, plugins can alter it to override or insert their own.
$namespaces = array( 'default' => 'http://www.w3.org/2005/Atom' );
$namespaces = Plugins::filter( 'atom_get_collection_namespaces', $namespaces );
$namespaces = array_map( create_function( '$value,$key', 'return ( ( $key == "default" ) ? "xmlns" : "xmlns:" . $key ) . "=\"" . $value ."\"";' ), $namespaces, array_keys( $namespaces ) );
$namespaces = implode( ' ', $namespaces );
$xml = new SimpleXMLElement( '<feed ' . $namespaces . '></feed>' );
$feed_generator = $xml->addChild( 'generator', 'Habari' );
$feed_generator->addAttribute( 'uri', 'http://www.habariproject.org/' );
$feed_generator->addAttribute( 'version', Version::get_habariversion() );
$feed_id = $xml->addChild( 'id', 'tag:' . Site::get_url( 'hostname' ) . ',' . date( "Y-m-d" ) . ':' . $id . '/' . Options::get( 'GUID' ) );
$feed_title = $xml->addChild( 'title', Utils::htmlspecialchars( Options::get( 'title' ) ) );
if ( $tagline = Options::get( 'tagline' ) ) {
$feed_subtitle = $xml->addChild( 'subtitle', Utils::htmlspecialchars( $tagline ) );
}
if ( $updated == null ) {
$feed_updated = $xml->addChild( 'updated', HabariDateTime::date_create()->get( 'c' ) );
}
else {
$feed_updated = $xml->addChild( 'updated', $updated->get( 'c' ) );
}
$feed_link = $xml->addChild( 'link' );
$feed_link->addAttribute( 'rel', 'alternate' );
$feed_link->addAttribute( 'href', $alternate );
$feed_link = $xml->addChild( 'link' );
$feed_link->addAttribute( 'rel', 'self' );
$feed_link->addAttribute( 'href', $self );
Plugins::act( 'atom_create_wrapper', $xml );
return $xml;
}
示例6: is_compatible
public static function is_compatible($ver)
{
$habari_ver = explode('.', str_replace(array('-', '_', ' '), '.', Version::get_habariversion()));
$ver = explode('.', str_replace(array('-', '_', ' '), '.', $ver));
$habari_ver = array_pad($habari_ver, count($ver), '0');
foreach ($habari_ver as $i => $el) {
if (isset($ver[$i])) {
if ($ver[$i] != 'x' && version_compare($el, $ver[$i]) != 0) {
return false;
}
} else {
return false;
}
}
return true;
}
示例7: get_sysinfo
/**
* Handles get requests for the system information page.
*/
public function get_sysinfo()
{
$sysinfo = array();
$siteinfo = array();
// Assemble Site Info
$siteinfo[_t('Habari Version')] = Version::get_habariversion();
if (Version::is_devel()) {
$siteinfo[_t('Habari Version')] .= " r" . Version::get_svn_revision();
}
$siteinfo[_t('Habari API Version')] = Version::get_apiversion();
$siteinfo[_t('Habari DB Version')] = Version::get_dbversion();
$siteinfo[_t('Active Theme')] = Options::get('theme_name');
$siteinfo[_t('Site Language')] = strlen(Options::get('system_locale')) ? Options::get('system_locale') : 'en-us';
$this->theme->siteinfo = $siteinfo;
// Assemble System Info
$sysinfo[_t('PHP Version')] = phpversion();
$sysinfo[_t('Server Software')] = $_SERVER['SERVER_SOFTWARE'];
$sysinfo[_t('Database')] = DB::get_driver_name() . ' - ' . DB::get_driver_version();
$sysinfo[_t('PHP Extensions')] = implode(', ', get_loaded_extensions());
if (defined('PCRE_VERSION')) {
$sysinfo[_t('PCRE Version')] = PCRE_VERSION;
} else {
// probably PHP < 5.2.4
ob_start();
phpinfo(8);
$phpinfo = ob_get_contents();
ob_end_clean();
preg_match('/PCRE Library Version.*class="v">(.*)$/mi', $phpinfo, $matches);
$sysinfo[_t('PCRE Version')] = $matches[1];
}
$sysinfo[_t('Browser')] = $_SERVER['HTTP_USER_AGENT'];
$this->theme->sysinfo = $sysinfo;
// Assemble Class Info
$classinfo = Utils::glob(HABARI_PATH . "/user/classes/*.php");
if (count($classinfo)) {
$classinfo = array_map('realpath', $classinfo);
}
$this->theme->classinfo = $classinfo;
// Assemble Plugin Info
$raw_plugins = Plugins::get_active();
$plugins = array('system' => array(), 'user' => array(), '3rdparty' => array(), 'other' => array());
foreach ($raw_plugins as $plugin) {
$file = $plugin->get_file();
if (preg_match('%[\\\\/](system|3rdparty|user)[\\\\/]plugins[\\\\/]%i', $file, $matches)) {
// A plugin's info is XML, cast the element to a string. See #1026.
$plugins[strtolower($matches[1])][(string) $plugin->info->name] = $file;
} else {
$plugins['other'][$plugin->info->name] = $file;
}
}
$this->theme->plugins = $plugins;
$this->display('sysinfo');
}
示例8: create_rss_wrapper
/**
* Creates a basic RSS-format XML structure with channel and items elements
* @return SimpleXMLElement The requested RSS document
*/
public function create_rss_wrapper($feed_name)
{
$itunes = Options::get(Podcast::OPTIONS_PREFIX . "{$feed_name}_itunes");
$xml = new SimpleXMLElement('<' . '?xml version="1.0" encoding="UTF-8" ?' . '><rss></rss>');
$xml->addAttribute('xmlns:xmlns:atom', 'http://www.w3.org/2005/Atom');
$xml->addAttribute('xmlns:xmlns:itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd');
$xml->addAttribute('version', '2.0');
$channel = $xml->addChild('channel');
$title = $channel->addChild('title', isset($itunes['title']) ? $itunes['title'] : Options::get('title'));
$link = $channel->addChild('link', Site::get_url('habari'));
$atom_link = $channel->addChild('xmlns:atom:link');
$atom_link->addAttribute('href', $this->current_url);
$atom_link->addAttribute('rel', 'self');
$atom_link->addAttribute('type', 'application/rss+xml');
$lang = $channel->addChild('language', strlen(Options::get('locale')) ? Options::get('locale') : 'en-us');
if ($tagline = Options::get('tagline')) {
$description = $channel->addChild('description', $tagline);
}
$max_time = DB::get_value("SELECT MAX(pubdate) FROM {posts} WHERE status = ? AND content_type = ? AND id in ( SELECT post_id from {postinfo} where name = ? )", array(Post::status('published'), Post::type('podcast'), $feed_name));
$pubDate = $channel->addChild('lastBuildDate', HabariDateTime::date_create($max_time)->get('r'));
$generator = $channel->addChild('generator', 'Habari ' . Version::get_habariversion() . ' http://habariproject.org/');
$itunes_author = $channel->addChild('xmlns:itunes:author', $itunes['author']);
$itunes_subtitle = $channel->addChild('xmlns:itunes:subtitle', $itunes['subtitle']);
$itunes_summary = $channel->addChild('xmlns:itunes:summary', $itunes['summary']);
$itunes_summary = $channel->addChild('description', $itunes['summary']);
$itunes_owner = $channel->addChild('xmlns:itunes:owner');
$itunes_owner_name = $itunes_owner->addChild('xmlns:itunes:name', $itunes['owner_name']);
$itunes_owner_email = $itunes_owner->addChild('xmlns:itunes:email', $itunes['owner_email']);
$itunes_explicit = $channel->addChild('xmlns:itunes:explicit', $itunes['explicit']);
$itunes_image = $channel->addChild('xmlns:itunes:image');
$itunes_image->addAttribute('href', $itunes['image']);
if (trim($itunes['main_category']) != '') {
$itunes_category = $channel->addChild('xmlns:itunes:category');
$categories = explode(':', $itunes['main_category']);
$itunes_category->addAttribute('text', $categories[0]);
if (isset($categories[1])) {
$child = $itunes_category->addChild('xmlns:itunes:category');
$child->addAttribute('text', $categories[1]);
}
}
if (trim($itunes['category_2']) != '') {
$itunes_category = $channel->addChild('xmlns:itunes:category');
$categories = explode(':', $itunes['category_2']);
$itunes_category->addAttribute('text', $categories[0]);
if (isset($categories[1])) {
$child = $itunes_category->addChild('xmlns:itunes:category');
$child->addAttribute('text', $categories[1]);
}
}
if (trim($itunes['category_3']) != '') {
$itunes_category = $channel->addChild('xmlns:itunes:category');
$categories = explode(':', $itunes['category_3']);
$itunes_category->addAttribute('text', $categories[0]);
if (isset($categories[1])) {
$child = $itunes_category->addChild('xmlns:itunes:category');
$child->addAttribute('text', $categories[1]);
}
}
$itunes_block = $channel->addChild('xmlns:itunes:block', $itunes['block'] ? 'Yes' : 'No');
if (strlen($itunes['redirect'])) {
$itunes_redirect = $channel->addChild('xmlns:itunes:new-feed-url', $itunes['redirect']);
}
Plugins::act('podcast_create_wrapper', $xml);
return $xml;
}
示例9:
?>
">
<div class="head clear">
<?php
echo "{$package->name} {$package->version}";
?>
</div>
<span class="content"><?php
echo $package->description;
?>
</span>
<?php
if (!$package->is_compatible()) {
?>
<div class="content"><?php
echo "{$package->name} {$package->version} is not compatible with Habari " . Version::get_habariversion();
?>
</div>
<?php
}
?>
<ul class="dropbutton<?php
echo $package->status == 'upgrade' || !$package->is_compatible() ? ' alert' : '';
?>
">
<?php
if (!$package->is_compatible()) {
?>
<li>not compatible!</li>
<?php
示例10: test_get_habariversion
function test_get_habariversion()
{
$this->assert_equal(Version::HABARI_MAJOR_MINOR . Version::HABARI_RELEASE, Version::get_habariversion());
}
示例11: get_sysinfo
/**
* Handles get requests for the system information page.
*/
public function get_sysinfo()
{
$sysinfo = array();
$siteinfo = array();
// Assemble Site Info
$siteinfo[_t('Habari Version')] = Version::get_habariversion();
if (Version::is_devel()) {
$siteinfo[_t('Habari Version')] .= " " . Version::get_git_short_hash();
}
$siteinfo[_t('Habari API Version')] = Version::get_apiversion();
$siteinfo[_t('Habari DB Version')] = Version::get_dbversion();
$siteinfo[_t('Active Theme')] = Options::get('theme_name');
$siteinfo[_t('System Locale')] = HabariLocale::get();
$siteinfo[_t('Cache Class')] = Cache::get_class();
$this->theme->siteinfo = $siteinfo;
// Assemble System Info
$sysinfo[_t('PHP Version')] = phpversion();
$sysinfo[_t('Server Software')] = $_SERVER['SERVER_SOFTWARE'];
$sysinfo[_t('Database')] = DB::get_driver_name() . ' - ' . DB::get_driver_version();
$sysinfo[_t('PHP Extensions')] = implode(', ', get_loaded_extensions());
$sysinfo[_t('PHP Configuration Settings')] = implode("<br>", Utils::get_ini_settings());
if (defined('PCRE_VERSION')) {
$sysinfo[_t('PCRE Version')] = PCRE_VERSION;
} else {
// probably PHP < 5.2.4
ob_start();
phpinfo(8);
$phpinfo = ob_get_contents();
ob_end_clean();
preg_match('/PCRE Library Version.*class="v">(.*)$/mi', $phpinfo, $matches);
$sysinfo[_t('PCRE Version')] = $matches[1];
}
$sysinfo[_t('Browser')] = $_SERVER['HTTP_USER_AGENT'];
$this->theme->sysinfo = $sysinfo;
// Assemble Class Info
$classinfo = Utils::glob(HABARI_PATH . "/user/classes/*.php");
if (count($classinfo)) {
$classinfo = array_map('realpath', $classinfo);
}
$this->theme->classinfo = $classinfo;
// Assemble Plugin Info
$raw_plugins = Plugins::get_active();
$plugins = array('system' => array(), 'user' => array(), '3rdparty' => array(), 'other' => array());
foreach ($raw_plugins as $plugin) {
$file = $plugin->get_file();
// Catch plugins that are symlinked from other locations as ReflectionClass->getFileName() only returns the ultimate file path, not the symlink path, and we really want the symlink path
$all_plugins = Plugins::list_all();
$filename = basename($file);
if (array_key_exists($filename, $all_plugins) && $all_plugins[$filename] != $file) {
$file = $all_plugins[$filename];
}
if (preg_match('%[\\\\/](system|3rdparty|user)[\\\\/]plugins[\\\\/]%i', $file, $matches)) {
// A plugin's info is XML, cast the element to a string. See #1026.
$plugins[strtolower($matches[1])][(string) $plugin->info->name] = $file;
} else {
// A plugin's info is XML, cast the element to a string.
$plugins['other'][(string) $plugin->info->name] = $file;
}
}
$this->theme->plugins = $plugins;
$this->theme->admin_page = _t('System Information');
$this->display('sysinfo');
}
示例12: register_beacons
/**
* Register beacons to check for updates.
* Includes Habari core, all active plugins, and any pluggable that implements the update_check hook.
*/
private static function register_beacons()
{
// if there are already beacons, don't run again
if (count(self::instance()->beacons) > 0) {
return;
}
Update::add('Habari', '7a0313be-d8e3-11db-8314-0800200c9a66', Version::get_habariversion());
// add the active theme
self::add_theme();
// add all active plugins
self::add_plugins();
Plugins::act('update_check');
}
示例13: _e
<?php
Plugins::act('admin_header', $this);
Stack::out('admin_header_javascript', Method::create('\\Habari\\Stack', 'scripts'));
Stack::out('admin_stylesheet', Method::create('\\Habari\\Stack', 'styles'));
?>
</head>
<body class="login">
<div id="page" class="container">
<div class="columns six offset-by-five">
<?php
echo $form;
?>
<p class="poweredby"><?php
_e('%1$s is powered by %2$s', array(Options::out('title'), '<a href="http://habariproject.org/" title="' . _t('Go to the Habari site') . '">Habari ' . Version::get_habariversion() . '</a>'));
?>
</p>
</div>
</div>
<?php
Plugins::act('admin_footer', $this);
Stack::out('admin_footer_javascript', ' <script src="%s" type="text/javascript"></script>' . "\r\n");
?>
<script type="text/javascript">
$(document).ready( function() {
<?php
Session::messages_out(true, Method::create('\\Habari\\Format', 'humane_messages'));
?>
$('.reset_link').click(function(){$(this).closest('form').toggleClass('do_reset'); return false;});
示例14: die
if (!defined('HABARI_PATH')) {
die('No direct access');
}
?>
</div>
<div id="bottom-secondary">
<div id="tags"><?php
echo Plugins::is_loaded('tagcloud') ? $theme->tag_cloud() : $theme->show_tags();
?>
</div>
</div>
<div id="footer">
<p>
<?php
_e('%1$s is powered by %2$s', array(Options::get('title'), '<a href="http://www.habariproject.org/" title="Habari">Habari ' . Version::get_habariversion() . '</a>'));
?>
-
<?php
_e('<a href="%1$s">Atom Entries</a> and <a href="%2$s">Atom Comments</a>', array(URL::get('atom_feed', array('index' => 1)), URL::get('atom_feed_comments')));
?>
</p>
</div>
<div class="clear"></div>
</div>
</div>
<?php
echo $theme->footer();
?>
</body>
</html>
示例15: _e
" title="<?php
_e('The latest comments to all posts');
?>
">comments feed</a>.
<br />
<a href="<?php
Site::out_url('habari');
?>
" title="<?php
Options::out('title');
?>
"><?php
Options::out('title');
?>
</a> is powered by <a href="http://www.habariproject.org/" title="Powered by Habari">Habari <?php
echo Version::get_habariversion();
if (Version::is_devel()) {
echo ' r' . Version::get_svn_revision();
}
?>
</a>.
<br />
Theme: <a href="http://www.somefoolwitha.com/hmallow2" title="hMallow2">hMallow2</a>. Administrator <a href="<?php
Site::out_url('habari');
?>
/admin"><?php
_e('admin');
?>
</a>.
<div id="footer_area">