Housekeeping: offene Dev-Dateien eingecheckt + Sidebar „Bestellungen"→„Versand"
- 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>
This commit is contained in:
parent
c7ddf7906e
commit
0f641ef33a
154 changed files with 23131 additions and 8 deletions
|
|
@ -0,0 +1,91 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue