/** * Do things like register/enqueue scripts and stylesheets * * @since 2.0 */ public function __construct() { add_shortcode('pods-content', array($this, 'shortcode')); $args = array('label' => 'Pod Pages', 'labels' => array('singular_name' => 'Pod Page'), 'public' => false, 'can_export' => false, 'show_ui' => true, 'show_in_menu' => false, 'query_var' => false, 'rewrite' => false, 'has_archive' => false, 'hierarchical' => false, 'supports' => array('title', 'author', 'revisions'), 'menu_icon' => PODS_URL . 'ui/images/icon16.png'); if (!pods_is_admin()) { $args['capability_type'] = 'pods_page'; } $args = PodsInit::object_label_fix($args, 'post_type'); register_post_type($this->object_type, apply_filters('pods_internal_register_post_type_object_page', $args)); add_filter('post_type_link', array($this, 'post_type_link'), 10, 2); if (!is_admin()) { add_action('load_textdomain', array($this, 'page_check'), 12); } else { add_filter('post_updated_messages', array($this, 'setup_updated_messages'), 10, 1); add_action('dbx_post_advanced', array($this, 'edit_page_form'), 10); add_action('pods_meta_groups', array($this, 'add_meta_boxes')); add_filter('get_post_metadata', array($this, 'get_meta'), 10, 4); add_filter('update_post_metadata', array($this, 'save_meta'), 10, 4); add_action('pods_meta_save_pre_post__pods_page', array($this, 'fix_filters'), 10, 5); add_action('post_updated', array($this, 'clear_cache'), 10, 3); add_action('delete_post', array($this, 'clear_cache'), 10, 1); add_filter('post_row_actions', array($this, 'remove_row_actions'), 10, 2); add_filter('bulk_actions-edit-' . $this->object_type, array($this, 'remove_bulk_actions')); add_filter('builder_layout_filter_non_layout_post_types', array($this, 'disable_builder_layout')); } }
/** * @param null $_blog_id */ public function reset($_blog_id = null) { global $wpdb; // Switch DB table prefixes if (null !== $_blog_id && $_blog_id != $wpdb->blogid) { switch_to_blog(pods_absint($_blog_id)); } else { $_blog_id = null; } $api = pods_api(); $pods = $api->load_pods(array('names_ids' => true)); foreach ($pods as $pod_id => $pod_label) { $api->delete_pod(array('id' => $pod_id)); } $templates = $api->load_templates(); foreach ($templates as $template) { $api->delete_template(array('id' => $template['id'])); } $pages = $api->load_pages(); foreach ($pages as $page) { $api->delete_page(array('id' => $page['id'])); } $helpers = $api->load_helpers(); foreach ($helpers as $helper) { $api->delete_helper(array('id' => $helper['id'])); } $tables = $wpdb->get_results("SHOW TABLES LIKE '{$wpdb->prefix}pods%'", ARRAY_N); if (!empty($tables)) { foreach ($tables as $table) { $table = $table[0]; pods_query("DROP TABLE `{$table}`", false); } } // Remove any orphans $wpdb->query("\n DELETE `p`, `pm`\n FROM `{$wpdb->posts}` AS `p`\n LEFT JOIN `{$wpdb->postmeta}` AS `pm`\n ON `pm`.`post_id` = `p`.`ID`\n WHERE\n `p`.`post_type` LIKE '_pods_%'\n "); delete_option('pods_framework_version'); delete_option('pods_framework_db_version'); delete_option('pods_framework_upgrade_2_0'); delete_option('pods_framework_upgraded_1_x'); // @todo Make sure all entries are being cleaned and do something about the pods_framework_upgrade_{version} dynamic entries created by PodsUpgrade delete_option('pods_framework_upgrade_2_0_0'); delete_option('pods_framework_upgrade_2_0_sister_ids'); delete_option('pods_framework_version_last'); delete_option('pods_component_settings'); $api->cache_flush_pods(); pods_transient_clear('pods_flush_rewrites'); self::$version = ''; // Restore DB table prefix (if switched) if (null !== $_blog_id) { restore_current_blog(); } }
/** * Include and Init the Pods class * * @see PodsInit * * @return PodsInit * * @since 2.0 */ function pods_init() { require_once PODS_DIR . 'classes/PodsInit.php'; return PodsInit::init(); }