_settings = $settings; add_shortcode('athena_expiration', array($this, 'content_expire')); $post_type = isset($_GET['post'])?get_post_type($_GET['post']): null; if(isset($this->_settings['enable_posttype_'.$post_type]) && $this->_settings['enable_posttype_'.$post_type] == true){ add_action( 'media_buttons', array($this, 'athena_btn'), 15); add_action( 'admin_footer', array($this, 'athena_btn_js' ) ); } } public static function init( $settings ){ if(!self::$_instance instanceof self){ self::$_instance = new Athena_Shortcode( $settings ); } return self::$_instance; }//end init method public function content_expire($atts, $content = null){ $data = shortcode_atts(array( 'profile' => null, ), $atts); if($data['profile'] !== null && is_numeric($data['profile'])){ $timestamp = get_post_meta($data['profile'], '_post_expiration_timestamp', true); }else{ return do_shortcode( $content ); } if($timestamp !== false && $timestamp > current_time( 'timestamp', 1)){ return do_shortcode( $content ); } }//end content_expire method public function athena_btn( $content ){ $html = ''; $args = array( 'post_type' => 'athenaprofile', 'posts_per_page' => -1, 'meta_key' => '_post_expiration_timestamp', 'meta_value' => current_time('timestamp', 1), 'meta_compare' => '>' ); $profiles = get_posts( $args ); ?>