Subversion Repositories oidplus

Compare Revisions

Ignore whitespace Rev 1126 → Rev 1127

/trunk/dev/translation/message_regenerate.phps
3,7 → 3,7
 
/*
* OIDplus 2.0
* Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
* Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
50,9 → 50,13
$all_strings = array();
 
$it = new RecursiveDirectoryIterator($dir);
$it->setFlags(RecursiveDirectoryIterator::SKIP_DOTS); // DOES NOT WORK! Folders with . prefix still get evaluated!
foreach(new RecursiveIteratorIterator($it) as $file) {
if ((strpos(str_replace('\\','/',realpath($file)),'/vendor/') !== false) && (strpos(str_replace('\\','/',realpath($file)),'/vendor/danielmarschall/') === false)) continue; // ignore third-party-code
if (strpos(str_replace('\\','/',realpath($file)),'/dev/') !== false) continue; // ignore development utilities
 
if (preg_match('@[/\\\\]\\.[^\\.]@',$file,$m)) continue; // Alternative to SKIP_DOTS
 
if ($file->getExtension() == 'php') {
$cont = file_get_contents($file);
$cont = phpRemoveComments($cont);
/trunk/includes/classes/OIDplus.class.php
1149,14 → 1149,12
// Reason: The autoloader detects the classes inside plugins/*/*/*/*.class.php, but it cannot know
// which namespace these files have, because their folder names do not reveal the namespace.
// So it just ignores the namespace and loads all classes with the same name.
// There can be problems if two plugins have the same classname (but are in different namespaces, e.g.
// because they are made by different vendors). For example, two object types with the same PHP class name
// get mixed up getIcon()'s.
// TODO: Think about a solution; There was a discussion here https://github.com/frdl/frdl-oidplus-plugin-type-pen/issues/1
$tmp = explode('\\',$class_name);
$class_name_no_namespace = end($tmp);
if (in_array($class_name_no_namespace, $known_main_classes_no_namespace)) {
throw new OIDplusException(_L('More than one plugin has the PHP class name "%1". This is currently no supported, not even if they are in different namespaces.', $class_name_no_namespace));
// Removed check for now, since everything should work correctly
// throw new OIDplusException(_L('More than one plugin has the PHP class name "%1". This is currently no supported, not even if they are in different namespaces.', $class_name_no_namespace));
}
$known_main_classes_no_namespace[] = $class_name_no_namespace;
 
/trunk/includes/classes/OIDplusObject.class.php
463,14 → 463,15
$ra_email = $row['ra_email'];
}
 
$dirs = glob(OIDplus::localpath().'plugins/'.'*'.'/objectTypes/'.$namespace.'/');
// $dirs = glob(OIDplus::localpath().'plugins/'.'*'.'/objectTypes/'.$namespace.'/');
// if (count($dirs) == 0) return null; // default icon (folder)
// $dir = substr($dirs[0], strlen(OIDplus::localpath()));
$reflection = new \ReflectionClass($this);
$dir = dirname($reflection->getFilename());
$dir = substr($dir, strlen(OIDplus::localpath()));
 
if (count($dirs) == 0) return null; // default icon (folder)
 
$dir = substr($dirs[0], strlen(OIDplus::localpath()));
 
if ($this->isRoot()) {
$icon = $dir . '/' . $this::treeIconFilename('root'); // see also OIDplusPagePublicObjects::get_treeicon_root()
$icon = $dir . '/' . $this::treeIconFilename('root');
} else {
// We use $this:: instead of self:: , because we want to call the overridden methods
if ($ra_email && OIDplus::authUtils()->isRaLoggedIn($ra_email)) {
/trunk/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php
30,20 → 30,9
* @return string|null
*/
private function get_treeicon_root($ot)/*: ?string*/ {
$dirs = glob(OIDplus::localpath().'plugins/'.'*'.'/objectTypes/'.$ot::ns());
 
if (count($dirs) == 0) {
$icon = null;
} else {
$dir = $dirs[0];
$icon_name = $ot::treeIconFilename('root'); // see also OIDplusObject::getIcon()
if (!$icon_name) return null;
$icon = $dir.'/'.$icon_name;
if (!file_exists($icon)) return null;
$icon = substr($icon, strlen(OIDplus::localpath()));
}
 
return $icon;
$root = $ot::parse($ot::root());
if (!$root) return null;
return $root->getIcon();
}
 
/**