Changeset 2480511
- Timestamp:
- 02/24/2021 10:12:48 AM (5 years ago)
- Location:
- miqid-elementor/trunk
- Files:
-
- 1 added
- 8 edited
-
core/widget_miqid.php (modified) (2 diffs)
-
handler/mybody.php (added)
-
miqid-elementor.php (modified) (2 diffs)
-
readme.md (modified) (1 diff)
-
widget/dynamic_images.php (modified) (2 diffs)
-
widget/dynamic_text.php (modified) (1 diff)
-
widget/iconlist.php (modified) (1 diff)
-
widget/input.php (modified) (1 diff)
-
widget/text_hide_if.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
miqid-elementor/trunk/core/widget_miqid.php
r2426420 r2480511 4 4 5 5 use Elementor\Widget_Base; 6 use MIQID\Elementor\Handler\{Address, Profile};6 use MIQID\Elementor\Handler\{Address, MyBody, Profile}; 7 7 use ReflectionClass; 8 8 … … 30 30 31 31 function getMIQIDFields() { 32 $options = []; 32 33 $Classes = [ 33 34 Profile::class, 34 35 Address::class, 36 MyBody::class, 35 37 ]; 36 $options = [];37 foreach ( $Classes as $i => $Class ) {38 if ( ! class_exists( $Class ) ) {39 continue;40 }41 38 42 $ClassShortName = ( new ReflectionClass( $Class ) )->getShortName(); 39 foreach ( $Classes as $i => $class ) { 40 $ReflectionClass = new ReflectionClass( $class ); 41 $ShortName = $ReflectionClass->getShortName(); 42 $class_options = []; 43 do { 44 foreach ( $ReflectionClass->getProperties() as $property ) { 45 $class_options[ sprintf( '%s.%s', $ShortName, $property->getName() ) ] = __( $property->getName(), 'miqid-core' ); 46 } 47 } while ( $ReflectionClass = $ReflectionClass->getParentClass() ); 48 49 $class_options = array_filter( $class_options, function ( $key ) { 50 return ! preg_match( '/instance/i', $key ); 51 }, ARRAY_FILTER_USE_KEY ); 43 52 44 53 $options[ $i ] = [ 45 'label' => __( $ ClassShortName, 'miqid-core' ),46 'options' => [],54 'label' => __( $ShortName, 'miqid-core' ), 55 'options' => $class_options, 47 56 ]; 48 49 50 $obj = $Class::Instance();51 $obj_data = [];52 if ( method_exists( $obj, 'jsonSerialize' ) ) {53 $obj_data = $obj->jsonSerialize();54 } else if ( ! empty( get_object_vars( $obj ) ) ) {55 $obj_data = get_object_vars( $obj );56 }57 58 foreach ( $obj_data as $key => $value ) {59 $optionKey = sprintf( '%s.%s', $ClassShortName, $key );60 $options[ $i ]['options'][ $optionKey ] = __( $key, 'miqid-core' );61 }62 57 } 63 58 -
miqid-elementor/trunk/miqid-elementor.php
r2466958 r2480511 4 4 * Plugin Name: MIQID-Elementor 5 5 * Description: MIQID-Elementor extend Elementor with MIQID data. 6 * Version: 1. 5.26 * Version: 1.6.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 24 24 25 25 class Elementor { 26 const VERSION = "1. 3";26 const VERSION = "1.6"; 27 27 const MINIMUM_ELEMENTOR_VERSION = "2.0.0"; 28 28 const MINIMUM_PHP_VERSION = "7.2"; -
miqid-elementor/trunk/readme.md
r2466958 r2480511 4 4 Tested up to: 5.6 5 5 Requires PHP: 7.2 6 Stable tag: 1. 5.26 Stable tag: 1.6.0 7 7 License: GPL v3 or later 8 8 -
miqid-elementor/trunk/widget/dynamic_images.php
r2466958 r2480511 140 140 ]; 141 141 142 $match = apply_filters( sprintf( 'miqid_%s', Util::snake_case( implode( '_', $miqid ) ) ), '');142 $match = do_shortcode( sprintf( '[miqid-%s fields="%s"]', mb_strtolower( array_shift( $miqid ) ), array_shift( $miqid ) ) ); 143 143 144 144 $cases = current( array_filter( $cases, function ( $case ) use ( $match ) { … … 176 176 } 177 177 178 function EscapeNonASCII( $string ) //Convert string to hex, replace non-printable chars with escaped hex 179 { 180 $hexbytes = strtoupper( bin2hex( $string ) ); 181 $i = 0; 182 while ( $i < strlen( $hexbytes ) ) { 183 $hexpair = substr( $hexbytes, $i, 2 ); 184 $decimal = hexdec( $hexpair ); 185 if ( $decimal < 32 || $decimal > 126 ) { 186 $top = substr( $hexbytes, 0, $i ); 187 $escaped = EscapeHex( $hexpair ); 188 $bottom = substr( $hexbytes, $i + 2 ); 189 $hexbytes = $top . $escaped . $bottom; 190 $i += 8; 191 } 192 $i += 2; 193 } 194 $string = hex2bin( $hexbytes ); 195 196 return $string; 197 } 198 199 function EscapeHex( $string ) //Helper function for EscapeNonASCII() 200 { 201 $x = "5C5C78"; //\x 202 $topnibble = bin2hex( $string[0] ); //Convert top nibble to hex 203 $bottomnibble = bin2hex( $string[1] ); //Convert bottom nibble to hex 204 $escaped = $x . $topnibble . $bottomnibble; //Concatenate escape sequence "\x" with top and bottom nibble 205 206 return $escaped; 207 } 208 209 function UnescapeNonASCII( $string ) //Convert string to hex, replace escaped hex with actual hex. 210 { 211 $stringtohex = bin2hex( $string ); 212 $stringtohex = preg_replace_callback( '/5c5c78([a-fA-F0-9]{4})/', function ( $m ) { 213 return hex2bin( $m[1] ); 214 }, $stringtohex ); 215 216 return hex2bin( strtoupper( $stringtohex ) ); 217 } 178 218 } -
miqid-elementor/trunk/widget/dynamic_text.php
r2466958 r2480511 134 134 $icon = $settings["icon"]; 135 135 $cases = $settings['switch']; 136 $match = apply_filters( sprintf( 'miqid_%s', Util::snake_case( implode( '_', $miqid ) ) ), '');136 $match = do_shortcode( sprintf( '[miqid-%s fields="%s"]', mb_strtolower( array_shift( $miqid ) ), array_shift( $miqid ) ) ); 137 137 $cases = current( array_filter( $cases, function ( $case ) use ( $match ) { 138 138 return preg_match( '/' . $case['match'] . '/i', $match ); -
miqid-elementor/trunk/widget/iconlist.php
r2466958 r2480511 95 95 foreach ( $settings['lines'] as $key => $line ) { 96 96 $miqid = explode( '.', $line["miqid"] ?? '' ); 97 $match = apply_filters( sprintf( 'miqid_%s', Util::snake_case( implode( '_', $miqid ) ) ), '' ); 98 99 $icon = preg_match( '/' . $line['match'] . '/i', $match ) 97 $match = do_shortcode( sprintf( '[miqid-%s fields="%s"]', mb_strtolower( array_shift( $miqid ) ), array_shift( $miqid ) ) ); 98 $icon = preg_match( '/' . $line['match'] . '/i', $match ) 100 99 ? $line['match_icon'] 101 100 : $line['default_icon']; -
miqid-elementor/trunk/widget/input.php
r2466381 r2480511 275 275 $this->add_render_attribute( 'input', 'type', $type ); 276 276 $this->add_render_attribute( 'input', 'name', sprintf( '[%s]', implode( '][', $field ) ) ); 277 $ filter = sprintf( 'miqid_%s', Util::snake_case( implode( '_', $field ) ) );278 $this->add_render_attribute( 'input', 'value', apply_filters( $filter, '' ));277 $value = do_shortcode( sprintf( '[miqid-%s fields="%s"]', mb_strtolower( array_shift( $miqid ) ), array_shift( $miqid ) ) ); 278 $this->add_render_attribute( 'input', 'value', $value ); 279 279 280 280 if ( ! empty( $settings['placeholder'] ) ) { -
miqid-elementor/trunk/widget/text_hide_if.php
r2466958 r2480511 47 47 $text = $settings['text']; 48 48 $miqid = explode( '.', $settings["miqid"] ?? '' ); 49 $match = apply_filters( sprintf( 'miqid_%s', Util::snake_case( implode( '_', $miqid ) ) ), '');49 $match = do_shortcode( sprintf( '[miqid-%s fields="%s"]', mb_strtolower( array_shift( $miqid ) ), array_shift( $miqid ) ) ); 50 50 $negate = filter_var( $settings['negate'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) ?? false; 51 51
Note: See TracChangeset
for help on using the changeset viewer.