mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-05 04:37:51 +02:00
Themes Plugin: fix all get files methods. Return empty array if folders doesnt exists.
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
$styles = Themes::getStyles();
|
$styles = Themes::getStyles();
|
||||||
$scripts = Themes::getScripts();
|
$scripts = Themes::getScripts();
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
$chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
|
$chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
|
||||||
$template_path = THEMES_SITE . DS . $current_site_theme . DS;
|
$template_path = THEMES_SITE . DS . $current_site_theme . DS;
|
||||||
$style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
|
$style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
|
||||||
@@ -477,7 +476,7 @@
|
|||||||
// Delete script
|
// Delete script
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
case "delete_script":
|
case "delete_script":
|
||||||
File::delete($style_path.Request::get('filename').'.js');
|
File::delete($script_path.Request::get('filename').'.js');
|
||||||
Notification::set('success', __('Script <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
Notification::set('success', __('Script <i>:name</i> deleted', 'themes', array(':name' => File::name(Request::get('filename')))));
|
||||||
Request::redirect('index.php?id=themes');
|
Request::redirect('index.php?id=themes');
|
||||||
break;
|
break;
|
||||||
|
@@ -74,7 +74,7 @@
|
|||||||
* Get Templates
|
* Get Templates
|
||||||
*
|
*
|
||||||
* @param string $theme Theme name
|
* @param string $theme Theme name
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getTemplates($theme = null) {
|
public static function getTemplates($theme = null) {
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
// Get all templates in current theme folder
|
// Get all templates in current theme folder
|
||||||
$templates = File::scan(THEMES_SITE . DS . $theme, '.template.php');
|
$templates = File::scan(THEMES_SITE . DS . $theme, '.template.php');
|
||||||
|
|
||||||
return $templates;
|
return ($templates) ? $templates : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
* Get Chunks
|
* Get Chunks
|
||||||
*
|
*
|
||||||
* @param string $theme Theme name
|
* @param string $theme Theme name
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getChunks($theme = null) {
|
public static function getChunks($theme = null) {
|
||||||
|
|
||||||
@@ -108,14 +108,14 @@
|
|||||||
// Get all templates in current theme folder
|
// Get all templates in current theme folder
|
||||||
$chunks = File::scan(THEMES_SITE . DS . $theme, '.chunk.php');
|
$chunks = File::scan(THEMES_SITE . DS . $theme, '.chunk.php');
|
||||||
|
|
||||||
return $chunks;
|
return ($chunks) ? $chunks : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Styles
|
* Get Styles
|
||||||
*
|
*
|
||||||
* @param string $theme Theme name
|
* @param string $theme Theme name
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getStyles($theme = null) {
|
public static function getStyles($theme = null) {
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
// Get all templates in current theme folder
|
// Get all templates in current theme folder
|
||||||
$styles = File::scan(THEMES_SITE . DS . $theme . DS . 'css', '.css');
|
$styles = File::scan(THEMES_SITE . DS . $theme . DS . 'css', '.css');
|
||||||
|
|
||||||
return $styles;
|
return ($styles) ? $styles : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
* Get Scripts
|
* Get Scripts
|
||||||
*
|
*
|
||||||
* @param string $theme Theme name
|
* @param string $theme Theme name
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getScripts($theme = null) {
|
public static function getScripts($theme = null) {
|
||||||
|
|
||||||
@@ -147,9 +147,9 @@
|
|||||||
$scripts = array();
|
$scripts = array();
|
||||||
|
|
||||||
// Get all templates in current theme folder
|
// Get all templates in current theme folder
|
||||||
$scripts = File::scan(THEMES_SITE . DS . $theme . DS . 'js', '.js');
|
$scripts = File::scan(THEMES_SITE . DS . $theme . DS . 'js' . DS , '.js');
|
||||||
|
|
||||||
return $scripts;
|
return ($scripts) ? $scripts : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user