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.
Completed
Push — master ( d4ff54...7bd111 )
by Brad
18:04
created

FooGallery_Pro_Paging::add_language_settings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
/**
3
 * FooGallery Pro Paging Class
4
 */
5
if ( ! class_exists( 'FooGallery_Pro_Paging' ) ) {
6
7
	class FooGallery_Pro_Paging {
8
9
		function __construct() {
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...
10
			add_filter( 'foogallery_gallery_template_paging_type_choices', array( $this, 'add_pro_paging_choices' ) );
11
12
			if ( is_admin() ) {
13
				//add a global setting to change the All filter
14
				add_filter( 'foogallery_admin_settings_override', array( $this, 'add_language_settings' ) );
15
			}
16
17
			//add the paging attributes to the gallery container
18
			add_filter( 'foogallery_build_container_data_options', array( $this, 'add_paging_data_options' ), 10, 3 );
19
		}
20
21
		/**
22
		 * Adds the presets that are available in the PRO version
23
		 *
24
		 * @param $choices
25
		 *
26
		 * @return mixed
27
		 */
28
		function add_pro_paging_choices( $choices ) {
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...
29
			$choices['pagination'] = __( 'Pagination', 'foogallery' );
30
			$choices['infinite'] = __( 'Infinite Scroll', 'foogallery' );
31
			$choices['loadMore'] = __( 'Load More', 'foogallery' );
32
			return $choices;
33
		}
34
35
		/**
36
		 * Add global setting to override the "All" text used in the filtering
37
		 * @param $settings
38
		 *
39
		 * @return mixed
40
		 */
41
		public function add_language_settings( $settings ) {
42
43
			$settings['settings'][] = array(
44
				'id'      => 'language_paging_loadmore_text',
45
				'title'   => __( 'Paging Load More Text', 'foogallery' ),
46
				'type'    => 'text',
47
				'default' => __( 'Load More', 'foogallery' ),
48
				'tab'     => 'language'
49
			);
50
51
			return $settings;
52
		}
53
54
		/**
55
		 * Add the required paging data options if needed
56
		 *
57
		 * @param $attributes array
58
		 * @param $gallery    FooGallery
59
		 *
60
		 * @return array
61
		 */
62
		function add_paging_data_options( $options, $gallery, $attributes ) {
0 ignored issues
show
Unused Code introduced by
The parameter $gallery is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $attributes is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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...
63
64
			$paging_loadmore_text_default = __( 'Load More', 'foogallery' );
65
			$paging_loadmore_text = foogallery_get_setting( 'language_paging_loadmore_text', $paging_loadmore_text_default );
66
			if ( empty( $paging_loadmore_text ) ) {
67
				$paging_loadmore_text = $paging_loadmore_text_default;
68
			}
69
			if ( $paging_loadmore_text_default !== $paging_loadmore_text ) {
70
				if ( !array_key_exists( 'il8n', $options ) ) {
71
					$options['il8n'] = array();
72
				}
73
74
				$options['il8n']['paging'] = array(
75
					'button' => $paging_loadmore_text
76
				);
77
			}
78
79
			return $options;
80
		}
81
	}
82
}