本文整理汇总了PHP中get_version函数的典型用法代码示例。如果您正苦于以下问题:PHP get_version函数的具体用法?PHP get_version怎么用?PHP get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vouchers_init
/**
* Vouchers plugin initialization functions.
*/
function vouchers_init()
{
// register a library of helper functions
elgg_register_library('elgg:vouchers', elgg_get_plugins_path() . 'vouchers/lib/vouchers.php');
// Register subtype
run_function_once('vouchers_manager_run_once_subtypes');
// Register entity_type for search
elgg_register_entity_type('object', Voucher::SUBTYPE);
// Site navigation
$item = new ElggMenuItem('vouchers', elgg_echo('vouchers:menu'), 'vouchers/all');
elgg_register_menu_item('site', $item);
// Extend CSS
elgg_extend_view('css/elgg', 'vouchers/css');
elgg_register_css('vouchers_tooltip_css', '//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css');
// Extend js
elgg_register_js('vouchersjs', elgg_get_site_url() . 'mod/vouchers/assets/vouchers.js');
elgg_register_js('vouchers_tooltip_js', '//code.jquery.com/ui/1.11.1/jquery-ui.js');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('vouchers', 'vouchers_page_handler');
// Register a URL handler for voucher
$release = get_version(true);
// Register a URL handler for agora
if ($release < 1.9) {
// version 1.8
elgg_register_entity_url_handler('object', 'vouchers', 'voucher_url');
} else {
// use this since Elgg 1.9
elgg_register_plugin_hook_handler('entity:url', 'object', 'vouchers_set_url');
}
// Register menu item to an ownerblock
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'vouchers_owner_block_menu');
// Register admin transaction log menu under "Utilities"
elgg_register_admin_menu_item('administer', 'vouchers_transactions_log', 'administer_utilities');
// register plugin hooks
elgg_register_plugin_hook_handler("public_pages", "walled_garden", "vouchers_walled_garden_hook");
// Register actions
$action_path = elgg_get_plugins_path() . 'vouchers/actions';
elgg_register_action("vouchers/addvoucher", "{$action_path}/addvoucher.php");
elgg_register_action("vouchers/delete", "{$action_path}/delvoucher.php");
elgg_register_action("vouchers/set_featured", "{$action_path}/vouchers/set_featured.php");
// set a voucher post as featured
elgg_register_action("vouchers/unset_featured", "{$action_path}/vouchers/unset_featured.php");
// unset a voucher post from featured
elgg_register_action("vouchers/get_with_points", "{$action_path}/vouchers/get_with_points.php");
// voucher purchase with points only
elgg_register_action('vouchers/be_interested', "{$action_path}/be_interested.php");
// send interest
elgg_register_action("vouchers/usersettings", "{$action_path}/usersettings.php");
// save user settings
// extend group main page
elgg_extend_view('groups/tool_latest', 'vouchers/group_module');
//elgg_extend_view("print", "printpreview/pageshell/pageshell");
// add the group vouchers tool option
add_group_tool_option('vouchers', elgg_echo('vouchers:group:enablevouchers'), true);
// Add vouchers widgets
elgg_register_widget_type('vouchers', elgg_echo('vouchers:widget'), elgg_echo('vouchers:widget:description'), 'profile,groups,dashboard');
// member's voucher posts
elgg_register_widget_type('vouchers_featured', elgg_echo('vouchers:widget:featured'), elgg_echo('vouchers:widget:featured:description'), 'dashboard');
// featured vouchers for dashboard
}
开发者ID:nlybe,项目名称:Elgg-Vouchers,代码行数:63,代码来源:start.php
示例2: advanced_notifications_create_annotation_event_handler
/**
* Handles the sending of notifications when replied on group forum topic
*
* @param string $event the name of the event
* @param string $type the type of the event
* @param ElggAnnotation $annotation the supplied ElggAnnotation
*
* @return void
*/
function advanced_notifications_create_annotation_event_handler($event, $type, $annotation)
{
if (!empty($annotation) && $annotation instanceof ElggAnnotation) {
// is this an annotation on which notifications should be sent
if (advanced_notifications_is_registered_notification_annotation($annotation)) {
// check if the entity isn't PRIVATE
$entity = $annotation->getEntity();
if (!empty($entity) && $entity->access_id != ACCESS_PRIVATE) {
// is the entity a registered notification entity
if (advanced_notifications_is_registered_notification_entity($entity)) {
// prepare to call the commandline
$commandline_options = array("event" => $event, "type" => $type, "id" => $annotation->id);
// in older versions of elgg do this differently
if (version_compare(get_version(true), "1.8.6", "<")) {
$entity = $annotation->getEntity();
unset($commandline_options["id"]);
$commandline_options["type"] = $entity->getType();
$commandline_options["guid"] = $entity->getGUID();
$commandline_options["input"] = "group_topic_post|" . base64_encode($annotation->value);
}
advanced_notifications_start_commandline($commandline_options);
}
}
}
}
}
开发者ID:juliendangers,项目名称:advanced_notifications,代码行数:35,代码来源:events.php
示例3: polls_init
function polls_init()
{
elgg_register_library('elgg:polls', elgg_get_plugins_path() . 'polls/models/model.php');
// Set up menu for logged in users
if (elgg_is_logged_in()) {
$item = new ElggMenuItem('polls', elgg_echo('polls'), 'polls/owner/' . elgg_get_logged_in_user_entity()->username);
} else {
$item = new ElggMenuItem('polls', elgg_echo('poll'), 'polls/all');
}
elgg_register_menu_item('site', $item);
// Extend system CSS with our own styles, which are defined in the polls/css view
elgg_extend_view('css/elgg', 'polls/css');
// Extend hover-over menu
elgg_extend_view('profile/menu/links', 'polls/menu');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('polls', 'polls_page_handler');
// Register a URL handler for poll posts
elgg_register_entity_url_handler('object', 'poll', 'polls_url');
// notifications
$elgg_version = explode('.', get_version(true));
if ($elgg_version[1] > 8) {
$send_notification = elgg_get_plugin_setting('send_notification', 'polls');
if (!$send_notification || $send_notification != 'no') {
elgg_register_notification_event('object', 'poll');
elgg_register_plugin_hook_handler('prepare', 'notification:create:object:poll', 'polls_prepare_notification');
}
}
// add link to owner block
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'polls_owner_block_menu');
elgg_register_plugin_hook_handler('widget_url', 'widget_manager', 'polls_widget_url_handler');
// Register entity type
elgg_register_entity_type('object', 'poll');
// register the JavaScript
$js = elgg_get_simplecache_url('js', 'polls/js');
elgg_register_simplecache_view('js/polls/js');
elgg_register_js('elgg.polls', $js);
// add group widget
$group_polls = elgg_get_plugin_setting('group_polls', 'polls');
if (!$group_polls || $group_polls != 'no') {
elgg_extend_view('groups/tool_latest', 'polls/group_module');
}
if (!$group_polls || $group_polls == 'yes_default') {
add_group_tool_option('polls', elgg_echo('polls:enable_polls'), TRUE);
} else {
if ($group_polls == 'yes_not_default') {
add_group_tool_option('polls', elgg_echo('polls:enable_polls'), FALSE);
}
}
//add widgets
elgg_register_widget_type('poll', elgg_echo('polls:my_widget_title'), elgg_echo('polls:my_widget_description'), "profile,groups");
elgg_register_widget_type('latestPolls', elgg_echo('polls:latest_widget_title'), elgg_echo('polls:latest_widget_description'), "index,profile,dashboard,groups");
elgg_register_widget_type('poll_individual', elgg_echo('polls:individual'), elgg_echo('poll_individual_group:widget:description'), "index,profile,dashboard,groups");
// Register actions
$action_path = elgg_get_plugins_path() . 'polls/actions/polls';
elgg_register_action("polls/add", "{$action_path}/add.php");
elgg_register_action("polls/edit", "{$action_path}/edit.php");
elgg_register_action("polls/delete", "{$action_path}/delete.php");
elgg_register_action("polls/vote", "{$action_path}/vote.php");
}
开发者ID:socialweb,项目名称:PiGo,代码行数:59,代码来源:start.php
示例4: diagnostics_basic_hook
/**
* Generate a basic report.
*
* @return string
*/
function diagnostics_basic_hook($hook, $entity_type, $returnvalue, $params)
{
// Get version information
$version = get_version();
$release = get_version(true);
$returnvalue .= elgg_echo('diagnostics:report:basic', array($release, $version));
return $returnvalue;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:13,代码来源:start.php
示例5: diagnostics_basic_hook
/**
* Generate a basic report.
*
* @param unknown_type $hook
* @param unknown_type $entity_type
* @param unknown_type $returnvalue
* @param unknown_type $params
*/
function diagnostics_basic_hook($hook, $entity_type, $returnvalue, $params)
{
global $CONFIG;
// Get version information
$version = get_version();
$release = get_version(true);
$returnvalue .= sprintf(elgg_echo('diagnostics:report:basic'), $release, $version);
return $returnvalue;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:17,代码来源:start.php
示例6: ping_home
/**
* Run once and only once.
*
* @param ElggSite $site The site who's information to use
*/
function ping_home(ElggSite $site)
{
global $NOTIFICATION_SERVER, $CONFIG;
// Get version information
$version = get_version();
$release = get_version(true);
// Get export
$export = export($site->guid);
return send_api_post_call($NOTIFICATION_SERVER, array('method' => 'elgg.system.ping', 'url' => $site->url, 'version' => $version, 'release' => $release), array(), $export, 'text/xml');
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:15,代码来源:ping.php
示例7: is_elgg18
/**
* Determine if we're running elgg 1.8 or newer
* @return boolean
*/
function is_elgg18()
{
static $is_elgg18;
if ($is_elgg18 !== null) {
return $is_elgg18;
}
if (is_callable('elgg_get_version')) {
return false;
// this is newer than 1.8
}
$is_elgg18 = strpos(get_version(true), '1.8') === 0;
return $is_elgg18;
}
开发者ID:arckinteractive,项目名称:elgg_stormpath,代码行数:17,代码来源:functions.php
示例8: transfer_plugins_export
/**
* Exports plugins and their configuration
*/
function transfer_plugins_export()
{
// metadata
$info = array('elgg_version' => get_version(true), 'elgg_release' => get_version(false), 'transfer_plugins_format' => TRANSFER_PLUGINS_FORMAT);
$info['plugins'] = array();
$plugins = elgg_get_plugins('all');
foreach ($plugins as $plugin) {
if (is_object($plugin) && is_object($plugin->getManifest())) {
$plugin_info = array('id' => $plugin->getID(), 'version' => $plugin->getManifest()->getVersion(), 'active' => (bool) $plugin->isActive(), 'settings' => $plugin->getAllSettings(), 'priority' => $plugin->getPriority());
}
$plugin_order[$plugin->getPriority() * 10] = $plugin->getID();
$info['plugins'][] = $plugin_info;
}
$info['17_pluginorder'] = serialize($plugin_order);
return serialize($info);
}
开发者ID:socialweb,项目名称:PiGo,代码行数:19,代码来源:start.php
示例9: get_version_number
function get_version_number()
{
$r = 'v';
$v = get_version();
$pos = strpos($v, ' ', 0);
if ($pos === false) {
my_die('Wrong version: ' . $v);
}
$vn = preg_split("/[.]/", substr($v, 0, $pos));
if (count($vn) < 3) {
my_die('Wrong version: ' . $v);
}
for ($i = 0; $i < 3; $i++) {
$r .= substr('000' . $vn[$i], -3);
}
return $r;
// 'vxxxyyyzzz' wenn version = x.y.z
}
开发者ID:shoehn,项目名称:learningwithtext,代码行数:18,代码来源:utilities.inc.php
示例10: header
header("Content-Type: text/plain");
?>
#!/bin/sh
BASEURL="<?php
echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . conf('subdirectory');
?>
"
TPL_BASE="${BASEURL}/assets/client_installer/"
MUNKIPATH="/usr/local/munki/" # TODO read munkipath from munki config
PREFPATH="/Library/Preferences/MunkiReport"
CURL="/usr/bin/curl --insecure --fail --silent --show-error"
# Exit status
ERR=0
VERSION="<?php
echo get_version();
?>
"
echo "BaseURL is ${BASEURL}"
echo "Retrieving munkireport scripts"
cd ${MUNKIPATH}
$CURL "${TPL_BASE}{preflight,postflight,report_broken_client}" --remote-name --remote-name --remote-name \
&& $CURL "${TPL_BASE}reportcommon" -o "${MUNKIPATH}munkilib/reportcommon.py" \
&& $CURL "${TPL_BASE}phpserialize" -o "${MUNKIPATH}munkilib/phpserialize.py"
if [ "${?}" != 0 ]
then
echo "Failed to download all required components!"
开发者ID:BillTheBest,项目名称:munkireport,代码行数:31,代码来源:install_script.php
示例11: define
<?php
define('VERSION_STATIC', '1.14');
function get_version()
{
date_default_timezone_set('UTC');
$root_dir = dirname(dirname(__FILE__));
if (is_dir("{$root_dir}/.git") && file_exists("{$root_dir}/.git/refs/heads/master")) {
$suffix = substr(trim(file_get_contents("{$root_dir}/.git/refs/heads/master")), 0, 7);
return VERSION_STATIC . ".{$suffix}";
}
return VERSION_STATIC;
}
define('VERSION', get_version());
开发者ID:adrianpietka,项目名称:bfrss,代码行数:14,代码来源:version.php
示例12: version_upgrade
/**
* Upgrades Elgg
*
*/
function version_upgrade()
{
$dbversion = (int) datalist_get('version');
// No version number? Oh snap...this is an upgrade from a clean installation < 1.7.
// Run all upgrades without error reporting and hope for the best.
// See http://trac.elgg.org/elgg/ticket/1432 for more.
$quiet = !$dbversion;
// Upgrade database
if (db_upgrade($dbversion, '', $quiet)) {
system_message(elgg_echo('upgrade:db'));
}
// Upgrade core
if (upgrade_code($dbversion, $quiet)) {
system_message(elgg_echo('upgrade:core'));
}
// Now we trigger an event to give the option for plugins to do something
$upgrade_details = new stdClass();
$upgrade_details->from = $dbversion;
$upgrade_details->to = get_version();
trigger_elgg_event('upgrade', 'upgrade', $upgrade_details);
// Update the version
datalist_set('version', get_version());
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:27,代码来源:version.php
示例13: elseif
if (isset($site_mods[$mod])) {
if (file_exists(NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_" . NV_LANG_INTERFACE . ".php")) {
include NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_" . NV_LANG_INTERFACE . ".php";
} elseif (file_exists(NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_" . NV_LANG_DATA . ".php")) {
include NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_" . NV_LANG_DATA . ".php";
} elseif (file_exists(NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_en.php")) {
include NV_ROOTDIR . "/modules/" . $site_mods[$mod]['module_file'] . "/language/admin_en.php";
}
}
return $lang_module;
}
$info = array();
if (defined('NV_IS_GODADMIN')) {
$field = array();
$field[] = array('key' => $lang_module['version_user'], 'value' => $global_config['version']);
$new_version = get_version(28800);
//kem tra lai sau 8 tieng
if ($new_version != false) {
if (nv_version_compare($global_config['version'], $new_version->version) < 0) {
$field[] = array('key' => $lang_module['version_news'], 'value' => (string) $new_version->version);
}
}
$caption = "<a href=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=settings&" . NV_OP_VARIABLE . "=checkupdate\">" . $lang_module['checkversion'] . "</a>";
$info[] = array('caption' => $caption, 'field' => $field);
}
foreach ($site_mods as $mod => $value) {
if (file_exists(NV_ROOTDIR . "/modules/" . $value['module_file'] . "/siteinfo.php")) {
$siteinfo = array();
$mod_data = $value['module_data'];
include NV_ROOTDIR . "/modules/" . $value['module_file'] . "/siteinfo.php";
if (!empty($siteinfo)) {
开发者ID:syphuonglam,项目名称:creative-portal,代码行数:31,代码来源:main.php
示例14: die
<?php
// Disallow direct access to this file for security reasons
if (!defined("IN_MYBB")) {
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$page->add_breadcrumb_item("CloudFlare Manager", "index.php?module=cloudflare");
$page->add_breadcrumb_item("Change Log", "index.php?module=cloudflare-change_log");
$page->output_header("CloudFlare Manager - Change Log For Version " . get_version());
$version = str_replace(" ", "", get_version());
$changelog = @file_get_contents("http://cf.mybbsecurity.net/changelog/" . $version);
if ($changelog) {
echo nl2br($changelog);
} else {
echo "Error: Cannot find change log for version " . get_version() . ".";
}
$page->output_footer();
开发者ID:EspialWires,项目名称:MyBB-CloudFlare-Manager,代码行数:17,代码来源:cloudflare_change_log.php
示例15: foreach
/**
* iZAP izap_videos
*
* @package Elgg videotizer, by iZAP Web Solutions.
* @license GNU Public License version 3
* @Contact iZAP Team "<[email protected]>"
* @Founder Tarun Jangra "<[email protected]>"
* @link http://www.izap.in/
*
*/
$limit = $vars['entity']->num_display;
$limit = $limit ? $limit : 5;
$options['type'] = 'object';
$options['subtype'] = 'izap_videos';
$options['limit'] = $limit;
if ((double) get_version(true) <= 1.6) {
$videos = get_entities($options['type'], $options['subtype'], 0, '', $options['subtype']);
} else {
$videos = elgg_get_entities($options);
}
if ($videos) {
foreach ($videos as $video) {
echo elgg_view('izap_videos/widgetListing', array('entity' => $video));
}
}
if (is_old_elgg()) {
?>
<script type="text/javascript">
$(document).ready(function() {
$(".izap_ajaxed_thumb").click(function() {
$("#load_video_" + this.rel).attr('style', '');
开发者ID:rimpy,项目名称:izap_videos,代码行数:31,代码来源:view.php
示例16: checkDependencies
/**
* Returns if the Elgg system meets the plugin's dependency
* requirements. This includes both requires and conflicts.
*
* Full reports can be requested. The results are returned
* as an array of arrays in the form array(
* 'type' => requires|conflicts,
* 'dep' => array( dependency array ),
* 'status' => bool if depedency is met,
* 'comment' => optional comment to display to the user.
* )
*
* @param bool $full_report Return a full report.
* @return bool|array
*/
public function checkDependencies($full_report = false)
{
// Note: $conflicts and $requires are not unused. They're called dynamically
$requires = $this->getManifest()->getRequires();
$conflicts = $this->getManifest()->getConflicts();
$enabled_plugins = elgg_get_plugins('active');
$this_id = $this->getID();
$report = array();
// first, check if any active plugin conflicts with us.
foreach ($enabled_plugins as $plugin) {
$temp_conflicts = array();
$temp_manifest = $plugin->getManifest();
if ($temp_manifest instanceof ElggPluginManifest) {
$temp_conflicts = $plugin->getManifest()->getConflicts();
}
foreach ($temp_conflicts as $conflict) {
if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) {
$result = $this->checkDepPlugin($conflict, $enabled_plugins, false);
// rewrite the conflict to show the originating plugin
$conflict['name'] = $plugin->getManifest()->getName();
if (!$full_report && !$result['status']) {
$this->errorMsg = "Conflicts with plugin \"{$plugin->getManifest()->getName()}\".";
return $result['status'];
} else {
$report[] = array('type' => 'conflicted', 'dep' => $conflict, 'status' => $result['status'], 'value' => $this->getManifest()->getVersion());
}
}
}
}
$check_types = array('requires', 'conflicts');
if ($full_report) {
// Note: $suggests is not unused. It's called dynamically
$suggests = $this->getManifest()->getSuggests();
$check_types[] = 'suggests';
}
foreach ($check_types as $dep_type) {
$inverse = $dep_type == 'conflicts' ? true : false;
foreach (${$dep_type} as $dep) {
switch ($dep['type']) {
case 'elgg_version':
$result = $this->checkDepElgg($dep, get_version(), $inverse);
break;
case 'elgg_release':
$result = $this->checkDepElgg($dep, get_version(true), $inverse);
break;
case 'plugin':
$result = $this->checkDepPlugin($dep, $enabled_plugins, $inverse);
break;
case 'priority':
$result = $this->checkDepPriority($dep, $enabled_plugins, $inverse);
break;
case 'php_extension':
$result = $this->checkDepPhpExtension($dep, $inverse);
break;
case 'php_ini':
$result = $this->checkDepPhpIni($dep, $inverse);
break;
}
// unless we're doing a full report, break as soon as we fail.
if (!$full_report && !$result['status']) {
$this->errorMsg = "Missing dependencies.";
return $result['status'];
} else {
// build report element and comment
$report[] = array('type' => $dep_type, 'dep' => $dep, 'status' => $result['status'], 'value' => $result['value']);
}
}
}
if ($full_report) {
// add provides to full report
$provides = $this->getManifest()->getProvides();
foreach ($provides as $provide) {
$report[] = array('type' => 'provides', 'dep' => $provide, 'status' => true, 'value' => '');
}
return $report;
}
return true;
}
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:93,代码来源:ElggPluginPackage.php
示例17: switch
if (!isset($import_handle)) {
$import_handle = "";
}
$package_size = 1048576;
switch ($task) {
case "get_sql":
get_sql_dump();
break;
case "get_sql_file":
get_sql_file($filename, $position);
break;
case "put_sql":
put_sql($import_handle);
break;
case "get_version":
get_version($version);
break;
case "get_config":
get_config();
break;
case "get_category_tree":
get_category_tree();
break;
case "run_indexer":
run_indexer();
break;
case "get_include_tables_exists":
get_include_tables_exists();
break;
case "get_var_from_script":
echo handle_dirs($vars_main_dir, $vars_names);
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:31,代码来源:bridge_biNsTNTP.php
示例18: check_plugin_compatibility
/**
* This function checks a plugin manifest 'elgg_version' value against the current install
* returning TRUE if the elgg_version is <= the current install's version.
* @param $manifest_elgg_version_string The build version (eg 2009010201).
* @return bool
*/
function check_plugin_compatibility($manifest_elgg_version_string)
{
$version = get_version();
if (strpos($manifest_elgg_version_string, '.') === false) {
// Using version
$req_version = (int) $manifest_elgg_version_string;
return $version >= $req_version;
}
return false;
}
开发者ID:eokyere,项目名称:elgg,代码行数:16,代码来源:plugins.php
示例19: elgg_deprecated_notice
/**
* Sends a notice about deprecated use of a function, view, etc.
*
* This function either displays or logs the deprecation message,
* depending upon the deprecation policies in {@link CODING.txt}.
* Logged messages are sent with the level of 'WARNING'. Only admins
* get visual deprecation notices. When non-admins are logged in, the
* notices are sent to PHP's log through elgg_dump().
*
* A user-visual message will be displayed if $dep_version is greater
* than 1 minor releases lower than the current Elgg version, or at all
* lower than the current Elgg major version.
*
* @note This will always at least log a warning. Don't use to pre-deprecate things.
* This assumes we are releasing in order and deprecating according to policy.
*
* @see CODING.txt
*
* @param string $msg Message to log / display.
* @param string $dep_version Human-readable *release* version: 1.7, 1.8, ...
* @param int $backtrace_level How many levels back to display the backtrace.
* Useful if calling from functions that are called
* from other places (like elgg_view()). Set to -1
* for a full backtrace.
*
* @return bool
* @since 1.7.0
*/
function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1)
{
// if it's a major release behind, visual and logged
// if it's a 1 minor release behind, visual and logged
// if it's for current minor release, logged.
// bugfixes don't matter because we are not deprecating between them
if (!$dep_version) {
return false;
}
$elgg_version = get_version(true);
$elgg_version_arr = explode('.', $elgg_version);
$elgg_major_version = (int) $elgg_version_arr[0];
$elgg_minor_version = (int) $elgg_version_arr[1];
$dep_major_version = (int) $dep_version;
$dep_minor_version = 10 * ($dep_version - $dep_major_version);
$visual = false;
if ($dep_major_version < $elgg_major_version || $dep_minor_version < $elgg_minor_version) {
$visual = true;
}
$msg = "Deprecated in {$dep_major_version}.{$dep_minor_version}: {$msg}";
if ($visual && elgg_is_admin_logged_in()) {
register_error($msg);
}
// Get a file and line number for the log. Never show this in the UI.
// Skip over the function that sent this notice and see who called the deprecated
// function itself.
$msg .= " Called from ";
$stack = array();
$backtrace = debug_backtrace();
// never show this call.
array_shift($backtrace);
$i = count($backtrace);
foreach ($backtrace as $trace) {
$stack[] = "[#{$i}] {$trace['file']}:{$trace['line']}";
$i--;
if ($backtrace_level > 0) {
if ($backtrace_level <= 1) {
break;
}
$backtrace_level--;
}
}
$msg .= implode("<br /> -> ", $stack);
elgg_dump($msg, elgg_is_admin_logged_in(), 'WARNING');
return true;
}
开发者ID:nhunaro,项目名称:Elgg,代码行数:74,代码来源:elgglib.php
示例20: header
<?php
/**
* Elgg ICAL output pageshell
*
* @package Elgg
* @subpackage Core
*
*/
header("Content-Type: text/calendar");
echo $vars['body'];
?>
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Curverider Ltd//NONSGML Elgg <?php
echo get_version(true);
?>
//EN
<?php
echo $vars['body'];
?>
END:VCALENDAR
开发者ID:redvabel,项目名称:Vabelgg,代码行数:22,代码来源:default.php
注:本文中的get_version函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论