Modérateur : Équipe
Code : Tout sélectionner
,
"version-check": {
"host": "version.phpbbdev.space",
"directory": "/versions/devspace",
"filename": "forum_subscriptions_version_file.json",
"ssl": true
}
Code : Tout sélectionner
$version_data = $this->functions->version_check();
Code : Tout sélectionner
'S_VERSION_CHECK' => (array_key_exists('current', $version_data)) ? $version_data['current'] : false,
Code : Tout sélectionner
// Template vars for header panel
$version_data = $this->functions->version_check();
Code : Tout sélectionner
'S_VERSION_CHECK' => (array_key_exists('current', $version_data)) ? $version_data['current'] : false,
Code : Tout sélectionner
// Template vars for header panel
$version_data = $this->functions->version_check();
Code : Tout sélectionner
'S_VERSION_CHECK' => (array_key_exists('current', $version_data)) ? $version_data['current'] : false,
Code : Tout sélectionner
/**
* Get the extension's namespace
*
* @return $extension_name
* @access public
*/
public function get_ext_namespace($mode = 'php')
{
// Let's extract the extension name from the namespace
$extension_name = substr($this->namespace, 0, -(strlen($this->namespace) - strrpos($this->namespace, '\\')));
// Now format the extension name
switch ($mode)
{
case 'php':
$extension_name = str_replace('\\', '/', $extension_name);
break;
case 'twig':
$extension_name = str_replace('\\', '_', $extension_name);
break;
}
return $extension_name;
}
/**
* Check if there is an updated version of the extension
*
* @return $new_version
* @access public
*/
public function version_check()
{
if ($this->get_meta('host') == 'www.phpbb.com')
{
$port = 'https://';
$stable = null;
}
else
{
$port = 'http://';
$stable = 'unstable';
}
// Can we access the version srver?
if (@fopen($port . $this->get_meta('host') . $this->get_meta('directory') . '/' . $this->get_meta('filename'), 'r'))
{
try
{
$md_manager = $this->ext_manager->create_extension_metadata_manager($this->get_ext_namespace());
$version_data = $this->ext_manager->version_check($md_manager, true, false, $stable);
}
catch (version_check_exception $e)
{
$version_data['current'] = 'fail';
}
}
else
{
$version_data['current'] = 'fail';
}
return $version_data;
}
Code : Tout sélectionner
{% if S_VERSION_CHECK %}
{% if S_VERSION_CHECK == 'fail' %}
<div class="head-panel-noversion">
<div class="head-description">{{ lang('NO_VERSION_EXPLAIN') }}</div>
</div>
{% else %}
<div class="head-panel-version">
<div class="head-title">{{ lang('NEW_VERSION', S_VERSION_CHECK) }}</div>
<div class="head-description">{{ lang('NEW_VERSION_EXPLAIN', S_VERSION_CHECK, DOWNLOAD) }}</div>
</div>
{% endif %}
{% endif %}
Code : Tout sélectionner
{% if S_VERSION_CHECK %}
{% if S_VERSION_CHECK == 'fail' %}
<div class="head-panel-noversion">
<div class="head-description">{{ lang('NO_VERSION_EXPLAIN') }}</div>
</div>
{% else %}
<div class="head-panel-version">
<div class="head-title">{{ lang('NEW_VERSION', S_VERSION_CHECK) }}</div>
<div class="head-description">{{ lang('NEW_VERSION_EXPLAIN', S_VERSION_CHECK, DOWNLOAD) }}</div>
</div>
{% endif %}
{% endif %}
ça me parait beaucoup quand même...
Code : Tout sélectionner
public function version_check()
{
if ($this->get_meta('host') == 'www.phpbb.com')
{
$port = 'https://';
$stable = null;
}
else
{
$port = 'http://';
$stable = 'unstable';
}
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité