Commit 0858505f authored by Rolf Forst's avatar Rolf Forst
Browse files

Add plugins support class

parent 317496dc
...@@ -10,8 +10,6 @@ class Expiration ...@@ -10,8 +10,6 @@ class Expiration
protected $options; protected $options;
protected $meta;
protected $cron_hook; protected $cron_hook;
protected $expiration_post_status = 'expired'; protected $expiration_post_status = 'expired';
...@@ -366,22 +364,14 @@ class Expiration ...@@ -366,22 +364,14 @@ class Expiration
); );
if (!empty($result)) { if (!empty($result)) {
$plugins = new Plugins();
foreach ($result as $row) { foreach ($result as $row) {
wp_update_post(['ID' => $row->post_id, 'post_status' => $this->expiration_post_status]); wp_update_post(['ID' => $row->post_id, 'post_status' => $this->expiration_post_status]);
// rrze cache plugin // rrze cache plugin support
$this->flush_cache(get_permalink($row->post_id)); $plugins->flush_rrze_cache(get_permalink($row->post_id));
} }
} }
} }
protected function flush_cache($url)
{
if (empty($url)) {
return;
}
if (has_action('rrzecache_flush_cache_url')) {
do_action('rrzecache_flush_cache_url', $url);
}
}
} }
<?php
namespace RRZE\PostExpiration;
defined('ABSPATH') || exit;
class Plugins
{
/**
* Flush the RRZE Cache
* RRZE Cache plugin support.
* @param string $url Post permalink
* @return void
*/
public function flush_rrze_cache($url)
{
if (empty($url)) {
return;
}
if (has_action('rrzecache_flush_cache_url')) {
do_action('rrzecache_flush_cache_url', $url);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment