Changeset 3260922
- Timestamp:
- 03/24/2025 03:30:42 PM (12 months ago)
- Location:
- permalink-history/trunk
- Files:
-
- 2 added
- 10 edited
- 1 copied
-
Plugin.php (modified) (1 diff)
-
classes/HistoryItem.php (modified) (2 diffs)
-
classes/MetaBox.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/ClassLoader.php (modified) (26 diffs)
-
vendor/composer/InstalledVersions.php (added)
-
vendor/composer/autoload_classmap.php (modified) (1 diff)
-
vendor/composer/autoload_namespaces.php (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (1 diff)
-
vendor/composer/installed.json (added)
-
vendor/composer/installed.php (copied) (copied from permalink-history/trunk/vendor/composer/installed.php) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
permalink-history/trunk/Plugin.php
r3246273 r3260922 3 3 * Plugin Name: Permalink History 4 4 * Description: Saves a history of posts permalinks 5 * Version: 1.3. 15 * Version: 1.3.2 6 6 * Author: PALASTHOTEL (by Edward Bock, Lucas Regalar) 7 7 * Author URI: https://palasthotel.de -
permalink-history/trunk/classes/HistoryItem.php
r2147533 r3260922 1 1 <?php 2 /**3 * Created by PhpStorm.4 * User: edward5 * Date: 2019-04-106 * Time: 18:027 */8 2 9 3 namespace Palasthotel\PermalinkHistory; 10 4 11 12 /**13 * @property int|null id14 * @property int content_id15 * @property string content_type16 * @property string permalink17 */18 5 class HistoryItem { 19 6 20 /** 21 * HistoryItem constructor. 22 * 23 * @param int $content_id 24 * @param string $content_type 25 * @param string $permalink 26 * @param int|null $id 27 */ 28 private function __construct($content_id, $content_type, $permalink, $id) { 29 $this->id = $id; 30 $this->content_id = $content_id; 31 $this->content_type = $content_type; 32 $this->permalink = $permalink; 7 private function __construct(public int $content_id, public string $content_type, public string $permalink, public ?int $id = null) { 33 8 } 34 9 35 /** 36 * @param int $content_id 37 * @param string $content_type 38 * @param string $permalink 39 * @param int|null $id 40 * 41 * @return HistoryItem 42 */ 43 public static function build($content_id, $content_type, $permalink, $id = null){ 10 public static function build(int $content_id, string $content_type, string $permalink, ?int $id = null){ 44 11 return new HistoryItem($content_id, $content_type, $permalink, $id); 45 12 } … … 48 15 * @param object|null $resultObject 49 16 * 50 * @return HistoryItem51 17 */ 52 18 public static function parse($resultObject){ -
permalink-history/trunk/classes/MetaBox.php
r3246273 r3260922 30 30 public function render(){ 31 31 $permalink = $this->plugin->post->getEscapedPermalink(get_the_ID()); 32 $history = array_filter($this->plugin->database->getHistoryFor(get_the_ID(), get_post_type()), function($item) use ($permalink){32 $history = array_filter($this->plugin->database->getHistoryFor(get_the_ID(), Database::CONTENT_TYPE_POST), function($item) use ($permalink){ 33 33 return $item->permalink !== $permalink; 34 34 }); 35 35 36 if(count($history)){ 36 37 echo "<ul>"; -
permalink-history/trunk/readme.txt
r3246273 r3260922 5 5 Requires at least: 5.0 6 6 Tested up to: 6.7.2 7 Stable tag: 1.3. 17 Stable tag: 1.3.2 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl … … 42 42 == Changelog == 43 43 44 = 1.3.2 = 45 * Fix: meta box for all other post types than post itself 46 44 47 = 1.3.1 = 45 48 * Php 8.2 compatibility warning fix -
permalink-history/trunk/vendor/autoload.php
r3246273 r3260922 3 3 // autoload.php @generated by Composer 4 4 5 if (PHP_VERSION_ID < 50600) { 6 if (!headers_sent()) { 7 header('HTTP/1.1 500 Internal Server Error'); 8 } 9 $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; 10 if (!ini_get('display_errors')) { 11 if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { 12 fwrite(STDERR, $err); 13 } elseif (!headers_sent()) { 14 echo $err; 15 } 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 21 } 22 5 23 require_once __DIR__ . '/composer/autoload_real.php'; 6 24 -
permalink-history/trunk/vendor/composer/ClassLoader.php
r3246273 r3260922 43 43 class ClassLoader 44 44 { 45 /** @var \Closure(string):void */ 46 private static $includeFile; 47 48 /** @var string|null */ 45 49 private $vendorDir; 46 50 47 51 // PSR-4 52 /** 53 * @var array<string, array<string, int>> 54 */ 48 55 private $prefixLengthsPsr4 = array(); 56 /** 57 * @var array<string, list<string>> 58 */ 49 59 private $prefixDirsPsr4 = array(); 60 /** 61 * @var list<string> 62 */ 50 63 private $fallbackDirsPsr4 = array(); 51 64 52 65 // PSR-0 66 /** 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 72 */ 53 73 private $prefixesPsr0 = array(); 74 /** 75 * @var list<string> 76 */ 54 77 private $fallbackDirsPsr0 = array(); 55 78 79 /** @var bool */ 56 80 private $useIncludePath = false; 81 82 /** 83 * @var array<string, string> 84 */ 57 85 private $classMap = array(); 86 87 /** @var bool */ 58 88 private $classMapAuthoritative = false; 89 90 /** 91 * @var array<string, bool> 92 */ 59 93 private $missingClasses = array(); 94 95 /** @var string|null */ 60 96 private $apcuPrefix; 61 97 98 /** 99 * @var array<string, self> 100 */ 62 101 private static $registeredLoaders = array(); 63 102 103 /** 104 * @param string|null $vendorDir 105 */ 64 106 public function __construct($vendorDir = null) 65 107 { 66 108 $this->vendorDir = $vendorDir; 67 } 68 109 self::initializeIncludeClosure(); 110 } 111 112 /** 113 * @return array<string, list<string>> 114 */ 69 115 public function getPrefixes() 70 116 { … … 76 122 } 77 123 124 /** 125 * @return array<string, list<string>> 126 */ 78 127 public function getPrefixesPsr4() 79 128 { … … 81 130 } 82 131 132 /** 133 * @return list<string> 134 */ 83 135 public function getFallbackDirs() 84 136 { … … 86 138 } 87 139 140 /** 141 * @return list<string> 142 */ 88 143 public function getFallbackDirsPsr4() 89 144 { … … 91 146 } 92 147 148 /** 149 * @return array<string, string> Array of classname => path 150 */ 93 151 public function getClassMap() 94 152 { … … 97 155 98 156 /** 99 * @param array $classMap Class to filename map 157 * @param array<string, string> $classMap Class to filename map 158 * 159 * @return void 100 160 */ 101 161 public function addClassMap(array $classMap) … … 112 172 * appending or prepending to the ones previously set for this prefix. 113 173 * 114 * @param string $prefix The prefix 115 * @param array|string $paths The PSR-0 root directories 116 * @param bool $prepend Whether to prepend the directories 174 * @param string $prefix The prefix 175 * @param list<string>|string $paths The PSR-0 root directories 176 * @param bool $prepend Whether to prepend the directories 177 * 178 * @return void 117 179 */ 118 180 public function add($prefix, $paths, $prepend = false) 119 181 { 182 $paths = (array) $paths; 120 183 if (!$prefix) { 121 184 if ($prepend) { 122 185 $this->fallbackDirsPsr0 = array_merge( 123 (array)$paths,186 $paths, 124 187 $this->fallbackDirsPsr0 125 188 ); … … 127 190 $this->fallbackDirsPsr0 = array_merge( 128 191 $this->fallbackDirsPsr0, 129 (array)$paths192 $paths 130 193 ); 131 194 } … … 136 199 $first = $prefix[0]; 137 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 138 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 139 202 140 203 return; … … 142 205 if ($prepend) { 143 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 144 (array)$paths,207 $paths, 145 208 $this->prefixesPsr0[$first][$prefix] 146 209 ); … … 148 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 149 212 $this->prefixesPsr0[$first][$prefix], 150 (array)$paths213 $paths 151 214 ); 152 215 } … … 157 220 * appending or prepending to the ones previously set for this namespace. 158 221 * 159 * @param string $prefix The prefix/namespace, with trailing '\\'160 * @param array|string $paths The PSR-4 base directories161 * @param bool $prepend Whether to prepend the directories222 * @param string $prefix The prefix/namespace, with trailing '\\' 223 * @param list<string>|string $paths The PSR-4 base directories 224 * @param bool $prepend Whether to prepend the directories 162 225 * 163 226 * @throws \InvalidArgumentException 227 * 228 * @return void 164 229 */ 165 230 public function addPsr4($prefix, $paths, $prepend = false) 166 231 { 232 $paths = (array) $paths; 167 233 if (!$prefix) { 168 234 // Register directories for the root namespace. 169 235 if ($prepend) { 170 236 $this->fallbackDirsPsr4 = array_merge( 171 (array)$paths,237 $paths, 172 238 $this->fallbackDirsPsr4 173 239 ); … … 175 241 $this->fallbackDirsPsr4 = array_merge( 176 242 $this->fallbackDirsPsr4, 177 (array)$paths243 $paths 178 244 ); 179 245 } … … 185 251 } 186 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 187 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 188 254 } elseif ($prepend) { 189 255 // Prepend directories for an already registered namespace. 190 256 $this->prefixDirsPsr4[$prefix] = array_merge( 191 (array)$paths,257 $paths, 192 258 $this->prefixDirsPsr4[$prefix] 193 259 ); … … 196 262 $this->prefixDirsPsr4[$prefix] = array_merge( 197 263 $this->prefixDirsPsr4[$prefix], 198 (array)$paths264 $paths 199 265 ); 200 266 } … … 205 271 * replacing any others previously set for this prefix. 206 272 * 207 * @param string $prefix The prefix 208 * @param array|string $paths The PSR-0 base directories 273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 275 * 276 * @return void 209 277 */ 210 278 public function set($prefix, $paths) … … 221 289 * replacing any others previously set for this namespace. 222 290 * 223 * @param string $prefix The prefix/namespace, with trailing '\\'224 * @param array|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 225 293 * 226 294 * @throws \InvalidArgumentException 295 * 296 * @return void 227 297 */ 228 298 public function setPsr4($prefix, $paths) … … 244 314 * 245 315 * @param bool $useIncludePath 316 * 317 * @return void 246 318 */ 247 319 public function setUseIncludePath($useIncludePath) … … 266 338 * 267 339 * @param bool $classMapAuthoritative 340 * 341 * @return void 268 342 */ 269 343 public function setClassMapAuthoritative($classMapAuthoritative) … … 286 360 * 287 361 * @param string|null $apcuPrefix 362 * 363 * @return void 288 364 */ 289 365 public function setApcuPrefix($apcuPrefix) … … 306 382 * 307 383 * @param bool $prepend Whether to prepend the autoloader or not 384 * 385 * @return void 308 386 */ 309 387 public function register($prepend = false) … … 325 403 /** 326 404 * Unregisters this instance as an autoloader. 405 * 406 * @return void 327 407 */ 328 408 public function unregister() … … 344 424 { 345 425 if ($file = $this->findFile($class)) { 346 includeFile($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 347 428 348 429 return true; … … 395 476 396 477 /** 397 * Returns the currently registered loaders indexed by their corresponding vendor directories.398 * 399 * @return self[]478 * Returns the currently registered loaders keyed by their corresponding vendor directories. 479 * 480 * @return array<string, self> 400 481 */ 401 482 public static function getRegisteredLoaders() … … 404 485 } 405 486 487 /** 488 * @param string $class 489 * @param string $ext 490 * @return string|false 491 */ 406 492 private function findFileWithExtension($class, $ext) 407 493 { … … 469 555 return false; 470 556 } 557 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 562 { 563 if (self::$includeFile !== null) { 564 return; 565 } 566 567 /** 568 * Scope isolated include. 569 * 570 * Prevents access to $this/self from included files. 571 * 572 * @param string $file 573 * @return void 574 */ 575 self::$includeFile = \Closure::bind(static function($file) { 576 include $file; 577 }, null, null); 578 } 471 579 } 472 473 /**474 * Scope isolated include.475 *476 * Prevents access to $this/self from included files.477 */478 function includeFile($file)479 {480 include $file;481 } -
permalink-history/trunk/vendor/composer/autoload_classmap.php
r3246273 r3260922 3 3 // autoload_classmap.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
permalink-history/trunk/vendor/composer/autoload_namespaces.php
r3246273 r3260922 3 3 // autoload_namespaces.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
permalink-history/trunk/vendor/composer/autoload_psr4.php
r3246273 r3260922 3 3 // autoload_psr4.php @generated by Composer 4 4 5 $vendorDir = dirname( dirname(__FILE__));5 $vendorDir = dirname(__DIR__); 6 6 $baseDir = dirname($vendorDir); 7 7 -
permalink-history/trunk/vendor/composer/autoload_real.php
r3246273 r3260922 24 24 25 25 spl_autoload_register(array('ComposerAutoloaderInit3d3f8d1991bb14c91265db0ad36c78b3', 'loadClassLoader'), true, true); 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname( \dirname(__FILE__)));26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 27 spl_autoload_unregister(array('ComposerAutoloaderInit3d3f8d1991bb14c91265db0ad36c78b3', 'loadClassLoader')); 28 28 29 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 30 if ($useStaticLoader) { 31 require __DIR__ . '/autoload_static.php'; 32 33 call_user_func(\Composer\Autoload\ComposerStaticInit3d3f8d1991bb14c91265db0ad36c78b3::getInitializer($loader)); 34 } else { 35 $map = require __DIR__ . '/autoload_namespaces.php'; 36 foreach ($map as $namespace => $path) { 37 $loader->set($namespace, $path); 38 } 39 40 $map = require __DIR__ . '/autoload_psr4.php'; 41 foreach ($map as $namespace => $path) { 42 $loader->setPsr4($namespace, $path); 43 } 44 45 $classMap = require __DIR__ . '/autoload_classmap.php'; 46 if ($classMap) { 47 $loader->addClassMap($classMap); 48 } 49 } 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit3d3f8d1991bb14c91265db0ad36c78b3::getInitializer($loader)); 50 31 51 32 $loader->register(true); -
permalink-history/trunk/vendor/composer/installed.php
r3006602 r3260922 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 7206d39a95fb6d6edf59150455596d8190de614c',6 'reference' => '566e0573e62ccaaa967a4a1f5cf3125ced3926cb', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 7206d39a95fb6d6edf59150455596d8190de614c',16 'reference' => '566e0573e62ccaaa967a4a1f5cf3125ced3926cb', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.