コード例 #1
0
    {
        $job_obj = get_post_type_object('job_listing');
        $job_singular = is_object($job_obj) ? $job_obj->labels->singular_name : __('Job', 'wp-job-manager-field-editor');
        if (!$job_singular) {
            $job_singular = __('Job', 'wp-job-manager-field-editor');
        }
        return $job_singular;
    }
    public static function autoload($class)
    {
        // Exit autoload if being called by a class other than ours
        if (FALSE === strpos($class, 'WP_Job_Manager_Field_Editor')) {
            return;
        }
        $class_file = str_replace('WP_Job_Manager_Field_Editor_', '', $class);
        $file_array = array_map('strtolower', explode('_', $class_file));
        $dirs = 0;
        $file = untrailingslashit(plugin_dir_path(__FILE__)) . '/classes/';
        while ($dirs++ < count($file_array)) {
            $file .= '/' . $file_array[$dirs - 1];
        }
        $file .= '.php';
        if (!file_exists($file) || $class === 'WP_Job_Manager_Field_Editor') {
            return;
        }
        include $file;
    }
}
spl_autoload_register(array('WP_Job_Manager_Field_Editor', 'autoload'));
WP_Job_Manager_Field_Editor::get_instance();