diff --git a/admin/Masmak/admin_plugins.html b/admin/Masmak/admin_plugins.html
index 3659092..5f26158 100755
--- a/admin/Masmak/admin_plugins.html
+++ b/admin/Masmak/admin_plugins.html
@@ -16,6 +16,9 @@
{lang.KLEEJA_STORE}
+
+ {lang.R_CHECK_UPDATE}
+
@@ -130,7 +133,14 @@
-
+
+
+
+
+ {lang.ALL_PLUGINS_UPDATED}{lang.NO_PLUGINS}
+
+
+
-
@@ -139,7 +149,7 @@
{{title}}
diff --git a/includes/adm/j_plugins.php b/includes/adm/j_plugins.php
index 2c7551c..b4299b3 100755
--- a/includes/adm/j_plugins.php
+++ b/includes/adm/j_plugins.php
@@ -63,6 +63,7 @@ switch ($case):
default:
case 'local':
case 'store':
+ case 'check':
# Get installed plugins
$query = array(
@@ -144,7 +145,7 @@ switch ($case):
$stylee = "admin_plugins";
//do not proceed if not store case
- if($case != 'store')
+ if(! in_array($case, ['store', 'check']))
{
break;
}
@@ -169,24 +170,40 @@ switch ($case):
$available_plugins_names = array_column($available_plugins, 'name');
foreach ($catalog_plugins as $plugin_info)
{
- if (! in_array($plugin_info['name'] , $available_plugins_names) && empty($installed_plugins[$plugin_info['name']]) )
+ if ($case == 'store' && in_array($plugin_info['name'] , $available_plugins_names) &&
+ ! empty($installed_plugins[$plugin_info['name']])
+ )
{
- $store_plugins[$plugin_info['name']] = array(
- 'name' => $plugin_info['name'] ,
- 'developer' => $plugin_info['developer'] ,
- 'version' => $plugin_info['file']['version'] ,
- 'title' => ! empty($plugin_info['title'][$config['language']]) ? $plugin_info['title'][$config['language']] : $plugin_info['title']['en'] ,
- 'website' => $plugin_info['website'] ,
- 'kj_min_version' => $plugin_info['kleeja_version']['min'] ,
- 'kj_max_version' => $plugin_info['kleeja_version']['max'] ,
- 'kj_version_cmtp' => sprintf($lang[ 'KLJ_VER_NO_PLUGIN'], $plugin_info['kleeja_version']['min'], $plugin_info['kleeja_version']['max']),
- 'icon' => $plugin_info['icon'] ,
- 'NotCompatible' => version_compare(strtolower($plugin_info['kleeja_version']['min']), KLEEJA_VERSION , '<=')
- && version_compare(strtolower($plugin_info['kleeja_version']['max']), KLEEJA_VERSION , '>=')
- ? false : true,
- );
+ continue;
}
- }
+
+ // is there a new version of this in the store
+ if ($case == 'check' && (! empty($installed_plugins[$plugin_info['name']]) &&
+ version_compare(
+ strtolower($installed_plugins[$row['plg_name']]['extra_info']['plugin_version']),
+ $plugin_info['file']['version'],
+ '>=') || empty($installed_plugins[$plugin_info['name']]))
+ ) {
+ continue;
+ }
+
+ $store_plugins[$plugin_info['name']] = array(
+ 'name' => $plugin_info['name'],
+ 'developer' => $plugin_info['developer'],
+ 'version' => $plugin_info['file']['version'],
+ 'title' => ! empty($plugin_info['title'][$config['language']]) ? $plugin_info['title'][$config['language']] : $plugin_info['title']['en'],
+ 'website' => $plugin_info['website'],
+ 'kj_min_version' => $plugin_info['kleeja_version']['min'],
+ 'kj_max_version' => $plugin_info['kleeja_version']['max'],
+ 'kj_version_cmtp' => sprintf($lang[ 'KLJ_VER_NO_PLUGIN'], $plugin_info['kleeja_version']['min'], $plugin_info['kleeja_version']['max']),
+ 'icon' => $plugin_info['icon'] ,
+ 'NotCompatible' => version_compare(strtolower($plugin_info['kleeja_version']['min']), KLEEJA_VERSION , '<=')
+ && version_compare(strtolower($plugin_info['kleeja_version']['max']), KLEEJA_VERSION , '>=')
+ ? false : true,
+ );
+ }
+
+ $no_store_plugins = sizeof($store_plugins) == 0;
break;
diff --git a/includes/style.php b/includes/style.php
index b315538..8b3fe93 100755
--- a/includes/style.php
+++ b/includes/style.php
@@ -174,38 +174,19 @@ class kleeja_style
*/
protected function _if_callback($matches)
{
- $char = array(' eq ', ' lt ', ' gt ', ' lte ', ' gte ', ' neq ', '==', '!=', '>=', '<=', '<', '>');
- $reps = array('==', '<', '>', '<=', '>=', '!=', '==', '!=', '>=', '<=', '<', '>');
$atts = call_user_func(array('kleeja_style', '_get_attributes'), $matches[0]);
- $con = trim(!empty($atts['NAME']) ? $atts['NAME'] : (empty($atts['LOOP']) ? '' : $atts['LOOP']));
-
- $con = str_replace('$this->vars', '[----this-vars----]', $con);
-
- if (preg_match('/(.*)(' . implode('|', $char) . ')(.*)/i', $con, $arr))
+ $condition = '';
+ foreach(['NAME' => '', 'LOOP' => '', 'AND' => ' && ', 'OR' => ' || '] as $attribute=>$separator)
{
- $arr[1] = trim($arr[1]);
- $var1 = $arr[1][0] != '$' ? call_user_func(array('kleeja_style', '_var_callback'), (!empty($atts['NAME']) ? '{' . $arr[1] . '}' : '{{' . $arr[1] . '}}')) : $arr[1];
- $opr = str_replace($char, $reps, $arr[2]);
- $var2 = trim($arr[3]);
-
- #check for type
- if ($var2[0] != '$' && !preg_match('/[0-9]/', $var2))
+ if(! empty($atts[$attribute]))
{
- $var2 = '"' . str_replace('"', '\"', $var2) . '"';
+ $condition .= $separator . $this->parse_condition($atts[$attribute]);
}
-
- $con = "$var1$opr$var2";
}
- elseif ($con[0] !== '$' && strpos($con, '(') === false)
- {
- $con = call_user_func(array('kleeja_style', '_var_callback'), (!empty($atts['NAME']) ? '{' . $con . '}' : '{{' . $con . '}}'));
- }
-
- $con = str_replace( '[----this-vars----]', '$this->vars', $con);
return strtoupper($matches[1]) == 'IF'
- ? ''
- : (strtoupper($matches[1]) == 'UNLESS' ? '' : '');
+ ? ''
+ : (strtoupper($matches[1]) == 'UNLESS' ? '' : '');
}
@@ -219,6 +200,32 @@ class kleeja_style
return '' . $matches[2] . '' . $matches[3] . '';
}
+ protected function parse_condition($condition)
+ {
+ $char = array(' eq ', ' lt ', ' gt ', ' lte ', ' gte ', ' neq ', '==', '!=', '>=', '<=', '<', '>');
+ $reps = array('==', '<', '>', '<=', '>=', '!=', '==', '!=', '>=', '<=', '<', '>');
+
+ $con = str_replace('$this->vars', '[----this-vars----]', $condition);
+
+ if (preg_match('/(.*)(' . implode('|', $char) . ')(.*)/i', $con, $arr)) {
+ $arr[1] = trim($arr[1]);
+ $var1 = $arr[1][0] != '$' ? call_user_func(array('kleeja_style', '_var_callback'), (!empty($condition) ? '{' . $arr[1] . '}' : '{{' . $arr[1] . '}}')) : $arr[1];
+ $opr = str_replace($char, $reps, $arr[2]);
+ $var2 = trim($arr[3]);
+
+ #check for type
+ if ($var2[0] != '$' && !preg_match('/[0-9]/', $var2)) {
+ $var2 = '"' . str_replace('"', '\"', $var2) . '"';
+ }
+
+ $con = "$var1 $opr $var2";
+ } elseif ($con[0] !== '$' && strpos($con, '(') === false) {
+ $con = call_user_func(array('kleeja_style', '_var_callback'), (!empty($condition) ? '{' . $con . '}' : '{{' . $con . '}}'));
+ }
+
+ return str_replace('[----this-vars----]', '$this->vars', $con);
+ }
+
/**
* make variable printable
diff --git a/lang/ar/acp.php b/lang/ar/acp.php
index 0e30ae2..47d81df 100755
--- a/lang/ar/acp.php
+++ b/lang/ar/acp.php
@@ -277,4 +277,5 @@ return array(
'KLJ_VER_NO_PLUGIN' => 'هذه الإضافة يمكنها العمل على إصدار كليجا %1$s حتى إصدار %2$s.',
'VERSION' => 'الإصدار',
'DEVELOPER' => 'المطور',
+ 'ALL_PLUGINS_UPDATED' => 'لا يوجد إضافات تحتاج تحديث حالياً ... ',
);
diff --git a/lang/en/acp.php b/lang/en/acp.php
index f33abe2..801a2ee 100755
--- a/lang/en/acp.php
+++ b/lang/en/acp.php
@@ -280,4 +280,5 @@ return array(
'KLJ_VER_NO_PLUGIN' => 'This plugin can works on Kleeja version %1$s up to version %2$s.',
'VERSION' => 'Version',
'DEVELOPER' => 'Developer',
+ 'ALL_PLUGINS_UPDATED' => 'There are no plugins that require an update currently...',
);