| @@ -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 | |
| @@ -3,241 +3,241 @@ | ||
| 3 | 3 |  class SD_Map extends WP_Super_Duper { | 
| 4 | 4 | |
| 5 | 5 | |
| 6 | - public $arguments; | |
| 7 | - | |
| 8 | - /** | |
| 9 | - * Sets up the widgets name etc | |
| 10 | - */ | |
| 11 | -	public function __construct() { | |
| 12 | - | |
| 13 | - $options = array( | |
| 14 | - 'textdomain' => 'super-duper', | |
| 15 | - // textdomain of the plugin/theme (used to prefix the Gutenberg block) | |
| 16 | - 'block-icon' => 'admin-site', | |
| 17 | - // Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right | |
| 18 | - 'block-category' => 'widgets', | |
| 19 | - // the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'. | |
| 20 | - 'block-keywords' => "['map','super','google']", | |
| 21 | - // used in the block search, MAX 3 | |
| 22 | - 'block-output' => array( // the block visual output elements as an array | |
| 23 | - array( | |
| 24 | - 'element' => 'p', | |
| 25 | -					'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'ayecode-connect' ), | |
| 26 | - //'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"', | |
| 27 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 28 | - ), | |
| 29 | - array( | |
| 30 | - 'element' => 'a', | |
| 31 | -					'content' => __('API KEY for Google Maps', 'ayecode-connect' ), | |
| 32 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 33 | - 'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/', | |
| 34 | - ), | |
| 35 | - array( | |
| 36 | - 'element' => 'img', | |
| 37 | - 'class' => '[%className%]', | |
| 38 | - //'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] | |
| 39 | - 'element_require' => '[%type%]=="image"', | |
| 40 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=".get_option( 'rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" | |
| 41 | - ), | |
| 42 | - array( | |
| 43 | - 'element' => 'div', | |
| 44 | - 'class' => 'sd-map-iframe-cover', | |
| 45 | -					'style'   => '{overflow:"hidden", position:"relative"}', | |
| 46 | - array( | |
| 47 | - 'element' => 'iframe', | |
| 48 | - 'title' => __( 'Placeholderx', 'ayecode-connect' ), | |
| 49 | - 'class' => '[%className%]', | |
| 50 | - 'width' => '[%width%]', | |
| 51 | - 'height' => '[%height%]', | |
| 52 | - 'frameborder' => '0', | |
| 53 | - 'allowfullscreen' => 'true', | |
| 54 | -						'style' => '{border:0}', | |
| 55 | - 'element_require' => '[%type%]!="image"', | |
| 56 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=".get_option( 'rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" | |
| 57 | - ), | |
| 58 | - ), | |
| 59 | - array( | |
| 60 | - 'element' => 'style', | |
| 61 | -					'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "'.__( 'Click here, Settings are in the block settings sidebar', 'ayecode-connect' ).'";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}', | |
| 62 | - 'element_require' => '[%type%]!="image"', | |
| 63 | - ), | |
| 64 | - ), | |
| 65 | - 'class_name' => __CLASS__, | |
| 66 | - // The calling class name | |
| 67 | - 'base_id' => 'sd_map', | |
| 68 | - // this is used as the widget id and the shortcode id. | |
| 69 | - 'name' => __( 'Map', 'ayecode-connect' ), | |
| 70 | - // the name of the widget/block | |
| 71 | - 'widget_ops' => array( | |
| 72 | - 'classname' => 'sd-map-class', | |
| 73 | - // widget class | |
| 74 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ), | |
| 75 | - // widget description | |
| 76 | - ), | |
| 77 | - 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. | |
| 78 | - 'type' => array( | |
| 79 | -					'title' => __('Map Type:', 'ayecode-connect'), | |
| 80 | -					'desc' => __('Select the map type to use.', 'ayecode-connect'), | |
| 81 | - 'type' => 'select', | |
| 82 | - 'options' => array( | |
| 83 | -						"image" => __('Static Image', 'ayecode-connect'), | |
| 84 | -						"place" => __('Place', 'ayecode-connect'), | |
| 6 | + public $arguments; | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * Sets up the widgets name etc | |
| 10 | + */ | |
| 11 | +    public function __construct() { | |
| 12 | + | |
| 13 | + $options = array( | |
| 14 | + 'textdomain' => 'super-duper', | |
| 15 | + // textdomain of the plugin/theme (used to prefix the Gutenberg block) | |
| 16 | + 'block-icon' => 'admin-site', | |
| 17 | + // Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right | |
| 18 | + 'block-category' => 'widgets', | |
| 19 | + // the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'. | |
| 20 | + 'block-keywords' => "['map','super','google']", | |
| 21 | + // used in the block search, MAX 3 | |
| 22 | + 'block-output' => array( // the block visual output elements as an array | |
| 23 | + array( | |
| 24 | + 'element' => 'p', | |
| 25 | +                    'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'ayecode-connect' ), | |
| 26 | + //'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"', | |
| 27 | + 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 28 | + ), | |
| 29 | + array( | |
| 30 | + 'element' => 'a', | |
| 31 | +                    'content' => __('API KEY for Google Maps', 'ayecode-connect' ), | |
| 32 | + 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 33 | + 'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/', | |
| 34 | + ), | |
| 35 | + array( | |
| 36 | + 'element' => 'img', | |
| 37 | + 'class' => '[%className%]', | |
| 38 | + //'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] | |
| 39 | + 'element_require' => '[%type%]=="image"', | |
| 40 | + 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=".get_option( 'rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" | |
| 41 | + ), | |
| 42 | + array( | |
| 43 | + 'element' => 'div', | |
| 44 | + 'class' => 'sd-map-iframe-cover', | |
| 45 | +                    'style'   => '{overflow:"hidden", position:"relative"}', | |
| 46 | + array( | |
| 47 | + 'element' => 'iframe', | |
| 48 | + 'title' => __( 'Placeholderx', 'ayecode-connect' ), | |
| 49 | + 'class' => '[%className%]', | |
| 50 | + 'width' => '[%width%]', | |
| 51 | + 'height' => '[%height%]', | |
| 52 | + 'frameborder' => '0', | |
| 53 | + 'allowfullscreen' => 'true', | |
| 54 | +                        'style' => '{border:0}', | |
| 55 | + 'element_require' => '[%type%]!="image"', | |
| 56 | + 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=".get_option( 'rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" | |
| 57 | + ), | |
| 58 | + ), | |
| 59 | + array( | |
| 60 | + 'element' => 'style', | |
| 61 | +                    'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "'.__( 'Click here, Settings are in the block settings sidebar', 'ayecode-connect' ).'";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}', | |
| 62 | + 'element_require' => '[%type%]!="image"', | |
| 63 | + ), | |
| 64 | + ), | |
| 65 | + 'class_name' => __CLASS__, | |
| 66 | + // The calling class name | |
| 67 | + 'base_id' => 'sd_map', | |
| 68 | + // this is used as the widget id and the shortcode id. | |
| 69 | + 'name' => __( 'Map', 'ayecode-connect' ), | |
| 70 | + // the name of the widget/block | |
| 71 | + 'widget_ops' => array( | |
| 72 | + 'classname' => 'sd-map-class', | |
| 73 | + // widget class | |
| 74 | + 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ), | |
| 75 | + // widget description | |
| 76 | + ), | |
| 77 | + 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. | |
| 78 | + 'type' => array( | |
| 79 | +                    'title' => __('Map Type:', 'ayecode-connect'), | |
| 80 | +                    'desc' => __('Select the map type to use.', 'ayecode-connect'), | |
| 81 | + 'type' => 'select', | |
| 82 | + 'options' => array( | |
| 83 | +                        "image" => __('Static Image', 'ayecode-connect'), | |
| 84 | +                        "place" => __('Place', 'ayecode-connect'), | |
| 85 | 85 |  //						"directions" => __('Directions', 'ayecode-connect'), | 
| 86 | 86 |  //						"search" => __('Search', 'ayecode-connect'), | 
| 87 | 87 |  //						"view" => __('View', 'ayecode-connect'), | 
| 88 | 88 |  //						"streetview" => __('Streetview', 'ayecode-connect'), | 
| 89 | - ), | |
| 90 | - 'default' => 'image', | |
| 91 | - 'desc_tip' => true, | |
| 92 | - 'advanced' => false | |
| 93 | - ), | |
| 94 | - 'location' => array( | |
| 95 | - 'type' => 'text', | |
| 96 | - 'title' => __( 'Location:', 'ayecode-connect' ), | |
| 97 | - 'desc' => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'ayecode-connect' ), | |
| 98 | - 'placeholder' => 'Place, city, zip code or GPS', | |
| 99 | - 'desc_tip' => true, | |
| 100 | - 'default' => 'Ireland', | |
| 101 | - 'advanced' => false | |
| 102 | - ), | |
| 103 | - 'static_width' => array( | |
| 104 | - 'type' => 'number', | |
| 105 | - 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 106 | - 'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 107 | - 'placeholder' => '600', | |
| 108 | - 'desc_tip' => true, | |
| 109 | - 'default' => '600', | |
| 110 | - 'custom_attributes' => array( | |
| 111 | - 'max' => '2000', | |
| 112 | - 'min' => '100', | |
| 113 | - ), | |
| 114 | - 'element_require' => '[%type%]=="image"', | |
| 115 | - 'advanced' => false | |
| 116 | - ), | |
| 117 | - 'static_height' => array( | |
| 118 | - 'type' => 'number', | |
| 119 | - 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 120 | - 'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 121 | - 'placeholder' => '400', | |
| 122 | - 'desc_tip' => true, | |
| 123 | - 'default' => '400', | |
| 124 | - 'custom_attributes' => array( | |
| 125 | - 'max' => '2000', | |
| 126 | - 'min' => '100', | |
| 127 | - 'required' => 'required', | |
| 128 | - ), | |
| 129 | - 'element_require' => '[%type%]=="image"', | |
| 130 | - 'advanced' => false | |
| 131 | - ), | |
| 132 | - 'width' => array( | |
| 133 | - 'type' => 'text', | |
| 134 | - 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 135 | - 'desc' => __( 'This is the width of the map, you can use % or px here.', 'ayecode-connect' ), | |
| 136 | - 'placeholder' => '100%', | |
| 137 | - 'desc_tip' => true, | |
| 138 | - 'default' => '100%', | |
| 139 | - 'element_require' => '[%type%]!="image"', | |
| 140 | - 'advanced' => false | |
| 141 | - ), | |
| 142 | - 'height' => array( | |
| 143 | - 'type' => 'text', | |
| 144 | - 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 145 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 146 | - 'placeholder' => '425px', | |
| 147 | - 'desc_tip' => true, | |
| 148 | - 'default' => '425px', | |
| 149 | - 'element_require' => '[%type%]!="image"', | |
| 150 | - 'advanced' => false | |
| 151 | - ), | |
| 152 | - 'maptype' => array( | |
| 153 | - 'type' => 'select', | |
| 154 | - 'title' => __( 'Mapview:', 'ayecode-connect' ), | |
| 155 | - 'desc' => __( 'This is the type of map view that will be used by default.', 'ayecode-connect' ), | |
| 156 | - 'options' => array( | |
| 157 | - "roadmap" => __( 'Road Map', 'ayecode-connect' ), | |
| 158 | - "satellite" => __( 'Satellite Map', 'ayecode-connect' ), | |
| 89 | + ), | |
| 90 | + 'default' => 'image', | |
| 91 | + 'desc_tip' => true, | |
| 92 | + 'advanced' => false | |
| 93 | + ), | |
| 94 | + 'location' => array( | |
| 95 | + 'type' => 'text', | |
| 96 | + 'title' => __( 'Location:', 'ayecode-connect' ), | |
| 97 | + 'desc' => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'ayecode-connect' ), | |
| 98 | + 'placeholder' => 'Place, city, zip code or GPS', | |
| 99 | + 'desc_tip' => true, | |
| 100 | + 'default' => 'Ireland', | |
| 101 | + 'advanced' => false | |
| 102 | + ), | |
| 103 | + 'static_width' => array( | |
| 104 | + 'type' => 'number', | |
| 105 | + 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 106 | + 'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 107 | + 'placeholder' => '600', | |
| 108 | + 'desc_tip' => true, | |
| 109 | + 'default' => '600', | |
| 110 | + 'custom_attributes' => array( | |
| 111 | + 'max' => '2000', | |
| 112 | + 'min' => '100', | |
| 113 | + ), | |
| 114 | + 'element_require' => '[%type%]=="image"', | |
| 115 | + 'advanced' => false | |
| 116 | + ), | |
| 117 | + 'static_height' => array( | |
| 118 | + 'type' => 'number', | |
| 119 | + 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 120 | + 'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 121 | + 'placeholder' => '400', | |
| 122 | + 'desc_tip' => true, | |
| 123 | + 'default' => '400', | |
| 124 | + 'custom_attributes' => array( | |
| 125 | + 'max' => '2000', | |
| 126 | + 'min' => '100', | |
| 127 | + 'required' => 'required', | |
| 128 | + ), | |
| 129 | + 'element_require' => '[%type%]=="image"', | |
| 130 | + 'advanced' => false | |
| 131 | + ), | |
| 132 | + 'width' => array( | |
| 133 | + 'type' => 'text', | |
| 134 | + 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 135 | + 'desc' => __( 'This is the width of the map, you can use % or px here.', 'ayecode-connect' ), | |
| 136 | + 'placeholder' => '100%', | |
| 137 | + 'desc_tip' => true, | |
| 138 | + 'default' => '100%', | |
| 139 | + 'element_require' => '[%type%]!="image"', | |
| 140 | + 'advanced' => false | |
| 141 | + ), | |
| 142 | + 'height' => array( | |
| 143 | + 'type' => 'text', | |
| 144 | + 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 145 | + 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 146 | + 'placeholder' => '425px', | |
| 147 | + 'desc_tip' => true, | |
| 148 | + 'default' => '425px', | |
| 149 | + 'element_require' => '[%type%]!="image"', | |
| 150 | + 'advanced' => false | |
| 151 | + ), | |
| 152 | + 'maptype' => array( | |
| 153 | + 'type' => 'select', | |
| 154 | + 'title' => __( 'Mapview:', 'ayecode-connect' ), | |
| 155 | + 'desc' => __( 'This is the type of map view that will be used by default.', 'ayecode-connect' ), | |
| 156 | + 'options' => array( | |
| 157 | + "roadmap" => __( 'Road Map', 'ayecode-connect' ), | |
| 158 | + "satellite" => __( 'Satellite Map', 'ayecode-connect' ), | |
| 159 | 159 | // "hybrid" => __( 'Hybrid Map', 'ayecode-connect' ), | 
| 160 | 160 | // "terrain" => __( 'Terrain Map', 'ayecode-connect' ), | 
| 161 | - ), | |
| 162 | - 'desc_tip' => true, | |
| 163 | - 'default' => 'roadmap', | |
| 164 | - 'advanced' => true | |
| 165 | - ), | |
| 166 | - 'zoom' => array( | |
| 167 | - 'type' => 'select', | |
| 168 | - 'title' => __( 'Zoom level:', 'ayecode-connect' ), | |
| 169 | - 'desc' => __( 'This is the zoom level of the map, `auto` is recommended.', 'ayecode-connect' ), | |
| 170 | - 'options' => range( 1, 19 ), | |
| 171 | - 'placeholder' => '', | |
| 172 | - 'desc_tip' => true, | |
| 173 | - 'default' => '7', | |
| 174 | - 'advanced' => true | |
| 175 | - ), | |
| 176 | - 'api_key' => array( | |
| 177 | - 'type' => 'text', | |
| 178 | - 'title' => __( 'Api Key:', 'ayecode-connect' ), | |
| 179 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 180 | - 'placeholder' => '', | |
| 181 | - 'desc_tip' => true, | |
| 182 | - 'default' => '', | |
| 183 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1', | |
| 184 | - 'advanced' => false | |
| 185 | - ), | |
| 186 | - ) | |
| 187 | - ); | |
| 188 | - | |
| 189 | - parent::__construct( $options ); | |
| 190 | - } | |
| 191 | - | |
| 192 | - | |
| 193 | - /** | |
| 194 | - * This is the output function for the widget, shortcode and block (front end). | |
| 195 | - * | |
| 196 | - * @param array $args The arguments values. | |
| 197 | - * @param array $widget_args The widget arguments when used. | |
| 198 | - * @param string $content The shortcode content argument | |
| 199 | - * | |
| 200 | - * @return string | |
| 201 | - */ | |
| 202 | -	public function output( $args = array(), $widget_args = array(), $content = '' ) { | |
| 203 | - | |
| 204 | - // options | |
| 205 | - $defaults = array( | |
| 206 | - 'type' => 'image', // image, place | |
| 207 | - 'location' => 'Ireland', | |
| 208 | - 'static_width' => '600', | |
| 209 | - 'static_height' => '400', | |
| 210 | - 'width'=> '100%', | |
| 211 | - 'height'=> '425px', | |
| 212 | - 'maptype' => 'roadmap', | |
| 213 | - 'zoom' => '7', | |
| 214 | - 'api_key' => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE', | |
| 215 | - ); | |
| 216 | - | |
| 217 | - /** | |
| 218 | - * Parse incoming $args into an array and merge it with $defaults | |
| 219 | - */ | |
| 220 | - $args = wp_parse_args($args, $defaults ); | |
| 221 | - | |
| 222 | - $output = ''; | |
| 223 | - | |
| 224 | - | |
| 225 | - // check if we have a global API key | |
| 226 | - $args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key']; | |
| 227 | - | |
| 228 | -		if($args['type']=='image'){ | |
| 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{ | |
| 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 | - } | |
| 233 | - | |
| 234 | - return $output; | |
| 235 | - | |
| 236 | - } | |
| 161 | + ), | |
| 162 | + 'desc_tip' => true, | |
| 163 | + 'default' => 'roadmap', | |
| 164 | + 'advanced' => true | |
| 165 | + ), | |
| 166 | + 'zoom' => array( | |
| 167 | + 'type' => 'select', | |
| 168 | + 'title' => __( 'Zoom level:', 'ayecode-connect' ), | |
| 169 | + 'desc' => __( 'This is the zoom level of the map, `auto` is recommended.', 'ayecode-connect' ), | |
| 170 | + 'options' => range( 1, 19 ), | |
| 171 | + 'placeholder' => '', | |
| 172 | + 'desc_tip' => true, | |
| 173 | + 'default' => '7', | |
| 174 | + 'advanced' => true | |
| 175 | + ), | |
| 176 | + 'api_key' => array( | |
| 177 | + 'type' => 'text', | |
| 178 | + 'title' => __( 'Api Key:', 'ayecode-connect' ), | |
| 179 | + 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 180 | + 'placeholder' => '', | |
| 181 | + 'desc_tip' => true, | |
| 182 | + 'default' => '', | |
| 183 | + 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1', | |
| 184 | + 'advanced' => false | |
| 185 | + ), | |
| 186 | + ) | |
| 187 | + ); | |
| 188 | + | |
| 189 | + parent::__construct( $options ); | |
| 190 | + } | |
| 191 | + | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * This is the output function for the widget, shortcode and block (front end). | |
| 195 | + * | |
| 196 | + * @param array $args The arguments values. | |
| 197 | + * @param array $widget_args The widget arguments when used. | |
| 198 | + * @param string $content The shortcode content argument | |
| 199 | + * | |
| 200 | + * @return string | |
| 201 | + */ | |
| 202 | +    public function output( $args = array(), $widget_args = array(), $content = '' ) { | |
| 203 | + | |
| 204 | + // options | |
| 205 | + $defaults = array( | |
| 206 | + 'type' => 'image', // image, place | |
| 207 | + 'location' => 'Ireland', | |
| 208 | + 'static_width' => '600', | |
| 209 | + 'static_height' => '400', | |
| 210 | + 'width'=> '100%', | |
| 211 | + 'height'=> '425px', | |
| 212 | + 'maptype' => 'roadmap', | |
| 213 | + 'zoom' => '7', | |
| 214 | + 'api_key' => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE', | |
| 215 | + ); | |
| 216 | + | |
| 217 | + /** | |
| 218 | + * Parse incoming $args into an array and merge it with $defaults | |
| 219 | + */ | |
| 220 | + $args = wp_parse_args($args, $defaults ); | |
| 221 | + | |
| 222 | + $output = ''; | |
| 223 | + | |
| 224 | + | |
| 225 | + // check if we have a global API key | |
| 226 | + $args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key']; | |
| 227 | + | |
| 228 | +        if($args['type']=='image'){ | |
| 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{ | |
| 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 | + } | |
| 233 | + | |
| 234 | + return $output; | |
| 235 | + | |
| 236 | + } | |
| 237 | 237 | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | 240 | // register it. | 
| 241 | 241 |  add_action( 'widgets_init', function () { | 
| 242 | - register_widget( 'SD_Map' ); | |
| 242 | + register_widget( 'SD_Map' ); | |
| 243 | 243 | } ); | 
| @@ -22,14 +22,14 @@ discard block | ||
| 22 | 22 | 'block-output' => array( // the block visual output elements as an array | 
| 23 | 23 | array( | 
| 24 | 24 | 'element' => 'p', | 
| 25 | -					'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'ayecode-connect' ), | |
| 25 | +					'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'ayecode-connect'), | |
| 26 | 26 | //'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"', | 
| 27 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 27 | +					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 28 | 28 | ), | 
| 29 | 29 | array( | 
| 30 | 30 | 'element' => 'a', | 
| 31 | -					'content' => __('API KEY for Google Maps', 'ayecode-connect' ), | |
| 32 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 31 | +					'content' => __('API KEY for Google Maps', 'ayecode-connect'), | |
| 32 | +					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', | |
| 33 | 33 | 'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/', | 
| 34 | 34 | ), | 
| 35 | 35 | array( | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | 'class' => '[%className%]', | 
| 38 | 38 | //'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] | 
| 39 | 39 | 'element_require' => '[%type%]=="image"', | 
| 40 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=".get_option( 'rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" | |
| 40 | +					'src'     => get_option('rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option('rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" | |
| 41 | 41 | ), | 
| 42 | 42 | array( | 
| 43 | 43 | 'element' => 'div', | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 |  					'style'   => '{overflow:"hidden", position:"relative"}', | 
| 46 | 46 | array( | 
| 47 | 47 | 'element' => 'iframe', | 
| 48 | - 'title' => __( 'Placeholderx', 'ayecode-connect' ), | |
| 48 | +						'title'   => __('Placeholderx', 'ayecode-connect'), | |
| 49 | 49 | 'class' => '[%className%]', | 
| 50 | 50 | 'width' => '[%width%]', | 
| 51 | 51 | 'height' => '[%height%]', | 
| @@ -53,12 +53,12 @@ discard block | ||
| 53 | 53 | 'allowfullscreen' => 'true', | 
| 54 | 54 |  						'style' => '{border:0}', | 
| 55 | 55 | 'element_require' => '[%type%]!="image"', | 
| 56 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=".get_option( 'rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" | |
| 56 | +						'src'     => get_option('rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option('rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" | |
| 57 | 57 | ), | 
| 58 | 58 | ), | 
| 59 | 59 | array( | 
| 60 | 60 | 'element' => 'style', | 
| 61 | -					'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "'.__( 'Click here, Settings are in the block settings sidebar', 'ayecode-connect' ).'";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}', | |
| 61 | +					'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __('Click here, Settings are in the block settings sidebar', 'ayecode-connect') . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}', | |
| 62 | 62 | 'element_require' => '[%type%]!="image"', | 
| 63 | 63 | ), | 
| 64 | 64 | ), | 
| @@ -66,12 +66,12 @@ discard block | ||
| 66 | 66 | // The calling class name | 
| 67 | 67 | 'base_id' => 'sd_map', | 
| 68 | 68 | // this is used as the widget id and the shortcode id. | 
| 69 | - 'name' => __( 'Map', 'ayecode-connect' ), | |
| 69 | +			'name'           => __('Map', 'ayecode-connect'), | |
| 70 | 70 | // the name of the widget/block | 
| 71 | 71 | 'widget_ops' => array( | 
| 72 | 72 | 'classname' => 'sd-map-class', | 
| 73 | 73 | // widget class | 
| 74 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect' ), | |
| 74 | +				'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'ayecode-connect'), | |
| 75 | 75 | // widget description | 
| 76 | 76 | ), | 
| 77 | 77 | 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. | 
| @@ -93,8 +93,8 @@ discard block | ||
| 93 | 93 | ), | 
| 94 | 94 | 'location' => array( | 
| 95 | 95 | 'type' => 'text', | 
| 96 | - 'title' => __( 'Location:', 'ayecode-connect' ), | |
| 97 | - 'desc' => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'ayecode-connect' ), | |
| 96 | +					'title'       => __('Location:', 'ayecode-connect'), | |
| 97 | +					'desc'        => __('Enter the location to show on the map, place, city, zip code or GPS.', 'ayecode-connect'), | |
| 98 | 98 | 'placeholder' => 'Place, city, zip code or GPS', | 
| 99 | 99 | 'desc_tip' => true, | 
| 100 | 100 | 'default' => 'Ireland', | 
| @@ -102,8 +102,8 @@ discard block | ||
| 102 | 102 | ), | 
| 103 | 103 | 'static_width' => array( | 
| 104 | 104 | 'type' => 'number', | 
| 105 | - 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 106 | - 'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 105 | +					'title'       => __('Width:', 'ayecode-connect'), | |
| 106 | +					'desc'        => __('This is the width of the map, for static maps you can only use px values.', 'ayecode-connect'), | |
| 107 | 107 | 'placeholder' => '600', | 
| 108 | 108 | 'desc_tip' => true, | 
| 109 | 109 | 'default' => '600', | 
| @@ -116,8 +116,8 @@ discard block | ||
| 116 | 116 | ), | 
| 117 | 117 | 'static_height' => array( | 
| 118 | 118 | 'type' => 'number', | 
| 119 | - 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 120 | - 'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'ayecode-connect' ), | |
| 119 | +					'title'       => __('Height:', 'ayecode-connect'), | |
| 120 | +					'desc'        => __('This is the height of the map, for static maps you can only use px values.', 'ayecode-connect'), | |
| 121 | 121 | 'placeholder' => '400', | 
| 122 | 122 | 'desc_tip' => true, | 
| 123 | 123 | 'default' => '400', | 
| @@ -131,8 +131,8 @@ discard block | ||
| 131 | 131 | ), | 
| 132 | 132 | 'width' => array( | 
| 133 | 133 | 'type' => 'text', | 
| 134 | - 'title' => __( 'Width:', 'ayecode-connect' ), | |
| 135 | - 'desc' => __( 'This is the width of the map, you can use % or px here.', 'ayecode-connect' ), | |
| 134 | +					'title'       => __('Width:', 'ayecode-connect'), | |
| 135 | +					'desc'        => __('This is the width of the map, you can use % or px here.', 'ayecode-connect'), | |
| 136 | 136 | 'placeholder' => '100%', | 
| 137 | 137 | 'desc_tip' => true, | 
| 138 | 138 | 'default' => '100%', | 
| @@ -141,8 +141,8 @@ discard block | ||
| 141 | 141 | ), | 
| 142 | 142 | 'height' => array( | 
| 143 | 143 | 'type' => 'text', | 
| 144 | - 'title' => __( 'Height:', 'ayecode-connect' ), | |
| 145 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 144 | +					'title'       => __('Height:', 'ayecode-connect'), | |
| 145 | +					'desc'        => __('This is the height of the map, you can use %, px or vh here.', 'ayecode-connect'), | |
| 146 | 146 | 'placeholder' => '425px', | 
| 147 | 147 | 'desc_tip' => true, | 
| 148 | 148 | 'default' => '425px', | 
| @@ -151,11 +151,11 @@ discard block | ||
| 151 | 151 | ), | 
| 152 | 152 | 'maptype' => array( | 
| 153 | 153 | 'type' => 'select', | 
| 154 | - 'title' => __( 'Mapview:', 'ayecode-connect' ), | |
| 155 | - 'desc' => __( 'This is the type of map view that will be used by default.', 'ayecode-connect' ), | |
| 154 | +					'title'    => __('Mapview:', 'ayecode-connect'), | |
| 155 | +					'desc'     => __('This is the type of map view that will be used by default.', 'ayecode-connect'), | |
| 156 | 156 | 'options' => array( | 
| 157 | - "roadmap" => __( 'Road Map', 'ayecode-connect' ), | |
| 158 | - "satellite" => __( 'Satellite Map', 'ayecode-connect' ), | |
| 157 | +						"roadmap"   => __('Road Map', 'ayecode-connect'), | |
| 158 | +						"satellite" => __('Satellite Map', 'ayecode-connect'), | |
| 159 | 159 | // "hybrid" => __( 'Hybrid Map', 'ayecode-connect' ), | 
| 160 | 160 | // "terrain" => __( 'Terrain Map', 'ayecode-connect' ), | 
| 161 | 161 | ), | 
| @@ -165,9 +165,9 @@ discard block | ||
| 165 | 165 | ), | 
| 166 | 166 | 'zoom' => array( | 
| 167 | 167 | 'type' => 'select', | 
| 168 | - 'title' => __( 'Zoom level:', 'ayecode-connect' ), | |
| 169 | - 'desc' => __( 'This is the zoom level of the map, `auto` is recommended.', 'ayecode-connect' ), | |
| 170 | - 'options' => range( 1, 19 ), | |
| 168 | +					'title'       => __('Zoom level:', 'ayecode-connect'), | |
| 169 | +					'desc'        => __('This is the zoom level of the map, `auto` is recommended.', 'ayecode-connect'), | |
| 170 | + 'options' => range(1, 19), | |
| 171 | 171 | 'placeholder' => '', | 
| 172 | 172 | 'desc_tip' => true, | 
| 173 | 173 | 'default' => '7', | 
| @@ -175,18 +175,18 @@ discard block | ||
| 175 | 175 | ), | 
| 176 | 176 | 'api_key' => array( | 
| 177 | 177 | 'type' => 'text', | 
| 178 | - 'title' => __( 'Api Key:', 'ayecode-connect' ), | |
| 179 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'ayecode-connect' ), | |
| 178 | +					'title'       => __('Api Key:', 'ayecode-connect'), | |
| 179 | +					'desc'        => __('This is the height of the map, you can use %, px or vh here.', 'ayecode-connect'), | |
| 180 | 180 | 'placeholder' => '', | 
| 181 | 181 | 'desc_tip' => true, | 
| 182 | 182 | 'default' => '', | 
| 183 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1', | |
| 183 | +					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1', | |
| 184 | 184 | 'advanced' => false | 
| 185 | 185 | ), | 
| 186 | 186 | ) | 
| 187 | 187 | ); | 
| 188 | 188 | |
| 189 | - parent::__construct( $options ); | |
| 189 | + parent::__construct($options); | |
| 190 | 190 | } | 
| 191 | 191 | |
| 192 | 192 | |
| @@ -199,7 +199,7 @@ discard block | ||
| 199 | 199 | * | 
| 200 | 200 | * @return string | 
| 201 | 201 | */ | 
| 202 | -	public function output( $args = array(), $widget_args = array(), $content = '' ) { | |
| 202 | +	public function output($args = array(), $widget_args = array(), $content = '') { | |
| 203 | 203 | |
| 204 | 204 | // options | 
| 205 | 205 | $defaults = array( | 
| @@ -217,18 +217,18 @@ discard block | ||
| 217 | 217 | /** | 
| 218 | 218 | * Parse incoming $args into an array and merge it with $defaults | 
| 219 | 219 | */ | 
| 220 | - $args = wp_parse_args($args, $defaults ); | |
| 220 | + $args = wp_parse_args($args, $defaults); | |
| 221 | 221 | |
| 222 | 222 | $output = ''; | 
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | // check if we have a global API key | 
| 226 | - $args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key']; | |
| 226 | +		$args['api_key'] = get_option('rgmk_google_map_api_key', false) ? get_option('rgmk_google_map_api_key') : $args['api_key']; | |
| 227 | 227 | |
| 228 | -		if($args['type']=='image'){ | |
| 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{ | |
| 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> "; | |
| 228 | +		if ($args['type'] == 'image') { | |
| 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 { | |
| 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 | |
| 234 | 234 | return $output; | 
| @@ -238,6 +238,6 @@ discard block | ||
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | 240 | // register it. | 
| 241 | -add_action( 'widgets_init', function () { | |
| 242 | - register_widget( 'SD_Map' ); | |
| 241 | +add_action('widgets_init', function() { | |
| 242 | +	register_widget('SD_Map'); | |
| 243 | 243 | } ); | 
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 |          $restrictedWords = implode('|', array_keys($this->locations)); | 
| 21 | 21 | |
| 22 | 22 | $vars['name'] = strtolower($vars['name']); | 
| 23 | -        $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui', | |
| 23 | +        $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:' . $restrictedWords . ')-)?(.*?)(?:-(?:' . $restrictedWords . '))?$/ui', | |
| 24 | 24 | '$1', | 
| 25 | 25 | $vars['name'] | 
| 26 | 26 | ); | 
| @@ -3,8 +3,8 @@ | ||
| 3 | 3 | |
| 4 | 4 | class ClanCatsFrameworkInstaller extends BaseInstaller | 
| 5 | 5 |  { | 
| 6 | - protected $locations = array( | |
| 7 | -		'ship'      => 'CCF/orbit/{$name}/', | |
| 8 | -		'theme'     => 'CCF/app/themes/{$name}/', | |
| 9 | - ); | |
| 6 | + protected $locations = array( | |
| 7 | +        'ship'      => 'CCF/orbit/{$name}/', | |
| 8 | +        'theme'     => 'CCF/app/themes/{$name}/', | |
| 9 | + ); | |
| 10 | 10 | } | 
| 11 | 11 | \ No newline at end of file | 
| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | unset($vars['name'][$key]); | 
| 23 | 23 | } | 
| 24 | 24 | } | 
| 25 | -        $vars['name'] = implode("",$vars['name']); | |
| 25 | +        $vars['name'] = implode("", $vars['name']); | |
| 26 | 26 | |
| 27 | 27 | return $vars; | 
| 28 | 28 | } | 
| @@ -28,7 +28,7 @@ | ||
| 28 | 28 | */ | 
| 29 | 29 | private function correctPluginName($vars) | 
| 30 | 30 |      { | 
| 31 | -        $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { | |
| 31 | +        $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) { | |
| 32 | 32 | return strtoupper($matches[0][1]); | 
| 33 | 33 | }, $vars['name']); | 
| 34 | 34 | $vars['name'] = ucfirst($camelCasedName); | 
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 | public function inflectPackageVars($vars) | 
| 14 | 14 |      { | 
| 15 | -        $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) { | |
| 15 | +        $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function($matches) { | |
| 16 | 16 | return strtoupper($matches[1]); | 
| 17 | 17 | }, $vars['name']); | 
| 18 | 18 | |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | class BitrixInstaller extends BaseInstaller | 
| 27 | 27 |  { | 
| 28 | 28 | protected $locations = array( | 
| 29 | -        'module'    => '{$bitrix_dir}/modules/{$name}/',    // deprecated, remove on the major release (Backward compatibility will be broken) | |
| 29 | +        'module'    => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) | |
| 30 | 30 |          'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) | 
| 31 | -        'theme'     => '{$bitrix_dir}/templates/{$name}/',  // deprecated, remove on the major release (Backward compatibility will be broken) | |
| 31 | +        'theme'     => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) | |
| 32 | 32 |          'd7-module'    => '{$bitrix_dir}/modules/{$vendor}.{$name}/', | 
| 33 | 33 |          'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/', | 
| 34 | 34 |          'd7-template'     => '{$bitrix_dir}/templates/{$vendor}_{$name}/', | 
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | */ | 
| 18 | 18 | public function inflectPackageVars($vars) | 
| 19 | 19 |      { | 
| 20 | -        $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) { | |
| 20 | +        $vars['name'] = preg_replace_callback('/(-[a-z])/', function($matches) { | |
| 21 | 21 | return strtoupper($matches[0][1]); | 
| 22 | 22 | }, $vars['name']); | 
| 23 | 23 | |
| @@ -35,11 +35,11 @@ discard block | ||
| 35 | 35 | */ | 
| 36 | 36 | protected function inflectModuleVars($vars) | 
| 37 | 37 |      { | 
| 38 | -        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy) | |
| 39 | -        $vars['name'] = str_replace('module-', '', $vars['name']);      // strip out module- | |
| 40 | -        $vars['name'] = preg_replace('/-module$/', '', $vars['name']);  // strip out -module | |
| 41 | -        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s | |
| 42 | - $vars['name'] = ucwords($vars['name']); // make module name camelcased | |
| 38 | +        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy) | |
| 39 | +        $vars['name'] = str_replace('module-', '', $vars['name']); // strip out module- | |
| 40 | +        $vars['name'] = preg_replace('/-module$/', '', $vars['name']); // strip out -module | |
| 41 | +        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s | |
| 42 | + $vars['name'] = ucwords($vars['name']); // make module name camelcased | |
| 43 | 43 | |
| 44 | 44 | return $vars; | 
| 45 | 45 | } | 
| @@ -52,11 +52,11 @@ discard block | ||
| 52 | 52 | */ | 
| 53 | 53 | protected function inflectThemeVars($vars) | 
| 54 | 54 |      { | 
| 55 | -        $vars['name'] = str_replace('pxcms-', '', $vars['name']);       // strip out pxcms- just incase (legacy) | |
| 56 | -        $vars['name'] = str_replace('theme-', '', $vars['name']);       // strip out theme- | |
| 57 | -        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']);   // strip out -theme | |
| 58 | -        $vars['name'] = str_replace('-', '_', $vars['name']);           // make -'s be _'s | |
| 59 | - $vars['name'] = ucwords($vars['name']); // make module name camelcased | |
| 55 | +        $vars['name'] = str_replace('pxcms-', '', $vars['name']); // strip out pxcms- just incase (legacy) | |
| 56 | +        $vars['name'] = str_replace('theme-', '', $vars['name']); // strip out theme- | |
| 57 | +        $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); // strip out -theme | |
| 58 | +        $vars['name'] = str_replace('-', '_', $vars['name']); // make -'s be _'s | |
| 59 | + $vars['name'] = ucwords($vars['name']); // make module name camelcased | |
| 60 | 60 | |
| 61 | 61 | return $vars; | 
| 62 | 62 | } |