GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code

< 40 %
40-60 %
> 60 %
1
<?php
2
/**
3
 * Plugin Name: Games Collector
4
 * Plugin URI:  https://github.com/jazzsequence/games-collector
5
 * Description: Catalog all your tabletop (or other) games in your WordPress site and display a list of games in your collection.
6
 * Version:     1.3.6
7
 * Author:      Chris Reynolds
8
 * Author URI:  https://jazzsequence.com
9
 * Donate link: https://paypal.me/jazzsequence
10
 * License:     GPLv3
11
 * Text Domain: games-collector
12
 * Domain Path: /languages
13
 *
14
 * @link https://github.com/jazzsequence/games-collector
15
 *
16
 * @package GamesCollector
17
 * @version 1.3.4
18
 */
19
20
/**
21
 * Copyright (c) 2017 Chris Reynolds (email : [email protected])
22
 *
23
 * This program is free software; you can redistribute it and/or modify
24
 * it under the terms of the GNU General Public License, version 2 or, at
25
 * your discretion, any later version, as published by the Free
26
 * Software Foundation.
27
 *
28
 * This program is distributed in the hope that it will be useful,
29
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31
 * GNU General Public License for more details.
32
 *
33
 * You should have received a copy of the GNU General Public License
34
 * along with this program; if not, write to the Free Software
35
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
36
 */
37
38
namespace GC\GamesCollector;
39
40
/**
41
 * Handles autoloading the namespaces and other required files.
42
 *
43
 * @since 1.1.0
44
 */
45
function autoload_init() {
46
	$cmb2_path = maybe_get_cmb2_path();
47
48
	// Add in some specific includes and vendor libraries.
49
	$files = [
50
		__DIR__ . '/inc/namespace.php',
51
		__DIR__ . '/inc/functions.php',
52
	];
53
54
	// Only add CMB2 if we found it.
55
	if ( $cmb2_path ) {
56
		$files[] = $cmb2_path;
57
	}
58
59
	// Check for extended cpts, load it if it hasn't already been loaded.
60
	if ( ! function_exists( 'register_extended_post_type' ) ) {
61
		$plugin_vendor = __DIR__ . '/vendor/johnbillion/extended-cpts/extended-cpts.php';
62
		$root_vendor = ABSPATH . '/vendor/johnbillion/extended-cpts/extended-cpts.php';
63
		
64
		// Check if extended cpts exists. If not, deactivate the plugin.
65
		$exists = file_exists( $plugin_vendor ) || file_exists( $root_vendor );
66
		if ( $exists ) {
67
			$files[] = $exists ? $plugin_vendor : $root_vendor;
68
		} elseif ( function_exists( 'deactivate_plugins' ) ) {
69
			// If it's not loaded, deactivate the plugin.
70
			deactivate_plugins( plugin_basename( __FILE__ ) );
71
		} else {
72
			// Something else happened, bail now.
73
			return \WP_Error( 'init_error', __( 'Error initializing the plugin. Could not find extended-cpts library and could not deactivate the plugin. Giving up.', 'games-collector' ) );
74
		}
75
	}
76
77
	// Autoload the namespaces.
78
	$namespaces = array_filter( glob( __DIR__ . '/inc/*' ), 'is_dir' );
79
	foreach ( $namespaces as $namespace ) {
80
		$files[] = $namespace . '/namespace.php';
81
	}
82
83
	// Loop through and load all the things!
84
	foreach ( $files as $file ) {
85
		require_once $file;
86
	}
87
}
88
89
/**
90
 * Try to get the path to the CMB2 library.
91
 *
92
 * @since 1.3.6
93
 */
94
function maybe_get_cmb2_path() {
95
	// If the CMB2 library is already loaded, we don't need to load it.
96
	if ( function_exists( 'cmb2_bootstrap' ) ) {
97
		return '';
98
	}
99
100
	// Maybe load from the vendor directory.
101
	if ( file_exists( __DIR__ . '/vendor/cmb2/init.php' ) ) {
102
		return __DIR__ . '/vendor/cmb2/init.php';
103
	}
104
105
	// Maybe load from the root /vendor directory.
106
	if ( file_exists( ABSPATH . '/vendor/cmb2/init.php' ) ) {
107
		return ABSPATH . '/vendor/cmb2/init.php';
108
	}
109
110
	// Was it installed as a plugin?
111
	if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) ) {
112
		// Activate the plugin.
113
		activate_plugin( 'cmb2' );
114
	}
115
116
	// Last chance, maybe it's in the mu-plugins directory. If it's here, it should already be activated.
117
	if ( file_exists( WPMU_PLUGIN_DIR . '/cmb2/init.php' ) ) {
118
		return WPMU_PLUGIN_DIR . '/cmb2/init.php';
119
	}
120
121
	// If we got here, we couldn't find CMB2.
122
	return '';
123
}
124
125
/**
126
 * Main initialization function.
127
 *
128
 * @since 1.1.0
129
 */
130
function init() {
131
	// Load all the required files.
132
	autoload_init();
133
134
	// If CMB2 was not loaded, deactivate ourself.
135
	if ( ! function_exists( 'cmb2_bootstrap' ) && function_exists( 'deactivate_plugins' ) ) {
136
		deactivate_plugins( plugin_basename( __FILE__ ) );
137
		return;
138
	}
139
140
	// Register activation hook.
141
	register_activation_hook( __FILE__, __NAMESPACE__ . '\\activate' );
142
143
	// Kick it off.
144
	add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' );
145
}
146
147
// Kick it off!
148
init();
149