| @@ -227,7 +227,7 @@ | ||
| 227 | 227 | |
| 228 | 228 |  		if($args['type']=='image'){ | 
| 229 | 229 | $output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=".esc_attr($args['location'])."&maptype=".esc_attr($args['maptype'])."&zoom=".esc_attr($args['zoom'])."&size=".esc_attr($args['static_width'])."x".esc_attr($args['static_height'])."&key=".esc_attr($args['api_key'])."' />"; | 
| 230 | -		}else{ | |
| 230 | +		} else{ | |
| 231 | 231 | $output .= "<iframe width='".esc_attr($args['width'])."' height='".esc_attr($args['height'])."' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/".esc_attr($args['type'])."?q=".esc_attr($args['location'])."&maptype=".esc_attr($args['maptype'])."&zoom=".esc_attr($args['zoom'])."&key=".esc_attr($args['api_key'])."' ></iframe> "; | 
| 232 | 232 | } | 
| 233 | 233 | |
| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | // Exit if accessed directly | 
| 3 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit; | |
| 5 | +} | |
| 4 | 6 |  if(!class_exists('Ayecode_Addons')) { | 
| 5 | 7 | |
| 6 | 8 | abstract class Ayecode_Addons | 
| @@ -49,9 +49,9 @@ discard block | ||
| 49 | 49 |  			if($type=='a'){ | 
| 50 | 50 | $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; | 
| 51 | 51 | $output .= '<a href="' . $args['href'] . '"'.$new_window; | 
| 52 | -			}elseif($type=='badge'){ | |
| 52 | +			} elseif($type=='badge'){ | |
| 53 | 53 | $output .= '<span '; | 
| 54 | -			}else{ | |
| 54 | +			} else{ | |
| 55 | 55 | $output .= '<button type="' . $type . '" '; | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -118,9 +118,9 @@ discard block | ||
| 118 | 118 | // close | 
| 119 | 119 |  			if($type=='a'){ | 
| 120 | 120 | $output .= '</a>'; | 
| 121 | -			}elseif($type=='badge'){ | |
| 121 | +			} elseif($type=='badge'){ | |
| 122 | 122 | $output .= '</span>'; | 
| 123 | -			}else{ | |
| 123 | +			} else{ | |
| 124 | 124 | $output .= '</button>'; | 
| 125 | 125 | } | 
| 126 | 126 | |
| @@ -1,7 +1,7 @@ discard block | ||
| 1 | -<?php | |
| 1 | + <?php | |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | - exit; // Exit if accessed directly | |
| 3 | +    if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit; // Exit if accessed directly | |
| 5 | 5 | } | 
| 6 | 6 | |
| 7 | 7 | /** | 
| @@ -9,145 +9,145 @@ discard block | ||
| 9 | 9 | * | 
| 10 | 10 | * @since 1.0.0 | 
| 11 | 11 | */ | 
| 12 | -class AUI_Component_Button { | |
| 12 | +    class AUI_Component_Button { | |
| 13 | 13 | |
| 14 | - /** | |
| 14 | + /** | |
| 15 | 15 | * Build the component. | 
| 16 | 16 | * | 
| 17 | 17 | * @param array $args | 
| 18 | 18 | * | 
| 19 | 19 | * @return string The rendered component. | 
| 20 | 20 | */ | 
| 21 | -	public static function get($args = array()){ | |
| 22 | - $defaults = array( | |
| 23 | - 'type' => 'a', // a, button, badge | |
| 24 | - 'href' => '#', | |
| 25 | - 'new_window' => false, | |
| 26 | - 'class' => 'btn btn-primary', | |
| 27 | - 'id' => '', | |
| 28 | - 'title' => '', | |
| 29 | - 'value' => '', | |
| 30 | - 'content' => '', | |
| 31 | - 'icon' => '', | |
| 32 | - 'hover_content' => '', | |
| 33 | - 'hover_icon' => '', | |
| 34 | - 'new_line_after' => true, | |
| 35 | - 'no_wrap' => true, | |
| 36 | - 'onclick' => '', | |
| 37 | - 'style' => '', | |
| 38 | - 'extra_attributes' => array(), // an array of extra attributes | |
| 39 | - 'icon_extra_attributes' => array() // an array of icon extra attributes | |
| 40 | - ); | |
| 41 | - | |
| 42 | - /** | |
| 21 | +	    public static function get($args = array()){ | |
| 22 | + $defaults = array( | |
| 23 | + 'type' => 'a', // a, button, badge | |
| 24 | + 'href' => '#', | |
| 25 | + 'new_window' => false, | |
| 26 | + 'class' => 'btn btn-primary', | |
| 27 | + 'id' => '', | |
| 28 | + 'title' => '', | |
| 29 | + 'value' => '', | |
| 30 | + 'content' => '', | |
| 31 | + 'icon' => '', | |
| 32 | + 'hover_content' => '', | |
| 33 | + 'hover_icon' => '', | |
| 34 | + 'new_line_after' => true, | |
| 35 | + 'no_wrap' => true, | |
| 36 | + 'onclick' => '', | |
| 37 | + 'style' => '', | |
| 38 | + 'extra_attributes' => array(), // an array of extra attributes | |
| 39 | + 'icon_extra_attributes' => array() // an array of icon extra attributes | |
| 40 | + ); | |
| 41 | + | |
| 42 | + /** | |
| 43 | 43 | * Parse incoming $args into an array and merge it with $defaults | 
| 44 | 44 | */ | 
| 45 | - $args = wp_parse_args( $args, $defaults ); | |
| 46 | - $output = ''; | |
| 47 | -		if ( ! empty( $args['type'] ) ) { | |
| 48 | - $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; | |
| 49 | - | |
| 50 | - // open/type | |
| 51 | -			if($type=='a'){ | |
| 52 | - $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; | |
| 53 | - $output .= '<a href="' . $args['href'] . '"'.$new_window; | |
| 54 | -			}elseif($type=='badge'){ | |
| 55 | - $output .= '<span '; | |
| 56 | -			}else{ | |
| 57 | - $output .= '<button type="' . $type . '" '; | |
| 58 | - } | |
| 59 | - | |
| 60 | - // name | |
| 61 | -			if(!empty($args['name'])){ | |
| 62 | - $output .= AUI_Component_Helper::name($args['name']); | |
| 63 | - } | |
| 64 | - | |
| 65 | - // id | |
| 66 | -			if(!empty($args['id'])){ | |
| 67 | - $output .= AUI_Component_Helper::id($args['id']); | |
| 68 | - } | |
| 69 | - | |
| 70 | - // title | |
| 71 | -			if(!empty($args['title'])){ | |
| 72 | - $output .= AUI_Component_Helper::title($args['title']); | |
| 73 | - } | |
| 74 | - | |
| 75 | - // value | |
| 76 | -			if(!empty($args['value'])){ | |
| 77 | - $output .= AUI_Component_Helper::value($args['value']); | |
| 78 | - } | |
| 79 | - | |
| 80 | - // class | |
| 81 | - $class = !empty($args['class']) ? $args['class'] : ''; | |
| 82 | - $output .= AUI_Component_Helper::class_attr($class); | |
| 45 | + $args = wp_parse_args( $args, $defaults ); | |
| 46 | + $output = ''; | |
| 47 | +		    if ( ! empty( $args['type'] ) ) { | |
| 48 | + $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; | |
| 49 | + | |
| 50 | + // open/type | |
| 51 | +			    if($type=='a'){ | |
| 52 | + $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; | |
| 53 | + $output .= '<a href="' . $args['href'] . '"'.$new_window; | |
| 54 | +			    }elseif($type=='badge'){ | |
| 55 | + $output .= '<span '; | |
| 56 | +			    }else{ | |
| 57 | + $output .= '<button type="' . $type . '" '; | |
| 58 | + } | |
| 59 | + | |
| 60 | + // name | |
| 61 | +			    if(!empty($args['name'])){ | |
| 62 | + $output .= AUI_Component_Helper::name($args['name']); | |
| 63 | + } | |
| 64 | + | |
| 65 | + // id | |
| 66 | +			    if(!empty($args['id'])){ | |
| 67 | + $output .= AUI_Component_Helper::id($args['id']); | |
| 68 | + } | |
| 69 | + | |
| 70 | + // title | |
| 71 | +			    if(!empty($args['title'])){ | |
| 72 | + $output .= AUI_Component_Helper::title($args['title']); | |
| 73 | + } | |
| 74 | + | |
| 75 | + // value | |
| 76 | +			    if(!empty($args['value'])){ | |
| 77 | + $output .= AUI_Component_Helper::value($args['value']); | |
| 78 | + } | |
| 79 | + | |
| 80 | + // class | |
| 81 | + $class = !empty($args['class']) ? $args['class'] : ''; | |
| 82 | + $output .= AUI_Component_Helper::class_attr($class); | |
| 83 | 83 | |
| 84 | - // data-attributes | |
| 85 | - $output .= AUI_Component_Helper::data_attributes($args); | |
| 84 | + // data-attributes | |
| 85 | + $output .= AUI_Component_Helper::data_attributes($args); | |
| 86 | 86 | |
| 87 | - // aria-attributes | |
| 88 | - $output .= AUI_Component_Helper::aria_attributes($args); | |
| 87 | + // aria-attributes | |
| 88 | + $output .= AUI_Component_Helper::aria_attributes($args); | |
| 89 | 89 | |
| 90 | - // extra attributes | |
| 91 | -			if(!empty($args['extra_attributes'])){ | |
| 92 | - $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); | |
| 93 | - } | |
| 90 | + // extra attributes | |
| 91 | +			    if(!empty($args['extra_attributes'])){ | |
| 92 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); | |
| 93 | + } | |
| 94 | 94 | |
| 95 | - // onclick, we don't escape this | |
| 96 | -			if(!empty($args['onclick'])){ | |
| 97 | - $output .= ' onclick="'.$args['onclick'].'" '; | |
| 98 | - } | |
| 95 | + // onclick, we don't escape this | |
| 96 | +			    if(!empty($args['onclick'])){ | |
| 97 | + $output .= ' onclick="'.$args['onclick'].'" '; | |
| 98 | + } | |
| 99 | 99 | |
| 100 | - // style, we don't escape this | |
| 101 | -			if(!empty($args['style'])){ | |
| 102 | - $output .= ' style="'.$args['style'].'" '; | |
| 103 | - } | |
| 100 | + // style, we don't escape this | |
| 101 | +			    if(!empty($args['style'])){ | |
| 102 | + $output .= ' style="'.$args['style'].'" '; | |
| 103 | + } | |
| 104 | 104 | |
| 105 | - // close opening tag | |
| 106 | - $output .= ' >'; | |
| 105 | + // close opening tag | |
| 106 | + $output .= ' >'; | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | - // hover content | |
| 110 | - $hover_content = false; | |
| 111 | -			if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ | |
| 112 | - $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; | |
| 113 | - $hover_content = true; | |
| 114 | - } | |
| 109 | + // hover content | |
| 110 | + $hover_content = false; | |
| 111 | +			    if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ | |
| 112 | + $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; | |
| 113 | + $hover_content = true; | |
| 114 | + } | |
| 115 | 115 | |
| 116 | - // content | |
| 117 | -			if($hover_content){$output .= "<span class='hover-content-original'>";} | |
| 118 | -			if(!empty($args['content']) || !empty($args['icon'])){ | |
| 119 | - $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; | |
| 120 | - } | |
| 121 | -			if($hover_content){$output .= "</span>";} | |
| 116 | + // content | |
| 117 | +			    if($hover_content){$output .= "<span class='hover-content-original'>";} | |
| 118 | +			    if(!empty($args['content']) || !empty($args['icon'])){ | |
| 119 | + $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; | |
| 120 | + } | |
| 121 | +			    if($hover_content){$output .= "</span>";} | |
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | - // close | |
| 126 | -			if($type=='a'){ | |
| 127 | - $output .= '</a>'; | |
| 128 | -			}elseif($type=='badge'){ | |
| 129 | - $output .= '</span>'; | |
| 130 | -			}else{ | |
| 131 | - $output .= '</button>'; | |
| 132 | - } | |
| 125 | + // close | |
| 126 | +			    if($type=='a'){ | |
| 127 | + $output .= '</a>'; | |
| 128 | +			    }elseif($type=='badge'){ | |
| 129 | + $output .= '</span>'; | |
| 130 | +			    }else{ | |
| 131 | + $output .= '</button>'; | |
| 132 | + } | |
| 133 | 133 | |
| 134 | - // maybe new line after? This adds better spacing between buttons. | |
| 135 | -			if(!empty($args['new_line_after'])){ | |
| 136 | - $output .= PHP_EOL; | |
| 137 | - } | |
| 134 | + // maybe new line after? This adds better spacing between buttons. | |
| 135 | +			    if(!empty($args['new_line_after'])){ | |
| 136 | + $output .= PHP_EOL; | |
| 137 | + } | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - // wrap | |
| 141 | -			if(!$args['no_wrap']){ | |
| 142 | - $output = AUI_Component_Input::wrap(array( | |
| 143 | - 'content' => $output, | |
| 144 | - )); | |
| 145 | - } | |
| 140 | + // wrap | |
| 141 | +			    if(!$args['no_wrap']){ | |
| 142 | + $output = AUI_Component_Input::wrap(array( | |
| 143 | + 'content' => $output, | |
| 144 | + )); | |
| 145 | + } | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | - } | |
| 148 | + } | |
| 149 | 149 | |
| 150 | - return $output; | |
| 151 | - } | |
| 150 | + return $output; | |
| 151 | + } | |
| 152 | 152 | |
| 153 | 153 | } | 
| 154 | 154 | \ No newline at end of file | 
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 | // dropdown-menu | 
| 56 | 56 |  			if(!empty($args['dropdown_menu'])){ | 
| 57 | 57 | $output .= $args['dropdown_menu']; | 
| 58 | -			}elseif(!empty($args['dropdown_items'])){ | |
| 58 | +			} elseif(!empty($args['dropdown_items'])){ | |
| 59 | 59 | $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; | 
| 60 | 60 | $output .= aui()->render($args['dropdown_items']); | 
| 61 | 61 | $output .= '</div>'; | 
| @@ -1,7 +1,7 @@ discard block | ||
| 1 | -<?php | |
| 1 | + <?php | |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | - exit; // Exit if accessed directly | |
| 3 | +    if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit; // Exit if accessed directly | |
| 5 | 5 | } | 
| 6 | 6 | |
| 7 | 7 | /** | 
| @@ -9,64 +9,64 @@ discard block | ||
| 9 | 9 | * | 
| 10 | 10 | * @since 1.0.0 | 
| 11 | 11 | */ | 
| 12 | -class AUI_Component_Dropdown { | |
| 12 | +    class AUI_Component_Dropdown { | |
| 13 | 13 | |
| 14 | - /** | |
| 14 | + /** | |
| 15 | 15 | * Build the component. | 
| 16 | 16 | * | 
| 17 | 17 | * @param array $args | 
| 18 | 18 | * | 
| 19 | 19 | * @return string The rendered component. | 
| 20 | 20 | */ | 
| 21 | -	public static function get($args = array()){ | |
| 22 | - $defaults = array( | |
| 23 | - 'type' => 'button', | |
| 24 | - 'href' => '#', | |
| 25 | - 'class' => 'btn btn-primary dropdown-toggle', | |
| 26 | - 'wrapper_class' => '', | |
| 27 | - 'dropdown_menu_class' => '', | |
| 28 | - 'id' => '', | |
| 29 | - 'title' => '', | |
| 30 | - 'value' => '', | |
| 31 | - 'content' => '', | |
| 32 | - 'icon' => '', | |
| 33 | - 'hover_content' => '', | |
| 34 | - 'hover_icon' => '', | |
| 35 | - 'data-toggle' => 'dropdown', | |
| 36 | - 'aria-haspopup' => 'true', | |
| 37 | - 'aria-expanded' => 'false', | |
| 38 | - 'dropdown_menu' => '', // unescaped html menu (non-preferred way) | |
| 39 | - 'dropdown_items' => array(), // array of AUI calls | |
| 21 | +	    public static function get($args = array()){ | |
| 22 | + $defaults = array( | |
| 23 | + 'type' => 'button', | |
| 24 | + 'href' => '#', | |
| 25 | + 'class' => 'btn btn-primary dropdown-toggle', | |
| 26 | + 'wrapper_class' => '', | |
| 27 | + 'dropdown_menu_class' => '', | |
| 28 | + 'id' => '', | |
| 29 | + 'title' => '', | |
| 30 | + 'value' => '', | |
| 31 | + 'content' => '', | |
| 32 | + 'icon' => '', | |
| 33 | + 'hover_content' => '', | |
| 34 | + 'hover_icon' => '', | |
| 35 | + 'data-toggle' => 'dropdown', | |
| 36 | + 'aria-haspopup' => 'true', | |
| 37 | + 'aria-expanded' => 'false', | |
| 38 | + 'dropdown_menu' => '', // unescaped html menu (non-preferred way) | |
| 39 | + 'dropdown_items' => array(), // array of AUI calls | |
| 40 | 40 | |
| 41 | - ); | |
| 41 | + ); | |
| 42 | 42 | |
| 43 | - /** | |
| 43 | + /** | |
| 44 | 44 | * Parse incoming $args into an array and merge it with $defaults | 
| 45 | 45 | */ | 
| 46 | - $args = wp_parse_args( $args, $defaults ); | |
| 47 | - $output = ''; | |
| 48 | -		if ( ! empty( $args['type'] ) ) { | |
| 49 | - // wrapper open | |
| 50 | - $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">'; | |
| 46 | + $args = wp_parse_args( $args, $defaults ); | |
| 47 | + $output = ''; | |
| 48 | +		    if ( ! empty( $args['type'] ) ) { | |
| 49 | + // wrapper open | |
| 50 | + $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">'; | |
| 51 | 51 | |
| 52 | - // button part | |
| 53 | - $output .= aui()->button($args); | |
| 52 | + // button part | |
| 53 | + $output .= aui()->button($args); | |
| 54 | 54 | |
| 55 | - // dropdown-menu | |
| 56 | -			if(!empty($args['dropdown_menu'])){ | |
| 57 | - $output .= $args['dropdown_menu']; | |
| 58 | -			}elseif(!empty($args['dropdown_items'])){ | |
| 59 | - $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; | |
| 60 | - $output .= aui()->render($args['dropdown_items']); | |
| 61 | - $output .= '</div>'; | |
| 62 | - } | |
| 55 | + // dropdown-menu | |
| 56 | +			    if(!empty($args['dropdown_menu'])){ | |
| 57 | + $output .= $args['dropdown_menu']; | |
| 58 | +			    }elseif(!empty($args['dropdown_items'])){ | |
| 59 | + $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; | |
| 60 | + $output .= aui()->render($args['dropdown_items']); | |
| 61 | + $output .= '</div>'; | |
| 62 | + } | |
| 63 | 63 | |
| 64 | - // wrapper close | |
| 65 | - $output .= '</div>'; | |
| 64 | + // wrapper close | |
| 65 | + $output .= '</div>'; | |
| 66 | 66 | |
| 67 | - } | |
| 67 | + } | |
| 68 | 68 | |
| 69 | - return $output; | |
| 70 | - } | |
| 69 | + return $output; | |
| 70 | + } | |
| 71 | 71 | |
| 72 | 72 | } | 
| 73 | 73 | \ No newline at end of file | 
| @@ -156,7 +156,9 @@ discard block | ||
| 156 | 156 | |
| 157 | 157 |  		function parse($data) { | 
| 158 | 158 | |
| 159 | - if ( ! $this->is_active_addon($data['import']->options['custom_type'])) return false; | |
| 159 | +			if ( ! $this->is_active_addon($data['import']->options['custom_type'])) { | |
| 160 | + return false; | |
| 161 | + } | |
| 160 | 162 | |
| 161 | 163 | $parsedData = $this->helper_parse($data, $this->options_array()); | 
| 162 | 164 | return $parsedData; | 
| @@ -177,8 +179,7 @@ discard block | ||
| 177 | 179 | if ($field['type'] == 'accordion') | 
| 178 | 180 |  						{ | 
| 179 | 181 | $this->fields[$value['slug']]['is_sub_field'] = true; | 
| 180 | - } | |
| 181 | - else | |
| 182 | + } else | |
| 182 | 183 |  						{ | 
| 183 | 184 |  							foreach ($value as $n => $param) {							 | 
| 184 | 185 |  								if (is_array($param) and ! empty($this->fields[$param['slug']])){ | 
| @@ -242,7 +243,9 @@ discard block | ||
| 242 | 243 |              if ( ! empty( $this->fields ) ) { | 
| 243 | 244 | |
| 244 | 245 |                  foreach ($this->fields as $field_slug => $field_params) { | 
| 245 | -                    if (in_array($field_params['type'], array('title', 'plain_text', 'acf'))) continue; | |
| 246 | +                    if (in_array($field_params['type'], array('title', 'plain_text', 'acf'))) { | |
| 247 | + continue; | |
| 248 | + } | |
| 246 | 249 | $default_value = ''; | 
| 247 | 250 |                      if (!empty($field_params['enum_values'])){ | 
| 248 | 251 |                          foreach ($field_params['enum_values'] as $key => $value) {						 | 
| @@ -310,8 +313,9 @@ discard block | ||
| 310 | 313 | |
| 311 | 314 |  		function post_saved( $importData ){ | 
| 312 | 315 | |
| 313 | - if (is_callable($this->post_saved_function)) | |
| 314 | - call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']); | |
| 316 | +			if (is_callable($this->post_saved_function)) { | |
| 317 | + call_user_func($this->post_saved_function, $importData['pid'], $importData['import'], $importData['logger']); | |
| 318 | + } | |
| 315 | 319 | |
| 316 | 320 | } | 
| 317 | 321 | |
| @@ -336,7 +340,9 @@ discard block | ||
| 336 | 340 | $data = array(); | 
| 337 | 341 |  				if (!empty($this->fields)){ | 
| 338 | 342 |  					foreach ($this->fields as $field_slug => $field_params) { | 
| 339 | -						if (in_array($field_params['type'], array('title', 'plain_text'))) continue; | |
| 343 | +						if (in_array($field_params['type'], array('title', 'plain_text'))) { | |
| 344 | + continue; | |
| 345 | + } | |
| 340 | 346 |  						switch ($field_params['type']) { | 
| 341 | 347 | |
| 342 | 348 | case 'image': | 
| @@ -421,7 +427,9 @@ discard block | ||
| 421 | 427 | $visible_fields = 0; | 
| 422 | 428 | |
| 423 | 429 |  			foreach ($this->fields as $field_slug => $field_params) { | 
| 424 | - if ($field_params['is_sub_field']) continue; | |
| 430 | +				if ($field_params['is_sub_field']) { | |
| 431 | + continue; | |
| 432 | + } | |
| 425 | 433 | $visible_fields++; | 
| 426 | 434 | } | 
| 427 | 435 | |
| @@ -430,7 +438,9 @@ discard block | ||
| 430 | 438 |  			foreach ($this->fields as $field_slug => $field_params) {				 | 
| 431 | 439 | |
| 432 | 440 | // do not render sub fields | 
| 433 | - if ($field_params['is_sub_field']) continue; | |
| 441 | +				if ($field_params['is_sub_field']) { | |
| 442 | + continue; | |
| 443 | + } | |
| 434 | 444 | |
| 435 | 445 | $counter++; | 
| 436 | 446 | |
| @@ -561,7 +571,9 @@ discard block | ||
| 561 | 571 | $fieldData['id'] = $field_params['field_obj']->ID; | 
| 562 | 572 | $fieldData['label'] = $field_params['field_obj']->post_title; | 
| 563 | 573 | $fieldData['key'] = $field_params['field_obj']->post_name; | 
| 564 | - if (empty($fieldData['name'])) $fieldData['name'] = $field_params['field_obj']->post_excerpt; | |
| 574 | +				if (empty($fieldData['name'])) { | |
| 575 | + $fieldData['name'] = $field_params['field_obj']->post_excerpt; | |
| 576 | + } | |
| 565 | 577 |  				if (function_exists('pmai_render_field')) { | 
| 566 | 578 | echo pmai_render_field($fieldData, ( ! empty($current_values) ) ? $current_values : array() ); | 
| 567 | 579 | } | 
| @@ -573,9 +585,12 @@ discard block | ||
| 573 | 585 |  			} else if($field_params['type'] == 'plain_text'){ | 
| 574 | 586 | if ($field_params['is_html']): | 
| 575 | 587 | echo $field_params['name']; | 
| 576 | - else: | |
| 588 | +				else { | |
| 589 | + : | |
| 577 | 590 | ?> | 
| 578 | - <p style="margin: 0 0 12px 0;"><?php echo $field_params['name'];?></p> | |
| 591 | + <p style="margin: 0 0 12px 0;"><?php echo $field_params['name']; | |
| 592 | + } | |
| 593 | + ?></p> | |
| 579 | 594 | <?php | 
| 580 | 595 | endif; | 
| 581 | 596 | } | 
| @@ -595,8 +610,7 @@ discard block | ||
| 595 | 610 |  					if (is_array($value)){ | 
| 596 | 611 |  						if ($field_params['type'] == 'accordion'){								 | 
| 597 | 612 | $sub_fields[$key][] = $this->convert_field($value, $current_values); | 
| 598 | - } | |
| 599 | - else | |
| 613 | + } else | |
| 600 | 614 |  						{ | 
| 601 | 615 |  							foreach ($value as $k => $sub_field) {								 | 
| 602 | 616 | if (is_array($sub_field) and ! empty($this->fields[$sub_field['slug']])) | 
| @@ -758,7 +772,9 @@ discard block | ||
| 758 | 772 | |
| 759 | 773 |  		function add_title($title = '', $tooltip = ''){ | 
| 760 | 774 | |
| 761 | - if (empty($title)) return; | |
| 775 | +			if (empty($title)) { | |
| 776 | + return; | |
| 777 | + } | |
| 762 | 778 | |
| 763 | 779 | return $this->add_field(sanitize_key($title) . time(), $title, 'title', null, $tooltip); | 
| 764 | 780 | |
| @@ -766,7 +782,9 @@ discard block | ||
| 766 | 782 | |
| 767 | 783 |  		function add_text($text = '', $is_html = false){ | 
| 768 | 784 | |
| 769 | - if (empty($text)) return; | |
| 785 | +			if (empty($text)) { | |
| 786 | + return; | |
| 787 | + } | |
| 770 | 788 | |
| 771 | 789 | $count = is_array($this->fields) ? count($this->fields) : 0; | 
| 772 | 790 | |
| @@ -902,7 +920,9 @@ discard block | ||
| 902 | 920 | */ | 
| 903 | 921 |  		function import_images( $slug, $title, $type = 'images', $callback = NULL ){ | 
| 904 | 922 | |
| 905 | - if ( empty($title) or empty($slug) ) return; | |
| 923 | +			if ( empty($title) or empty($slug) ) { | |
| 924 | + return; | |
| 925 | + } | |
| 906 | 926 | |
| 907 | 927 |  			if (is_array($slug)) { | 
| 908 | 928 | $section_slug = 'pmxi_' . md5(serialize($slug)); | 
| @@ -1005,8 +1025,7 @@ discard block | ||
| 1005 | 1025 | $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug]['xpaths'][$option_name], $file)->parse(); | 
| 1006 | 1026 | $tmp_files[] = $file; | 
| 1007 | 1027 | } | 
| 1008 | - } | |
| 1009 | -						else {							 | |
| 1028 | +						} else {							 | |
| 1010 | 1029 | $data[$option_name] = XmlImportParser::factory($xml, $cxpath, (string) $import->options[$this->slug][$option_name], $file)->parse(); | 
| 1011 | 1030 | $tmp_files[] = $file; | 
| 1012 | 1031 | } | 
| @@ -1036,13 +1055,23 @@ discard block | ||
| 1036 | 1055 | |
| 1037 | 1056 | $import_options = $import_options['options']; | 
| 1038 | 1057 | |
| 1039 | - if ($import_options['update_all_data'] == 'yes') return true; | |
| 1058 | +			if ($import_options['update_all_data'] == 'yes') { | |
| 1059 | + return true; | |
| 1060 | + } | |
| 1040 | 1061 | |
| 1041 | - if ( ! $import_options['is_update_custom_fields'] ) return false; | |
| 1062 | +			if ( ! $import_options['is_update_custom_fields'] ) { | |
| 1063 | + return false; | |
| 1064 | + } | |
| 1042 | 1065 | |
| 1043 | - if ($import_options['update_custom_fields_logic'] == "full_update") return true; | |
| 1044 | - if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) return true; | |
| 1045 | - if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) return true; | |
| 1066 | +			if ($import_options['update_custom_fields_logic'] == "full_update") { | |
| 1067 | + return true; | |
| 1068 | + } | |
| 1069 | +			if ($import_options['update_custom_fields_logic'] == "only" and ! empty($import_options['custom_fields_list']) and is_array($import_options['custom_fields_list']) and in_array($meta_key, $import_options['custom_fields_list']) ) { | |
| 1070 | + return true; | |
| 1071 | + } | |
| 1072 | +			if ($import_options['update_custom_fields_logic'] == "all_except" and ( empty($import_options['custom_fields_list']) or ! in_array($meta_key, $import_options['custom_fields_list']) )) { | |
| 1073 | + return true; | |
| 1074 | + } | |
| 1046 | 1075 | |
| 1047 | 1076 | return false; | 
| 1048 | 1077 | |
| @@ -1056,13 +1085,23 @@ discard block | ||
| 1056 | 1085 | |
| 1057 | 1086 | $import_options = $import_options['options']; | 
| 1058 | 1087 | |
| 1059 | - if ($import_options['update_all_data'] == 'yes') return true; | |
| 1088 | +			if ($import_options['update_all_data'] == 'yes') { | |
| 1089 | + return true; | |
| 1090 | + } | |
| 1060 | 1091 | |
| 1061 | - if ( ! $import_options['is_update_categories'] ) return false; | |
| 1092 | +			if ( ! $import_options['is_update_categories'] ) { | |
| 1093 | + return false; | |
| 1094 | + } | |
| 1062 | 1095 | |
| 1063 | - if ($import_options['update_categories_logic'] == "full_update") return true; | |
| 1064 | - if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) return true; | |
| 1065 | - if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) return true; | |
| 1096 | +			if ($import_options['update_categories_logic'] == "full_update") { | |
| 1097 | + return true; | |
| 1098 | + } | |
| 1099 | +			if ($import_options['update_categories_logic'] == "only" and ! empty($import_options['taxonomies_list']) and is_array($import_options['taxonomies_list']) and in_array($tax_name, $import_options['taxonomies_list']) ) { | |
| 1100 | + return true; | |
| 1101 | + } | |
| 1102 | +			if ($import_options['update_categories_logic'] == "all_except" and ( empty($import_options['taxonomies_list']) or ! in_array($tax_name, $import_options['taxonomies_list']) )) { | |
| 1103 | + return true; | |
| 1104 | + } | |
| 1066 | 1105 | |
| 1067 | 1106 | return false; | 
| 1068 | 1107 | |
| @@ -1072,11 +1111,17 @@ discard block | ||
| 1072 | 1111 | |
| 1073 | 1112 | $import_options = $import_options['options']; | 
| 1074 | 1113 | |
| 1075 | - if ($import_options['update_all_data'] == 'yes') return true; | |
| 1114 | +			if ($import_options['update_all_data'] == 'yes') { | |
| 1115 | + return true; | |
| 1116 | + } | |
| 1076 | 1117 | |
| 1077 | - if (!$import_options['is_update_images']) return false; | |
| 1118 | +			if (!$import_options['is_update_images']) { | |
| 1119 | + return false; | |
| 1120 | + } | |
| 1078 | 1121 | |
| 1079 | - if ($import_options['is_update_images']) return true; | |
| 1122 | +			if ($import_options['is_update_images']) { | |
| 1123 | + return true; | |
| 1124 | + } | |
| 1080 | 1125 | |
| 1081 | 1126 | return false; | 
| 1082 | 1127 | } | 
| @@ -1153,7 +1198,9 @@ discard block | ||
| 1153 | 1198 | |
| 1154 | 1199 | $requires_counter = 0; | 
| 1155 | 1200 |  				foreach ($conditions['plugins'] as $plugin) { | 
| 1156 | - if ( is_plugin_active($plugin) ) $requires_counter++; | |
| 1201 | +					if ( is_plugin_active($plugin) ) { | |
| 1202 | + $requires_counter++; | |
| 1203 | + } | |
| 1157 | 1204 | } | 
| 1158 | 1205 | |
| 1159 | 1206 |  				if ($requires_counter != count($conditions['plugins'])){ 					 | 
| @@ -19,12 +19,18 @@ | ||
| 19 | 19 | |
| 20 | 20 | <?php if ( ! empty( $logo_width ) && ! empty( $logo_height ) ) : ?> | 
| 21 | 21 | <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> | 
| 22 | - <?php else : ?> | |
| 23 | - <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> | |
| 22 | +        <?php else { | |
| 23 | + : ?> | |
| 24 | + <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); | |
| 25 | +} | |
| 26 | +?>"> | |
| 24 | 27 | <?php endif; ?> | 
| 25 | 28 | |
| 26 | - <?php else : ?> | |
| 27 | - <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> | |
| 29 | +    <?php else { | |
| 30 | + : ?> | |
| 31 | + <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); | |
| 32 | +} | |
| 33 | +?></h1> | |
| 28 | 34 | <?php endif; ?> | 
| 29 | 35 | |
| 30 | 36 | </a> | 
| @@ -1,4 +1,4 @@ discard block | ||
| 1 | -<?php | |
| 1 | + <?php | |
| 2 | 2 | /** | 
| 3 | 3 | * Displays left side of the invoice title. | 
| 4 | 4 | * | 
| @@ -7,24 +7,24 @@ discard block | ||
| 7 | 7 | * @version 1.0.19 | 
| 8 | 8 | */ | 
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; | |
| 10 | + defined( 'ABSPATH' ) || exit; | |
| 11 | 11 | |
| 12 | -$logo_width = wpinv_get_option( 'logo_width' ); | |
| 13 | -$logo_height = wpinv_get_option( 'logo_height' ); | |
| 12 | + $logo_width = wpinv_get_option( 'logo_width' ); | |
| 13 | + $logo_height = wpinv_get_option( 'logo_height' ); | |
| 14 | 14 | |
| 15 | -?> | |
| 16 | -<a target="_blank" class="logo-link text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> | |
| 15 | + ?> | |
| 16 | + <a target="_blank" class="logo-link text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> | |
| 17 | 17 | |
| 18 | 18 | <?php if ( $logo = wpinv_get_business_logo() ) : ?> | 
| 19 | - | |
| 19 | + | |
| 20 | 20 | <?php if ( ! empty( $logo_width ) && ! empty( $logo_height ) ) : ?> | 
| 21 | - <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> | |
| 21 | + <img class="logo" style="max-width:100%; width:<?php echo absint( $logo_width ); ?>px; height:<?php echo absint( $logo_height ); ?>px;" src="<?php echo esc_url( $logo ); ?>"> | |
| 22 | 22 | <?php else : ?> | 
| 23 | - <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> | |
| 23 | + <img class="logo" style="max-width:100%;" src="<?php echo esc_url( $logo ); ?>"> | |
| 24 | 24 | <?php endif; ?> | 
| 25 | - | |
| 25 | + | |
| 26 | 26 | <?php else : ?> | 
| 27 | - <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> | |
| 27 | + <h1 class="h3"><?php echo esc_html( wpinv_get_business_name() ); ?></h1> | |
| 28 | 28 | <?php endif; ?> | 
| 29 | 29 | |
| 30 | 30 | </a> | 
| @@ -57,9 +57,12 @@ | ||
| 57 | 57 | </li> | 
| 58 | 58 | <?php endforeach; ?> | 
| 59 | 59 | </ol> | 
| 60 | - <?php else : ?> | |
| 60 | +            <?php else { | |
| 61 | + : ?> | |
| 61 | 62 | <div class='mb-3'> </div> | 
| 62 | - <?php endif; ?> | |
| 63 | + <?php endif; | |
| 64 | +} | |
| 65 | +?> | |
| 63 | 66 | |
| 64 | 67 | <div class="text-center pb-3 mt-5"> | 
| 65 | 68 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> | 
| @@ -38,8 +38,11 @@ | ||
| 38 | 38 | )); | 
| 39 | 39 | ?>" | 
| 40 | 40 | class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a> | 
| 41 | - <?php else : ?> | |
| 42 | - <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span> | |
| 41 | +                    <?php else { | |
| 42 | + : ?> | |
| 43 | + <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); | |
| 44 | +} | |
| 45 | +?></span> | |
| 43 | 46 | <?php endif; ?> | 
| 44 | 47 | </li> | 
| 45 | 48 | |
| @@ -154,9 +154,12 @@ discard block | ||
| 154 | 154 | <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
| 155 | 155 | </span> | 
| 156 | 156 | </div> | 
| 157 | - <?php else : ?> | |
| 157 | +                            <?php else { | |
| 158 | + : ?> | |
| 158 | 159 | <span class="input-group-text left wpinv-if-flat"> | 
| 159 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 160 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 161 | +} | |
| 162 | +?> | |
| 160 | 163 | </span> | 
| 161 | 164 | <?php endif; ?> | 
| 162 | 165 | <?php endif; ?> | 
| @@ -170,9 +173,12 @@ discard block | ||
| 170 | 173 | <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | 
| 171 | 174 | </span> | 
| 172 | 175 | </div> | 
| 173 | - <?php else : ?> | |
| 176 | +                            <?php else { | |
| 177 | + : ?> | |
| 174 | 178 | <span class="input-group-text left wpinv-if-flat"> | 
| 175 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 179 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 180 | +} | |
| 181 | +?> | |
| 176 | 182 | </span> | 
| 177 | 183 | <?php endif; ?> | 
| 178 | 184 | <?php endif; ?> | 
| @@ -180,9 +186,12 @@ discard block | ||
| 180 | 186 | <div class="input-group-append right wpinv-if-percent"> | 
| 181 | 187 | <span class="input-group-text">%</span> | 
| 182 | 188 | </div> | 
| 183 | - <?php else : ?> | |
| 189 | +                        <?php else { | |
| 190 | + : ?> | |
| 184 | 191 | <span class="input-group-text right wpinv-if-percent">%</span> | 
| 185 | - <?php endif; ?> | |
| 192 | + <?php endif; | |
| 193 | +} | |
| 194 | +?> | |
| 186 | 195 | </div> | 
| 187 | 196 | </div> | 
| 188 | 197 | <div class="col-sm-1 pt-2 pl-0"> | 
| @@ -357,9 +366,12 @@ discard block | ||
| 357 | 366 | <div class="input-group-prepend"> | 
| 358 | 367 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
| 359 | 368 | </div> | 
| 360 | - <?php else : ?> | |
| 369 | +                            <?php else { | |
| 370 | + : ?> | |
| 361 | 371 | <span class="input-group-text"> | 
| 362 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 372 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 373 | +} | |
| 374 | +?> | |
| 363 | 375 | </span> | 
| 364 | 376 | <?php endif; ?> | 
| 365 | 377 | <?php endif; ?> | 
| @@ -371,9 +383,12 @@ discard block | ||
| 371 | 383 | <div class="input-group-append"> | 
| 372 | 384 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
| 373 | 385 | </div> | 
| 374 | - <?php else : ?> | |
| 386 | +                            <?php else { | |
| 387 | + : ?> | |
| 375 | 388 | <span class="input-group-text"> | 
| 376 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 389 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 390 | +} | |
| 391 | +?> | |
| 377 | 392 | </span> | 
| 378 | 393 | <?php endif; ?> | 
| 379 | 394 | <?php endif; ?> | 
| @@ -397,9 +412,12 @@ discard block | ||
| 397 | 412 | <div class="input-group-prepend"> | 
| 398 | 413 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
| 399 | 414 | </div> | 
| 400 | - <?php else : ?> | |
| 415 | +                            <?php else { | |
| 416 | + : ?> | |
| 401 | 417 | <span class="input-group-text"> | 
| 402 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 418 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 419 | +} | |
| 420 | +?> | |
| 403 | 421 | </span> | 
| 404 | 422 | <?php endif; ?> | 
| 405 | 423 | <?php endif; ?> | 
| @@ -411,9 +429,12 @@ discard block | ||
| 411 | 429 | <div class="input-group-append"> | 
| 412 | 430 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> | 
| 413 | 431 | </div> | 
| 414 | - <?php else : ?> | |
| 432 | +                            <?php else { | |
| 433 | + : ?> | |
| 415 | 434 | <span class="input-group-text"> | 
| 416 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> | |
| 435 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); | |
| 436 | +} | |
| 437 | +?> | |
| 417 | 438 | </span> | 
| 418 | 439 | <?php endif; ?> | 
| 419 | 440 | <?php endif; ?> |