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.

FooGallery_Albums_Extension   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 93
rs 10
c 0
b 0
f 0
wmc 10
lcom 0
cbo 5

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 25 2
A includes() 0 14 2
A apply_album_defaults() 0 5 1
A register_myself() 0 4 1
A flush_rewrite_rules() 0 6 1
A include_album_language_settings() 0 11 1
A add_album_settings() 0 15 1
A uninstall() 0 3 1
1
<?php
2
if ( ! class_exists( 'FooGallery_Albums_Extension' ) ) {
3
4
	define( 'FOOGALLERY_ALBUM_PATH', plugin_dir_path( __FILE__ ) );
5
	define( 'FOOGALLERY_ALBUM_URL', plugin_dir_url( __FILE__ ) );
6
	define( 'FOOGALLERY_CPT_ALBUM', 'foogallery-album' );
7
	define( 'FOOGALLERY_ALBUM_META_GALLERIES', 'foogallery_album_galleries' );
8
	define( 'FOOGALLERY_ALBUM_META_TEMPLATE', 'foogallery_album_template' );
9
	define( 'FOOGALLERY_ALBUM_META_SORT', 'foogallery_album_sort' );
10
11
	class FooGallery_Albums_Extension {
12
13
		function __construct() {
14
			$this->includes();
15
16
			new FooGallery_Album_Rewrite_Rules();
17
			new FooGallery_Albums_PostTypes();
18
			new FooGallery_Album_Shortcodes();
19
20
			if ( is_admin() ) {
21
				new FooGallery_Albums_Admin_Columns();
22
				new FooGallery_Admin_Album_MetaBoxes();
23
24
				//add language settings
25
				add_filter( 'foogallery_admin_settings_override', array( $this, 'include_album_language_settings' ) );
26
27
				//add some global settings for albums
28
				add_filter( 'foogallery_admin_settings_override', array($this, 'add_album_settings' ) );
29
30
				add_action( 'foogallery_uninstall', array($this, 'uninstall' ) );
31
			}
32
			add_filter( 'foogallery_album_templates_files', array( $this, 'register_myself' ) );
33
			add_filter( 'foogallery_defaults', array( $this, 'apply_album_defaults' ) );
34
			add_action( 'foogallery_extension_activated-albums', array( $this, 'flush_rewrite_rules' ) );
35
			add_filter( 'foogallery_alter_album_template_field', array( $this, 'alter_gallery_template_field' ), 10, 2 );
36
			add_filter( 'foogallery_albums_supports_video-stack', '__return_true' );
37
		}
38
39
		function includes() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
			require_once( FOOGALLERY_ALBUM_PATH . 'functions.php' );
41
			require_once( FOOGALLERY_ALBUM_PATH . 'class-posttypes.php' );
42
			require_once( FOOGALLERY_ALBUM_PATH . 'class-foogallery-album.php' );
43
			require_once( FOOGALLERY_ALBUM_PATH . 'public/class-rewrite-rules.php' );
44
			require_once( FOOGALLERY_ALBUM_PATH . 'public/class-shortcodes.php' );
45
			require_once( FOOGALLERY_ALBUM_PATH . 'public/class-foogallery-album-template-loader.php' );
46
47
			if ( is_admin() ) {
48
				//only admin
49
				require_once( FOOGALLERY_ALBUM_PATH . 'admin/class-metaboxes.php' );
50
				require_once( FOOGALLERY_ALBUM_PATH . 'admin/class-columns.php' );
51
			}
52
		}
53
54
		function apply_album_defaults( $defaults ) {
55
			$defaults['album_template'] = 'default';
56
57
			return $defaults;
58
		}
59
60
		function register_myself( $extensions ) {
61
			$extensions[] = __FILE__;
62
			return $extensions;
63
		}
64
65
		function flush_rewrite_rules() {
66
			$rewrite = new FooGallery_Album_Rewrite_Rules();
67
			$rewrite->add_gallery_endpoint();
68
69
			flush_rewrite_rules();
70
		}
71
72
		function include_album_language_settings( $settings ) {
73
			$settings['settings'][] = array(
74
				'id'      => 'language_back_to_album_text',
75
				'title'   => __( 'Back To Album Text', 'foogallery' ),
76
				'type'    => 'text',
77
				'default' => __( '&laquo; back to album', 'foogallery' ),
78
				'tab'     => 'language'
79
			);
80
81
			return $settings;
82
		}
83
84
		function add_album_settings( $settings ) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
85
86
			$settings['tabs']['albums'] = __( 'Albums', 'foogallery' );
87
88
			$settings['settings'][] = array(
89
					'id'      => 'album_gallery_slug',
90
					'title'   => __( 'Gallery Slug', 'foogallery' ),
91
					'type'    => 'text',
92
					'default' => 'gallery',
93
					'desc'    => __( 'The slug that is used when generating gallery URL\'s for albums. PLEASE NOTE : if you change this value, you might need to save your Permalinks again.', 'foogallery' ),
94
					'tab'     => 'albums'
95
			);
96
97
			return $settings;
98
		}
99
100
		function uninstall() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
101
			foogallery_album_uninstall();
102
		}
103
	}
104
}
105