-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
234 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
FriendsOfRedaxo/addon/UsageCheck/Exception/InvalidParameterException.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
/** | ||
* Config-Datei | ||
* @author akrys | ||
*/ | ||
namespace FriendsOfRedaxo\UsageCheck; | ||
|
||
/** | ||
* Config-Klasse mit Konstanten für die Runtime | ||
* @author akrys | ||
*/ | ||
class Config | ||
{ | ||
/** | ||
* Technischer Name des Addons | ||
* @var string | ||
*/ | ||
const NAME = 'usage_check'; | ||
|
||
/** | ||
* (Absolutes) Basis Verzeichnis holen | ||
* @return string | ||
* @deprecated wird nicht mehr benötigt, sobald alte Klassen mit 'addon' im Namespace nicht mehr unterstützt werden | ||
* @codeCoverageIgnore | ||
*/ | ||
public static function getBaseDir() // remove in v4 | ||
{ | ||
return (string) realpath(__DIR__); | ||
} | ||
|
||
/** | ||
* Autoload Funktion | ||
* @param string $name | ||
* @return void | ||
* | ||
* @deprecated wird nicht mehr benötigt, sobald alte Klassen mit 'addon' im Namespace nicht mehr unterstützt werden | ||
* @codeCoverageIgnore | ||
*/ | ||
public static function autoload($name): void // remove in v4 | ||
{ | ||
if (stristr($name, 'FriendsOfRedaxo\\addon\\UsageCheck')) { | ||
$oldName = $name; | ||
$newName = str_replace('FriendsOfRedaxo\\addon\\UsageCheck', 'FriendsOfRedaxo\\UsageCheck', $name); | ||
|
||
$backtrace = debug_backtrace(); | ||
$backtraceText = ''; | ||
$i = 0; | ||
foreach ($backtrace as $key => $item) { | ||
if (isset($backtrace[$key]['file']) && isset($backtrace[$key]['line'])) { | ||
if (stristr($backtrace[$key]['file'], '/usage_check/')) { | ||
continue; | ||
} | ||
|
||
$backtraceText = ' in '.$backtrace[$key]['file'].': '.$backtrace[$key]['line']; | ||
break; | ||
} | ||
$i++; | ||
} | ||
|
||
$msg = "Deprecated class name found: ".$oldName.$backtraceText.PHP_EOL.'New class: '.$newName; | ||
|
||
class_alias($newName, $oldName); | ||
|
||
user_error($msg, E_USER_DEPRECATED); | ||
$name = $newName; | ||
} | ||
|
||
|
||
if (!stristr($name, __NAMESPACE__)) { | ||
return; // not a UsageCheck class | ||
} | ||
|
||
if (class_exists($name)) { | ||
return; | ||
} | ||
|
||
//namespace parts not in directory structure. | ||
$name = str_replace(__NAMESPACE__, '', $name); | ||
|
||
$filename = self::getBaseDir().'/'.str_replace('\\', '/', $name).'.php'; | ||
if (file_exists($filename)) { | ||
require $filename; | ||
return; | ||
} | ||
// throw new \Exception($filename.' not found'); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.