Load a post type
@param string $class
772113
public static function load($class)
    {
        $instance = new $class;
        $post_type = $instance->getPostType();

        // WordPress has a limit of 20 characters per
        if (strlen($post_type) > 20) {
            throw new \Exception('Post Type name exceeds maximum 20 characters: '.$post_type);
        }

        // This might happen if you're introducing a middle class between your post type and TacoPost
        // Ex: Foo extends \ClientTacoPost extends Taco\Post
        if (!$post_type) {
            return false;
        }
        
        //add_action('init', array($instance, 'registerPostType'));
        $instance->registerPostType();
        add_action('save_post', array($instance, 'addSaveHooks'));

        if (is_admin()) {
            // If we're in the edit screen, we want the post loaded
            // so that TacoPost::getFields knows which post it's working with.
            // This helps if you want TacoPost::getFields to use conditional logic
            // based on which post is currently being edited.
            $is_edit_screen = (
                is_array($_SERVER)
                && preg_match('/post.php\?post=[\d]{1,}/i', $_SERVER['REQUEST_URI'])
                && !Arr::iterable($_POST)
            );
            $is_edit_save = (
                preg_match('/post.php/i', $_SERVER['REQUEST_URI'])
                && Arr::iterable($_POST)
            );
            $post = null;
            if ($is_edit_screen && array_key_exists('post', $_GET)) {
                    $post = get_post($_GET['post']);
            } elseif ($is_edit_save) {
                $post = get_post($_POST['post_ID']);
            }
            if ($post && $post->post_type === $instance->getPostType()) {
                $instance->load($post);
            }
            
            add_action('admin_menu', array($instance, 'addMetaBoxes'));
            add_action(sprintf('manage_%s_posts_columns', $post_type), array($instance, 'addAdminColumns'), 10, 2);
            add_action(sprintf('manage_%s_posts_custom_column', $post_type), array($instance, 'renderAdminColumn'), 10, 2);
            add_filter(sprintf('manage_edit-%s_sortable_columns', $post_type), array($instance, 'makeAdminColumnsSortable'));
            add_filter('request', array($instance, 'sortAdminColumns'));
            add_filter('posts_clauses', array($instance, 'makeAdminTaxonomyColumnsSortable'), 10, 2);
            
            // Hide the title column in the browse view of the admin UI
            $is_browsing_index = (
                is_array($_SERVER)
                && preg_match('/edit.php\?post_type='.$post_type.'$/i', $_SERVER['REQUEST_URI'])
            );
            if ($is_browsing_index && $instance->getHideTitleFromAdminColumns()) {
                add_action('admin_init', function () {
                    wp_register_style('hide_title_column_css', plugins_url('taco/base/hide_title_column.css'));
                    wp_enqueue_style('hide_title_column_css');
                });
            }
        }
    }
1161183
public static function autoloader($class) {
		// Check that the class starts with "Requests"
		if (strpos($class, 'Requests') !== 0) {
			return;
		}

		$file = str_replace('_', '/', $class);
		if (file_exists(dirname(__FILE__) . '/' . $file . '.php')) {
			require_once(dirname(__FILE__) . '/' . $file . '.php');
		}
	}
1359299
public function autoload($class) {
        $classKey = strtolower($class);

        if (isset($this->classes[$classKey])) {
            list($_, $path) = $this->classes[$classKey];
            include_once $path;
        }
    }
838695
public static function load($class) {
			// Checks if class is OAuth2, then OAuthRequest,
			// then searches the /src directory if the class name starts with OAuth.
			$class = strtolower($class);
			if($class == "oauth2")
				require_once __DIR__ . '/oauth.class.php';
			elseif($class == "oauthrequest")
				require_once __DIR__ . '/oauthrequest.class.php';
			elseif((substr($class, 0, 5) == "oauth") && file_exists(__DIR__ . "/" . substr($class, 5) . ".class.php"))
				require_once __DIR__ . '/' . substr($class, 5) . '.class.php';
			else return false;
			return true;
		}
742277
public static function autoload($class)
    {
        $baseRoot = Container::get('config')->get('app_full_path');
        // project-specific namespace prefix
        $prefix = Container::get('config')->get('namespace_prefix');

        // does the class use the namespace prefix?
        $len = strlen($prefix);
        if (strncmp($prefix, $class, $len) !== 0) {
            // no, move to the next registered autoloader
            return;
        }

        // get the relative class name
        $relativeClass = substr($class, $len);

        // replace the namespace prefix with the base directory, replace namespace
        // separators with directory separators in the relative class name, append
        // with .php
        $file = $baseRoot . '/' . str_replace('\\', '/', $relativeClass) . '.php';

        self::import($file);
    }
771436
public function load($class)
    {
        $class = ltrim($class, '\\');

        if (strpos($class, $this->namespace) === 0) {
            $nsparts = explode('\\', $class);
            $class = array_pop($nsparts);
            $nsparts[ ] = '';
            $path = $this->path . implode(DIRECTORY_SEPARATOR, $nsparts);
            $path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';

            if (file_exists($path)) {
                require $path;

                return true;
            }
        }

        return false;
    }
905960
private static function _autoload($class)
    {
        $realClass = $class;
        if (preg_match('/^JProxy_/i', $class)) {
            $class = preg_replace('/^JProxy_/i', '', $class);
        }
        foreach (self::$prefixes as $prefix => $lookup) {
            $chr = strlen($prefix) < strlen($class) ? $class[strlen($prefix)] : 0;

            if (strpos($class, $prefix) === 0 && ($chr === strtoupper($chr))) {
                $existsBefore = class_exists($realClass, false);
                if ($realClass === $class) {
                    self::loadByAlias($realClass);
                    self::load($realClass);
                }
                $return = true;
                if (!$existsBefore && !class_exists($class, false)) {
                    $return = self::_load(substr($class, strlen($prefix)), $lookup);
                }
                if ($realClass === $class && !$existsBefore && class_exists($realClass, false)) {
                    self::injectStaticDependencies($class);
                }

                return $return;
            }
        }

        return false;
    }
421900
private function loadController($class)
    {
        $controller = new $class($this->currentControllerAliasConfig);
        if (!is_a($controller, '\\mpf\\web\\Controller')) {
            $this->critical('Controller `' . $class . '` must extend \\mpf\\web\\Controller!', array(
                'requestedController' => $this->request()->getController(),
                'requestedModule' => $this->request()->getModule()
            ));
            return null;
        }
        return $controller;
    }
715474
public function loadClass($class)
    {
        if (0 === strpos($class, 'Admingenerated')) {
            $file_path = $this->base_path.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';

            if (!file_exists($file_path)) {
                $this->generateEmptyController($class);
            }

            if (file_exists($file_path)) {
                require $file_path;
            }
        }
    }
371063
public static function load($class)
	{
		// deal with funny is_callable('static::classname') side-effect
		if (strpos($class, 'static::') === 0)
		{
			// is called from within the class, so it's already loaded
			return true;
		}

		$loaded = false;
		$class = ltrim($class, '\\');
		$namespaced = ($pos = strripos($class, '\\')) !== false;

		if (empty(static::$auto_initialize))
		{
			static::$auto_initialize = $class;
		}

		if (isset(static::$classes[strtolower($class)]))
		{
			static::init_class($class, str_replace('/', DS, static::$classes[strtolower($class)]));
			$loaded = true;
		}
		elseif ($full_class = static::find_core_class($class))
		{
			if ( ! class_exists($full_class, false) and ! interface_exists($full_class, false))
			{
				include static::prep_path(static::$classes[strtolower($full_class)]);
			}
			if ( ! class_exists($class, false))
			{
				class_alias($full_class, $class);
			}
			static::init_class($class);
			$loaded = true;
		}
		else
		{
			$full_ns = substr($class, 0, $pos);

			if ($full_ns)
			{
				foreach (static::$namespaces as $ns => $path)
				{
					$ns = ltrim($ns, '\\');
					if (stripos($full_ns, $ns) === 0)
					{
						$path .= static::class_to_path(
							substr($class, strlen($ns) + 1),
							array_key_exists($ns, static::$psr_namespaces)
						);
						if (is_file($path))
						{
							static::init_class($class, $path);
							$loaded = true;
							break;
						}
					}
				}
			}

			if ( ! $loaded)
			{
				$path = APPPATH.'classes/'.static::class_to_path($class);

				if (is_file($path))
				{
					static::init_class($class, $path);
					$loaded = true;
				}
			}
		}

		// Prevent failed load from keeping other classes from initializing
		if (static::$auto_initialize == $class)
		{
			static::$auto_initialize = null;
		}

		return $loaded;
	}
606194
public static function load($class)
    {
        $class = static::normalizeClass($class);

        foreach (static::$directories as $directory)
        {
            if (file_exists($path = $directory.DIRECTORY_SEPARATOR.$class))
            {
                require_once $path;

                return true;
            }
        }
        return false;
    }
745326
public function register($class, string $path = '')
    {
        if (empty($class->slug)) {
            return;
        }

        if (!is_multisite() && $class->multisiteOnly) {
            return;
        }

        // Get post type slug
        $postTypeSlug = self::prefixSlug($class->slug);
        self::$classes[$postTypeSlug] = $class;

        // Set labels
        $labels = array(
            'name'               => _x($class->nameSingular, 'post type general name', 'modularity'),
            'singular_name'      => _x($class->nameSingular, 'post type singular name', 'modularity'),
            'menu_name'          => _x($class->namePlural, 'admin menu', 'modularity'),
            'name_admin_bar'     => _x($class->nameSingular, 'add new on admin bar', 'modularity'),
            'add_new'            => _x('Add New', 'add new button', 'modularity'),
            'add_new_item'       => sprintf(__('Add new %s', 'modularity'), $class->nameSingular),
            'new_item'           => sprintf(__('New %s', 'modularity'), $class->nameSingular),
            'edit_item'          => sprintf(__('Edit %s', 'modularity'), $class->nameSingular),
            'view_item'          => sprintf(__('View %s', 'modularity'), $class->nameSingular),
            'all_items'          => sprintf(__('Edit %s', 'modularity'), $class->namePlural),
            'search_items'       => sprintf(__('Search %s', 'modularity'), $class->namePlural),
            'parent_item_colon'  => sprintf(__('Parent %s', 'modularity'), $class->namePlural),
            'not_found'          => sprintf(__('No %s', 'modularity'), $class->namePlural),
            'not_found_in_trash' => sprintf(__('No %s in trash', 'modularity'), $class->namePlural)
        );

        // Set args
        $args = array(
            'labels'               => $labels,
            'description'          => __($class->description, 'modularity'),
            'public'               => false,
            'publicly_queryable'   => false,
            'exclude_from_search'  => false,
            'show_ui'              => true,
            'show_in_nav_menus'    => false,
            'show_in_menu'         => ($this->showInAdminMenu()) ? 'modularity' : false,
            'has_archive'          => false,
            'rewrite'              => false,
            'hierarchical'         => false,
            'menu_position'        => 100,
            'menu_icon'            => $class->icon,
            'supports'             => array_merge($class->supports, array('title', 'revisions', 'author')),
            'capabilities'         => array(
                'edit_post'          => 'edit_module',
                'edit_posts'         => 'edit_modules',
                'edit_others_posts'  => 'edit_other_modules',
                'publish_posts'      => 'publish_modules',
                'read_post'          => 'read_module',
                'read_private_posts' => 'read_private_posts',
                'delete_post'        => 'delete_module'
            ),
            'map_meta_cap'         => true
        );

        //Disable from search search pages (someone did a huge mistake designing this feature)
        if (is_search()) {
            $args['exclude_from_search'] = true;
        }

        // Get menu icon
        if (empty($args['menu_icon']) && $icon = $this->getIcon($path, $class)) {
            $args['menu_icon'] = $icon;
            $args['menu_icon_auto_import'] = true;
        }

        // Register the post type if module is enabled
        if (in_array($postTypeSlug, self::$enabled)) {

            register_post_type($postTypeSlug, $args);
            $this->setupListTableField($postTypeSlug);

            $class->plugin = (array) $class->plugin;

            if (!empty($class->plugin)) {
                // Fallback to enable old modules to register their plugins
                if (!is_array($class->plugin)) {
                    $class->plugin = array($class->plugin);
                }

                // Ability to filter path
                $class->plugin = apply_filters('Modularity/Register/Plugin', $class->plugin, $postTypeSlug);

                // Include
                foreach ($class->plugin as $plugin) {
                    /**
                     * Deprecated
                     * @todo  Remove……
                     */
                    trigger_error('Deprecation message: Modularity module "' . $postTypeSlug . '" is using a deprecated way of including plugins. Use the wp action "Modularity/Plugins" to load plugins instead.', E_USER_WARNING);

                    if (file_exists($plugin)) {
                        require_once $plugin;
                    } elseif (file_exists(MODULARITY_PATH . 'plugins/'. $plugin)) {
                        require_once MODULARITY_PATH . 'plugins/'. $plugin;
                    }
                }
            }
        }

        // Check if module is deprecated
        if ($class->isDeprecated) {
            \Modularity\ModuleManager::$deprecated[] = $postTypeSlug;
        }

        // Add to list of available modules
        \Modularity\ModuleManager::$available[$postTypeSlug] = $args;

        // Store settings of each module in static var
        self::$moduleSettings[$postTypeSlug] = array(
            'moduleSlug'    => $postTypeSlug,
            'slug'          => $class->slug,
            'singular_name' => $class->nameSingular,
            'plural_name'   => $class->namePlural,
            'description'   => $class->description,
            'supports'      => $class->supports,
            'icon'          => $class->icon,
            'plugin'        => $class->plugin,
            'cache_ttl'     => $class->cacheTtl,
            'hide_title'    => $class->hideTitle
        );

        $class->moduleSlug = $postTypeSlug;

        return $postTypeSlug;
    }
1091528
public function loadClass($class)
    {
        $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);

        try {
            if ($this->isFinder && !isset($this->loaded[$class])) {
                $this->loaded[$class] = true;
                if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
                    // no-op
                } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
                    require $file;

                    return;
                } else {
                    require $file;
                }
            } else {
                ($this->classLoader)($class);
                $file = false;
            }
        } finally {
            error_reporting($e);
        }

        $this->checkClass($class, $file);
    }
620943
static function autoload($class)
	{
		$root = explode('\\', trim($class, '\\'), 2);
		if (count($root) > 1 and isset(self::$namespaces[$root[0]]))
		{
            include self::$namespaces[$root[0]].'/'.str_replace('\\', '/', $root[1]).'.php';
		}
	}
713127
public static function autoload($class)
    {
        $_class = strtolower($class);
        $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
        if (strpos($_class, 'smarty_internal_') === 0) {
            if (strpos($_class, 'smarty_internal_compile_') === 0) {
                if (is_file($file)) {
                    require $file;
                }
                return;
            }
            @include $file;
            return;
        }
        if (preg_match('/^(smarty_(((template_(source|config|cache|compiled|resource_base))|((cached|compiled)?resource)|(variable|security)))|(smarty(bc)?)$)/',
                       $_class, $match)) {
            if (!empty($match[3])) {
                @include $file;
                return;
            } elseif (!empty($match[9]) && isset(self::$rootClasses[$_class])) {
                $file = self::$rootClasses[$_class];
                require $file;
                return;
            }
        }
        if (0 !== strpos($_class, 'smarty')) {
            return;
        }
        if (is_file($file)) {
            require $file;
            return;
        }
        return;
    }
701075
public static function load($class)
    {
        if (stripos($class, 'Phpass') === 0) {
            $file = str_replace('\\', '/', $class);

            if (file_exists(dirname(__FILE__) . '/../' . $file . '.php')) {
                require_once(dirname(__FILE__) . '/../' . $file . '.php');
            }
        }
    }
386345
public static function autoload($class)
    {
        if ($class === 'Cpdf') {
            require_once __DIR__ . "/../lib/Cpdf.php";
            return;
        }

        $prefixLength = strlen(self::PREFIX);
        if (0 === strncmp(self::PREFIX, $class, $prefixLength)) {
            $file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
            $file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
            if (file_exists($file)) {
                require_once $file;
            }
        }
    }