Plugin Directory

Changeset 3010366


Ignore:
Timestamp:
12/15/2023 06:56:27 AM (2 years ago)
Author:
EdwardBock
Message:

release 1.0.1

Location:
future-monitor
Files:
6 added
2 deleted
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • future-monitor/tags/1.0.1/Plugin.php

    r2303898 r3010366  
    44 * Plugin URI: https://github.com/palasthotel/future-monitor
    55 * Description: Monitors the future of your system. For example planned posts...
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Palasthotel by Edward Bock <edward.bock@palasthotel.de>
    88 * Author URI: https://palasthotel.de
     
    1010 * Domain Path: /languages
    1111 * Requires at least: 4.0
    12  * Tested up to: 5.3.2
     12 * Tested up to: 6.4.2
    1313 * License: http://www.gnu.org/licenses/gpl-3.0.html GPLv3
    1414 *
     
    1919namespace Palasthotel\FutureMonitor;
    2020
     21require_once dirname(__FILE__) . "/vendor/autoload.php";
    2122
    22 /**
    23  * @property string url
    24  * @property string path
    25  * @property string basename
    26  * @property DashboardWidget dashboardWidget
    27  * @property Store store
    28  * @property Schedule schedule
    29  */
    30 class Plugin {
     23class Plugin extends Components\Plugin {
    3124
    3225    const DOMAIN = "future-monitor";
    3326    const SCHEDULE_ACTION = "future_monitor_publish_future_posts";
     27    public Store $store;
     28    public Schedule $schedule;
     29    public DashboardWidget $dashboardWidget;
    3430
    35     public function __construct() {
    36 
    37         load_plugin_textdomain(
    38             Plugin::DOMAIN,
    39             false,
    40             dirname( plugin_basename( __FILE__ ) ) . '/languages'
    41         );
    42 
    43         $this->url      = plugin_dir_url( __FILE__ );
    44         $this->path     = plugin_dir_path( __FILE__ );
    45         $this->basename = plugin_basename( __FILE__ );
    46 
    47         require_once dirname(__FILE__)."/vendor/autoload.php";
     31    public function onCreate(): void {
     32        $this->loadTextdomain(Plugin::DOMAIN, "languages");
    4833
    4934        $this->store = new Store();
     
    5136        $this->dashboardWidget = new DashboardWidget($this);
    5237
    53         /**
    54          * on activate or deactivate plugin
    55          */
    56         register_activation_hook( __FILE__, array( $this, "activation" ) );
    57         register_deactivation_hook( __FILE__, array( $this, "deactivation" ) );
    5838    }
    5939
    60     public function activation(){
     40    public function onSiteActivation(): void {
     41        parent::onSiteActivation();
    6142        $this->schedule->start();
    6243    }
    6344
    64     public function deactivation(){
     45    public function onSiteDeactivation(): void {
     46        parent::onSiteDeactivation();
    6547        $this->schedule->stop();
    6648    }
  • future-monitor/tags/1.0.1/classes/Schedule.php

    r2303898 r3010366  
    55
    66
    7 /**
    8  * @property Plugin plugin
    9  */
    10 class Schedule {
     7use Palasthotel\FutureMonitor\Components\Component;
    118
    12     /**
    13      * Schedule constructor.
    14      *
    15      * @param Plugin $plugin
    16      */
    17     public function __construct($plugin) {
    18         $this->plugin = $plugin;
     9class Schedule extends Component {
     10    public function onCreate(): void {
    1911        add_action( 'admin_init', array( $this, 'start' ) );
    2012        add_action( Plugin::SCHEDULE_ACTION, array($this,'execute'));
    2113    }
    2214
    23     /**
    24      * @return false|int
    25      */
    26     public function isScheduled() {
     15    public function isScheduled(): bool|int {
    2716        return wp_next_scheduled( Plugin::SCHEDULE_ACTION );
    2817    }
    2918
    30     public function start(){
     19    public function start(): void {
    3120        if(!$this->isScheduled()){
    3221            wp_schedule_event( time(), 'hourly', Plugin::SCHEDULE_ACTION );
     
    3423    }
    3524
    36     public function stop(){
     25    public function stop(): void {
    3726        wp_clear_scheduled_hook(Plugin::SCHEDULE_ACTION);
    3827    }
    3928
    40     public function execute(){
     29    public function execute(): void {
    4130        $posts = $this->plugin->store->getPublishablePostIds();
    4231        foreach ($posts as $post_id){
  • future-monitor/tags/1.0.1/classes/Store.php

    r2303898 r3010366  
    55
    66
     7use WP_Post;
     8
    79class Store {
    810
    9     private $post_ids;
     11    private ?array $post_ids = null;
    1012
    1113    /**
    12      * @return array
     14     * @return int[]
    1315     */
    14     public function getScheduledPostIdsFromOptions() {
     16    public function getScheduledPostIdsFromOptions(): array {
    1517
    1618        if ( $this->post_ids == NULL ) {
     
    3739
    3840    /**
    39      * @return \WP_Post[]
     41     * @return WP_Post[]
    4042     */
    41     public function getFuturePostIds() {
     43    public function getFuturePostIds(): array {
    4244        return get_posts( array(
    4345            'fields'         => 'ids',
     
    5153
    5254    /**
    53      * @return \WP_Post[]
     55     * @return WP_Post[]
    5456     */
    55     public function getPublishablePostIds() {
     57    public function getPublishablePostIds(): array {
    5658        return get_posts( array(
    5759            'fields'         => 'ids',
  • future-monitor/tags/1.0.1/readme.txt

    r2303898 r3010366  
    44Tags: dashboard, widget, planned posts, schedule visualization
    55Requires at least: 4.0
    6 Tested up to: 5.3.2
    7 Requires PHP: 7.3
    8 Stable tag: 1.0.0
     6Tested up to: 6.4.2
     7Requires PHP: 8.0
     8Stable tag: 1.0.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030== Changelog ==
    3131
     32= 1.0.1 =
     33* PHP 8.2 update
     34
    3235= 1.0 =
    3336* First release
  • future-monitor/tags/1.0.1/vendor/autoload.php

    r2303898 r3010366  
    33// autoload.php @generated by Composer
    44
     5if (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
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
  • future-monitor/tags/1.0.1/vendor/composer/ClassLoader.php

    r2303898 r3010366  
    3838 * @author Fabien Potencier <fabien@symfony.com>
    3939 * @author Jordi Boggiano <j.boggiano@seld.be>
    40  * @see    http://www.php-fig.org/psr/psr-0/
    41  * @see    http://www.php-fig.org/psr/psr-4/
     40 * @see    https://www.php-fig.org/psr/psr-0/
     41 * @see    https://www.php-fig.org/psr/psr-4/
    4242 */
    4343class ClassLoader
    4444{
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
     49    private $vendorDir;
     50
    4551    // PSR-4
     52    /**
     53     * @var array<string, array<string, int>>
     54     */
    4655    private $prefixLengthsPsr4 = array();
     56    /**
     57     * @var array<string, list<string>>
     58     */
    4759    private $prefixDirsPsr4 = array();
     60    /**
     61     * @var list<string>
     62     */
    4863    private $fallbackDirsPsr4 = array();
    4964
    5065    // 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     */
    5173    private $prefixesPsr0 = array();
     74    /**
     75     * @var list<string>
     76     */
    5277    private $fallbackDirsPsr0 = array();
    5378
     79    /** @var bool */
    5480    private $useIncludePath = false;
     81
     82    /**
     83     * @var array<string, string>
     84     */
    5585    private $classMap = array();
     86
     87    /** @var bool */
    5688    private $classMapAuthoritative = false;
     89
     90    /**
     91     * @var array<string, bool>
     92     */
    5793    private $missingClasses = array();
     94
     95    /** @var string|null */
    5896    private $apcuPrefix;
    5997
     98    /**
     99     * @var array<string, self>
     100     */
     101    private static $registeredLoaders = array();
     102
     103    /**
     104     * @param string|null $vendorDir
     105     */
     106    public function __construct($vendorDir = null)
     107    {
     108        $this->vendorDir = $vendorDir;
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
     114     */
    60115    public function getPrefixes()
    61116    {
    62117        if (!empty($this->prefixesPsr0)) {
    63             return call_user_func_array('array_merge', $this->prefixesPsr0);
     118            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
    64119        }
    65120
     
    67122    }
    68123
     124    /**
     125     * @return array<string, list<string>>
     126     */
    69127    public function getPrefixesPsr4()
    70128    {
     
    72130    }
    73131
     132    /**
     133     * @return list<string>
     134     */
    74135    public function getFallbackDirs()
    75136    {
     
    77138    }
    78139
     140    /**
     141     * @return list<string>
     142     */
    79143    public function getFallbackDirsPsr4()
    80144    {
     
    82146    }
    83147
     148    /**
     149     * @return array<string, string> Array of classname => path
     150     */
    84151    public function getClassMap()
    85152    {
     
    88155
    89156    /**
    90      * @param array $classMap Class to filename map
     157     * @param array<string, string> $classMap Class to filename map
     158     *
     159     * @return void
    91160     */
    92161    public function addClassMap(array $classMap)
     
    103172     * appending or prepending to the ones previously set for this prefix.
    104173     *
    105      * @param string       $prefix  The prefix
    106      * @param array|string $paths   The PSR-0 root directories
    107      * @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
    108179     */
    109180    public function add($prefix, $paths, $prepend = false)
    110181    {
     182        $paths = (array) $paths;
    111183        if (!$prefix) {
    112184            if ($prepend) {
    113185                $this->fallbackDirsPsr0 = array_merge(
    114                     (array) $paths,
     186                    $paths,
    115187                    $this->fallbackDirsPsr0
    116188                );
     
    118190                $this->fallbackDirsPsr0 = array_merge(
    119191                    $this->fallbackDirsPsr0,
    120                     (array) $paths
     192                    $paths
    121193                );
    122194            }
     
    127199        $first = $prefix[0];
    128200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    129             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    130202
    131203            return;
     
    133205        if ($prepend) {
    134206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    135                 (array) $paths,
     207                $paths,
    136208                $this->prefixesPsr0[$first][$prefix]
    137209            );
     
    139211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    140212                $this->prefixesPsr0[$first][$prefix],
    141                 (array) $paths
     213                $paths
    142214            );
    143215        }
     
    148220     * appending or prepending to the ones previously set for this namespace.
    149221     *
    150      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    151      * @param array|string $paths   The PSR-4 base directories
    152      * @param bool         $prepend Whether to prepend the directories
     222     * @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
    153225     *
    154226     * @throws \InvalidArgumentException
     227     *
     228     * @return void
    155229     */
    156230    public function addPsr4($prefix, $paths, $prepend = false)
    157231    {
     232        $paths = (array) $paths;
    158233        if (!$prefix) {
    159234            // Register directories for the root namespace.
    160235            if ($prepend) {
    161236                $this->fallbackDirsPsr4 = array_merge(
    162                     (array) $paths,
     237                    $paths,
    163238                    $this->fallbackDirsPsr4
    164239                );
     
    166241                $this->fallbackDirsPsr4 = array_merge(
    167242                    $this->fallbackDirsPsr4,
    168                     (array) $paths
     243                    $paths
    169244                );
    170245            }
     
    176251            }
    177252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    178             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    179254        } elseif ($prepend) {
    180255            // Prepend directories for an already registered namespace.
    181256            $this->prefixDirsPsr4[$prefix] = array_merge(
    182                 (array) $paths,
     257                $paths,
    183258                $this->prefixDirsPsr4[$prefix]
    184259            );
     
    187262            $this->prefixDirsPsr4[$prefix] = array_merge(
    188263                $this->prefixDirsPsr4[$prefix],
    189                 (array) $paths
     264                $paths
    190265            );
    191266        }
     
    196271     * replacing any others previously set for this prefix.
    197272     *
    198      * @param string       $prefix The prefix
    199      * @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
    200277     */
    201278    public function set($prefix, $paths)
     
    212289     * replacing any others previously set for this namespace.
    213290     *
    214      * @param string       $prefix The prefix/namespace, with trailing '\\'
    215      * @param array|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    216293     *
    217294     * @throws \InvalidArgumentException
     295     *
     296     * @return void
    218297     */
    219298    public function setPsr4($prefix, $paths)
     
    235314     *
    236315     * @param bool $useIncludePath
     316     *
     317     * @return void
    237318     */
    238319    public function setUseIncludePath($useIncludePath)
     
    257338     *
    258339     * @param bool $classMapAuthoritative
     340     *
     341     * @return void
    259342     */
    260343    public function setClassMapAuthoritative($classMapAuthoritative)
     
    277360     *
    278361     * @param string|null $apcuPrefix
     362     *
     363     * @return void
    279364     */
    280365    public function setApcuPrefix($apcuPrefix)
     
    297382     *
    298383     * @param bool $prepend Whether to prepend the autoloader or not
     384     *
     385     * @return void
    299386     */
    300387    public function register($prepend = false)
    301388    {
    302389        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
     390
     391        if (null === $this->vendorDir) {
     392            return;
     393        }
     394
     395        if ($prepend) {
     396            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
     397        } else {
     398            unset(self::$registeredLoaders[$this->vendorDir]);
     399            self::$registeredLoaders[$this->vendorDir] = $this;
     400        }
    303401    }
    304402
    305403    /**
    306404     * Unregisters this instance as an autoloader.
     405     *
     406     * @return void
    307407     */
    308408    public function unregister()
    309409    {
    310410        spl_autoload_unregister(array($this, 'loadClass'));
     411
     412        if (null !== $this->vendorDir) {
     413            unset(self::$registeredLoaders[$this->vendorDir]);
     414        }
    311415    }
    312416
     
    315419     *
    316420     * @param  string    $class The name of the class
    317      * @return bool|null True if loaded, null otherwise
     421     * @return true|null True if loaded, null otherwise
    318422     */
    319423    public function loadClass($class)
    320424    {
    321425        if ($file = $this->findFile($class)) {
    322             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    323428
    324429            return true;
    325430        }
     431
     432        return null;
    326433    }
    327434
     
    368475    }
    369476
     477    /**
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
     481     */
     482    public static function getRegisteredLoaders()
     483    {
     484        return self::$registeredLoaders;
     485    }
     486
     487    /**
     488     * @param  string       $class
     489     * @param  string       $ext
     490     * @return string|false
     491     */
    370492    private function findFileWithExtension($class, $ext)
    371493    {
     
    433555        return false;
    434556    }
     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    }
    435579}
    436 
    437 /**
    438  * Scope isolated include.
    439  *
    440  * Prevents access to $this/self from included files.
    441  */
    442 function includeFile($file)
    443 {
    444     include $file;
    445 }
  • future-monitor/tags/1.0.1/vendor/composer/autoload_classmap.php

    r2303898 r3010366  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
    88return array(
    9     'Palasthotel\\FutureMonitor\\DashboardWidget' => $baseDir . '/classes/DashboardWidget.php',
     9    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
    1010);
  • future-monitor/tags/1.0.1/vendor/composer/autoload_namespaces.php

    r2303898 r3010366  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • future-monitor/tags/1.0.1/vendor/composer/autoload_psr4.php

    r2303898 r3010366  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • future-monitor/tags/1.0.1/vendor/composer/autoload_real.php

    r2303898 r3010366  
    1414    }
    1515
     16    /**
     17     * @return \Composer\Autoload\ClassLoader
     18     */
    1619    public static function getLoader()
    1720    {
     
    2124
    2225        spl_autoload_register(array('ComposerAutoloaderInitcee45bc917afd312f76959aa7478f42e', 'loadClassLoader'), true, true);
    23         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     26        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    2427        spl_autoload_unregister(array('ComposerAutoloaderInitcee45bc917afd312f76959aa7478f42e', 'loadClassLoader'));
    2528
    26         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    27         if ($useStaticLoader) {
    28             require_once __DIR__ . '/autoload_static.php';
    29 
    30             call_user_func(\Composer\Autoload\ComposerStaticInitcee45bc917afd312f76959aa7478f42e::getInitializer($loader));
    31         } else {
    32             $map = require __DIR__ . '/autoload_namespaces.php';
    33             foreach ($map as $namespace => $path) {
    34                 $loader->set($namespace, $path);
    35             }
    36 
    37             $map = require __DIR__ . '/autoload_psr4.php';
    38             foreach ($map as $namespace => $path) {
    39                 $loader->setPsr4($namespace, $path);
    40             }
    41 
    42             $classMap = require __DIR__ . '/autoload_classmap.php';
    43             if ($classMap) {
    44                 $loader->addClassMap($classMap);
    45             }
    46         }
     29        require __DIR__ . '/autoload_static.php';
     30        call_user_func(\Composer\Autoload\ComposerStaticInitcee45bc917afd312f76959aa7478f42e::getInitializer($loader));
    4731
    4832        $loader->register(true);
  • future-monitor/tags/1.0.1/vendor/composer/autoload_static.php

    r2303898 r3010366  
    2222
    2323    public static $classMap = array (
    24         'Palasthotel\\FutureMonitor\\DashboardWidget' => __DIR__ . '/../..' . '/classes/DashboardWidget.php',
     24        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
    2525    );
    2626
  • future-monitor/trunk/Plugin.php

    r2303898 r3010366  
    44 * Plugin URI: https://github.com/palasthotel/future-monitor
    55 * Description: Monitors the future of your system. For example planned posts...
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Palasthotel by Edward Bock <edward.bock@palasthotel.de>
    88 * Author URI: https://palasthotel.de
     
    1010 * Domain Path: /languages
    1111 * Requires at least: 4.0
    12  * Tested up to: 5.3.2
     12 * Tested up to: 6.4.2
    1313 * License: http://www.gnu.org/licenses/gpl-3.0.html GPLv3
    1414 *
     
    1919namespace Palasthotel\FutureMonitor;
    2020
     21require_once dirname(__FILE__) . "/vendor/autoload.php";
    2122
    22 /**
    23  * @property string url
    24  * @property string path
    25  * @property string basename
    26  * @property DashboardWidget dashboardWidget
    27  * @property Store store
    28  * @property Schedule schedule
    29  */
    30 class Plugin {
     23class Plugin extends Components\Plugin {
    3124
    3225    const DOMAIN = "future-monitor";
    3326    const SCHEDULE_ACTION = "future_monitor_publish_future_posts";
     27    public Store $store;
     28    public Schedule $schedule;
     29    public DashboardWidget $dashboardWidget;
    3430
    35     public function __construct() {
    36 
    37         load_plugin_textdomain(
    38             Plugin::DOMAIN,
    39             false,
    40             dirname( plugin_basename( __FILE__ ) ) . '/languages'
    41         );
    42 
    43         $this->url      = plugin_dir_url( __FILE__ );
    44         $this->path     = plugin_dir_path( __FILE__ );
    45         $this->basename = plugin_basename( __FILE__ );
    46 
    47         require_once dirname(__FILE__)."/vendor/autoload.php";
     31    public function onCreate(): void {
     32        $this->loadTextdomain(Plugin::DOMAIN, "languages");
    4833
    4934        $this->store = new Store();
     
    5136        $this->dashboardWidget = new DashboardWidget($this);
    5237
    53         /**
    54          * on activate or deactivate plugin
    55          */
    56         register_activation_hook( __FILE__, array( $this, "activation" ) );
    57         register_deactivation_hook( __FILE__, array( $this, "deactivation" ) );
    5838    }
    5939
    60     public function activation(){
     40    public function onSiteActivation(): void {
     41        parent::onSiteActivation();
    6142        $this->schedule->start();
    6243    }
    6344
    64     public function deactivation(){
     45    public function onSiteDeactivation(): void {
     46        parent::onSiteDeactivation();
    6547        $this->schedule->stop();
    6648    }
  • future-monitor/trunk/classes/Schedule.php

    r2303898 r3010366  
    55
    66
    7 /**
    8  * @property Plugin plugin
    9  */
    10 class Schedule {
     7use Palasthotel\FutureMonitor\Components\Component;
    118
    12     /**
    13      * Schedule constructor.
    14      *
    15      * @param Plugin $plugin
    16      */
    17     public function __construct($plugin) {
    18         $this->plugin = $plugin;
     9class Schedule extends Component {
     10    public function onCreate(): void {
    1911        add_action( 'admin_init', array( $this, 'start' ) );
    2012        add_action( Plugin::SCHEDULE_ACTION, array($this,'execute'));
    2113    }
    2214
    23     /**
    24      * @return false|int
    25      */
    26     public function isScheduled() {
     15    public function isScheduled(): bool|int {
    2716        return wp_next_scheduled( Plugin::SCHEDULE_ACTION );
    2817    }
    2918
    30     public function start(){
     19    public function start(): void {
    3120        if(!$this->isScheduled()){
    3221            wp_schedule_event( time(), 'hourly', Plugin::SCHEDULE_ACTION );
     
    3423    }
    3524
    36     public function stop(){
     25    public function stop(): void {
    3726        wp_clear_scheduled_hook(Plugin::SCHEDULE_ACTION);
    3827    }
    3928
    40     public function execute(){
     29    public function execute(): void {
    4130        $posts = $this->plugin->store->getPublishablePostIds();
    4231        foreach ($posts as $post_id){
  • future-monitor/trunk/classes/Store.php

    r2303898 r3010366  
    55
    66
     7use WP_Post;
     8
    79class Store {
    810
    9     private $post_ids;
     11    private ?array $post_ids = null;
    1012
    1113    /**
    12      * @return array
     14     * @return int[]
    1315     */
    14     public function getScheduledPostIdsFromOptions() {
     16    public function getScheduledPostIdsFromOptions(): array {
    1517
    1618        if ( $this->post_ids == NULL ) {
     
    3739
    3840    /**
    39      * @return \WP_Post[]
     41     * @return WP_Post[]
    4042     */
    41     public function getFuturePostIds() {
     43    public function getFuturePostIds(): array {
    4244        return get_posts( array(
    4345            'fields'         => 'ids',
     
    5153
    5254    /**
    53      * @return \WP_Post[]
     55     * @return WP_Post[]
    5456     */
    55     public function getPublishablePostIds() {
     57    public function getPublishablePostIds(): array {
    5658        return get_posts( array(
    5759            'fields'         => 'ids',
  • future-monitor/trunk/readme.txt

    r2303898 r3010366  
    44Tags: dashboard, widget, planned posts, schedule visualization
    55Requires at least: 4.0
    6 Tested up to: 5.3.2
    7 Requires PHP: 7.3
    8 Stable tag: 1.0.0
     6Tested up to: 6.4.2
     7Requires PHP: 8.0
     8Stable tag: 1.0.1
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030== Changelog ==
    3131
     32= 1.0.1 =
     33* PHP 8.2 update
     34
    3235= 1.0 =
    3336* First release
  • future-monitor/trunk/vendor/autoload.php

    r2303898 r3010366  
    33// autoload.php @generated by Composer
    44
     5if (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
    523require_once __DIR__ . '/composer/autoload_real.php';
    624
  • future-monitor/trunk/vendor/composer/ClassLoader.php

    r2303898 r3010366  
    3838 * @author Fabien Potencier <fabien@symfony.com>
    3939 * @author Jordi Boggiano <j.boggiano@seld.be>
    40  * @see    http://www.php-fig.org/psr/psr-0/
    41  * @see    http://www.php-fig.org/psr/psr-4/
     40 * @see    https://www.php-fig.org/psr/psr-0/
     41 * @see    https://www.php-fig.org/psr/psr-4/
    4242 */
    4343class ClassLoader
    4444{
     45    /** @var \Closure(string):void */
     46    private static $includeFile;
     47
     48    /** @var string|null */
     49    private $vendorDir;
     50
    4551    // PSR-4
     52    /**
     53     * @var array<string, array<string, int>>
     54     */
    4655    private $prefixLengthsPsr4 = array();
     56    /**
     57     * @var array<string, list<string>>
     58     */
    4759    private $prefixDirsPsr4 = array();
     60    /**
     61     * @var list<string>
     62     */
    4863    private $fallbackDirsPsr4 = array();
    4964
    5065    // 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     */
    5173    private $prefixesPsr0 = array();
     74    /**
     75     * @var list<string>
     76     */
    5277    private $fallbackDirsPsr0 = array();
    5378
     79    /** @var bool */
    5480    private $useIncludePath = false;
     81
     82    /**
     83     * @var array<string, string>
     84     */
    5585    private $classMap = array();
     86
     87    /** @var bool */
    5688    private $classMapAuthoritative = false;
     89
     90    /**
     91     * @var array<string, bool>
     92     */
    5793    private $missingClasses = array();
     94
     95    /** @var string|null */
    5896    private $apcuPrefix;
    5997
     98    /**
     99     * @var array<string, self>
     100     */
     101    private static $registeredLoaders = array();
     102
     103    /**
     104     * @param string|null $vendorDir
     105     */
     106    public function __construct($vendorDir = null)
     107    {
     108        $this->vendorDir = $vendorDir;
     109        self::initializeIncludeClosure();
     110    }
     111
     112    /**
     113     * @return array<string, list<string>>
     114     */
    60115    public function getPrefixes()
    61116    {
    62117        if (!empty($this->prefixesPsr0)) {
    63             return call_user_func_array('array_merge', $this->prefixesPsr0);
     118            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
    64119        }
    65120
     
    67122    }
    68123
     124    /**
     125     * @return array<string, list<string>>
     126     */
    69127    public function getPrefixesPsr4()
    70128    {
     
    72130    }
    73131
     132    /**
     133     * @return list<string>
     134     */
    74135    public function getFallbackDirs()
    75136    {
     
    77138    }
    78139
     140    /**
     141     * @return list<string>
     142     */
    79143    public function getFallbackDirsPsr4()
    80144    {
     
    82146    }
    83147
     148    /**
     149     * @return array<string, string> Array of classname => path
     150     */
    84151    public function getClassMap()
    85152    {
     
    88155
    89156    /**
    90      * @param array $classMap Class to filename map
     157     * @param array<string, string> $classMap Class to filename map
     158     *
     159     * @return void
    91160     */
    92161    public function addClassMap(array $classMap)
     
    103172     * appending or prepending to the ones previously set for this prefix.
    104173     *
    105      * @param string       $prefix  The prefix
    106      * @param array|string $paths   The PSR-0 root directories
    107      * @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
    108179     */
    109180    public function add($prefix, $paths, $prepend = false)
    110181    {
     182        $paths = (array) $paths;
    111183        if (!$prefix) {
    112184            if ($prepend) {
    113185                $this->fallbackDirsPsr0 = array_merge(
    114                     (array) $paths,
     186                    $paths,
    115187                    $this->fallbackDirsPsr0
    116188                );
     
    118190                $this->fallbackDirsPsr0 = array_merge(
    119191                    $this->fallbackDirsPsr0,
    120                     (array) $paths
     192                    $paths
    121193                );
    122194            }
     
    127199        $first = $prefix[0];
    128200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    129             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    130202
    131203            return;
     
    133205        if ($prepend) {
    134206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    135                 (array) $paths,
     207                $paths,
    136208                $this->prefixesPsr0[$first][$prefix]
    137209            );
     
    139211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    140212                $this->prefixesPsr0[$first][$prefix],
    141                 (array) $paths
     213                $paths
    142214            );
    143215        }
     
    148220     * appending or prepending to the ones previously set for this namespace.
    149221     *
    150      * @param string       $prefix  The prefix/namespace, with trailing '\\'
    151      * @param array|string $paths   The PSR-4 base directories
    152      * @param bool         $prepend Whether to prepend the directories
     222     * @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
    153225     *
    154226     * @throws \InvalidArgumentException
     227     *
     228     * @return void
    155229     */
    156230    public function addPsr4($prefix, $paths, $prepend = false)
    157231    {
     232        $paths = (array) $paths;
    158233        if (!$prefix) {
    159234            // Register directories for the root namespace.
    160235            if ($prepend) {
    161236                $this->fallbackDirsPsr4 = array_merge(
    162                     (array) $paths,
     237                    $paths,
    163238                    $this->fallbackDirsPsr4
    164239                );
     
    166241                $this->fallbackDirsPsr4 = array_merge(
    167242                    $this->fallbackDirsPsr4,
    168                     (array) $paths
     243                    $paths
    169244                );
    170245            }
     
    176251            }
    177252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    178             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    179254        } elseif ($prepend) {
    180255            // Prepend directories for an already registered namespace.
    181256            $this->prefixDirsPsr4[$prefix] = array_merge(
    182                 (array) $paths,
     257                $paths,
    183258                $this->prefixDirsPsr4[$prefix]
    184259            );
     
    187262            $this->prefixDirsPsr4[$prefix] = array_merge(
    188263                $this->prefixDirsPsr4[$prefix],
    189                 (array) $paths
     264                $paths
    190265            );
    191266        }
     
    196271     * replacing any others previously set for this prefix.
    197272     *
    198      * @param string       $prefix The prefix
    199      * @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
    200277     */
    201278    public function set($prefix, $paths)
     
    212289     * replacing any others previously set for this namespace.
    213290     *
    214      * @param string       $prefix The prefix/namespace, with trailing '\\'
    215      * @param array|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    216293     *
    217294     * @throws \InvalidArgumentException
     295     *
     296     * @return void
    218297     */
    219298    public function setPsr4($prefix, $paths)
     
    235314     *
    236315     * @param bool $useIncludePath
     316     *
     317     * @return void
    237318     */
    238319    public function setUseIncludePath($useIncludePath)
     
    257338     *
    258339     * @param bool $classMapAuthoritative
     340     *
     341     * @return void
    259342     */
    260343    public function setClassMapAuthoritative($classMapAuthoritative)
     
    277360     *
    278361     * @param string|null $apcuPrefix
     362     *
     363     * @return void
    279364     */
    280365    public function setApcuPrefix($apcuPrefix)
     
    297382     *
    298383     * @param bool $prepend Whether to prepend the autoloader or not
     384     *
     385     * @return void
    299386     */
    300387    public function register($prepend = false)
    301388    {
    302389        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
     390
     391        if (null === $this->vendorDir) {
     392            return;
     393        }
     394
     395        if ($prepend) {
     396            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
     397        } else {
     398            unset(self::$registeredLoaders[$this->vendorDir]);
     399            self::$registeredLoaders[$this->vendorDir] = $this;
     400        }
    303401    }
    304402
    305403    /**
    306404     * Unregisters this instance as an autoloader.
     405     *
     406     * @return void
    307407     */
    308408    public function unregister()
    309409    {
    310410        spl_autoload_unregister(array($this, 'loadClass'));
     411
     412        if (null !== $this->vendorDir) {
     413            unset(self::$registeredLoaders[$this->vendorDir]);
     414        }
    311415    }
    312416
     
    315419     *
    316420     * @param  string    $class The name of the class
    317      * @return bool|null True if loaded, null otherwise
     421     * @return true|null True if loaded, null otherwise
    318422     */
    319423    public function loadClass($class)
    320424    {
    321425        if ($file = $this->findFile($class)) {
    322             includeFile($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    323428
    324429            return true;
    325430        }
     431
     432        return null;
    326433    }
    327434
     
    368475    }
    369476
     477    /**
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
     481     */
     482    public static function getRegisteredLoaders()
     483    {
     484        return self::$registeredLoaders;
     485    }
     486
     487    /**
     488     * @param  string       $class
     489     * @param  string       $ext
     490     * @return string|false
     491     */
    370492    private function findFileWithExtension($class, $ext)
    371493    {
     
    433555        return false;
    434556    }
     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    }
    435579}
    436 
    437 /**
    438  * Scope isolated include.
    439  *
    440  * Prevents access to $this/self from included files.
    441  */
    442 function includeFile($file)
    443 {
    444     include $file;
    445 }
  • future-monitor/trunk/vendor/composer/autoload_classmap.php

    r2303898 r3010366  
    33// autoload_classmap.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
    88return array(
    9     'Palasthotel\\FutureMonitor\\DashboardWidget' => $baseDir . '/classes/DashboardWidget.php',
     9    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
    1010);
  • future-monitor/trunk/vendor/composer/autoload_namespaces.php

    r2303898 r3010366  
    33// autoload_namespaces.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • future-monitor/trunk/vendor/composer/autoload_psr4.php

    r2303898 r3010366  
    33// autoload_psr4.php @generated by Composer
    44
    5 $vendorDir = dirname(dirname(__FILE__));
     5$vendorDir = dirname(__DIR__);
    66$baseDir = dirname($vendorDir);
    77
  • future-monitor/trunk/vendor/composer/autoload_real.php

    r2303898 r3010366  
    1414    }
    1515
     16    /**
     17     * @return \Composer\Autoload\ClassLoader
     18     */
    1619    public static function getLoader()
    1720    {
     
    2124
    2225        spl_autoload_register(array('ComposerAutoloaderInitcee45bc917afd312f76959aa7478f42e', 'loadClassLoader'), true, true);
    23         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     26        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    2427        spl_autoload_unregister(array('ComposerAutoloaderInitcee45bc917afd312f76959aa7478f42e', 'loadClassLoader'));
    2528
    26         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
    27         if ($useStaticLoader) {
    28             require_once __DIR__ . '/autoload_static.php';
    29 
    30             call_user_func(\Composer\Autoload\ComposerStaticInitcee45bc917afd312f76959aa7478f42e::getInitializer($loader));
    31         } else {
    32             $map = require __DIR__ . '/autoload_namespaces.php';
    33             foreach ($map as $namespace => $path) {
    34                 $loader->set($namespace, $path);
    35             }
    36 
    37             $map = require __DIR__ . '/autoload_psr4.php';
    38             foreach ($map as $namespace => $path) {
    39                 $loader->setPsr4($namespace, $path);
    40             }
    41 
    42             $classMap = require __DIR__ . '/autoload_classmap.php';
    43             if ($classMap) {
    44                 $loader->addClassMap($classMap);
    45             }
    46         }
     29        require __DIR__ . '/autoload_static.php';
     30        call_user_func(\Composer\Autoload\ComposerStaticInitcee45bc917afd312f76959aa7478f42e::getInitializer($loader));
    4731
    4832        $loader->register(true);
  • future-monitor/trunk/vendor/composer/autoload_static.php

    r2303898 r3010366  
    2222
    2323    public static $classMap = array (
    24         'Palasthotel\\FutureMonitor\\DashboardWidget' => __DIR__ . '/../..' . '/classes/DashboardWidget.php',
     24        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
    2525    );
    2626
Note: See TracChangeset for help on using the changeset viewer.