/**
  * Setup test case
  *
  * @since 1.0.0
  */
 public function setUp()
 {
     parent::setUp();
     // Add custom factories
     $this->factory = new AC_Unit_Test_Factory();
     $this->setOutputCallback(array($this, 'filter_output'));
     // Register post types before each test
     AC_Post_Types::register_post_types();
     AC_Post_Types::register_taxonomies();
 }
    {
        if (post_type_exists('portfolio')) {
            return;
        }
        do_action('axiscomposer_register_post_type');
        $permalinks = get_option('axiscomposer_permalinks');
        $portfolio_permalink = empty($permalinks['portfolio_base']) ? _x('portfolio', 'slug', 'axiscomposer') : $permalinks['portfolio_base'];
        register_post_type('portfolio', apply_filters('axiscomposer_register_post_type_portfolio', array('labels' => array('name' => __('Projects', 'axiscomposer'), 'singular_name' => __('Project', 'axiscomposer'), 'menu_name' => _x('Portfolio', 'Admin menu name', 'axiscomposer'), 'all_items' => __('All projects', 'axiscomposer'), 'add_new' => __('Add project', 'axiscomposer'), 'add_new_item' => __('Add new project', 'axiscomposer'), 'edit' => __('Edit', 'axiscomposer'), 'edit_item' => __('Edit project', 'axiscomposer'), 'new_item' => __('New project', 'axiscomposer'), 'view' => __('View project', 'axiscomposer'), 'view_item' => __('View project', 'axiscomposer'), 'search_items' => __('Search projects', 'axiscomposer'), 'not_found' => __('No projects found', 'axiscomposer'), 'not_found_in_trash' => __('No projects found in trash', 'axiscomposer'), 'parent' => __('Parent project', 'axiscomposer'), 'featured_image' => __('Project image', 'axiscomposer'), 'set_featured_image' => __('Set project image', 'axiscomposer'), 'remove_featured_image' => __('Remove project image', 'axiscomposer'), 'use_featured_image' => __('Use as project image', 'axiscomposer'), 'insert_into_item' => __('Insert into project', 'axiscomposer'), 'uploaded_to_this_item' => __('Uploaded to this project', 'axiscomposer'), 'filter_items_list' => __('Filter projects', 'axiscomposer'), 'items_list_navigation' => __('Projects navigation', 'axiscomposer'), 'items_list' => __('Projects list', 'axiscomposer')), 'description' => __('This is where you can add new portfolio items to your project.', 'axiscomposer'), 'public' => true, 'show_ui' => true, 'capability_type' => 'portfolio', 'map_meta_cap' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'hierarchical' => false, 'query_var' => true, 'menu_icon' => 'dashicons-portfolio', 'rewrite' => $portfolio_permalink ? array('slug' => untrailingslashit($portfolio_permalink), 'with_front' => false, 'feeds' => true) : false, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes', 'publicize', 'wpcom-markdown'), 'has_archive' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true)));
    }
    /**
     * Add Portfolio Support to Jetpack Omnisearch.
     */
    public static function support_jetpack_omnisearch()
    {
        if (class_exists('Jetpack_Omnisearch_Posts')) {
            new Jetpack_Omnisearch_Posts('portfolio');
        }
    }
    /**
     * Added portfolio for Jetpack related posts.
     * @param  array $post_types
     * @return array
     */
    public static function rest_api_allowed_post_types($post_types)
    {
        $post_types[] = 'portfolio';
        return $post_types;
    }
}
AC_Post_Types::init();
 /**
  * Install AC.
  */
 public static function install()
 {
     global $wpdb;
     if (!defined('AC_INSTALLING')) {
         define('AC_INSTALLING', true);
     }
     // Ensure needed classes are loaded
     include_once dirname(__FILE__) . '/admin/class-ac-admin-notices.php';
     self::create_options();
     self::create_roles();
     self::create_files();
     // Register post types
     AC_Post_Types::register_post_types();
     AC_Post_Types::register_taxonomies();
     // Queue upgrades wizard
     $current_ac_version = get_option('axiscomposer_version', null);
     $current_db_version = get_option('axiscomposer_db_version', null);
     AC_Admin_Notices::remove_all_notices();
     // No versions? This is a new install :)
     if (is_null($current_ac_version) && is_null($current_db_version) && apply_filters('axiscomposer_enable_setup_wizard', true)) {
         set_transient('_ac_activation_redirect', 1, 30);
     }
     if (!is_null($current_db_version) && version_compare($current_db_version, max(array_keys(self::$db_updates)), '<')) {
         AC_Admin_Notices::add_notice('update');
     } else {
         self::update_db_version();
     }
     self::update_ac_version();
     // Flush rules after install
     flush_rewrite_rules();
     /*
      * Deletes all expired transients. The multi-table delete syntax is used
      * to delete the transient record from table a, and the corresponding
      * transient_timeout record from table b.
      *
      * Based on code inside core's upgrade_network() function.
      */
     $sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\tWHERE a.option_name LIKE %s\n\t\t\tAND a.option_name NOT LIKE %s\n\t\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\n\t\t\tAND b.option_value < %d";
     $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time()));
     // Trigger action
     do_action('axiscomposer_installed');
 }