<?php
/**
* @file include/plugin.php
- *
+ *
* @brief Some functions to handle addons and themes.
*/
+use Friendica\App;
/**
* @brief uninstalls an addon.
$parr = explode(',',$plugins);
if (count($parr)) {
- foreach($parr as $pl) {
+ foreach ($parr as $pl) {
$pl = trim($pl);
if (file_exists($fname)) {
$t = @filemtime($fname);
- foreach($installed as $i) {
+ foreach ($installed as $i) {
if (($i['name'] == $pl) && ($i['timestamp'] != $t)) {
logger('Reloading plugin: ' . $i['name']);
@include_once($fname);
/**
* @brief unregisters a hook.
- *
+ *
* @param string $hook the name of the hook
* @param string $file the name of the file that hooks into
* @param string $function the name of the function that the hook called
$a = get_app();
if (is_array($a->hooks) && (array_key_exists('app_menu',$a->hooks))) {
- foreach($a->hooks['app_menu'] as $hook) {
+ foreach ($a->hooks['app_menu'] as $hook) {
if ($hook[0] == 'addon/'.$name.'/'.$name.'.php')
return true;
}
if ($r){
$ll = explode("\n", $m[0]);
- foreach( $ll as $l ) {
+ foreach ( $ll as $l ) {
$l = trim($l,"\t\n\r */");
if ($l!=""){
list($k,$v) = array_map("trim", explode(":",$l,2));
/**
* @brief Parse theme comment in search of theme infos.
- *
+ *
* like
* \code
* ..* Name: My Theme
if ($r){
$ll = explode("\n", $m[0]);
- foreach( $ll as $l ) {
+ foreach ( $ll as $l ) {
$l = trim($l,"\t\n\r */");
if ($l!=""){
list($k,$v) = array_map("trim", explode(":",$l,2));
*/
function get_theme_screenshot($theme) {
$exts = array('.png','.jpg');
- foreach($exts as $ext) {
+ foreach ($exts as $ext) {
if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
}
/**
* @brief Get the full path to relevant theme files by filename
- *
+ *
* This function search in the theme directory (and if not present in global theme directory)
* if there is a directory with the file extension and for a file with the given
- * filename.
- *
+ * filename.
+ *
* @param string $file Filename
* @param string $root Full root path
* @return string Path to the file or empty string if the file isn't found
$root = $root . '/';
}
$theme_info = $a->theme_info;
- if (is_array($theme_info) AND array_key_exists('extends',$theme_info)) {
+ if (is_array($theme_info) && array_key_exists('extends',$theme_info)) {
$parent = $theme_info['extends'];
} else {
$parent = 'NOPATH';
"{$root}view/theme/$parent/$ext/$file",
"{$root}view/$ext/$file",
);
- foreach($paths as $p) {
+ foreach ($paths as $p) {
// strpos() is faster than strstr when checking if one string is in another (http://php.net/manual/en/function.strstr.php)
if (strpos($p,'NOPATH') !== false) {
continue;