Changeset 2634877
- Timestamp:
- 11/24/2021 03:36:10 PM (4 years ago)
- Location:
- shoppable-recipes
- Files:
-
- 14 edited
- 1 copied
-
tags/1.1.6 (copied) (copied from shoppable-recipes/trunk)
-
tags/1.1.6/includes/class-widget.php (modified) (3 diffs)
-
tags/1.1.6/readme.txt (modified) (3 diffs)
-
tags/1.1.6/shoppable-recipes.php (modified) (2 diffs)
-
tags/1.1.6/vendor/autoload.php (modified) (1 diff)
-
tags/1.1.6/vendor/composer/autoload_real.php (modified) (3 diffs)
-
tags/1.1.6/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.1.6/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/includes/class-widget.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/shoppable-recipes.php (modified) (2 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shoppable-recipes/tags/1.1.6/includes/class-widget.php
r2632758 r2634877 37 37 * @return string 38 38 */ 39 public function shortcode() { 40 41 return $this->widget(); 39 public function shortcode($atts) { 40 41 $atts = shortcode_atts([ 42 'url' => '', 43 ], $atts); 44 45 // Remove all illegal characters from a url 46 $recipe_url = filter_var($atts['url'], FILTER_SANITIZE_URL); 47 48 // Validate url 49 if (filter_var($recipe_url, FILTER_VALIDATE_URL)) { 50 return $this->widget($recipe_url); 51 } else { 52 return $this->widget(); 53 } 54 } 55 56 /** 57 * Returns widget settings (recipeId or recipeUrl) depending on a given recipe URL. 58 * 59 * @param $recipe_url 60 * 61 * @return string 62 */ 63 private function custom_recipe_url($recipe_url) { 64 65 if ($recipe_url && parse_url($recipe_url)['host'] === 'my.whisk.com') { 66 return 'recipeId: "' . basename(parse_url($recipe_url, PHP_URL_PATH)) . '",'; 67 } else { 68 return 'recipeUrl: "' . $recipe_url . '",'; 69 } 70 42 71 } 43 72 … … 47 76 * @return string 48 77 */ 49 public function widget( ) {78 public function widget($recipe_url = '') { 50 79 51 80 wp_enqueue_script("whisk-widget-loader", SHOPPABLE_RECIPES_URL . "assets/loader.js", [], '', true); … … 77 106 whisk.queue.push(function () { 78 107 whisk.shoppingList.defineWidget("whisk-widget", { 79 80 108 <?php if ($custom_widget && $custom_widget_toggle === 'on') : echo $custom_widget; else : ?> 81 82 trackingId: "<?php if ($options['tracking_id']) { 109 <?php if ($recipe_url) : 110 echo $this->custom_recipe_url($recipe_url); 111 endif; ?> 112 trackingId: "<?php if ($options['tracking_id']) : 83 113 echo $options['tracking_id']; 84 }?>",114 endif; ?>", 85 115 onlineCheckout: { 86 116 enabled: <?php if ($options['hide_add_to_cart'] === "on") { -
shoppable-recipes/tags/1.1.6/readme.txt
r2632758 r2634877 5 5 Tested up to: 5.6 6 6 Requires PHP: 5.6.20 7 Stable tag: 1.1. 57 Stable tag: 1.1.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 ` 27 27 <?php echo do_shortcode('[whisk-widget]'); ?> 28 ` 29 30 By default, widget will use URL of the page it's inserted into and look for a recipe there. If no recipe is found, widget will not load. 31 It is also possible to specify another recipe URL with 'url' shortcode parameter and use widget on a pages without recipes. 32 ` 33 [whisk-widget url='https://my.whisk.com/recipes/1073f5bf3bf4dab40f9b0a6589309aed6e9'] 28 34 ` 29 35 … … 73 79 74 80 == Changelog == 81 = v 1.1.6 (24.11.2021) = 82 * added: new shortcode parameter (url) to specify custom recipe URL (by default widget uses URL of the page it's inserted into). 75 83 = v 1.1.5 (19.11.2021) = 76 84 * fixed a bug with recipe URL -
shoppable-recipes/tags/1.1.6/shoppable-recipes.php
r2632758 r2634877 10 10 * Requires at least: 5.0 11 11 * Tested up to: 5.6 12 * Version: 1.1. 513 * Stable tag: 1.1. 512 * Version: 1.1.6 13 * Stable tag: 1.1.6 14 14 * 15 15 * Text Domain: shoppable-recipes … … 27 27 } 28 28 29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1. 5' );29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1.6' ); 30 30 define( 'SHOPPABLE_RECIPES_PATH', __DIR__ ); 31 31 define( 'SHOPPABLE_RECIPES_URL', plugin_dir_url( __FILE__ ) ); -
shoppable-recipes/tags/1.1.6/vendor/autoload.php
r2632758 r2634877 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f::getLoader();7 return ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0::getLoader(); -
shoppable-recipes/tags/1.1.6/vendor/composer/autoload_real.php
r2632758 r2634877 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f5 class ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
shoppable-recipes/tags/1.1.6/vendor/composer/autoload_static.php
r2632758 r2634877 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f7 class ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
shoppable-recipes/tags/1.1.6/vendor/composer/installed.php
r2632758 r2634877 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.1. 5',4 'version' => '1.1. 5.0',3 'pretty_version' => '1.1.6', 4 'version' => '1.1.6.0', 5 5 'type' => 'wordpress-plugin', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' 92b49749e55d80d81be26a44253e6ed2ce1c773e',8 'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70', 9 9 'name' => 'paul-fedorov/shoppable-recipes', 10 10 'dev' => false, … … 21 21 ), 22 22 'paul-fedorov/shoppable-recipes' => array( 23 'pretty_version' => '1.1. 5',24 'version' => '1.1. 5.0',23 'pretty_version' => '1.1.6', 24 'version' => '1.1.6.0', 25 25 'type' => 'wordpress-plugin', 26 26 'install_path' => __DIR__ . '/../../', 27 27 'aliases' => array(), 28 'reference' => ' 92b49749e55d80d81be26a44253e6ed2ce1c773e',28 'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70', 29 29 'dev_requirement' => false, 30 30 ), -
shoppable-recipes/trunk/includes/class-widget.php
r2632758 r2634877 37 37 * @return string 38 38 */ 39 public function shortcode() { 40 41 return $this->widget(); 39 public function shortcode($atts) { 40 41 $atts = shortcode_atts([ 42 'url' => '', 43 ], $atts); 44 45 // Remove all illegal characters from a url 46 $recipe_url = filter_var($atts['url'], FILTER_SANITIZE_URL); 47 48 // Validate url 49 if (filter_var($recipe_url, FILTER_VALIDATE_URL)) { 50 return $this->widget($recipe_url); 51 } else { 52 return $this->widget(); 53 } 54 } 55 56 /** 57 * Returns widget settings (recipeId or recipeUrl) depending on a given recipe URL. 58 * 59 * @param $recipe_url 60 * 61 * @return string 62 */ 63 private function custom_recipe_url($recipe_url) { 64 65 if ($recipe_url && parse_url($recipe_url)['host'] === 'my.whisk.com') { 66 return 'recipeId: "' . basename(parse_url($recipe_url, PHP_URL_PATH)) . '",'; 67 } else { 68 return 'recipeUrl: "' . $recipe_url . '",'; 69 } 70 42 71 } 43 72 … … 47 76 * @return string 48 77 */ 49 public function widget( ) {78 public function widget($recipe_url = '') { 50 79 51 80 wp_enqueue_script("whisk-widget-loader", SHOPPABLE_RECIPES_URL . "assets/loader.js", [], '', true); … … 77 106 whisk.queue.push(function () { 78 107 whisk.shoppingList.defineWidget("whisk-widget", { 79 80 108 <?php if ($custom_widget && $custom_widget_toggle === 'on') : echo $custom_widget; else : ?> 81 82 trackingId: "<?php if ($options['tracking_id']) { 109 <?php if ($recipe_url) : 110 echo $this->custom_recipe_url($recipe_url); 111 endif; ?> 112 trackingId: "<?php if ($options['tracking_id']) : 83 113 echo $options['tracking_id']; 84 }?>",114 endif; ?>", 85 115 onlineCheckout: { 86 116 enabled: <?php if ($options['hide_add_to_cart'] === "on") { -
shoppable-recipes/trunk/readme.txt
r2632758 r2634877 5 5 Tested up to: 5.6 6 6 Requires PHP: 5.6.20 7 Stable tag: 1.1. 57 Stable tag: 1.1.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 ` 27 27 <?php echo do_shortcode('[whisk-widget]'); ?> 28 ` 29 30 By default, widget will use URL of the page it's inserted into and look for a recipe there. If no recipe is found, widget will not load. 31 It is also possible to specify another recipe URL with 'url' shortcode parameter and use widget on a pages without recipes. 32 ` 33 [whisk-widget url='https://my.whisk.com/recipes/1073f5bf3bf4dab40f9b0a6589309aed6e9'] 28 34 ` 29 35 … … 73 79 74 80 == Changelog == 81 = v 1.1.6 (24.11.2021) = 82 * added: new shortcode parameter (url) to specify custom recipe URL (by default widget uses URL of the page it's inserted into). 75 83 = v 1.1.5 (19.11.2021) = 76 84 * fixed a bug with recipe URL -
shoppable-recipes/trunk/shoppable-recipes.php
r2632758 r2634877 10 10 * Requires at least: 5.0 11 11 * Tested up to: 5.6 12 * Version: 1.1. 513 * Stable tag: 1.1. 512 * Version: 1.1.6 13 * Stable tag: 1.1.6 14 14 * 15 15 * Text Domain: shoppable-recipes … … 27 27 } 28 28 29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1. 5' );29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1.6' ); 30 30 define( 'SHOPPABLE_RECIPES_PATH', __DIR__ ); 31 31 define( 'SHOPPABLE_RECIPES_URL', plugin_dir_url( __FILE__ ) ); -
shoppable-recipes/trunk/vendor/autoload.php
r2632758 r2634877 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f::getLoader();7 return ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0::getLoader(); -
shoppable-recipes/trunk/vendor/composer/autoload_real.php
r2632758 r2634877 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f5 class ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
shoppable-recipes/trunk/vendor/composer/autoload_static.php
r2632758 r2634877 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f7 class ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 32 32 { 33 33 return \Closure::bind(function () use ($loader) { 34 $loader->prefixLengthsPsr4 = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$prefixLengthsPsr4;35 $loader->prefixDirsPsr4 = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$prefixDirsPsr4;36 $loader->classMap = ComposerStaticInit 7fcdefbbaf23029e3b3d96510c06e14f::$classMap;34 $loader->prefixLengthsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixLengthsPsr4; 35 $loader->prefixDirsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixDirsPsr4; 36 $loader->classMap = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$classMap; 37 37 38 38 }, null, ClassLoader::class); -
shoppable-recipes/trunk/vendor/composer/installed.php
r2632758 r2634877 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => '1.1. 5',4 'version' => '1.1. 5.0',3 'pretty_version' => '1.1.6', 4 'version' => '1.1.6.0', 5 5 'type' => 'wordpress-plugin', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => ' 92b49749e55d80d81be26a44253e6ed2ce1c773e',8 'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70', 9 9 'name' => 'paul-fedorov/shoppable-recipes', 10 10 'dev' => false, … … 21 21 ), 22 22 'paul-fedorov/shoppable-recipes' => array( 23 'pretty_version' => '1.1. 5',24 'version' => '1.1. 5.0',23 'pretty_version' => '1.1.6', 24 'version' => '1.1.6.0', 25 25 'type' => 'wordpress-plugin', 26 26 'install_path' => __DIR__ . '/../../', 27 27 'aliases' => array(), 28 'reference' => ' 92b49749e55d80d81be26a44253e6ed2ce1c773e',28 'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70', 29 29 'dev_requirement' => false, 30 30 ),
Note: See TracChangeset
for help on using the changeset viewer.