Completed
Pull Request — master (#605)
by Zack
05:45
created
includes/presets/register-default-templates.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Load default templates
16
-add_action( 'init', 'gravityview_register_default_templates', 11 );
16
+add_action('init', 'gravityview_register_default_templates', 11);
17 17
 
18 18
 /**
19 19
  * Registers the default templates
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
 	/** @define "GRAVITYVIEW_DIR" "../../" */
24 24
 
25 25
 	// The abstract class required by all template files.
26
-	require_once GRAVITYVIEW_DIR . 'includes/class-gravityview-template.php';
26
+	require_once GRAVITYVIEW_DIR.'includes/class-gravityview-template.php';
27 27
 
28
-	$path = GRAVITYVIEW_DIR . 'includes/presets/';
29
-	include_once $path . 'default-table/class-gravityview-default-template-table.php';
30
-	include_once $path . 'default-list/class-gravityview-default-template-list.php';
31
-	include_once $path . 'default-edit/class-gravityview-default-template-edit.php';
32
-	include_once $path . 'business-listings/class-gravityview-preset-business-listings.php';
33
-	include_once $path . 'business-data/class-gravityview-preset-business-data.php';
34
-	include_once $path . 'profiles/class-gravityview-preset-profiles.php';
35
-	include_once $path . 'staff-profiles/class-gravityview-preset-staff-profiles.php';
36
-	include_once $path . 'website-showcase/class-gravityview-preset-website-showcase.php';
37
-	include_once $path . 'issue-tracker/class-gravityview-preset-issue-tracker.php';
38
-	include_once $path . 'resume-board/class-gravityview-preset-resume-board.php';
39
-	include_once $path . 'job-board/class-gravityview-preset-job-board.php';
40
-	include_once $path . 'event-listings/class-gravityview-preset-event-listings.php';
28
+	$path = GRAVITYVIEW_DIR.'includes/presets/';
29
+	include_once $path.'default-table/class-gravityview-default-template-table.php';
30
+	include_once $path.'default-list/class-gravityview-default-template-list.php';
31
+	include_once $path.'default-edit/class-gravityview-default-template-edit.php';
32
+	include_once $path.'business-listings/class-gravityview-preset-business-listings.php';
33
+	include_once $path.'business-data/class-gravityview-preset-business-data.php';
34
+	include_once $path.'profiles/class-gravityview-preset-profiles.php';
35
+	include_once $path.'staff-profiles/class-gravityview-preset-staff-profiles.php';
36
+	include_once $path.'website-showcase/class-gravityview-preset-website-showcase.php';
37
+	include_once $path.'issue-tracker/class-gravityview-preset-issue-tracker.php';
38
+	include_once $path.'resume-board/class-gravityview-preset-resume-board.php';
39
+	include_once $path.'job-board/class-gravityview-preset-job-board.php';
40
+	include_once $path.'event-listings/class-gravityview-preset-event-listings.php';
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
includes/presets/resume-board/class-gravityview-preset-resume-board.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@
 block discarded – undo
21 21
 		$settings = array(
22 22
 			'slug'          => 'table',
23 23
 			'type'          => 'preset',
24
-			'label'         => __( 'Resume Board', 'gravityview' ),
25
-			'description'   => __( 'Allow job-seekers to post their resumes.', 'gravityview' ),
26
-			'logo'          => plugins_url( 'includes/presets/resume-board/logo-resume-board.png', GRAVITYVIEW_FILE ),
24
+			'label'         => __('Resume Board', 'gravityview'),
25
+			'description'   => __('Allow job-seekers to post their resumes.', 'gravityview'),
26
+			'logo'          => plugins_url('includes/presets/resume-board/logo-resume-board.png', GRAVITYVIEW_FILE),
27 27
 			'preview'       => 'http://demo.gravityview.co/blog/view/resume-board/',
28
-			'preset_form'   => GRAVITYVIEW_DIR . 'includes/presets/resume-board/form-resume-board.xml',
29
-			'preset_fields' => GRAVITYVIEW_DIR . 'includes/presets/resume-board/fields-resume-board.xml'
28
+			'preset_form'   => GRAVITYVIEW_DIR.'includes/presets/resume-board/form-resume-board.xml',
29
+			'preset_fields' => GRAVITYVIEW_DIR.'includes/presets/resume-board/fields-resume-board.xml'
30 30
 		);
31 31
 
32
-		parent::__construct( $id, $settings );
32
+		parent::__construct($id, $settings);
33 33
 
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
includes/presets/staff-profiles/class-gravityview-preset-staff-profiles.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@
 block discarded – undo
21 21
 		$settings = array(
22 22
 			'slug'          => 'list',
23 23
 			'type'          => 'preset',
24
-			'label'         => __( 'Staff Profiles', 'gravityview' ),
25
-			'description'   => __( 'List members of your team.', 'gravityview' ),
26
-			'logo'          => plugins_url( 'includes/presets/staff-profiles/logo-staff-profiles.png', GRAVITYVIEW_FILE ),
24
+			'label'         => __('Staff Profiles', 'gravityview'),
25
+			'description'   => __('List members of your team.', 'gravityview'),
26
+			'logo'          => plugins_url('includes/presets/staff-profiles/logo-staff-profiles.png', GRAVITYVIEW_FILE),
27 27
 			'preview'       => 'http://demo.gravityview.co/blog/view/staff-profiles/',
28
-			'preset_form'   => GRAVITYVIEW_DIR . 'includes/presets/staff-profiles/form-staff-profiles.xml',
29
-			'preset_fields' => GRAVITYVIEW_DIR . 'includes/presets/staff-profiles/fields-staff-profiles.xml',
28
+			'preset_form'   => GRAVITYVIEW_DIR.'includes/presets/staff-profiles/form-staff-profiles.xml',
29
+			'preset_fields' => GRAVITYVIEW_DIR.'includes/presets/staff-profiles/fields-staff-profiles.xml',
30 30
 		);
31 31
 
32
-		parent::__construct( $id, $settings );
32
+		parent::__construct($id, $settings);
33 33
 
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
presets/website-showcase/class-gravityview-preset-website-showcase.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@
 block discarded – undo
21 21
 		$settings = array(
22 22
 			'slug'          => 'list',
23 23
 			'type'          => 'preset',
24
-			'label'         => __( 'Website Showcase', 'gravityview' ),
25
-			'description'   => __( 'Feature submitted websites with screenshots.', 'gravityview' ),
26
-			'logo'          => plugins_url( 'includes/presets/website-showcase/logo-website-showcase.png', GRAVITYVIEW_FILE ),
24
+			'label'         => __('Website Showcase', 'gravityview'),
25
+			'description'   => __('Feature submitted websites with screenshots.', 'gravityview'),
26
+			'logo'          => plugins_url('includes/presets/website-showcase/logo-website-showcase.png', GRAVITYVIEW_FILE),
27 27
 			'preview'       => 'http://demo.gravityview.co/blog/view/website-showcase/',
28
-			'preset_form'   => GRAVITYVIEW_DIR . 'includes/presets/website-showcase/form-website-showcase.xml',
29
-			'preset_fields' => GRAVITYVIEW_DIR . 'includes/presets/website-showcase/fields-website-showcase.xml'
28
+			'preset_form'   => GRAVITYVIEW_DIR.'includes/presets/website-showcase/form-website-showcase.xml',
29
+			'preset_fields' => GRAVITYVIEW_DIR.'includes/presets/website-showcase/fields-website-showcase.xml'
30 30
 		);
31 31
 
32
-		parent::__construct( $id, $settings );
32
+		parent::__construct($id, $settings);
33 33
 
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-custom-content.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 	function __construct() {
19 19
 
20
-		$this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' );
20
+		$this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview');
21 21
 
22 22
 		$default_values = array(
23 23
 			'header' => 1,
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 		$settings = array(
28 28
 			'content' => array(
29 29
 				'type' => 'textarea',
30
-				'label' => __( 'Custom Content', 'gravityview' ),
31
-				'desc' => __( 'Enter text or HTML. Also supports shortcodes.', 'gravityview' ),
30
+				'label' => __('Custom Content', 'gravityview'),
31
+				'desc' => __('Enter text or HTML. Also supports shortcodes.', 'gravityview'),
32 32
 				'value' => '',
33 33
 				'class'	=> 'code',
34 34
 				'merge_tags' => false,
@@ -36,58 +36,58 @@  discard block
 block discarded – undo
36 36
 			),
37 37
 			'wpautop' => array(
38 38
 				'type' => 'checkbox',
39
-				'label' => __( 'Automatically add paragraphs to content', 'gravityview' ),
40
-				'tooltip' => __( 'Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview' ),
39
+				'label' => __('Automatically add paragraphs to content', 'gravityview'),
40
+				'tooltip' => __('Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview'),
41 41
 				'value' => '',
42 42
 			),
43 43
 		);
44 44
 
45
-		parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings );
45
+		parent::__construct(__('Custom Content', 'gravityview'), 'custom_content', $default_values, $settings);
46 46
 	}
47 47
 
48
-	public function render_frontend( $widget_args, $content = '', $context = '') {
48
+	public function render_frontend($widget_args, $content = '', $context = '') {
49 49
 
50
-		if( !$this->pre_render_frontend() ) {
50
+		if (!$this->pre_render_frontend()) {
51 51
 			return;
52 52
 		}
53 53
 
54
-		if( !empty( $widget_args['title'] ) ) {
54
+		if (!empty($widget_args['title'])) {
55 55
 			echo $widget_args['title'];
56 56
 		}
57 57
 
58 58
 
59 59
 		// Make sure the class is loaded in DataTables
60
-		if( !class_exists( 'GFFormDisplay' ) ) {
61
-			include_once( GFCommon::get_base_path() . '/form_display.php' );
60
+		if (!class_exists('GFFormDisplay')) {
61
+			include_once(GFCommon::get_base_path().'/form_display.php');
62 62
 		}
63 63
 
64
-		$widget_args['content'] = trim( rtrim( $widget_args['content'] ) );
64
+		$widget_args['content'] = trim(rtrim($widget_args['content']));
65 65
 
66 66
 		// No custom content
67
-		if( empty( $widget_args['content'] ) ) {
68
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) );
67
+		if (empty($widget_args['content'])) {
68
+			do_action('gravityview_log_debug', sprintf('%s[render_frontend]: No content.', get_class($this)));
69 69
 			return;
70 70
 		}
71 71
 
72 72
 		// Add paragraphs?
73
-		if( !empty( $widget_args['wpautop'] ) ) {
74
-			$widget_args['content'] = wpautop( $widget_args['content'] );
73
+		if (!empty($widget_args['wpautop'])) {
74
+			$widget_args['content'] = wpautop($widget_args['content']);
75 75
 		}
76 76
 
77 77
 		$content = $widget_args['content'];
78 78
 
79
-		$content = GravityView_Merge_Tags::replace_variables( $content );
79
+		$content = GravityView_Merge_Tags::replace_variables($content);
80 80
 
81 81
 		// Enqueue scripts needed for Gravity Form display, if form shortcode exists.
82 82
 		// Also runs `do_shortcode()`
83
-		$content = GFCommon::gform_do_shortcode( $content );
83
+		$content = GFCommon::gform_do_shortcode($content);
84 84
 
85 85
 
86 86
 		// Add custom class
87
-		$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
88
-		$class = gravityview_sanitize_html_class( $class );
87
+		$class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : '';
88
+		$class = gravityview_sanitize_html_class($class);
89 89
 
90
-		echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>';
90
+		echo '<div class="gv-widget-custom-content '.$class.'">'.$content.'</div>';
91 91
 
92 92
 	}
93 93
 
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-links.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,38 +11,38 @@  discard block
 block discarded – undo
11 11
 
12 12
 	function __construct() {
13 13
 
14
-		$this->widget_description = __('Links to multiple pages of results.', 'gravityview' );
14
+		$this->widget_description = __('Links to multiple pages of results.', 'gravityview');
15 15
 
16
-		$default_values = array( 'header' => 1, 'footer' => 1 );
17
-		$settings = array( 'show_all' => array(
16
+		$default_values = array('header' => 1, 'footer' => 1);
17
+		$settings = array('show_all' => array(
18 18
 			'type' => 'checkbox',
19
-			'label' => __( 'Show each page number', 'gravityview' ),
19
+			'label' => __('Show each page number', 'gravityview'),
20 20
 			'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'),
21 21
 			'value' => false
22 22
 		));
23
-		parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings );
23
+		parent::__construct(__('Page Links', 'gravityview'), 'page_links', $default_values, $settings);
24 24
 
25 25
 	}
26 26
 
27
-	public function render_frontend( $widget_args, $content = '', $context = '') {
27
+	public function render_frontend($widget_args, $content = '', $context = '') {
28 28
 		$gravityview_view = GravityView_View::getInstance();
29 29
 
30
-		if( !$this->pre_render_frontend() ) {
30
+		if (!$this->pre_render_frontend()) {
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		$page_size = $gravityview_view->paging['page_size'];
35 35
 		$total = $gravityview_view->total_entries;
36 36
 
37
-		$atts = shortcode_atts( array(
38
-			'show_all' => !empty( $this->settings['show_all']['default'] ),
39
-		), $widget_args, 'gravityview_widget_page_links' );
37
+		$atts = shortcode_atts(array(
38
+			'show_all' => !empty($this->settings['show_all']['default']),
39
+		), $widget_args, 'gravityview_widget_page_links');
40 40
 
41 41
 		// displaying info
42
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
42
+		$curr_page = empty($_GET['pagenum']) ? 1 : intval($_GET['pagenum']);
43 43
 
44 44
 		$page_link_args = array(
45
-			'base' => add_query_arg('pagenum','%#%', gv_directory_link() ),
45
+			'base' => add_query_arg('pagenum', '%#%', gv_directory_link()),
46 46
 			'format' => '&pagenum=%#%',
47 47
 			'add_args' => array(), //
48 48
 			'prev_text' => '&laquo;',
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			'type' => 'list',
51 51
 			'end_size' => 1,
52 52
 			'mid_size' => 2,
53
-			'total' => empty( $page_size ) ? 0 : ceil( $total / $page_size ),
53
+			'total' => empty($page_size) ? 0 : ceil($total / $page_size),
54 54
 			'current' => $curr_page,
55
-			'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice
55
+			'show_all' => !empty($atts['show_all']), // to be available at backoffice
56 56
 		);
57 57
 
58 58
 		/**
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 		 * @since 1.1.4
61 61
 		 * @param array  $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/)
62 62
 		 */
63
-		$page_link_args = apply_filters('gravityview_page_links_args', $page_link_args );
63
+		$page_link_args = apply_filters('gravityview_page_links_args', $page_link_args);
64 64
 
65
-		$page_links = paginate_links( $page_link_args );
65
+		$page_links = paginate_links($page_link_args);
66 66
 
67
-		if( !empty( $page_links )) {
68
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
69
-			$class = gravityview_sanitize_html_class( $class );
70
-			echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>';
67
+		if (!empty($page_links)) {
68
+			$class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : '';
69
+			$class = gravityview_sanitize_html_class($class);
70
+			echo '<div class="gv-widget-page-links '.$class.'">'.$page_links.'</div>';
71 71
 		} else {
72
-			do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' );
72
+			do_action('gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.');
73 73
 		}
74 74
 
75 75
 	}
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-pagination-info.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	function __construct() {
18 18
 
19
-		$this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' );
19
+		$this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview');
20 20
 
21 21
 		$default_values = array(
22 22
 			'header' => 1,
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$settings = array();
27 27
 
28
-		parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings );
28
+		parent::__construct(__('Show Pagination Info', 'gravityview'), 'page_info', $default_values, $settings);
29 29
 	}
30 30
 
31
-	public function render_frontend( $widget_args, $content = '', $context = '') {
31
+	public function render_frontend($widget_args, $content = '', $context = '') {
32 32
 		$gravityview_view = GravityView_View::getInstance();
33 33
 
34
-		if( !$this->pre_render_frontend() ) {
34
+		if (!$this->pre_render_frontend()) {
35 35
 			return;
36 36
 		}
37 37
 
38
-		if( !empty( $widget_args['title'] ) ) {
38
+		if (!empty($widget_args['title'])) {
39 39
 			echo $widget_args['title'];
40 40
 		}
41 41
 
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 
46 46
 		$output = '';
47 47
 
48
-		if( ! empty( $pagination_counts ) ) {
48
+		if (!empty($pagination_counts)) {
49 49
 
50 50
 			$first = $pagination_counts['first'];
51 51
 			$last = $pagination_counts['last'];
52 52
 			$total = $pagination_counts['total'];
53 53
 
54
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
55
-			$class = gravityview_sanitize_html_class( $class );
54
+			$class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : '';
55
+			$class = gravityview_sanitize_html_class($class);
56 56
 
57
-			$output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>';
57
+			$output = '<div class="gv-widget-pagination '.$class.'"><p>'.sprintf(__('Displaying %1$s - %2$s of %3$s', 'gravityview'), number_format_i18n($first), number_format_i18n($last), number_format_i18n($total)).'</p></div>';
58 58
 		}
59 59
 
60 60
 		/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		 * @param int $last Last entry #
65 65
 		 * @param int $total Total entries #
66 66
 		 */
67
-		echo apply_filters( 'gravityview_pagination_output', $output, $first, $last, $total );
67
+		echo apply_filters('gravityview_pagination_output', $output, $first, $last, $total);
68 68
 
69 69
 	}
70 70
 
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -51,37 +51,37 @@  discard block
 block discarded – undo
51 51
 	// hold widget View options
52 52
 	private $widget_options;
53 53
 
54
-	function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) {
54
+	function __construct($widget_label, $widget_id, $defaults = array(), $settings = array()) {
55 55
 
56 56
 
57 57
 		/**
58 58
 		 * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name
59 59
 		 * @var string
60 60
 		 */
61
-		$this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name;
61
+		$this->shortcode_name = !isset($this->shortcode_name) ? strtolower(get_class($this)) : $this->shortcode_name;
62 62
 
63 63
 		$this->widget_label = $widget_label;
64 64
 		$this->widget_id = $widget_id;
65
-		$this->defaults = array_merge( array( 'header' => 0, 'footer' => 0 ), $defaults );
65
+		$this->defaults = array_merge(array('header' => 0, 'footer' => 0), $defaults);
66 66
 
67 67
 		// Make sure every widget has a title, even if empty
68 68
 		$this->settings = $this->get_default_settings();
69
-		$this->settings = wp_parse_args( $settings, $this->settings );
69
+		$this->settings = wp_parse_args($settings, $this->settings);
70 70
 
71 71
 		// register widgets to be listed in the View Configuration
72
-		add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') );
72
+		add_filter('gravityview_register_directory_widgets', array($this, 'register_widget'));
73 73
 
74 74
 		// widget options
75
-		add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 );
75
+		add_filter('gravityview_template_widget_options', array($this, 'assign_widget_options'), 10, 3);
76 76
 
77 77
 		// frontend logic
78
-		add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 );
78
+		add_action("gravityview_render_widget_{$widget_id}", array($this, 'render_frontend'), 10, 1);
79 79
 
80 80
 		// register shortcodes
81
-		add_action( 'wp', array( $this, 'add_shortcode') );
81
+		add_action('wp', array($this, 'add_shortcode'));
82 82
 
83 83
 		// Use shortcodes in text widgets.
84
-		add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) );
84
+		add_filter('widget_text', array($this, 'maybe_do_shortcode'));
85 85
 	}
86 86
 
87 87
 
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 		 * @param boolean $enable_custom_class False by default. Return true if you want to enable.
100 100
 		 * @param GravityView_Widget $this Current instance of GravityView_Widget
101 101
 		 */
102
-		$enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this );
102
+		$enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this);
103 103
 
104
-		if( $enable_custom_class ) {
104
+		if ($enable_custom_class) {
105 105
 
106 106
 			$settings['custom_class'] = array(
107 107
 				'type' => 'text',
108
-				'label' => __( 'Custom CSS Class:', 'gravityview' ),
109
-				'desc' => __( 'This class will be added to the widget container', 'gravityview'),
108
+				'label' => __('Custom CSS Class:', 'gravityview'),
109
+				'desc' => __('This class will be added to the widget container', 'gravityview'),
110 110
 				'value' => '',
111 111
 				'merge_tags' => true,
112 112
 			);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return array|null   Settings array; NULL if not set
129 129
 	 */
130 130
 	public function get_settings() {
131
-		return !empty( $this->settings ) ? $this->settings : NULL;
131
+		return !empty($this->settings) ? $this->settings : NULL;
132 132
 	}
133 133
 
134 134
 	/**
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * @param  string $key Key for the setting
137 137
 	 * @return mixed|null      Value of the setting; NULL if not set
138 138
 	 */
139
-	public function get_setting( $key ) {
139
+	public function get_setting($key) {
140 140
 		$setting = NULL;
141 141
 
142
-		if( isset( $this->settings ) && is_array( $this->settings ) ) {
143
-			$setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL;
142
+		if (isset($this->settings) && is_array($this->settings)) {
143
+			$setting = isset($this->settings[$key]) ? $this->settings[$key] : NULL;
144 144
 		}
145 145
 
146 146
 		return $setting;
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 	 * @param  null|WP_Widget Empty if not called by WP_Widget, or a WP_Widget instance
153 153
 	 * @return string         Widget text
154 154
 	 */
155
-	function maybe_do_shortcode( $text, $widget = NULL ) {
155
+	function maybe_do_shortcode($text, $widget = NULL) {
156 156
 
157
-		if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) {
158
-			return do_shortcode( $text );
157
+		if (!empty($this->shortcode_name) && has_shortcode($text, $this->shortcode_name)) {
158
+			return do_shortcode($text);
159 159
 		}
160 160
 
161 161
 		return $text;
162 162
 	}
163 163
 
164
-	function render_shortcode( $atts, $content = '', $context = '' ) {
164
+	function render_shortcode($atts, $content = '', $context = '') {
165 165
 
166 166
 		ob_start();
167 167
 
168
-		$this->render_frontend( $atts, $content, $context );
168
+		$this->render_frontend($atts, $content, $context);
169 169
 
170 170
 		return ob_get_clean();
171 171
 	}
@@ -173,31 +173,31 @@  discard block
 block discarded – undo
173 173
 	/**
174 174
 	 * Add $this->shortcode_name shortcode to output self::render_frontend()
175 175
 	 */
176
-	function add_shortcode( $run_on_singular = true ) {
176
+	function add_shortcode($run_on_singular = true) {
177 177
 		global $post;
178 178
 
179
-		if( GravityView_Plugin::is_admin() ) { return; }
179
+		if (GravityView_Plugin::is_admin()) { return; }
180 180
 
181
-		if( empty( $this->shortcode_name ) ) { return; }
181
+		if (empty($this->shortcode_name)) { return; }
182 182
 
183 183
 		// If the widget shouldn't output on single entries, don't show it
184
-		if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) {
185
-			do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) );
184
+		if (empty($this->show_on_single) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry()) {
185
+			do_action('gravityview_log_debug', sprintf('%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)));
186 186
 
187
-			add_shortcode( $this->shortcode_name, '__return_null' );
187
+			add_shortcode($this->shortcode_name, '__return_null');
188 188
 			return;
189 189
 		}
190 190
 
191 191
 
192
-		if( !has_gravityview_shortcode( $post ) ) {
192
+		if (!has_gravityview_shortcode($post)) {
193 193
 
194
-			do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) );
194
+			do_action('gravityview_log_debug', sprintf('%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)));
195 195
 
196
-			add_shortcode( $this->shortcode_name, '__return_null' );
196
+			add_shortcode($this->shortcode_name, '__return_null');
197 197
 			return;
198 198
 		}
199 199
 
200
-		add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') );
200
+		add_shortcode($this->shortcode_name, array($this, 'render_shortcode'));
201 201
 	}
202 202
 
203 203
 	/**
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 	 * @param  array $widgets
206 206
 	 * @return array $widgets
207 207
 	 */
208
-	function register_widget( $widgets ) {
209
-		$widgets[ $this->widget_id ] = array(
210
-			'label' => $this->widget_label ,
208
+	function register_widget($widgets) {
209
+		$widgets[$this->widget_id] = array(
210
+			'label' => $this->widget_label,
211 211
 			'description' => $this->widget_description,
212 212
 			'subtitle' => $this->widget_subtitle,
213 213
 		);
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 	 * @param string $template (default: '')
223 223
 	 * @return array
224 224
 	 */
225
-	public function assign_widget_options( $options = array(), $template = '', $widget = '' ) {
225
+	public function assign_widget_options($options = array(), $template = '', $widget = '') {
226 226
 
227
-		if( $this->widget_id === $widget ) {
228
-			$options = array_merge( $options, $this->settings );
227
+		if ($this->widget_id === $widget) {
228
+			$options = array_merge($options, $this->settings);
229 229
 		}
230 230
 
231 231
 		return $options;
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	public function render_frontend( $widget_args, $content = '', $context = '') {
240
+	public function render_frontend($widget_args, $content = '', $context = '') {
241 241
 		// to be defined by child class
242
-		if( !$this->pre_render_frontend() ) {
242
+		if (!$this->pre_render_frontend()) {
243 243
 			return;
244 244
 		}
245 245
 	}
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 	public function pre_render_frontend() {
252 252
 		$gravityview_view = GravityView_View::getInstance();
253 253
 
254
-		if( empty( $gravityview_view ) ) {
255
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) );
254
+		if (empty($gravityview_view)) {
255
+			do_action('gravityview_log_debug', sprintf('%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)));
256 256
 			return false;
257 257
 		}
258 258
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 		 * @param boolean $hide_until_searched Hide until search?
262 262
 		 * @param GravityView_Widget $this Widget instance
263 263
 		 */
264
-		$hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this );
264
+		$hide_until_search = apply_filters('gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this);
265 265
 
266
-		if( $hide_until_search ) {
267
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) );
266
+		if ($hide_until_search) {
267
+			do_action('gravityview_log_debug', sprintf('%s[render_frontend]: Hide View data until search is performed', get_class($this)));
268 268
 			return false;
269 269
 		}
270 270
 
Please login to merge, or discard this patch.
includes/widgets/poll/class-gravityview-widget-poll.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	function __construct() {
23 23
 
24
-		$this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview' );
24
+		$this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview');
25 25
 
26
-		$this->widget_subtitle = sprintf( _x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' );
26
+		$this->widget_subtitle = sprintf(_x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview'), '<em>', '</em>');
27 27
 
28 28
 		$default_values = array(
29 29
 			'header' => 1,
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 				'label' => __('Display Percentages', 'gravityview'),
36 36
 				'type' => 'checkbox',
37 37
 				'value' => true,
38
-				'tooltip' => __( 'Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
38
+				'tooltip' => __('Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview'),
39 39
 			),
40 40
 			'counts' => array(
41 41
 				'label' => __('Display Counts', 'gravityview'),
42 42
 				'type' => 'checkbox',
43 43
 				'value' => true,
44
-				'tooltip' => __( 'Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview' ),
44
+				'tooltip' => __('Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview'),
45 45
 			),
46 46
 			'style' => array(
47 47
 				'type' => 'select',
48 48
 				'label' => __('Style', 'gravityview'),
49
-				'tooltip' => __( 'The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview' ),
49
+				'tooltip' => __('The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview'),
50 50
 				'value' => 'green',
51 51
 				'choices' => array(
52 52
 					'green' => __('Green', 'gravityview'),
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 			)
58 58
 		);
59 59
 
60
-		parent::__construct( __( 'Poll Results', 'gravityview' ) , 'poll', $default_values, $settings );
60
+		parent::__construct(__('Poll Results', 'gravityview'), 'poll', $default_values, $settings);
61 61
 
62 62
 		// frontend - add template path
63
-		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
63
+		add_filter('gravityview_template_paths', array($this, 'add_template_path'));
64 64
 
65 65
 	}
66 66
 
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 	 * @since 1.8
70 70
 	 * @param array $file_paths List of template paths ordered
71 71
 	 */
72
-	function add_template_path( $file_paths ) {
72
+	function add_template_path($file_paths) {
73 73
 
74 74
 		$index = 126;
75 75
 
76 76
 		// Index 100 is the default GravityView template path.
77
-		$file_paths[ $index ] = plugin_dir_path( __FILE__ ) . 'templates/';
77
+		$file_paths[$index] = plugin_dir_path(__FILE__).'templates/';
78 78
 
79 79
 		return $file_paths;
80 80
 	}
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 		$GFPolls = GFPolls::get_instance();
90 90
 
91
-		wp_enqueue_script('gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array('jquery'), $GFPolls->_version);
91
+		wp_enqueue_script('gpoll_js', $GFPolls->get_base_url().'/js/gpoll.js', array('jquery'), $GFPolls->_version);
92 92
 
93 93
 		$GFPolls->localize_scripts();
94 94
 
95
-		wp_enqueue_style('gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version);
95
+		wp_enqueue_style('gpoll_css', $GFPolls->get_base_url().'/css/gpoll.css', null, $GFPolls->_version);
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,20 +102,20 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function pre_render_frontend() {
104 104
 
105
-		if( !class_exists('GFPolls') ) {
105
+		if (!class_exists('GFPolls')) {
106 106
 
107 107
 			$return = false;
108 108
 
109
-			do_action( 'gravityview_log_error', 'Poll Widget not displayed; the Poll Addon is not loaded' );
109
+			do_action('gravityview_log_error', 'Poll Widget not displayed; the Poll Addon is not loaded');
110 110
 
111 111
 		} else {
112 112
 
113 113
 			$return = parent::pre_render_frontend();
114 114
 
115
-			$poll_fields = GFCommon::get_fields_by_type( GravityView_View::getInstance()->getForm(), array( 'poll' ) );
115
+			$poll_fields = GFCommon::get_fields_by_type(GravityView_View::getInstance()->getForm(), array('poll'));
116 116
 
117
-			if ( empty ( $poll_fields ) ) {
118
-				do_action( 'gravityview_log_error', 'Poll Widget not displayed; there are no poll fields for the form' );
117
+			if (empty ($poll_fields)) {
118
+				do_action('gravityview_log_error', 'Poll Widget not displayed; there are no poll fields for the form');
119 119
 				$return = false;
120 120
 			}
121 121
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return array Final poll widget settings
132 132
 	 */
133
-	function get_frontend_settings( $widget_settings ) {
133
+	function get_frontend_settings($widget_settings) {
134 134
 
135 135
 		$default_settings = array(
136 136
 			'field' => 0,
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 			'counts' => true,
140 140
 		);
141 141
 
142
-		$settings = wp_parse_args( $widget_settings, $default_settings );
142
+		$settings = wp_parse_args($widget_settings, $default_settings);
143 143
 
144 144
 		/**
145 145
 		 * @filter `gravityview/widget/poll/settings` Modify display settings for the poll widget
146 146
 		 * @since 1.8
147 147
 		 * @param array $settings Settings with `field`, `style`, `percentages` and `counts` keys
148 148
 		 */
149
-		$settings = apply_filters( 'gravityview/widget/poll/settings', $settings );
149
+		$settings = apply_filters('gravityview/widget/poll/settings', $settings);
150 150
 
151 151
 		return $settings;
152 152
 	}
@@ -158,29 +158,29 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @since 1.8
160 160
 	 */
161
-	public function render_frontend( $widget_args, $content = '', $context = '') {
161
+	public function render_frontend($widget_args, $content = '', $context = '') {
162 162
 
163
-		if( !$this->pre_render_frontend() ) {
163
+		if (!$this->pre_render_frontend()) {
164 164
 			return;
165 165
 		}
166 166
 
167 167
 		// Make sure the class is loaded in DataTables
168
-		if( !class_exists( 'GFFormDisplay' ) ) {
169
-			include_once( GFCommon::get_base_path() . '/form_display.php' );
168
+		if (!class_exists('GFFormDisplay')) {
169
+			include_once(GFCommon::get_base_path().'/form_display.php');
170 170
 		}
171 171
 
172 172
 		$this->enqueue_scripts_and_styles();
173 173
 
174
-		$settings = $this->get_frontend_settings( $widget_args );
174
+		$settings = $this->get_frontend_settings($widget_args);
175 175
 
176
-		$percentages = empty( $settings['percentages'] ) ? 'false' : 'true';
176
+		$percentages = empty($settings['percentages']) ? 'false' : 'true';
177 177
 
178
-		$counts = empty( $settings['counts'] ) ? 'false' : 'true';
178
+		$counts = empty($settings['counts']) ? 'false' : 'true';
179 179
 
180
-		if( !empty( $settings['field'] ) ) {
181
-			$merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts );
180
+		if (!empty($settings['field'])) {
181
+			$merge_tag = sprintf('{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts);
182 182
 		} else {
183
-			$merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts );
183
+			$merge_tag = sprintf('{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts);
184 184
 		}
185 185
 
186 186
 		$gravityview_view = GravityView_View::getInstance();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$gravityview_view->poll_settings = $settings;
191 191
 
192
-		$gravityview_view->render('widget', 'poll', false );
192
+		$gravityview_view->render('widget', 'poll', false);
193 193
 
194 194
 	}
195 195
 
Please login to merge, or discard this patch.