Remove notices

This commit is contained in:
champsupertramp
2016-03-30 10:00:41 +08:00
parent f7959b8499
commit 6eb0777e01
+21 -17
View File
@@ -416,33 +416,37 @@ class UM_Shortcodes {
$paths[] = glob(get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php');
}
foreach ($paths as $k => $files) {
if( isset( $paths ) && ! empty( $paths ) ){
foreach ($paths as $k => $files) {
foreach ($files as $file) {
foreach ($files as $file) {
$clean_filename = $this->get_template_name($file);
$clean_filename = $this->get_template_name($file);
if (0 === strpos($clean_filename, $excluded)) {
if (0 === strpos($clean_filename, $excluded)) {
$source = file_get_contents($file);
$tokens = token_get_all($source);
$comment = array(
T_COMMENT, // All comments since PHP5
T_DOC_COMMENT, // PHPDoc comments
);
foreach ($tokens as $token) {
if (in_array($token[0], $comment) && strstr($token[1], '/* Template:') && $clean_filename != $excluded) {
$txt = $token[1];
$txt = str_replace('/* Template: ', '', $txt);
$txt = str_replace(' */', '', $txt);
$array[$clean_filename] = $txt;
$source = file_get_contents($file);
$tokens = token_get_all($source);
$comment = array(
T_COMMENT, // All comments since PHP5
T_DOC_COMMENT, // PHPDoc comments
);
foreach ($tokens as $token) {
if (in_array($token[0], $comment) && strstr($token[1], '/* Template:') && $clean_filename != $excluded) {
$txt = $token[1];
$txt = str_replace('/* Template: ', '', $txt);
$txt = str_replace(' */', '', $txt);
$array[$clean_filename] = $txt;
}
}
}
}
}
}
return $array;