| Server IP : 104.21.74.147 / Your IP : 216.73.217.154 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Services/ |
Upload File : |
<?php
namespace Themeco\Cornerstone\Services;
require_once ABSPATH . '/wp-admin/includes/template.php';
const WC_LOAD_FILE = ABSPATH . '/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php';
class PostStates {
//State
static $loaded = false;
public const META_STATE_KEY = "_cs_states_cache";
/**
* Main loader
* @TODO figure out why we need to manually load in some of these files
*/
public static function load() {
if (static::$loaded) {
return;
}
//WooCommerce
if (class_exists('WooCommerce') && file_exists(WC_LOAD_FILE)) {
require_once WC_LOAD_FILE;
}
static::$loaded = true;
}
/**
* Helper loads up if not loaded
*/
public static function getPostState($post) {
static::load();
return (object)get_post_states($post);
}
public static function savePostState($post, $states = []) {
static::load();
//Save as comma delim string
$states_str = implode(" ", $states);
$data = get_post_meta($post->ID, static::META_STATE_KEY, false);
//Already all good
if ($data === $states_str) {
return;
}
//Update DB
update_post_meta( $post->ID, static::META_STATE_KEY, $states_str );
}
}