- Sidebar-Menü „Bestellungen" in „Versand" umbenannt (layout-sidenav), sonst nur Blade-Formatierung. - Entwicklungspläne in ISO-Datumsformat umbenannt (entwicklungsplan-aktualisiert-*). - dev/dhl-for-woocommerce/ (DHL-Plugin) + dev/partnercenter-api.zip + PastedGraphic hinzugefügt. - .claude/ bewusst NICHT eingecheckt (lokale Claude-Code-Konfiguration). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
91 lines
2.2 KiB
PHP
91 lines
2.2 KiB
PHP
<?php
|
|
|
|
use PR_DHL\lib\PDFMerger\PDFMerger;
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
if (! class_exists('PR_DHL_Libraryloader')) {
|
|
|
|
class PR_DHL_Libraryloader
|
|
{
|
|
const CLASS_PDF_MERGER = 'pdf_merger';
|
|
|
|
private static $instances = [];
|
|
|
|
protected $include_path = null;
|
|
|
|
protected $file_path = null;
|
|
|
|
protected $loaded = [];
|
|
|
|
/**
|
|
* Constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
// Set paths
|
|
$this->include_path = PR_DHL_PLUGIN_DIR_PATH.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR;
|
|
$this->file_path = $this->include_path.'PDFMerger'.DIRECTORY_SEPARATOR.'PDFMerger.php';
|
|
$this->file_path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $this->file_path);
|
|
}
|
|
|
|
/**
|
|
* Returns a singleton instance of the called class
|
|
*
|
|
* @return static
|
|
*/
|
|
public static function instance()
|
|
{
|
|
|
|
$class = get_called_class();
|
|
if (! isset(self::$instances[$class])) {
|
|
self::$instances[$class] = new static;
|
|
}
|
|
|
|
return self::$instances[$class];
|
|
|
|
}
|
|
|
|
public function get_pdf_merger()
|
|
{
|
|
if (! class_exists('PR_DHL\lib\PDFMerger\PDFMerger')) {
|
|
$loaded = $this->include_file($this->file_path);
|
|
|
|
if (! $loaded) {
|
|
return null;
|
|
}
|
|
$this->loaded[] = self::CLASS_PDF_MERGER;
|
|
}
|
|
|
|
// Something very unexpected happened, return
|
|
if (! class_exists('PR_DHL\lib\PDFMerger\PDFMerger')) {
|
|
return null;
|
|
}
|
|
|
|
return new PDFMerger;
|
|
}
|
|
|
|
/**
|
|
* Include a file if it exists.
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function include_file($path)
|
|
{
|
|
|
|
if (file_exists($path)) {
|
|
// Supress errors of third party libraries
|
|
$status = @include_once $path;
|
|
if ($status !== 1) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|