Skip to content

Commit

Permalink
revert master to 1.0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
stiofan committed Nov 19, 2021
1 parent ffbd740 commit 7204a81
Show file tree
Hide file tree
Showing 9 changed files with 2,682 additions and 3,612 deletions.
14 changes: 0 additions & 14 deletions change-log.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
= 2.0.2 =
* Elementor Pro will cause fatal error if old style register_widget is calles - FIXED

= 2.0.1 =
* Added missing static functions to main class for backwards comparability - FIXED

= 2.0.0 =
* WARNING v2 is a breaking change, please see our migration guide in our github repo https://github.com/AyeCode/wp-super-duper/ - BREAKING CHANGE
* Widget, blocks and shortcodes classes separated our for better readability and memory usage - CHANGED
* 'output_types' => array( 'block', 'shortcode' ) argument added to be able to only load certain types of output - ADDED
* Legacy widgets can be converted to blocks on the fly - ADDED
* Widgets hidden from legacy selector to prevent double option in widgets area - CHANGED
* Option added to WordPress General settings to set if widgets are loaded - ADDED

= 1.0.27 =
* Category settings loads only 10 categories on CPT change - FIXED
* Hook added to filter class & attributes for Elementor widget output - ADDED
Expand Down
22 changes: 11 additions & 11 deletions hello-world.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class SD_Hello_World extends WP_Super_Duper {


public $arguments;

/**
Expand All @@ -27,10 +28,7 @@ public function __construct() {
'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
)
),
'output_types' => array( 'block', 'shortcode' ),
// Sample showing how to disable widgets for a given SD instance.
'block-wrap' => '',
// You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
'block-wrap' => '', // You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
'class_name' => __CLASS__,
// The calling class name
'base_id' => 'hello_world',
Expand All @@ -42,12 +40,8 @@ public function __construct() {
// widget class
'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
// widget description
'output' => array( $this, 'output' )
),
'no_wrap' => true,
// This will prevent the widget being wrapped in the containing widget class div.
//'block-editor-style' => 'https://example.com/style.css',
// Lets you add a URL for styles that should be added to the block editor.
'no_wrap' => true, // This will prevent the widget being wrapped in the containing widget class div.
'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings.
'after_text' => array( // this is the input name=''
'title' => __( 'Text after hello:', 'hello-world' ),
Expand Down Expand Up @@ -82,6 +76,7 @@ public function __construct() {
* @return string
*/
public function output( $args = array(), $widget_args = array(), $content = '' ) {

/**
* @var string $after_text
* @var string $another_input This is added by filter below.
Expand All @@ -96,11 +91,16 @@ public function output( $args = array(), $widget_args = array(), $content = '' )
}

return "Hello: " . $after_text . "" . $another_input;

}

}

new SD_Hello_World();
// register it.
add_action( 'widgets_init', function () {
register_widget( 'SD_Hello_World' );
} );


/**
* Extend the options via filter hook, this can be done via plugin/theme.
Expand Down Expand Up @@ -133,4 +133,4 @@ function _my_extra_arguments( $options ) {
return $options;
}

//add_filter( 'wp_super_duper_options_hello_world', '_my_extra_arguments' );
//add_filter( 'wp_super_duper_options_hello_world', '_my_extra_arguments' );
188 changes: 95 additions & 93 deletions map.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@ public function __construct() {
// used in the block search, MAX 3
'block-output' => array( // the block visual output elements as an array
array(
'element' => 'p',
'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: ', 'super-duper' ),
'element' => 'p',
'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: ','super-duper'),
//'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"',
'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""',
),
array(
'element' => 'a',
'content' => __( 'API KEY for Google Maps', 'super-duper' ),
'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/',
'element' => 'a',
'content' => __('API KEY for Google Maps','super-duper'),
'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""',
'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/',
),
array(
'element' => 'img',
'class' => '[%className%]',
'element' => 'img',
'class' => '[%className%]',
//'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
'element_require' => '[%type%]=="image"',
'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%]"
'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%]"
),
array(
'element' => 'div',
'class' => 'sd-map-iframe-cover',
'style' => '{overflow:"hidden", position:"relative"}',
array(
'element' => 'iframe',
'title' => __( 'Placeholderx', 'super-duper' ),
'class' => '[%className%]',
'width' => '[%width%]',
'height' => '[%height%]',
'frameborder' => '0',
'element' => 'iframe',
'title' => __( 'Placeholderx', 'super-duper' ),
'class' => '[%className%]',
'width' => '[%width%]',
'height' => '[%height%]',
'frameborder' => '0',
'allowfullscreen' => 'true',
'style' => '{border:0}',
'style' => '{border:0}',
'element_require' => '[%type%]!="image"',
'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%]"
'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%]"
),
),
array(
'element' => 'style',
'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __( "Click here, Settings are in the block settings sidebar", "super-duper" ) . '";} .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;}',
'element' => 'style',
'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "'.__("Click here, Settings are in the block settings sidebar","super-duper").'";} .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;}',
'element_require' => '[%type%]!="image"',
),
),
Expand All @@ -73,16 +73,15 @@ public function __construct() {
// widget class
'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
// widget description
'output' => array( $this, 'output' )
),
'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings.
'type' => array(
'title' => __( 'Map Type:', 'geodirectory' ),
'desc' => __( 'Select the map type to use.', 'geodirectory' ),
'type' => 'select',
'options' => array(
"image" => __( 'Static Image', 'geodirectory' ),
"place" => __( 'Place', 'geodirectory' ),
'type' => array(
'title' => __('Map Type:', 'geodirectory'),
'desc' => __('Select the map type to use.', 'geodirectory'),
'type' => 'select',
'options' => array(
"image" => __('Static Image', 'geodirectory'),
"place" => __('Place', 'geodirectory'),
// "directions" => __('Directions', 'geodirectory'),
// "search" => __('Search', 'geodirectory'),
// "view" => __('View', 'geodirectory'),
Expand All @@ -92,7 +91,7 @@ public function __construct() {
'desc_tip' => true,
'advanced' => false
),
'location' => array(
'location' => array(
'type' => 'text',
'title' => __( 'Location:', 'geodirectory' ),
'desc' => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory' ),
Expand All @@ -101,56 +100,56 @@ public function __construct() {
'default' => 'Ireland',
'advanced' => false
),
'static_width' => array(
'type' => 'number',
'title' => __( 'Width:', 'geodirectory' ),
'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ),
'placeholder' => '600',
'desc_tip' => true,
'default' => '600',
'static_width' => array(
'type' => 'number',
'title' => __( 'Width:', 'geodirectory' ),
'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ),
'placeholder' => '600',
'desc_tip' => true,
'default' => '600',
'custom_attributes' => array(
'max' => '2000',
'min' => '100',
'max' => '2000',
'min' => '100',
),
'element_require' => '[%type%]=="image"',
'advanced' => false
'element_require' => '[%type%]=="image"',
'advanced' => false
),
'static_height' => array(
'type' => 'number',
'title' => __( 'Height:', 'geodirectory' ),
'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ),
'placeholder' => '400',
'desc_tip' => true,
'default' => '400',
'static_height' => array(
'type' => 'number',
'title' => __( 'Height:', 'geodirectory' ),
'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ),
'placeholder' => '400',
'desc_tip' => true,
'default' => '400',
'custom_attributes' => array(
'max' => '2000',
'min' => '100',
'required' => 'required',
'max' => '2000',
'min' => '100',
'required' => 'required',
),
'element_require' => '[%type%]=="image"',
'advanced' => false
'element_require' => '[%type%]=="image"',
'advanced' => false
),
'width' => array(
'type' => 'text',
'title' => __( 'Width:', 'geodirectory' ),
'desc' => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ),
'placeholder' => '100%',
'desc_tip' => true,
'default' => '100%',
'width' => array(
'type' => 'text',
'title' => __( 'Width:', 'geodirectory' ),
'desc' => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ),
'placeholder' => '100%',
'desc_tip' => true,
'default' => '100%',
'element_require' => '[%type%]!="image"',
'advanced' => false
'advanced' => false
),
'height' => array(
'type' => 'text',
'title' => __( 'Height:', 'geodirectory' ),
'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
'placeholder' => '425px',
'desc_tip' => true,
'default' => '425px',
'height' => array(
'type' => 'text',
'title' => __( 'Height:', 'geodirectory' ),
'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
'placeholder' => '425px',
'desc_tip' => true,
'default' => '425px',
'element_require' => '[%type%]!="image"',
'advanced' => false
'advanced' => false
),
'maptype' => array(
'maptype' => array(
'type' => 'select',
'title' => __( 'Mapview:', 'geodirectory' ),
'desc' => __( 'This is the type of map view that will be used by default.', 'geodirectory' ),
Expand All @@ -164,7 +163,7 @@ public function __construct() {
'default' => 'roadmap',
'advanced' => true
),
'zoom' => array(
'zoom' => array(
'type' => 'select',
'title' => __( 'Zoom level:', 'geodirectory' ),
'desc' => __( 'This is the zoom level of the map, `auto` is recommended.', 'geodirectory' ),
Expand All @@ -174,15 +173,15 @@ public function __construct() {
'default' => '7',
'advanced' => true
),
'api_key' => array(
'type' => 'text',
'title' => __( 'Api Key:', 'geodirectory' ),
'desc' => __( 'Enter your Google maps API key here.', 'geodirectory' ),
'placeholder' => '',
'desc_tip' => true,
'default' => '',
'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1',
'advanced' => false
'api_key' => array(
'type' => 'text',
'title' => __( 'Api Key:', 'geodirectory' ),
'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
'placeholder' => '',
'desc_tip' => true,
'default' => '',
'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1',
'advanced' => false
),
)
);
Expand All @@ -204,32 +203,32 @@ public function output( $args = array(), $widget_args = array(), $content = '' )

// options
$defaults = array(
'type' => 'image', // image, place
'location' => 'Ireland',
'static_width' => '600',
'type' => 'image', // image, place
'location' => 'Ireland',
'static_width' => '600',
'static_height' => '400',
'width' => '100%',
'height' => '425px',
'maptype' => 'roadmap',
'zoom' => '7',
'api_key' => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE',
'width'=> '100%',
'height'=> '425px',
'maptype' => 'roadmap',
'zoom' => '7',
'api_key' => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE',
);

/**
* Parse incoming $args into an array and merge it with $defaults
*/
$args = wp_parse_args( $args, $defaults );
$args = wp_parse_args($args, $defaults );

$output = '';


// check if we have a global API key
$args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key'];

if ( $args['type'] == 'image' ) {
$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'] ) . "' />";
} else {
$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> ";
if($args['type']=='image'){
$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'])."' />";
}else{
$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> ";
}

return $output;
Expand All @@ -238,4 +237,7 @@ public function output( $args = array(), $widget_args = array(), $content = '' )

}

new SD_Map();
// register it.
add_action( 'widgets_init', function () {
register_widget( 'SD_Map' );
} );
6 changes: 3 additions & 3 deletions sd-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @return mixed|void
*/
function sd_pagenow_exclude() {
function sd_pagenow_exclude(){
return apply_filters( 'sd_pagenow_exclude', array(
'upload.php',
'edit-comments.php',
Expand All @@ -33,6 +33,6 @@ function sd_pagenow_exclude() {
*
* @return mixed|void
*/
function sd_widget_exclude() {
function sd_widget_exclude(){
return apply_filters( 'sd_widget_exclude', array() );
}
}
Loading

0 comments on commit 7204a81

Please sign in to comment.