Plugin Directory

Changeset 2634877


Ignore:
Timestamp:
11/24/2021 03:36:10 PM (4 years ago)
Author:
paulfedorov
Message:

Update to version 1.1.6 from GitHub

Location:
shoppable-recipes
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shoppable-recipes/tags/1.1.6/includes/class-widget.php

    r2632758 r2634877  
    3737     * @return string
    3838     */
    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
    4271    }
    4372
     
    4776     * @return string
    4877     */
    49     public function widget() {
     78    public function widget($recipe_url = '') {
    5079
    5180        wp_enqueue_script("whisk-widget-loader", SHOPPABLE_RECIPES_URL . "assets/loader.js", [], '', true);
     
    77106        whisk.queue.push(function () {
    78107            whisk.shoppingList.defineWidget("whisk-widget", {
    79 
    80108                <?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']) :
    83113                    echo $options['tracking_id'];
    84                 } ?>",
     114                endif; ?>",
    85115                onlineCheckout: {
    86116                    enabled: <?php if ($options['hide_add_to_cart'] === "on") {
  • shoppable-recipes/tags/1.1.6/readme.txt

    r2632758 r2634877  
    55Tested up to: 5.6
    66Requires PHP: 5.6.20
    7 Stable tag: 1.1.5
     7Stable tag: 1.1.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626`
    2727<?php echo do_shortcode('[whisk-widget]'); ?>
     28`
     29
     30By 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.
     31It 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']
    2834`
    2935
     
    7379
    7480== 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).
    7583= v 1.1.5 (19.11.2021) =
    7684* fixed a bug with recipe URL
  • shoppable-recipes/tags/1.1.6/shoppable-recipes.php

    r2632758 r2634877  
    1010 * Requires at least: 5.0
    1111 * Tested up to: 5.6
    12  * Version: 1.1.5
    13  * Stable tag: 1.1.5
     12 * Version: 1.1.6
     13 * Stable tag: 1.1.6
    1414 *
    1515 * Text Domain: shoppable-recipes
     
    2727}
    2828
    29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1.5' );
     29define( 'SHOPPABLE_RECIPES_VERSION', '1.1.6' );
    3030define( 'SHOPPABLE_RECIPES_PATH', __DIR__ );
    3131define( 'SHOPPABLE_RECIPES_URL', plugin_dir_url( __FILE__ ) );
  • shoppable-recipes/tags/1.1.6/vendor/autoload.php

    r2632758 r2634877  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f::getLoader();
     7return ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0::getLoader();
  • shoppable-recipes/tags/1.1.6/vendor/composer/autoload_real.php

    r2632758 r2634877  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f
     5class ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • shoppable-recipes/tags/1.1.6/vendor/composer/autoload_static.php

    r2632758 r2634877  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f
     7class ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3232    {
    3333        return \Closure::bind(function () use ($loader) {
    34             $loader->prefixLengthsPsr4 = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$prefixLengthsPsr4;
    35             $loader->prefixDirsPsr4 = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$prefixDirsPsr4;
    36             $loader->classMap = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$classMap;
     34            $loader->prefixLengthsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixLengthsPsr4;
     35            $loader->prefixDirsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixDirsPsr4;
     36            $loader->classMap = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$classMap;
    3737
    3838        }, null, ClassLoader::class);
  • shoppable-recipes/tags/1.1.6/vendor/composer/installed.php

    r2632758 r2634877  
    11<?php return array(
    22    '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',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => '92b49749e55d80d81be26a44253e6ed2ce1c773e',
     8        'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70',
    99        'name' => 'paul-fedorov/shoppable-recipes',
    1010        'dev' => false,
     
    2121        ),
    2222        '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',
    2525            'type' => 'wordpress-plugin',
    2626            'install_path' => __DIR__ . '/../../',
    2727            'aliases' => array(),
    28             'reference' => '92b49749e55d80d81be26a44253e6ed2ce1c773e',
     28            'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70',
    2929            'dev_requirement' => false,
    3030        ),
  • shoppable-recipes/trunk/includes/class-widget.php

    r2632758 r2634877  
    3737     * @return string
    3838     */
    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
    4271    }
    4372
     
    4776     * @return string
    4877     */
    49     public function widget() {
     78    public function widget($recipe_url = '') {
    5079
    5180        wp_enqueue_script("whisk-widget-loader", SHOPPABLE_RECIPES_URL . "assets/loader.js", [], '', true);
     
    77106        whisk.queue.push(function () {
    78107            whisk.shoppingList.defineWidget("whisk-widget", {
    79 
    80108                <?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']) :
    83113                    echo $options['tracking_id'];
    84                 } ?>",
     114                endif; ?>",
    85115                onlineCheckout: {
    86116                    enabled: <?php if ($options['hide_add_to_cart'] === "on") {
  • shoppable-recipes/trunk/readme.txt

    r2632758 r2634877  
    55Tested up to: 5.6
    66Requires PHP: 5.6.20
    7 Stable tag: 1.1.5
     7Stable tag: 1.1.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626`
    2727<?php echo do_shortcode('[whisk-widget]'); ?>
     28`
     29
     30By 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.
     31It 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']
    2834`
    2935
     
    7379
    7480== 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).
    7583= v 1.1.5 (19.11.2021) =
    7684* fixed a bug with recipe URL
  • shoppable-recipes/trunk/shoppable-recipes.php

    r2632758 r2634877  
    1010 * Requires at least: 5.0
    1111 * Tested up to: 5.6
    12  * Version: 1.1.5
    13  * Stable tag: 1.1.5
     12 * Version: 1.1.6
     13 * Stable tag: 1.1.6
    1414 *
    1515 * Text Domain: shoppable-recipes
     
    2727}
    2828
    29 define( 'SHOPPABLE_RECIPES_VERSION', '1.1.5' );
     29define( 'SHOPPABLE_RECIPES_VERSION', '1.1.6' );
    3030define( 'SHOPPABLE_RECIPES_PATH', __DIR__ );
    3131define( 'SHOPPABLE_RECIPES_URL', plugin_dir_url( __FILE__ ) );
  • shoppable-recipes/trunk/vendor/autoload.php

    r2632758 r2634877  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f::getLoader();
     7return ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0::getLoader();
  • shoppable-recipes/trunk/vendor/composer/autoload_real.php

    r2632758 r2634877  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f
     5class ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit7fcdefbbaf23029e3b3d96510c06e14f', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit3ae3e2128f1c06f940a9c8000bbb69d0', 'loadClassLoader'));
    3030
    3131        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3333            require __DIR__ . '/autoload_static.php';
    3434
    35             call_user_func(\Composer\Autoload\ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::getInitializer($loader));
     35            call_user_func(\Composer\Autoload\ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::getInitializer($loader));
    3636        } else {
    3737            $map = require __DIR__ . '/autoload_namespaces.php';
  • shoppable-recipes/trunk/vendor/composer/autoload_static.php

    r2632758 r2634877  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f
     7class ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    3232    {
    3333        return \Closure::bind(function () use ($loader) {
    34             $loader->prefixLengthsPsr4 = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$prefixLengthsPsr4;
    35             $loader->prefixDirsPsr4 = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$prefixDirsPsr4;
    36             $loader->classMap = ComposerStaticInit7fcdefbbaf23029e3b3d96510c06e14f::$classMap;
     34            $loader->prefixLengthsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixLengthsPsr4;
     35            $loader->prefixDirsPsr4 = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$prefixDirsPsr4;
     36            $loader->classMap = ComposerStaticInit3ae3e2128f1c06f940a9c8000bbb69d0::$classMap;
    3737
    3838        }, null, ClassLoader::class);
  • shoppable-recipes/trunk/vendor/composer/installed.php

    r2632758 r2634877  
    11<?php return array(
    22    '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',
    55        'type' => 'wordpress-plugin',
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => '92b49749e55d80d81be26a44253e6ed2ce1c773e',
     8        'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70',
    99        'name' => 'paul-fedorov/shoppable-recipes',
    1010        'dev' => false,
     
    2121        ),
    2222        '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',
    2525            'type' => 'wordpress-plugin',
    2626            'install_path' => __DIR__ . '/../../',
    2727            'aliases' => array(),
    28             'reference' => '92b49749e55d80d81be26a44253e6ed2ce1c773e',
     28            'reference' => 'aa29733feb8d517644b2bd2399e25f384f42ad70',
    2929            'dev_requirement' => false,
    3030        ),
Note: See TracChangeset for help on using the changeset viewer.