Lazy Load by WP Rocket - Version 2.0

Version Description

  • Enhancement: Lazyload is now applied on the template_redirect hook, which should allow the plugin to apply the optimization on more images and encountering less conflicts at the same time
  • Enhancement: Specifically target with the lazyload script images/iframes elements with a data-lazy-src attribute
  • Enhancement: Update lazyload script to the latest version
  • Enhancement: Possibility to apply lazyload on background-images with a specific markup, see FAQ
  • Enhancement: Use a svg image as placeholder instead of a base64 gif
  • Bugfix: Only use MutationObserver if available in the browser
  • Bugfix: When using the Youtube thumbnail option, correctly format the Youtube query if the video URL is encoded
  • Bugfix: Improve iframe matching to prevent unexpected results
  • Bugfix: Update CSS for the Youtube thumbnail option to prevent issue with the Gutenberg embeds block
Download this release

Release Info

Developer wp_media
Plugin Icon 128x128 Lazy Load by WP Rocket
Version 2.0
Comparing to
See all releases

Code changes from version 1.4.9 to 2.0

Files changed (126) hide show
  1. 3rd-party/3rd-party.php +0 -4
  2. 3rd-party/amp.php +0 -17
  3. admin/actions.php +0 -49
  4. admin/admin.php +0 -158
  5. admin/notices.php +0 -79
  6. assets/img/play.png +0 -0
  7. assets/js/lazyload-10.11.1.js +0 -301
  8. assets/js/lazyload-10.11.1.min.js +0 -1
  9. assets/js/lazyload-10.19.js +448 -0
  10. assets/js/lazyload-10.19.min.js +2 -0
  11. assets/js/lazyload-10.19.min.js.map +1 -0
  12. assets/js/lazyload-10.3.5.js +0 -249
  13. assets/js/lazyload-10.3.5.min.js +0 -1
  14. assets/js/lazyload-10.8.js +0 -273
  15. assets/js/lazyload-10.8.min.js +0 -1
  16. assets/js/lazyload-8.11.min.js +0 -1
  17. assets/js/{lazyload-8.11.js → lazyload-8.17.js} +245 -154
  18. assets/js/lazyload-8.17.min.js +2 -0
  19. assets/js/lazyload-8.17.min.js.map +1 -0
  20. assets/js/lazyload-8.2.js +0 -354
  21. assets/js/lazyload-8.2.min.js +0 -1
  22. assets/js/lazyload-8.5.2.js +0 -363
  23. assets/js/lazyload-8.5.2.min.js +0 -1
  24. assets/js/lazyload-8.9.js +0 -375
  25. assets/js/lazyload-8.9.min.js +0 -1
  26. composer.json +47 -0
  27. composer.lock +528 -0
  28. main.php +11 -0
  29. phpcs.xml +30 -0
  30. readme.txt +21 -2
  31. rocket-lazy-load.php +35 -575
  32. src/Admin/AdminPage.php +170 -0
  33. src/Admin/ImagifyNotice.php +66 -0
  34. src/EventManagement/EventManager.php +139 -0
  35. src/EventManagement/EventManagerAwareSubscriberInterface.php +15 -0
  36. src/EventManagement/SubscriberInterface.php +33 -0
  37. src/Options/AbstractOptions.php +63 -0
  38. src/Options/OptionArray.php +105 -0
  39. src/Options/Options.php +97 -0
  40. src/Plugin.php +91 -0
  41. src/ServiceProvider/AdminServiceProvider.php +41 -0
  42. src/ServiceProvider/ImagifyNoticeServiceProvider.php +39 -0
  43. src/ServiceProvider/LazyloadServiceProvider.php +42 -0
  44. src/ServiceProvider/OptionServiceProvider.php +39 -0
  45. src/ServiceProvider/SubscribersServiceProvider.php +54 -0
  46. src/Subscriber/AdminPageSubscriber.php +136 -0
  47. src/Subscriber/ImagifyNoticeSubscriber.php +144 -0
  48. src/Subscriber/LazyloadSubscriber.php +333 -0
  49. src/Subscriber/ThirdParty/AMPSubscriber.php +60 -0
  50. src/rocket-lazyload-requirements-check.php +137 -0
  51. vendor/autoload.php +7 -0
  52. vendor/composer/ClassLoader.php +445 -0
  53. vendor/composer/LICENSE +21 -0
  54. vendor/composer/autoload_classmap.php +9 -0
  55. vendor/composer/autoload_namespaces.php +9 -0
  56. vendor/composer/autoload_psr4.php +14 -0
  57. vendor/composer/autoload_real.php +52 -0
  58. vendor/composer/autoload_static.php +60 -0
  59. vendor/composer/installed.json +197 -0
  60. vendor/container-interop/container-interop/.gitignore +3 -0
  61. vendor/container-interop/container-interop/LICENSE +20 -0
  62. vendor/container-interop/container-interop/README.md +148 -0
  63. vendor/container-interop/container-interop/composer.json +15 -0
  64. vendor/container-interop/container-interop/docs/ContainerInterface-meta.md +114 -0
  65. vendor/container-interop/container-interop/docs/ContainerInterface.md +158 -0
  66. vendor/container-interop/container-interop/docs/Delegate-lookup-meta.md +259 -0
  67. vendor/container-interop/container-interop/docs/Delegate-lookup.md +60 -0
  68. vendor/container-interop/container-interop/docs/images/interoperating_containers.png +0 -0
  69. vendor/container-interop/container-interop/docs/images/priority.png +0 -0
  70. vendor/container-interop/container-interop/docs/images/side_by_side_containers.png +0 -0
  71. vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php +15 -0
  72. vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php +15 -0
  73. vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php +15 -0
  74. vendor/league/container/CHANGELOG.md +123 -0
  75. vendor/league/container/CONTRIBUTING.md +29 -0
  76. vendor/league/container/LICENSE.md +21 -0
  77. vendor/league/container/README.md +69 -0
  78. vendor/league/container/composer.json +53 -0
  79. vendor/league/container/src/Argument/ArgumentResolverInterface.php +26 -0
  80. vendor/league/container/src/Argument/ArgumentResolverTrait.php +82 -0
  81. vendor/league/container/src/Argument/RawArgument.php +27 -0
  82. vendor/league/container/src/Argument/RawArgumentInterface.php +13 -0
  83. vendor/league/container/src/Container.php +305 -0
  84. vendor/league/container/src/ContainerAwareInterface.php +20 -0
  85. vendor/league/container/src/ContainerAwareTrait.php +34 -0
  86. vendor/league/container/src/ContainerInterface.php +59 -0
  87. vendor/league/container/src/Definition/AbstractDefinition.php +62 -0
  88. vendor/league/container/src/Definition/CallableDefinition.php +23 -0
  89. vendor/league/container/src/Definition/ClassDefinition.php +67 -0
  90. vendor/league/container/src/Definition/ClassDefinitionInterface.php +23 -0
  91. vendor/league/container/src/Definition/DefinitionFactory.php +28 -0
  92. vendor/league/container/src/Definition/DefinitionFactoryInterface.php +17 -0
  93. vendor/league/container/src/Definition/DefinitionInterface.php +30 -0
  94. vendor/league/container/src/Exception/NotFoundException.php +10 -0
  95. vendor/league/container/src/ImmutableContainerAwareInterface.php +22 -0
  96. vendor/league/container/src/ImmutableContainerAwareTrait.php +36 -0
  97. vendor/league/container/src/ImmutableContainerInterface.php +10 -0
  98. vendor/league/container/src/Inflector/Inflector.php +103 -0
  99. vendor/league/container/src/Inflector/InflectorAggregate.php +53 -0
  100. vendor/league/container/src/Inflector/InflectorAggregateInterface.php +25 -0
  101. vendor/league/container/src/ReflectionContainer.php +87 -0
  102. vendor/league/container/src/ServiceProvider/AbstractServiceProvider.php +27 -0
  103. vendor/league/container/src/ServiceProvider/AbstractSignatureServiceProvider.php +31 -0
  104. vendor/league/container/src/ServiceProvider/BootableServiceProviderInterface.php +14 -0
  105. vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php +88 -0
  106. vendor/league/container/src/ServiceProvider/ServiceProviderAggregateInterface.php +32 -0
  107. vendor/league/container/src/ServiceProvider/ServiceProviderInterface.php +26 -0
  108. vendor/league/container/src/ServiceProvider/SignatureServiceProviderInterface.php +24 -0
  109. vendor/psr/container/.gitignore +3 -0
  110. vendor/psr/container/LICENSE +21 -0
  111. vendor/psr/container/README.md +5 -0
  112. vendor/psr/container/composer.json +27 -0
  113. vendor/psr/container/src/ContainerExceptionInterface.php +13 -0
  114. vendor/psr/container/src/ContainerInterface.php +37 -0
  115. vendor/psr/container/src/NotFoundExceptionInterface.php +13 -0
  116. vendor/wp-media/rocket-lazyload-common/.gitignore +1 -0
  117. vendor/wp-media/rocket-lazyload-common/LICENSE +674 -0
  118. vendor/wp-media/rocket-lazyload-common/README.md +2 -0
  119. vendor/wp-media/rocket-lazyload-common/composer.json +23 -0
  120. vendor/wp-media/rocket-lazyload-common/composer.lock +71 -0
  121. vendor/wp-media/rocket-lazyload-common/phpcs.xml +7 -0
  122. vendor/wp-media/rocket-lazyload-common/src/Assets.php +116 -0
  123. vendor/wp-media/rocket-lazyload-common/src/Iframe.php +170 -0
  124. vendor/wp-media/rocket-lazyload-common/src/Image.php +248 -0
  125. views/admin-page.php +118 -0
  126. views/imagify-notice.php +33 -0
3rd-party/3rd-party.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- require ROCKET_LL_3RD_PARTY_PATH . 'amp.php';
 
 
 
 
3rd-party/amp.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- /**
5
- * Removes LazyLoad when on an AMP version of a post with the AMP for WordPress plugin from Auttomatic
6
- *
7
- * @since 1.2.2
8
- *
9
- * @author Remy Perona
10
- */
11
- function rocket_lazyload_disable_on_amp() {
12
- if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
13
- add_filter( 'do_rocket_lazyload', '__return_false' );
14
- add_filter( 'do_rocket_lazyload_iframes', '__return_false' );
15
- }
16
- }
17
- add_action( 'wp', 'rocket_lazyload_disable_on_amp' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/actions.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- /**
5
- * Manage the dismissed boxes
6
- *
7
- * @since 2.4 Add a delete_transient on function name (box name)
8
- * @since 1.3.0 $args can replace $_GET when called internaly
9
- * @since 1.1.10
10
- *
11
- * @param array $args An array of query args.
12
- */
13
- function rocket_lazyload_dismiss_boxes( $args ) {
14
- $args = empty( $args ) ? $_GET : $args;
15
-
16
- if ( isset( $args['box'], $args['_wpnonce'] ) ) {
17
-
18
- if ( ! wp_verify_nonce( $args['_wpnonce'], $args['action'] . '_' . $args['box'] ) ) {
19
- if ( defined( 'DOING_AJAX' ) ) {
20
- wp_send_json( array( 'error' => 1 ) );
21
- } else {
22
- wp_nonce_ays( '' );
23
- }
24
- }
25
-
26
- if ( '__rocket_lazyload_imagify_notice' === $args['box'] ) {
27
- update_option( 'rocket_lazyload_dismiss_imagify_notice', 0 );
28
- }
29
-
30
- global $current_user;
31
- $actual = get_user_meta( $current_user->ID, 'rocket_lazyload_boxes', true );
32
- $actual = array_merge( (array) $actual, array( $args['box'] ) );
33
- $actual = array_filter( $actual );
34
- $actual = array_unique( $actual );
35
- update_user_meta( $current_user->ID, 'rocket_lazyload_boxes', $actual );
36
- delete_transient( $args['box'] );
37
-
38
- if ( 'admin-post.php' === $GLOBALS['pagenow'] ) {
39
- if ( defined( 'DOING_AJAX' ) ) {
40
- wp_send_json( array( 'error' => 0 ) );
41
- } else {
42
- wp_safe_redirect( wp_get_referer() );
43
- die();
44
- }
45
- }
46
- }
47
- }
48
- add_action( 'wp_ajax_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' );
49
- add_action( 'admin_post_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/admin.php DELETED
@@ -1,158 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- /**
5
- * Add Rocket LazyLoad settings page to Settings menu.
6
- *
7
- * @since 1.1
8
- * @return void
9
- */
10
- function rocket_lazyload_add_menu() {
11
- add_options_page( __( 'LazyLoad by WP Rocket', 'rocket-lazy-load' ), __( 'LazyLoad', 'rocket-lazy-load' ), 'manage_options', 'rocket-lazyload', 'rocket_lazyload_options_output' );
12
- }
13
- add_action( 'admin_menu', 'rocket_lazyload_add_menu' );
14
-
15
- /**
16
- * Enqueue the css for the option page
17
- *
18
- * @since 1.1
19
- * @author Remy Perona
20
- *
21
- * @param string $hook Current page hook.
22
- */
23
- function rocket_lazyload_enqueue_scripts( $hook ) {
24
- if ( 'settings_page_rocket-lazyload' !== $hook ) {
25
- return;
26
- }
27
-
28
- wp_enqueue_style( 'rocket-lazyload', ROCKET_LL_ASSETS_URL . 'css/admin.css', null, ROCKET_LL_VERSION );
29
- }
30
- add_action( 'admin_enqueue_scripts', 'rocket_lazyload_enqueue_scripts' );
31
-
32
-
33
- /**
34
- * Register Rocket LazyLoad settings.
35
- *
36
- * @since 1.1
37
- * @return void
38
- */
39
- function rocket_lazyload_settings_init() {
40
- register_setting( 'rocket_lazyload', 'rocket_lazyload_options' );
41
- }
42
- add_action( 'admin_init', 'rocket_lazyload_settings_init' );
43
-
44
-
45
- /**
46
- * Display Rocket LazyLoad settings.
47
- *
48
- * @since 1.1
49
- * @return void
50
- */
51
- function rocket_lazyload_options_output() {
52
- global $wp_version;
53
-
54
- $options = array(
55
- 'images' => array(
56
- 'label' => __( 'Images', 'rocket-lazy-load' ),
57
- ),
58
- 'iframes' => array(
59
- 'label' => __( 'Iframes &amp; Videos', 'rocket-lazy-load' ),
60
- ),
61
- 'youtube' => array(
62
- 'label' => __( 'Replace Youtube videos by thumbnail', 'rocket-lazy-load' ),
63
- ),
64
- );
65
-
66
- // check user capabilities.
67
- if ( ! current_user_can( 'manage_options' ) ) {
68
- return;
69
- }
70
-
71
- ?>
72
- <div class="wrap rocket-lazyload-settings">
73
-
74
- <?php $heading_tag = version_compare( $wp_version, '4.3' ) >= 0 ? 'h1' : 'h2'; ?>
75
- <<?php echo $heading_tag; ?> class="screen-reader-text"><?php echo esc_html( get_admin_page_title() ); ?></<?php echo $heading_tag; ?>>
76
- <div class="rocket-lazyload-header">
77
- <div>
78
- <p class="rocket-lazyload-title"><img src="<?php echo ROCKET_LL_ASSETS_URL; ?>img/logo.png" srcset="<?php echo ROCKET_LL_ASSETS_URL; ?>img/logo@2x.png 2x" alt="<?php echo esc_attr( get_admin_page_title() ); ?>" width="216" height="59"></p>
79
- <p class="rocket-lazyload-subtitle"><?php _e( 'Settings', 'rocket-lazy-load' ); ?></p>
80
- </div>
81
- <?php $rocket_lazyload_rate_url = 'https://wordpress.org/support/plugin/rocket-lazy-load/reviews/?rate=5#postform'; ?>
82
- <p class="rocket-lazyload-rate-us">
83
- <?php
84
- // Translators: %1$s is a <strong> tag, %2$s is </strong><br>, %3$s is the complete link tag to Rocket Lazy Load review form, %4$s is the closing </a> tag.
85
- printf( __( '%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'rocket-lazy-load' ), '<strong>', '</strong><br>', '<a href="' . $rocket_lazyload_rate_url . '">', '</a>' );
86
- ?>
87
- <br>
88
- <a class="stars" href="<?php echo $rocket_lazyload_rate_url; ?>"><?php echo str_repeat( '<span class="dashicons dashicons-star-filled"></span>', 5 ); ?></a>
89
- </p>
90
- </div>
91
- <div class="rocket-lazyload-body">
92
- <form action="options.php" class="rocket-lazyload-form" method="post">
93
- <fieldset>
94
- <legend class="screen-reader-text"><?php _e( 'Lazyload', 'rocket-lazy-load' ); ?></legend>
95
- <p><?php _e( 'LazyLoad displays images, iframes and videos on a page only when they are visible to the user.', 'rocket-lazy-load' ); ?></p>
96
- <p><?php _e( 'This mechanism reduces the number of HTTP requests and improves the loading time.', 'rocket-lazy-load' ); ?></p>
97
- <ul class="rocket-lazyload-options">
98
- <?php foreach ( $options as $slug => $infos ) { ?>
99
-
100
- <li class="rocket-lazyload-option">
101
- <input type="checkbox" value="1" id="lazyload-<?php echo $slug; ?>" name="rocket_lazyload_options[<?php echo $slug; ?>]" <?php checked( rocket_lazyload_get_option( $slug, 0 ), 1 ); ?> aria-labelledby="describe-lazyload-<?php echo $slug; ?>">
102
- <label for="lazyload-<?php echo $slug; ?>">
103
- <span id="describe-lazyload-<?php echo $slug; ?>" class="rocket-lazyload-label-description"><?php echo $infos['label']; ?></span>
104
- </label>
105
- </li>
106
-
107
- <?php } ?>
108
-
109
- </ul>
110
- </fieldset>
111
- <?php settings_fields( 'rocket_lazyload' ); ?>
112
-
113
- <?php if ( ! is_plugin_active( 'wp-rocket/wp-rocket.php' ) ) { ?>
114
- <div class="rocket-lazyload-upgrade">
115
-
116
- <div class="rocket-lazyload-upgrade-cta">
117
- <p class="rocket-lazyload-subtitle"><?php _e( 'We recommend for you', 'rocket-lazy-load' ); ?></p>
118
- <p class="rocket-lazyload-bigtext">
119
- <?php _e( 'Go Premium with', 'rocket-lazy-load' ); ?>
120
- <img class="rocket-lazyload-rocket-logo" src="<?php echo ROCKET_LL_ASSETS_URL; ?>img/wprocket.png" srcset="<?php echo ROCKET_LL_ASSETS_URL; ?>img/wprocket@2x.png" width="232" height="63" alt="WP Rocket">
121
- </p>
122
-
123
- <div class="rocket-lazyload-cta-block">
124
- <?php $promo = __( 'Get %s OFF%s Now', 'rocket-lazy-load' ); ?>
125
- <?php /*<span class="rocket-lazyload-cta-promo">
126
- <?php printf( $promo, '<strong>20%', '</strong>' ); ?>
127
- </span>*/ ?>
128
- <a class="button button-primary" href="https://wp-rocket.me/?utm_source=wp_plugin&utm_medium=rocket_lazyload"><?php _e( 'Get WP&nbsp;Rocket Now!', 'rocket-lazy-load' ); ?></a>
129
- </div>
130
- </div><!-- .rocket-lazyload-upgrade-cta -->
131
-
132
- <div class="rocket-lazyload-upgrade-arguments">
133
- <ul>
134
- <li class="rll-upgrade-item"><?php printf( __( '%sMultiple new features%s to further improve your load time', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
135
- <li class="rll-upgrade-item"><?php printf( __( 'All you need to %simprove your Google PageSpeed%s score', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
136
- <li class="rll-upgrade-item"><?php printf( __( '%sBoost your SEO%s by preloading your cache page for Google’s bots', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
137
- <li class="rll-upgrade-item"><?php printf( __( 'Watch your conversion rise with the %s100%% WooCommerce compatibility%s', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
138
- <li class="rll-upgrade-item"><?php printf( __( 'Minimal configuration, %sImmediate results%s', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
139
- <li class="rll-upgrade-item"><?php printf( __( 'Set up takes %s5 minutes flat%s', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
140
- <li class="rll-upgrade-item"><?php printf( __( '%s24/7 support%s', 'rocket-lazy-load' ), '<strong>', '</strong>' ) ?></li>
141
- </ul>
142
- </div><!-- .rocket-lazyload-upgrade-arguments -->
143
-
144
- </div><!-- .rocket-lazyload-upgrade -->
145
- <?php } ?>
146
-
147
- <p class="submit">
148
- <button type="submit" class="button button-primary">
149
- <span class="text"><?php _e( 'Save changes', 'rocket-lazy-load' ); ?></span>
150
- <span class="icon">✓</span>
151
- </button>
152
- </p>
153
- </form>
154
- </div>
155
- </div>
156
- <?php
157
- }
158
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/notices.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
3
-
4
- /**
5
- * Add a message about Imagify on the Rocket LazyLoad options page.
6
- *
7
- * @author Geoffrey Crofte
8
- * @return void
9
- * @since 1.4.5
10
- */
11
- function rocket_lazyload_imagify_notice() {
12
- $current_screen = get_current_screen();
13
-
14
- // Add the notice only on the "WP Rocket" settings, "Media Library" & "Upload New Media" screens.
15
- if ( 'admin_notices' === current_filter() && ( isset( $current_screen ) && 'settings_page_rocket-lazyload' !== $current_screen->base ) ) {
16
- return;
17
- }
18
-
19
- $boxes = get_user_meta( $GLOBALS['current_user']->ID, 'rocket_lazyload_boxes', true );
20
-
21
- if ( defined( 'IMAGIFY_VERSION' ) || in_array( __FUNCTION__, (array) $boxes, true ) || 1 === get_option( 'rocket_lazyload_dismiss_imagify_notice' ) || ! current_user_can( 'manage_options' ) ) {
22
- return;
23
- }
24
-
25
- $action_url = wp_nonce_url( add_query_arg(
26
- array(
27
- 'action' => 'install-plugin',
28
- 'plugin' => 'imagify',
29
- ),
30
- admin_url( 'update.php' )
31
- ), 'install-plugin_imagify' );
32
-
33
- $classes = ' install-now';
34
- $cta_txt = esc_html__( 'Install Imagify for Free', 'rocket-lazy-load' );
35
-
36
- $dismiss_url = wp_nonce_url(
37
- admin_url( 'admin-post.php?action=rocket_lazyload_ignore&box=' . __FUNCTION__ ),
38
- 'rocket_lazyload_ignore_' . __FUNCTION__
39
- );
40
- ?>
41
-
42
- <div id="plugin-filter" class="updated plugin-card plugin-card-imagify rktll-imagify-notice">
43
- <a href="<?php echo $dismiss_url; ?>" class="rktll-cross"><span class="dashicons dashicons-no"></span></a>
44
-
45
- <p class="rktll-imagify-logo">
46
- <img src="<?php echo ROCKET_LL_ASSETS_URL ?>img/logo-imagify.png" srcset="<?php echo ROCKET_LL_ASSETS_URL ?>img/logo-imagify.svg 2x" alt="Imagify" width="150" height="18">
47
- </p>
48
- <p class="rktll-imagify-msg">
49
- <?php _e( 'Speed up your website and boost your SEO by reducing image file sizes without losing quality with Imagify.', 'rocket-lazy-load' ); ?>
50
- </p>
51
- <p class="rktll-imagify-cta">
52
- <a data-slug="imagify" href="<?php echo $action_url; ?>" class="button button-primary<?php echo $classes; ?>"><?php echo $cta_txt; ?></a>
53
- </p>
54
- </div>
55
-
56
- <?php
57
- }
58
- add_action( 'admin_notices', 'rocket_lazyload_imagify_notice' );
59
-
60
- /**
61
- * Add Script to remove Notice thanks to JS.
62
- * @since 1.4.5
63
- * @author Geoffrey Crofte
64
- * @return void
65
- */
66
- function rocket_lazyload_notice_script() {
67
- echo <<<HTML
68
- <script>
69
- jQuery( document ).ready( function( $ ){
70
- $( '.rktll-cross' ).on( 'click', function( e ) {
71
- e.preventDefault();
72
- var url = $( this ).attr( 'href' ).replace( 'admin-post', 'admin-ajax' );
73
- $.get( url ).done( $( this ).parent().hide( 'slow' ) );
74
- });
75
- } );
76
- </script>
77
- HTML;
78
- }
79
- add_action( 'admin_footer', 'rocket_lazyload_notice_script' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/img/play.png DELETED
Binary file
assets/js/lazyload-10.11.1.js DELETED
@@ -1,301 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var getInstanceSettings = function getInstanceSettings(customSettings) {
11
- var defaultSettings = {
12
- elements_selector: "img",
13
- container: document,
14
- threshold: 300,
15
- data_src: "src",
16
- data_srcset: "srcset",
17
- data_sizes: "sizes",
18
- class_loading: "loading",
19
- class_loaded: "loaded",
20
- class_error: "error",
21
- callback_load: null,
22
- callback_error: null,
23
- callback_set: null,
24
- callback_enter: null
25
- };
26
-
27
- return _extends({}, defaultSettings, customSettings);
28
- };
29
-
30
- var dataPrefix = "data-";
31
- var processedDataName = "was-processed";
32
- var processedDataValue = "true";
33
-
34
- var getData = function getData(element, attribute) {
35
- return element.getAttribute(dataPrefix + attribute);
36
- };
37
-
38
- var setData = function setData(element, attribute, value) {
39
- return element.setAttribute(dataPrefix + attribute, value);
40
- };
41
-
42
- var setWasProcessed = function setWasProcessed(element) {
43
- return setData(element, processedDataName, processedDataValue);
44
- };
45
-
46
- var getWasProcessed = function getWasProcessed(element) {
47
- return getData(element, processedDataName) === processedDataValue;
48
- };
49
-
50
- function purgeElements(elements) {
51
- return elements.filter(function (element) {
52
- return !getWasProcessed(element);
53
- });
54
- }
55
-
56
- /* Creates instance and notifies it through the window element */
57
- var createInstance = function createInstance(classObj, options) {
58
- var event;
59
- var eventString = "LazyLoad::Initialized";
60
- var instance = new classObj(options);
61
- try {
62
- // Works in modern browsers
63
- event = new CustomEvent(eventString, { detail: { instance: instance } });
64
- } catch (err) {
65
- // Works in Internet Explorer (all versions)
66
- event = document.createEvent("CustomEvent");
67
- event.initCustomEvent(eventString, false, false, { instance: instance });
68
- }
69
- window.dispatchEvent(event);
70
- };
71
-
72
- /* Auto initialization of one or more instances of lazyload, depending on the
73
- options passed in (plain object or an array) */
74
- function autoInitialize(classObj, options) {
75
- if (!options.length) {
76
- // Plain object
77
- createInstance(classObj, options);
78
- } else {
79
- // Array of objects
80
- for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
81
- createInstance(classObj, optionsItem);
82
- }
83
- }
84
- }
85
-
86
- var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName) {
87
- for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
88
- if (childTag.tagName === "SOURCE") {
89
- var attributeValue = getData(childTag, dataAttrName);
90
- if (attributeValue) {
91
- childTag.setAttribute(attrName, attributeValue);
92
- }
93
- }
94
- }
95
- };
96
-
97
- var setAttributeIfNotNullOrEmpty = function setAttributeIfNotNullOrEmpty(element, attrName, value) {
98
- if (!value) {
99
- return;
100
- }
101
- element.setAttribute(attrName, value);
102
- };
103
-
104
- var setSources = function setSources(element, settings) {
105
- var sizesDataName = settings.data_sizes,
106
- srcsetDataName = settings.data_srcset,
107
- srcDataName = settings.data_src;
108
-
109
- var srcDataValue = getData(element, srcDataName);
110
- switch (element.tagName) {
111
- case "IMG":
112
- {
113
- var parent = element.parentNode;
114
- if (parent && parent.tagName === "PICTURE") {
115
- setSourcesInChildren(parent, "srcset", srcsetDataName);
116
- }
117
- var sizesDataValue = getData(element, sizesDataName);
118
- setAttributeIfNotNullOrEmpty(element, "sizes", sizesDataValue);
119
- var srcsetDataValue = getData(element, srcsetDataName);
120
- setAttributeIfNotNullOrEmpty(element, "srcset", srcsetDataValue);
121
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
122
- break;
123
- }
124
- case "IFRAME":
125
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
126
- break;
127
- case "VIDEO":
128
- setSourcesInChildren(element, "src", srcDataName);
129
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
130
- break;
131
- default:
132
- if (srcDataValue) {
133
- element.style.backgroundImage = 'url("' + srcDataValue + '")';
134
- }
135
- }
136
- };
137
-
138
- var isBot = !("onscroll" in window) || /glebot/.test(navigator.userAgent);
139
-
140
- var runningOnBrowser = typeof window !== "undefined";
141
-
142
- var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
143
-
144
- var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
145
-
146
- var addClass = function addClass(element, className) {
147
- if (supportsClassList) {
148
- element.classList.add(className);
149
- return;
150
- }
151
- element.className += (element.className ? " " : "") + className;
152
- };
153
-
154
- var removeClass = function removeClass(element, className) {
155
- if (supportsClassList) {
156
- element.classList.remove(className);
157
- return;
158
- }
159
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
160
- };
161
-
162
- var callCallback = function callCallback(callback, argument) {
163
- if (callback) {
164
- callback(argument);
165
- }
166
- };
167
-
168
- var loadString = "load";
169
- var errorString = "error";
170
-
171
- var removeListeners = function removeListeners(element, loadHandler, errorHandler) {
172
- element.removeEventListener(loadString, loadHandler);
173
- element.removeEventListener(errorString, errorHandler);
174
- };
175
-
176
- var addOneShotListeners = function addOneShotListeners(element, settings) {
177
- var onLoad = function onLoad(event) {
178
- onEvent(event, true, settings);
179
- removeListeners(element, onLoad, onError);
180
- };
181
- var onError = function onError(event) {
182
- onEvent(event, false, settings);
183
- removeListeners(element, onLoad, onError);
184
- };
185
- element.addEventListener(loadString, onLoad);
186
- element.addEventListener(errorString, onError);
187
- };
188
-
189
- var onEvent = function onEvent(event, success, settings) {
190
- var element = event.target;
191
- removeClass(element, settings.class_loading);
192
- addClass(element, success ? settings.class_loaded : settings.class_error); // Setting loaded or error class
193
- callCallback(success ? settings.callback_load : settings.callback_error, element);
194
- };
195
-
196
- function revealElement(element, settings, force) {
197
- if (!force && getWasProcessed(element)) {
198
- return; // element has already been processed and force wasn't true
199
- }
200
- callCallback(settings.callback_enter, element);
201
- if (["IMG", "IFRAME", "VIDEO"].indexOf(element.tagName) > -1) {
202
- addOneShotListeners(element, settings);
203
- addClass(element, settings.class_loading);
204
- }
205
- setSources(element, settings);
206
- setWasProcessed(element);
207
- callCallback(settings.callback_set, element);
208
- }
209
-
210
- /* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and
211
- entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */
212
- var isIntersecting = function isIntersecting(element) {
213
- return element.isIntersecting || element.intersectionRatio > 0;
214
- };
215
-
216
- var getObserverSettings = function getObserverSettings(settings) {
217
- return {
218
- root: settings.container === document ? null : settings.container,
219
- rootMargin: settings.threshold + "px"
220
- };
221
- };
222
-
223
- var LazyLoad = function LazyLoad(customSettings, elements) {
224
- this._settings = getInstanceSettings(customSettings);
225
- this._setObserver();
226
- this.update(elements);
227
- };
228
-
229
- LazyLoad.prototype = {
230
- _setObserver: function _setObserver() {
231
- var _this = this;
232
-
233
- if (!supportsIntersectionObserver) {
234
- return;
235
- }
236
- var revealIntersectingElements = function revealIntersectingElements(entries) {
237
- entries.forEach(function (entry) {
238
- if (isIntersecting(entry)) {
239
- var element = entry.target;
240
- _this.load(element);
241
- _this._observer.unobserve(element);
242
- }
243
- });
244
- _this._elements = purgeElements(_this._elements);
245
- };
246
- this._observer = new IntersectionObserver(revealIntersectingElements, getObserverSettings(this._settings));
247
- },
248
-
249
- loadAll: function loadAll() {
250
- var _this2 = this;
251
-
252
- this._elements.forEach(function (element) {
253
- _this2.load(element);
254
- });
255
- this._elements = purgeElements(this._elements);
256
- },
257
-
258
- update: function update(elements) {
259
- var _this3 = this;
260
-
261
- var settings = this._settings;
262
- var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
263
-
264
- this._elements = purgeElements(Array.prototype.slice.call(nodeSet)); // nodeset to array for IE compatibility
265
-
266
- if (isBot || !this._observer) {
267
- this.loadAll();
268
- return;
269
- }
270
-
271
- this._elements.forEach(function (element) {
272
- _this3._observer.observe(element);
273
- });
274
- },
275
-
276
- destroy: function destroy() {
277
- var _this4 = this;
278
-
279
- if (this._observer) {
280
- purgeElements(this._elements).forEach(function (element) {
281
- _this4._observer.unobserve(element);
282
- });
283
- this._observer = null;
284
- }
285
- this._elements = null;
286
- this._settings = null;
287
- },
288
-
289
- load: function load(element, force) {
290
- revealElement(element, this._settings, force);
291
- }
292
- };
293
-
294
- /* Automatic instances creation if required (useful for async script loading!) */
295
- var autoInitOptions = window.lazyLoadOptions;
296
- if (runningOnBrowser && autoInitOptions) {
297
- autoInitialize(LazyLoad, autoInitOptions);
298
- }
299
-
300
- return LazyLoad;
301
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-10.11.1.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";function e(e){return e.filter(function(e){return!a(e)})}function t(e,t,n){!n&&a(e)||(h(t.callback_enter,e),["IMG","IFRAME","VIDEO"].indexOf(e.tagName)>-1&&(y(e,t),m(e,t.class_loading)),u(e,t),o(e),h(t.callback_set,e))}var n=function(e){var t={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null,callback_enter:null};return _extends({},t,e)},r=function(e,t){return e.getAttribute("data-"+t)},s=function(e,t,n){return e.setAttribute("data-"+t,n)},o=function(e){return s(e,"was-processed","true")},a=function(e){return"true"===r(e,"was-processed")},i=function(e,t){var n,r=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:r}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:r})}window.dispatchEvent(n)},c=function(e,t,n){for(var s,o=0;s=e.children[o];o+=1)if("SOURCE"===s.tagName){var a=r(s,n);a&&s.setAttribute(t,a)}},l=function(e,t,n){n&&e.setAttribute(t,n)},u=function(e,t){var n=t.data_sizes,s=t.data_srcset,o=t.data_src,a=r(e,o);switch(e.tagName){case"IMG":var i=e.parentNode;i&&"PICTURE"===i.tagName&&c(i,"srcset",s);var u=r(e,n);l(e,"sizes",u);var d=r(e,s);l(e,"srcset",d),l(e,"src",a);break;case"IFRAME":l(e,"src",a);break;case"VIDEO":c(e,"src",o),l(e,"src",a);break;default:a&&(e.style.backgroundImage='url("'+a+'")')}},d=!("onscroll"in window)||/glebot/.test(navigator.userAgent),f="undefined"!=typeof window,_=f&&"IntersectionObserver"in window,v=f&&"classList"in document.createElement("p"),m=function(e,t){v?e.classList.add(t):e.className+=(e.className?" ":"")+t},b=function(e,t){v?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},h=function(e,t){e&&e(t)},p=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},y=function(e,t){var n=function n(s){g(s,!0,t),p(e,n,r)},r=function r(s){g(s,!1,t),p(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)},g=function(e,t,n){var r=e.target;b(r,n.class_loading),m(r,t?n.class_loaded:n.class_error),h(t?n.callback_load:n.callback_error,r)},E=function(e){return e.isIntersecting||e.intersectionRatio>0},w=function(e){return{root:e.container===document?null:e.container,rootMargin:e.threshold+"px"}},L=function(e,t){this._settings=n(e),this._setObserver(),this.update(t)};L.prototype={_setObserver:function(){var t=this;if(_){this._observer=new IntersectionObserver(function(n){n.forEach(function(e){if(E(e)){var n=e.target;t.load(n),t._observer.unobserve(n)}}),t._elements=e(t._elements)},w(this._settings))}},loadAll:function(){var t=this;this._elements.forEach(function(e){t.load(e)}),this._elements=e(this._elements)},update:function(t){var n=this,r=this._settings,s=t||r.container.querySelectorAll(r.elements_selector);this._elements=e(Array.prototype.slice.call(s)),!d&&this._observer?this._elements.forEach(function(e){n._observer.observe(e)}):this.loadAll()},destroy:function(){var t=this;this._observer&&(e(this._elements).forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(e,n){t(e,this._settings,n)}};var I=window.lazyLoadOptions;return f&&I&&function(e,t){if(t.length)for(var n,r=0;n=t[r];r+=1)i(e,n);else i(e,t)}(L,I),L});
 
assets/js/lazyload-10.19.js ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
+
3
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
+
5
+ (function (global, factory) {
6
+ (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
+ })(this, function () {
8
+ 'use strict';
9
+
10
+ var defaultSettings = {
11
+ elements_selector: "img",
12
+ container: document,
13
+ threshold: 300,
14
+ thresholds: null,
15
+ data_src: "src",
16
+ data_srcset: "srcset",
17
+ data_sizes: "sizes",
18
+ data_bg: "bg",
19
+ class_loading: "loading",
20
+ class_loaded: "loaded",
21
+ class_error: "error",
22
+ load_delay: 0,
23
+ callback_load: null,
24
+ callback_error: null,
25
+ callback_set: null,
26
+ callback_enter: null,
27
+ callback_finish: null,
28
+ to_webp: false
29
+ };
30
+
31
+ var getInstanceSettings = function getInstanceSettings(customSettings) {
32
+ return _extends({}, defaultSettings, customSettings);
33
+ };
34
+
35
+ var dataPrefix = "data-";
36
+ var processedDataName = "was-processed";
37
+ var timeoutDataName = "ll-timeout";
38
+ var trueString = "true";
39
+
40
+ var getData = function getData(element, attribute) {
41
+ return element.getAttribute(dataPrefix + attribute);
42
+ };
43
+
44
+ var setData = function setData(element, attribute, value) {
45
+ var attrName = dataPrefix + attribute;
46
+ if (value === null) {
47
+ element.removeAttribute(attrName);
48
+ return;
49
+ }
50
+ element.setAttribute(attrName, value);
51
+ };
52
+
53
+ var setWasProcessedData = function setWasProcessedData(element) {
54
+ return setData(element, processedDataName, trueString);
55
+ };
56
+
57
+ var getWasProcessedData = function getWasProcessedData(element) {
58
+ return getData(element, processedDataName) === trueString;
59
+ };
60
+
61
+ var setTimeoutData = function setTimeoutData(element, value) {
62
+ return setData(element, timeoutDataName, value);
63
+ };
64
+
65
+ var getTimeoutData = function getTimeoutData(element) {
66
+ return getData(element, timeoutDataName);
67
+ };
68
+
69
+ var purgeProcessedElements = function purgeProcessedElements(elements) {
70
+ return elements.filter(function (element) {
71
+ return !getWasProcessedData(element);
72
+ });
73
+ };
74
+
75
+ var purgeOneElement = function purgeOneElement(elements, elementToPurge) {
76
+ return elements.filter(function (element) {
77
+ return element !== elementToPurge;
78
+ });
79
+ };
80
+
81
+ /* Creates instance and notifies it through the window element */
82
+ var createInstance = function createInstance(classObj, options) {
83
+ var event;
84
+ var eventString = "LazyLoad::Initialized";
85
+ var instance = new classObj(options);
86
+ try {
87
+ // Works in modern browsers
88
+ event = new CustomEvent(eventString, { detail: { instance: instance } });
89
+ } catch (err) {
90
+ // Works in Internet Explorer (all versions)
91
+ event = document.createEvent("CustomEvent");
92
+ event.initCustomEvent(eventString, false, false, { instance: instance });
93
+ }
94
+ window.dispatchEvent(event);
95
+ };
96
+
97
+ /* Auto initialization of one or more instances of lazyload, depending on the
98
+ options passed in (plain object or an array) */
99
+ function autoInitialize(classObj, options) {
100
+ if (!options) {
101
+ return;
102
+ }
103
+ if (!options.length) {
104
+ // Plain object
105
+ createInstance(classObj, options);
106
+ } else {
107
+ // Array of objects
108
+ for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
109
+ createInstance(classObj, optionsItem);
110
+ }
111
+ }
112
+ }
113
+
114
+ var replaceExtToWebp = function replaceExtToWebp(value, condition) {
115
+ return condition ? value.replace(/\.(jpe?g|png)/gi, ".webp") : value;
116
+ };
117
+
118
+ var detectWebp = function detectWebp() {
119
+ var webpString = "image/webp";
120
+ var canvas = document.createElement("canvas");
121
+
122
+ if (canvas.getContext && canvas.getContext("2d")) {
123
+ return canvas.toDataURL(webpString).indexOf('data:' + webpString) === 0;
124
+ }
125
+
126
+ return false;
127
+ };
128
+
129
+ var runningOnBrowser = typeof window !== "undefined";
130
+
131
+ var isBot = runningOnBrowser && !("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
132
+
133
+ var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
134
+
135
+ var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
136
+
137
+ var supportsWebp = runningOnBrowser && detectWebp();
138
+
139
+ var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName, toWebpFlag) {
140
+ for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
141
+ if (childTag.tagName === "SOURCE") {
142
+ var attrValue = getData(childTag, dataAttrName);
143
+ setAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);
144
+ }
145
+ }
146
+ };
147
+
148
+ var setAttributeIfValue = function setAttributeIfValue(element, attrName, value, toWebpFlag) {
149
+ if (!value) {
150
+ return;
151
+ }
152
+ element.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));
153
+ };
154
+
155
+ var setSourcesImg = function setSourcesImg(element, settings) {
156
+ var toWebpFlag = supportsWebp && settings.to_webp;
157
+ var srcsetDataName = settings.data_srcset;
158
+ var parent = element.parentNode;
159
+
160
+ if (parent && parent.tagName === "PICTURE") {
161
+ setSourcesInChildren(parent, "srcset", srcsetDataName, toWebpFlag);
162
+ }
163
+ var sizesDataValue = getData(element, settings.data_sizes);
164
+ setAttributeIfValue(element, "sizes", sizesDataValue);
165
+ var srcsetDataValue = getData(element, srcsetDataName);
166
+ setAttributeIfValue(element, "srcset", srcsetDataValue, toWebpFlag);
167
+ var srcDataValue = getData(element, settings.data_src);
168
+ setAttributeIfValue(element, "src", srcDataValue, toWebpFlag);
169
+ };
170
+
171
+ var setSourcesIframe = function setSourcesIframe(element, settings) {
172
+ var srcDataValue = getData(element, settings.data_src);
173
+
174
+ setAttributeIfValue(element, "src", srcDataValue);
175
+ };
176
+
177
+ var setSourcesVideo = function setSourcesVideo(element, settings) {
178
+ var srcDataName = settings.data_src;
179
+ var srcDataValue = getData(element, srcDataName);
180
+
181
+ setSourcesInChildren(element, "src", srcDataName);
182
+ setAttributeIfValue(element, "src", srcDataValue);
183
+ element.load();
184
+ };
185
+
186
+ var setSourcesBgImage = function setSourcesBgImage(element, settings) {
187
+ var toWebpFlag = supportsWebp && settings.to_webp;
188
+ var srcDataValue = getData(element, settings.data_src);
189
+ var bgDataValue = getData(element, settings.data_bg);
190
+
191
+ if (srcDataValue) {
192
+ var setValue = replaceExtToWebp(srcDataValue, toWebpFlag);
193
+ element.style.backgroundImage = 'url("' + setValue + '")';
194
+ }
195
+
196
+ if (bgDataValue) {
197
+ var _setValue = replaceExtToWebp(bgDataValue, toWebpFlag);
198
+ element.style.backgroundImage = _setValue;
199
+ }
200
+ };
201
+
202
+ var setSourcesFunctions = {
203
+ IMG: setSourcesImg,
204
+ IFRAME: setSourcesIframe,
205
+ VIDEO: setSourcesVideo
206
+ };
207
+
208
+ var setSources = function setSources(element, instance) {
209
+ var settings = instance._settings;
210
+ var tagName = element.tagName;
211
+ var setSourcesFunction = setSourcesFunctions[tagName];
212
+ if (setSourcesFunction) {
213
+ setSourcesFunction(element, settings);
214
+ instance._updateLoadingCount(1);
215
+ instance._elements = purgeOneElement(instance._elements, element);
216
+ return;
217
+ }
218
+ setSourcesBgImage(element, settings);
219
+ };
220
+
221
+ var addClass = function addClass(element, className) {
222
+ if (supportsClassList) {
223
+ element.classList.add(className);
224
+ return;
225
+ }
226
+ element.className += (element.className ? " " : "") + className;
227
+ };
228
+
229
+ var removeClass = function removeClass(element, className) {
230
+ if (supportsClassList) {
231
+ element.classList.remove(className);
232
+ return;
233
+ }
234
+ element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
235
+ };
236
+
237
+ var callbackIfSet = function callbackIfSet(callback, argument) {
238
+ if (callback) {
239
+ callback(argument);
240
+ }
241
+ };
242
+
243
+ var genericLoadEventName = "load";
244
+ var mediaLoadEventName = "loadeddata";
245
+ var errorEventName = "error";
246
+
247
+ var addEventListener = function addEventListener(element, eventName, handler) {
248
+ element.addEventListener(eventName, handler);
249
+ };
250
+
251
+ var removeEventListener = function removeEventListener(element, eventName, handler) {
252
+ element.removeEventListener(eventName, handler);
253
+ };
254
+
255
+ var addEventListeners = function addEventListeners(element, loadHandler, errorHandler) {
256
+ addEventListener(element, genericLoadEventName, loadHandler);
257
+ addEventListener(element, mediaLoadEventName, loadHandler);
258
+ addEventListener(element, errorEventName, errorHandler);
259
+ };
260
+
261
+ var removeEventListeners = function removeEventListeners(element, loadHandler, errorHandler) {
262
+ removeEventListener(element, genericLoadEventName, loadHandler);
263
+ removeEventListener(element, mediaLoadEventName, loadHandler);
264
+ removeEventListener(element, errorEventName, errorHandler);
265
+ };
266
+
267
+ var eventHandler = function eventHandler(event, success, instance) {
268
+ var settings = instance._settings;
269
+ var className = success ? settings.class_loaded : settings.class_error;
270
+ var callback = success ? settings.callback_load : settings.callback_error;
271
+ var element = event.target;
272
+
273
+ removeClass(element, settings.class_loading);
274
+ addClass(element, className);
275
+ callbackIfSet(callback, element);
276
+
277
+ instance._updateLoadingCount(-1);
278
+ };
279
+
280
+ var addOneShotEventListeners = function addOneShotEventListeners(element, instance) {
281
+ var loadHandler = function loadHandler(event) {
282
+ eventHandler(event, true, instance);
283
+ removeEventListeners(element, loadHandler, errorHandler);
284
+ };
285
+ var errorHandler = function errorHandler(event) {
286
+ eventHandler(event, false, instance);
287
+ removeEventListeners(element, loadHandler, errorHandler);
288
+ };
289
+ addEventListeners(element, loadHandler, errorHandler);
290
+ };
291
+
292
+ var managedTags = ["IMG", "IFRAME", "VIDEO"];
293
+
294
+ var loadAndUnobserve = function loadAndUnobserve(element, observer, instance) {
295
+ revealElement(element, instance);
296
+ observer.unobserve(element);
297
+ };
298
+
299
+ var cancelDelayLoad = function cancelDelayLoad(element) {
300
+ var timeoutId = getTimeoutData(element);
301
+ if (!timeoutId) {
302
+ return; // do nothing if timeout doesn't exist
303
+ }
304
+ clearTimeout(timeoutId);
305
+ setTimeoutData(element, null);
306
+ };
307
+
308
+ var delayLoad = function delayLoad(element, observer, instance) {
309
+ var loadDelay = instance._settings.load_delay;
310
+ var timeoutId = getTimeoutData(element);
311
+ if (timeoutId) {
312
+ return; // do nothing if timeout already set
313
+ }
314
+ timeoutId = setTimeout(function () {
315
+ loadAndUnobserve(element, observer, instance);
316
+ cancelDelayLoad(element);
317
+ }, loadDelay);
318
+ setTimeoutData(element, timeoutId);
319
+ };
320
+
321
+ function revealElement(element, instance, force) {
322
+ var settings = instance._settings;
323
+ if (!force && getWasProcessedData(element)) {
324
+ return; // element has already been processed and force wasn't true
325
+ }
326
+ callbackIfSet(settings.callback_enter, element);
327
+ if (managedTags.indexOf(element.tagName) > -1) {
328
+ addOneShotEventListeners(element, instance);
329
+ addClass(element, settings.class_loading);
330
+ }
331
+ setSources(element, instance);
332
+ setWasProcessedData(element);
333
+ callbackIfSet(settings.callback_set, element);
334
+ }
335
+
336
+ /* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and
337
+ entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */
338
+ var isIntersecting = function isIntersecting(entry) {
339
+ return entry.isIntersecting || entry.intersectionRatio > 0;
340
+ };
341
+
342
+ var getObserverSettings = function getObserverSettings(settings) {
343
+ return {
344
+ root: settings.container === document ? null : settings.container,
345
+ rootMargin: settings.thresholds || settings.threshold + "px"
346
+ };
347
+ };
348
+
349
+ var LazyLoad = function LazyLoad(customSettings, elements) {
350
+ this._settings = getInstanceSettings(customSettings);
351
+ this._setObserver();
352
+ this._loadingCount = 0;
353
+ this.update(elements);
354
+ };
355
+
356
+ LazyLoad.prototype = {
357
+ _manageIntersection: function _manageIntersection(entry) {
358
+ var observer = this._observer;
359
+ var loadDelay = this._settings.load_delay;
360
+ var element = entry.target;
361
+
362
+ // WITHOUT LOAD DELAY
363
+ if (!loadDelay) {
364
+ if (isIntersecting(entry)) {
365
+ loadAndUnobserve(element, observer, this);
366
+ }
367
+ return;
368
+ }
369
+
370
+ // WITH LOAD DELAY
371
+ if (isIntersecting(entry)) {
372
+ delayLoad(element, observer, this);
373
+ } else {
374
+ cancelDelayLoad(element);
375
+ }
376
+ },
377
+
378
+ _onIntersection: function _onIntersection(entries) {
379
+ entries.forEach(this._manageIntersection.bind(this));
380
+ },
381
+
382
+ _setObserver: function _setObserver() {
383
+ if (!supportsIntersectionObserver) {
384
+ return;
385
+ }
386
+ this._observer = new IntersectionObserver(this._onIntersection.bind(this), getObserverSettings(this._settings));
387
+ },
388
+
389
+ _updateLoadingCount: function _updateLoadingCount(plusMinus) {
390
+ this._loadingCount += plusMinus;
391
+ if (this._elements.length === 0 && this._loadingCount === 0) {
392
+ callbackIfSet(this._settings.callback_finish);
393
+ }
394
+ },
395
+
396
+ update: function update(elements) {
397
+ var _this = this;
398
+
399
+ var settings = this._settings;
400
+ var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
401
+
402
+ this._elements = purgeProcessedElements(Array.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility
403
+ );
404
+
405
+ if (isBot || !this._observer) {
406
+ this.loadAll();
407
+ return;
408
+ }
409
+
410
+ this._elements.forEach(function (element) {
411
+ _this._observer.observe(element);
412
+ });
413
+ },
414
+
415
+ destroy: function destroy() {
416
+ var _this2 = this;
417
+
418
+ if (this._observer) {
419
+ this._elements.forEach(function (element) {
420
+ _this2._observer.unobserve(element);
421
+ });
422
+ this._observer = null;
423
+ }
424
+ this._elements = null;
425
+ this._settings = null;
426
+ },
427
+
428
+ load: function load(element, force) {
429
+ revealElement(element, this, force);
430
+ },
431
+
432
+ loadAll: function loadAll() {
433
+ var _this3 = this;
434
+
435
+ var elements = this._elements;
436
+ elements.forEach(function (element) {
437
+ _this3.load(element);
438
+ });
439
+ }
440
+ };
441
+
442
+ /* Automatic instances creation if required (useful for async script loading) */
443
+ if (runningOnBrowser) {
444
+ autoInitialize(LazyLoad, window.lazyLoadOptions);
445
+ }
446
+
447
+ return LazyLoad;
448
+ });
assets/js/lazyload-10.19.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";function t(t,e,n){var o=e._settings;!n&&i(t)||(C(o.callback_enter,t),R.indexOf(t.tagName)>-1&&(N(t,e),I(t,o.class_loading)),E(t,e),a(t),C(o.callback_set,t))}var e={elements_selector:"img",container:document,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1},n=function(t){return _extends({},e,t)},o=function(t,e){return t.getAttribute("data-"+e)},r=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},a=function(t){return r(t,"was-processed","true")},i=function(t){return"true"===o(t,"was-processed")},s=function(t,e){return r(t,"ll-timeout",e)},c=function(t){return o(t,"ll-timeout")},l=function(t){return t.filter(function(t){return!i(t)})},u=function(t,e){return t.filter(function(t){return t!==e})},d=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},f=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},_="undefined"!=typeof window,v=_&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),g=_&&"IntersectionObserver"in window,h=_&&"classList"in document.createElement("p"),b=_&&function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))&&0===t.toDataURL("image/webp").indexOf("data:image/webp")}(),m=function(t,e,n,r){for(var a,i=0;a=t.children[i];i+=1)if("SOURCE"===a.tagName){var s=o(a,n);p(a,e,s,r)}},p=function(t,e,n,o){n&&t.setAttribute(e,f(n,o))},y=function(t,e){var n=b&&e.to_webp,r=o(t,e.data_src),a=o(t,e.data_bg);if(r){var i=f(r,n);t.style.backgroundImage='url("'+i+'")'}if(a){var s=f(a,n);t.style.backgroundImage=s}},w={IMG:function(t,e){var n=b&&e.to_webp,r=e.data_srcset,a=t.parentNode;a&&"PICTURE"===a.tagName&&m(a,"srcset",r,n);var i=o(t,e.data_sizes);p(t,"sizes",i);var s=o(t,r);p(t,"srcset",s,n);var c=o(t,e.data_src);p(t,"src",c,n)},IFRAME:function(t,e){var n=o(t,e.data_src);p(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,r=o(t,n);m(t,"src",n),p(t,"src",r),t.load()}},E=function(t,e){var n=e._settings,o=t.tagName,r=w[o];if(r)return r(t,n),e._updateLoadingCount(1),void(e._elements=u(e._elements,t));y(t,n)},I=function(t,e){h?t.classList.add(e):t.className+=(t.className?" ":"")+e},L=function(t,e){h?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},C=function(t,e){t&&t(e)},O=function(t,e,n){t.addEventListener(e,n)},k=function(t,e,n){t.removeEventListener(e,n)},x=function(t,e,n){O(t,"load",e),O(t,"loadeddata",e),O(t,"error",n)},A=function(t,e,n){k(t,"load",e),k(t,"loadeddata",e),k(t,"error",n)},z=function(t,e,n){var o=n._settings,r=e?o.class_loaded:o.class_error,a=e?o.callback_load:o.callback_error,i=t.target;L(i,o.class_loading),I(i,r),C(a,i),n._updateLoadingCount(-1)},N=function(t,e){var n=function n(r){z(r,!0,e),A(t,n,o)},o=function o(r){z(r,!1,e),A(t,n,o)};x(t,n,o)},R=["IMG","IFRAME","VIDEO"],S=function(e,n,o){t(e,o),n.unobserve(e)},M=function(t){var e=c(t);e&&(clearTimeout(e),s(t,null))},j=function(t,e,n){var o=n._settings.load_delay,r=c(t);r||(r=setTimeout(function(){S(t,e,n),M(t)},o),s(t,r))},D=function(t){return t.isIntersecting||t.intersectionRatio>0},T=function(t){return{root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}},U=function(t,e){this._settings=n(t),this._setObserver(),this._loadingCount=0,this.update(e)};return U.prototype={_manageIntersection:function(t){var e=this._observer,n=this._settings.load_delay,o=t.target;n?D(t)?j(o,e,this):M(o):D(t)&&S(o,e,this)},_onIntersection:function(t){t.forEach(this._manageIntersection.bind(this))},_setObserver:function(){g&&(this._observer=new IntersectionObserver(this._onIntersection.bind(this),T(this._settings)))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&C(this._settings.callback_finish)},update:function(t){var e=this,n=this._settings,o=t||n.container.querySelectorAll(n.elements_selector);this._elements=l(Array.prototype.slice.call(o)),!v&&this._observer?this._elements.forEach(function(t){e._observer.observe(t)}):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(e,n){t(e,this,n)},loadAll:function(){var t=this;this._elements.forEach(function(e){t.load(e)})}},_&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)d(t,n);else d(t,e)}(U,window.lazyLoadOptions),U});
2
+ //# sourceMappingURL=lazyload-10.19.min.js.map
assets/js/lazyload-10.19.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["lazyload.js"],"names":["global","factory","exports","_typeof","module","define","amd","LazyLoad","this","revealElement","element","instance","force","callbackIfSet","settings","callback_enter","managedTags","tagName","setSources","setWasProcessedData","callback_set","defaultSettings","elements_selector","container","document","threshold","thresholds","data_src","data_srcset","data_sizes","data_bg","class_loading","class_loaded","class_error","load_delay","callback_load","callback_error","to_webp","customSettings","_extends","timeoutDataName","attribute","trueString","setData","getAttribute","dataPrefix","attrName","value","removeAttribute","getData","setTimeoutData","getWasProcessedData","getTimeoutData","elements","elementToPurge","createInstance","filter","classObj","options","event","detail","createEvent","initCustomEvent","window","replaceExtToWebp","condition","length","runningOnBrowser","detectWebp","createElement","navigator","userAgent","canvas","toDataURL","supportsClassList","supportsWebp","optionsItem","indexOf","setSourcesInChildren","parentTag","dataAttrName","toWebpFlag","childTag","i","children","attrValue","setAttributeIfValue","setAttribute","srcDataValue","bgDataValue","backgroundImage","setValue","style","IMG","IFRAME","srcsetDataName","parent","parentNode","sizesDataValue","srcsetDataValue","VIDEO","srcDataName","load","_settings","setSourcesFunction","setSourcesFunctions","_updateLoadingCount","purgeOneElement","_elements","setSourcesBgImage","className","classList","add","remove","replace","RegExp","callback","argument","genericLoadEventName","removeEventListener","eventName","addEventListeners","addEventListener","loadHandler","errorHandler","removeEventListeners","success","removeClass","addClass","addOneShotEventListeners","eventHandler","observer","loadAndUnobserve","cancelDelayLoad","timeoutId","clearTimeout","delayLoad","loadDelay","setTimeout","getObserverSettings","entry","isIntersecting","intersectionRatio","rootMargin","root","getInstanceSettings","_setObserver","_loadingCount","update","_manageIntersection","_observer","target","entries","forEach","bind","supportsIntersectionObserver","IntersectionObserver","_onIntersection","plusMinus","nodeSet","querySelectorAll","purgeProcessedElements","Array","prototype","slice","call","isBot","destroy","_this","observe","loadAll","_this2","unobserve","_this3","autoInitialize","lazyLoadOptions"],"mappings":"kYAAC,SAAUA,EAAQC,GACC,YAAnB,oBAAOC,QAAP,YAAAC,QAAOD,WAA0C,oBAAXE,OAAyBA,OAAOF,QAAUD,IAC9D,mBAAXI,QAAyBA,OAAOC,IAAMD,OAAOJ,GACnDD,EAAOO,SAAWN,IAHnB,CAAAO,KAAA,WAAkBP,aAwUjB,SAAAQ,EAAAC,EAAAC,EAAAC,GACDC,IAAAA,EAAcC,EAASC,WACnBC,GAAAA,EAA4BC,KAG/BJ,EAAAC,EAAAC,eAAAL,GACDQ,EAAWR,QAASC,EAApBM,UAAA,IACAE,EAAoBT,EAApBC,GACAE,EAAAA,EAAcC,EAASM,gBAFvBF,EAAWR,EAASC,GAKrBQ,EAAAT,GAHCG,EAAcC,EAASM,aAAcV,IA5UrC,IAACW,GAAqBC,kBAAA,MAItBC,UAAWC,SAFZC,UAAMJ,IACLC,WAAAA,KACAC,SAAAA,MACAE,YAAW,SACXC,WAAAA,QACAC,QAAAA,KACAC,cAAa,UACbC,aAAY,SACZC,YAAS,QACTC,WAAAA,EACAC,cAAc,KACdC,eAAa,KACbC,aAZuB,KAavBC,eAAe,KACfC,gBAAgB,KAChBhB,SAAAA,GAGAiB,EAAS,SAAAC,GAlBc,OAAxBC,YAAAlB,EAAAiB,IA2BME,EAAAA,SAAAA,EAAkBC,GACxB,OAAMC,EAAAA,aANgB,QAMtBD,IAGCE,EAAOjC,SAAQkC,EAAAA,EAAaC,GAC5B,IAFDC,EARsB,QAQtBL,EAMe,OAAVM,EACHrC,EAAAA,aAAQsC,EAAgBF,GAH1BpC,EAAMiC,gBAAAA,IAMLjC,EAAqBoC,SAAAA,GAAAA,OACrBH,EAPDjC,EAbA,gBAImB,SAkBbS,EAAsB,SAAAT,GAAA,MAlBT,SAkBSuC,EAC3BN,EAvBD,kBA4BMO,EAAiB,SAACxC,EAASqC,GAAV,OAHvBJ,EAAMQ,EAnBkB,aAmBIJ,IAA5BK,EAAA,SAAA1C,GAAA,OAAAuC,EAAAvC,EAnBwB,eAsBlBwC,EAAAA,SAAAA,GAAiB,OAAAG,EACd3C,OAAR,SAAAA,GAAA,OAAiB8B,EADK9B,MAGjB0C,EAAiB,SAAAC,EAAjBD,GAAiB,OAAAC,EAAmB3C,OAAR,SAAAA,GAAA,OAAiB8B,IAA5Bc,KAGtBC,EAAgBC,SAAOC,EAAAC,GAAA,IAAAC,EADxBhD,EAAA,IAAA8C,EAAAC,GAaC,IARAC,EAAON,IAAAA,YAJP,yBAIuBO,QAAAjD,SAAAA,KAAA,MAAWD,IADnCiD,EAAAnC,SAAAqC,YAAA,gBAeQC,gBAlBP,yBAkBoC,GAAO,GAASnD,SAAAA,IAVrDoD,OAAMR,cAAiBI,IAoBrBK,EAAA,SAAAjB,EAAAkB,GAAA,OACDA,EAAKP,EAAQQ,QAAQ,kBAAA,SAAAnB,GAWtBoB,EAAA,oBAAAJ,OAGMK,EACLD,KAAiB,aAAjBJ,SACA,gCAAsBM,KAAcC,UAApCC,WAEIC,EACHL,GAAcM,yBAAPV,OAeHW,EAZLP,GAAA,cAAA3C,SAAA6C,cAAA,KAeKM,EAAeR,GAnCJV,WACf,IACAe,EAAAhD,SAAA6C,cAAA,UAECd,SAAAA,EAAAA,aAAeE,EAAUmB,WAAzB,QACA,IAAAJ,EAAAC,UAJK,cAILI,QAAA,mBA8BsCT,GAEnCU,EAAuB,SAZ7BC,EAcCjC,EAVDkC,EAYCC,GAEA,IAAK,IAAWC,EAAPC,EAAI,EAAcD,EAAWH,EAAUK,SAASD,GAAKA,GAAK,EARpE,GAAqBhB,WAAfQ,EAAAA,QAAeR,CAUlB,IAAIkB,EAAYpC,EAAQiC,EAAUF,GARrCM,EAAMR,EAAuBhC,EAAvBgC,EAAAA,KAUHQ,EAAA,SACD5E,EACDoC,EAKAC,EAHDkC,GAOElC,GAGDrC,EAVD6E,aAAAzC,EAAAkB,EAAAjB,EAAAkC,KA4COA,EAAaN,SAAAA,EAAgB7D,GACnC,IAAM0E,EAAAA,GAAe1E,EAAiBA,QAChC2E,EAAcxC,EAAQvC,EAASI,EAASgB,UAAxC2D,EAAcxC,EAAQvC,EAASI,EAASgB,SAG7C,GAAA0D,EAAexB,CACftD,IAAAA,EAAcgF,EAAdF,EAAwCG,GACxCjF,EAAAkF,MAAAF,gBAAA,QAAAC,EAAA,KAGA,GAAAF,EAAIE,CACJjF,IAAAA,EAAcgF,EAAdD,EAAAR,GACAvE,EAAAkF,MAAAF,gBAAAC,IAIDE,GACAC,IAhDmBnB,SAAAA,EAAAA,GACnB,IAAMoB,EAAAA,GAA0BnE,EAAhCS,QACM2D,EAAiBC,EAAvBrE,YAAMoE,EAAStF,EAAQuF,WAGtBnB,GAA6B,YAA7BA,EAAAA,SACAA,EAAAkB,EAAA,SAAAD,EAAAd,GAEDK,IAAAA,EAAoB5E,EAASA,EAASwF,EAAAA,YACtCZ,EAAMa,EAAkBlD,QAAAiD,GACxBZ,IAAAA,EAAoB5E,EAASA,EAAUyF,GACvCb,EAAqBrC,EAAQvC,SAASI,EAAtCmE,GACAK,IAAAA,EAAoB5E,EAApBA,EAAoC8E,EAAAA,UACpCF,EAdD5E,EAAA,MAAA8E,EAAAP,IAkDCmB,OAjCqBnD,SAAAA,EAAQvC,GAA7B,IAAM8E,EAAevC,EAAQvC,EAASI,EAASa,UAG/C2D,EAJD5E,EAAA,MAAA8E,IA+B4BY,MAxBPtF,SAAAA,EAASa,GAC7B,IAAM6D,EAAevC,EAAQvC,SAAvB8E,EAAevC,EAAQvC,EAAS2F,GAGtCf,EAAoB5E,EAAS,MAAO8E,GACpC9E,EAAAA,EAAA,MAAA8E,GACA9E,EAPD4F,SAgCOxF,EAAWH,SAAAA,EAAS4F,GAC1B,IAAMtF,EAAUP,EAAQO,UAClBuF,EAAAA,EAAAA,QACFA,EAAoBC,EAAAxF,GACvBuF,GAAAA,EAIA,OAHA7F,EAAS+F,EAAAA,GACT/F,EAAAA,oBAAqBgG,QACrBhG,EAAAiG,UAAAD,EAAAhG,EAAAiG,UAAAlG,IAGDmG,EAXDnG,EAAAI,IAcK4D,EAAAA,SAAAA,EAAmBoC,GACtBpG,EACAA,EAAAqG,UAAAC,IAAAF,GAGDpG,EANDoG,YAAApG,EAAAoG,UAAA,IAAA,IAAAA,GASKpC,EAAAA,SAAAA,EAAmBoC,GACtBpG,EACAA,EAAAqG,UAAAE,OAAAH,GAMDpG,EATDoG,UAAApG,EAAAoG,UAMEI,QAAQ,IAAIC,OAAO,WAAaL,EAAY,YAAa,KAK3DI,QAAMrG,OAAAA,IACLqG,QAAIE,OAAU,KADfvG,EAAA,SAAAuG,EAAAC,GACKD,GAKLA,EAAME,IAQAC,EAAAA,SAAAA,EAAsBC,EAAtBD,GACL7G,EAAAA,iBAAQ6G,EAAoBC,IAGvBC,EAAoB,SAAA/G,EAApB+G,EAAAA,GACLC,EAAAA,oBAA0BJ,EAAAA,IAD3BG,EAAA,SAAA/G,EAAAiH,EAAAC,GACCF,EAAiBhH,EATO,OASwBiH,GAKjDD,EAAMG,EAboBL,aAapBK,GACLN,EAAAA,EAfD,QAe8BD,IAD9BO,EAAA,SAAAnH,EAAAiH,EAAAC,GACCL,EAAoB7G,EAfI,OAe2BiH,GAKpDJ,EAAqB7G,EAnBK8G,aAmBWM,GACpCP,EAAe5G,EArBhB,QAqBCiH,IAGMlH,EAAUiD,SAAhBA,EAAAmE,EAAAnH,GAHA,IAAIG,EAAWH,EAAS4F,UAKxBwB,EAAYrH,EAASI,EAASiB,aAA9BjB,EAAAmB,YACA+F,EAAAF,EAAkBhB,EAAlB3E,cAAArB,EAAAsB,eACAvB,EAAcuG,EAAAA,OAEdzG,EAAS+F,EAAAA,EAAoB3E,eAC7BiG,EAXDtH,EAAAoG,GAQCjG,EAAcuG,EAAU1G,GAMxBC,EAAMgH,qBAAAA,IAANM,EAAA,SAAAvH,EAAAC,GAIA,IAAMiH,EAAe,SAAfA,EAAejE,GACpBuE,EAAAA,GAAA,EAAAvH,GACAkH,EAAAA,EAAAF,EAAAC,IAEDH,EAAkB/G,SAAlB+G,EAAkB/G,GATnBwH,EAAAvE,GAAA,EAAAhD,GAOEkH,EAAqBnH,EAASiH,EAAaC,IAE5CH,EAAkB/G,EAASiH,EAAaC,IAOxCO,GAAmBzH,MAAnB,SAAA,SAFK0H,EAAmB,SAAC1H,EAASyH,EAAUxH,GAK7CF,EAAM4H,EAAkB1H,GACvBwH,EAAIG,UAAYlF,IAGfiF,EAAA,SAAA3H,GACD6H,IAAAA,EAAaD,EAAb5H,GACAwC,IAGDqF,aAAMC,GACLtF,EAAIuF,EAAY9H,QAGf6H,EAAQ,SAAA9H,EAAAyH,EAAAxH,GACR,IAAA8H,EAAA9H,EAAA4F,UAAArE,WACDoG,EAAYI,EAAWhI,GACtB0H,IAGDlF,EAAAA,WAAA,WAVDkF,EAAA1H,EAAAyH,EAAAxH,GAQE0H,EAAgB3H,IAKlB+H,GACCvF,EAAIpC,EAAWH,KAmBVgI,EAAAA,SAAAA,GAAAA,OAAsBC,EAAAC,gBAAaD,EAAAE,kBAAA,GAExCC,EAAqBrH,SAAAA,GAAAA,OAFmBsH,KAAblI,EAAAS,YAAAC,SAAA,KAAAV,EAAAS,UAAAwH,WAA5BjI,EAAAY,YAAAZ,EAAAW,UAAA,OAMClB,EAAA,SAAiB0I,EAAoB3G,GACrC9B,KAAA+F,UAAK2C,EAAL5G,GACA9B,KAAA0I,eACA1I,KAAA2I,cAAA,EACA3I,KALD4I,OAAA/F,IAoGC,OA5FAgG,EAAAA,WACCA,oBAAe,SAAKC,GACpB,IAAAnB,EAAIM,KAAYa,UAChBb,EAAcG,KAAMW,UAApBrH,WAAIxB,EAAUkI,EAAMW,OAInBd,EAQAD,EAAAI,GACAJ,EAAM9H,EAAAyH,EAAA3H,MAEN6H,EAAA3H,GAVC0H,EAAiB1H,IACjB0H,EAAA1H,EAAAyH,EAAA3H,OAaFgJ,gBAAA,SAAqBH,GACrBG,EAxBmBC,QAAAjJ,KAAA6I,oBAAAK,KAAAlJ,QA2BnB0I,aAAKS,WACJA,IAMDnJ,KAlCmB8I,UAAA,IAAAM,qBA+BlBpJ,KAAKqJ,gBAAgBH,KAAKlJ,MAK5BkG,EAAqBlG,KAAA+F,cAInBG,oBAAA,SAAAoD,GACDtJ,KAzCmB2I,eAAAW,EAsCW,IAA1BtJ,KAAKoG,UAAU1C,QAAuC,IAAvB1D,KAAK2I,eAKzCC,EAAQ5I,KAAA+F,UAASlD,kBAEhB+F,OAAMW,SACL1G,GAAAA,IAAAA,EAAAA,KAFKvC,EAAWN,KAAK+F,UAKjBK,EAAYvD,GAFhBvC,EAASS,UAAUyI,iBAAiBlJ,EAASQ,mBAO7Cd,KAAAoG,UAAAqD,EACAC,MAAAC,UAAAC,MAAAC,KAAAN,KAGDO,GAAK1D,KAAU6C,UAKhBc,KAAAA,UAASd,QAAA,SAAA/I,GAAW8J,EAAAlB,UAAAmB,QAAA/J,KAJlBF,KAAAkK,WAOCH,QAAA,WAAA,IAAAI,EAAAnK,KADDA,KAAA8I,YAGA9I,KAAAoG,UAAA6C,QAAA,SAAA/I,GACAiK,EAAArB,UAAAsB,UAAAlK,KAEDF,KAAK+F,UAAY,MADjB/F,KAAKoG,UAAY,KAIlBN,KAAAA,UAAM,MAANA,KAAM,SAAS5F,EAASE,GAIxB8J,EAAShK,EAAAF,KAAWI,IACnB8J,QAAIrH,WAAW,IAAAwH,EAAArK,KACNiJ,KAAQ7C,UACXN,QAAK5F,SAAAA,GACVmK,EAFDvE,KAAA5F,OAQDoK,GAlXC,SAAArH,EAAAC,GACAC,GAAAA,EAGAA,GAAAA,EAAQnC,OAiBR,IAAK,IAAWoD,EAAPO,EAAI,EAAiBP,EAAclB,EAAQyB,GAAKA,GAAK,EAXhE5B,EAAAE,EAAAmB,QAJErB,EAAAE,EAAAC,GA6WDoH,CAAAvK,EAAAwD,OAAAgH,iBA7bDxK","file":"lazyload.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.LazyLoad = factory());\n}(this, (function () { 'use strict';\n\nconst defaultSettings = {\n\telements_selector: \"img\",\n\tcontainer: document,\n\tthreshold: 300,\n\tthresholds: null,\n\tdata_src: \"src\",\n\tdata_srcset: \"srcset\",\n\tdata_sizes: \"sizes\",\n\tdata_bg: \"bg\",\n\tclass_loading: \"loading\",\n\tclass_loaded: \"loaded\",\n\tclass_error: \"error\",\n\tload_delay: 0,\n\tcallback_load: null,\n\tcallback_error: null,\n\tcallback_set: null,\n\tcallback_enter: null,\n\tcallback_finish: null,\n\tto_webp: false\n};\n\nvar getInstanceSettings = customSettings => {\n\treturn Object.assign({}, defaultSettings, customSettings);\n};\n\nconst dataPrefix = \"data-\";\nconst processedDataName = \"was-processed\";\nconst timeoutDataName = \"ll-timeout\";\nconst trueString = \"true\";\n\nconst getData = (element, attribute) => {\n\treturn element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n\tvar attrName = dataPrefix + attribute;\n\tif (value === null) {\n\t\telement.removeAttribute(attrName);\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setWasProcessedData = element =>\n\tsetData(element, processedDataName, trueString);\n\nconst getWasProcessedData = element =>\n\tgetData(element, processedDataName) === trueString;\n\nconst setTimeoutData = (element, value) =>\n\tsetData(element, timeoutDataName, value);\n\nconst getTimeoutData = element => getData(element, timeoutDataName);\n\nconst purgeProcessedElements = elements => {\n\treturn elements.filter(element => !getWasProcessedData(element));\n};\n\nconst purgeOneElement = (elements, elementToPurge) => {\n\treturn elements.filter(element => element !== elementToPurge);\n};\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n\tvar event;\n\tlet eventString = \"LazyLoad::Initialized\";\n\tlet instance = new classObj(options);\n\ttry {\n\t\t// Works in modern browsers\n\t\tevent = new CustomEvent(eventString, { detail: { instance } });\n\t} catch (err) {\n\t\t// Works in Internet Explorer (all versions)\n\t\tevent = document.createEvent(\"CustomEvent\");\n\t\tevent.initCustomEvent(eventString, false, false, { instance });\n\t}\n\twindow.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of lazyload, depending on the \n options passed in (plain object or an array) */\nfunction autoInitialize(classObj, options) {\n\tif (!options) {\n\t\treturn;\n\t}\n\tif (!options.length) {\n\t\t// Plain object\n\t\tcreateInstance(classObj, options);\n\t} else {\n\t\t// Array of objects\n\t\tfor (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n\t\t\tcreateInstance(classObj, optionsItem);\n\t\t}\n\t}\n}\n\nconst replaceExtToWebp = (value, condition) =>\n\tcondition ? value.replace(/\\.(jpe?g|png)/gi, \".webp\") : value;\n\nconst detectWebp = () => {\n\tvar webpString = \"image/webp\";\n\tvar canvas = document.createElement(\"canvas\");\n\n\tif (canvas.getContext && canvas.getContext(\"2d\")) {\n\t\treturn canvas.toDataURL(webpString).indexOf(`data:${webpString}`) === 0;\n\t}\n\n\treturn false;\n};\n\nconst runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n\t(runningOnBrowser && !(\"onscroll\" in window)) ||\n\t/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);\n\nconst supportsIntersectionObserver =\n\trunningOnBrowser && \"IntersectionObserver\" in window;\n\nconst supportsClassList =\n\trunningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst supportsWebp = runningOnBrowser && detectWebp();\n\nconst setSourcesInChildren = function(\n\tparentTag,\n\tattrName,\n\tdataAttrName,\n\ttoWebpFlag\n) {\n\tfor (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n\t\tif (childTag.tagName === \"SOURCE\") {\n\t\t\tlet attrValue = getData(childTag, dataAttrName);\n\t\t\tsetAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);\n\t\t}\n\t}\n};\n\nconst setAttributeIfValue = function(\n\telement,\n\tattrName,\n\tvalue,\n\ttoWebpFlag\n) {\n\tif (!value) {\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));\n};\n\nconst setSourcesImg = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcsetDataName = settings.data_srcset;\n\tconst parent = element.parentNode;\n\n\tif (parent && parent.tagName === \"PICTURE\") {\n\t\tsetSourcesInChildren(parent, \"srcset\", srcsetDataName, toWebpFlag);\n\t}\n\tconst sizesDataValue = getData(element, settings.data_sizes);\n\tsetAttributeIfValue(element, \"sizes\", sizesDataValue);\n\tconst srcsetDataValue = getData(element, srcsetDataName);\n\tsetAttributeIfValue(element, \"srcset\", srcsetDataValue, toWebpFlag);\n\tconst srcDataValue = getData(element, settings.data_src);\n\tsetAttributeIfValue(element, \"src\", srcDataValue, toWebpFlag);\n};\n\nconst setSourcesIframe = (element, settings) => {\n\tconst srcDataValue = getData(element, settings.data_src);\n\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n};\n\nconst setSourcesVideo = (element, settings) => {\n\tconst srcDataName = settings.data_src;\n\tconst srcDataValue = getData(element, srcDataName);\n\n\tsetSourcesInChildren(element, \"src\", srcDataName);\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n\telement.load();\n};\n\nconst setSourcesBgImage = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcDataValue = getData(element, settings.data_src);\n\tconst bgDataValue = getData(element, settings.data_bg);\n\n\tif (srcDataValue) {\n\t\tlet setValue = replaceExtToWebp(srcDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = `url(\"${setValue}\")`;\n\t}\n\n\tif (bgDataValue) {\n\t\tlet setValue = replaceExtToWebp(bgDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = setValue;\n\t}\n};\n\nconst setSourcesFunctions = {\n\tIMG: setSourcesImg,\n\tIFRAME: setSourcesIframe,\n\tVIDEO: setSourcesVideo\n};\n\nconst setSources = (element, instance) => {\n\tconst settings = instance._settings;\n\tconst tagName = element.tagName;\n\tconst setSourcesFunction = setSourcesFunctions[tagName];\n\tif (setSourcesFunction) {\n\t\tsetSourcesFunction(element, settings);\n\t\tinstance._updateLoadingCount(1);\n\t\tinstance._elements = purgeOneElement(instance._elements, element);\n\t\treturn;\n\t}\n\tsetSourcesBgImage(element, settings);\n};\n\nconst addClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.add(className);\n\t\treturn;\n\t}\n\telement.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.remove(className);\n\t\treturn;\n\t}\n\telement.className = element.className.\n\t\treplace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").\n\t\treplace(/^\\s+/, \"\").\n\t\treplace(/\\s+$/, \"\");\n};\n\nconst callbackIfSet = (callback, argument) => {\n\tif (callback) {\n\t\tcallback(argument);\n\t}\n};\n\nconst genericLoadEventName = \"load\";\nconst mediaLoadEventName = \"loadeddata\";\nconst errorEventName = \"error\";\n\nconst addEventListener = (element, eventName, handler) => {\n\telement.addEventListener(eventName, handler);\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n\telement.removeEventListener(eventName, handler);\n};\n\nconst addEventListeners = (element, loadHandler, errorHandler) => {\n\taddEventListener(element, genericLoadEventName, loadHandler);\n\taddEventListener(element, mediaLoadEventName, loadHandler);\n\taddEventListener(element, errorEventName, errorHandler);\n};\n\nconst removeEventListeners = (element, loadHandler, errorHandler) => {\n\tremoveEventListener(element, genericLoadEventName, loadHandler);\n\tremoveEventListener(element, mediaLoadEventName, loadHandler);\n\tremoveEventListener(element, errorEventName, errorHandler);\n};\n\nconst eventHandler = function(event, success, instance) {\n\tvar settings = instance._settings;\n\tconst className = success ? settings.class_loaded : settings.class_error;\n\tconst callback = success ? settings.callback_load : settings.callback_error;\n\tconst element = event.target;\n\n\tremoveClass(element, settings.class_loading);\n\taddClass(element, className);\n\tcallbackIfSet(callback, element);\n\n\tinstance._updateLoadingCount(-1);\n};\n\nconst addOneShotEventListeners = (element, instance) => {\n\tconst loadHandler = event => {\n\t\teventHandler(event, true, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\tconst errorHandler = event => {\n\t\teventHandler(event, false, instance);\n\t\tremoveEventListeners(element, loadHandler, errorHandler);\n\t};\n\taddEventListeners(element, loadHandler, errorHandler);\n};\n\nconst managedTags = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nconst loadAndUnobserve = (element, observer, instance) => {\n\trevealElement(element, instance);\n\tobserver.unobserve(element);\n};\n\nconst cancelDelayLoad = element => {\n\tvar timeoutId = getTimeoutData(element);\n\tif (!timeoutId) {\n\t\treturn; // do nothing if timeout doesn't exist\n\t}\n\tclearTimeout(timeoutId);\n\tsetTimeoutData(element, null);\n};\n\nconst delayLoad = (element, observer, instance) => {\n\tvar loadDelay = instance._settings.load_delay;\n\tvar timeoutId = getTimeoutData(element);\n\tif (timeoutId) {\n\t\treturn; // do nothing if timeout already set\n\t}\n\ttimeoutId = setTimeout(function() {\n\t\tloadAndUnobserve(element, observer, instance);\n\t\tcancelDelayLoad(element);\n\t}, loadDelay);\n\tsetTimeoutData(element, timeoutId);\n};\n\nfunction revealElement(element, instance, force) {\n\tvar settings = instance._settings;\n\tif (!force && getWasProcessedData(element)) {\n\t\treturn; // element has already been processed and force wasn't true\n\t}\n\tcallbackIfSet(settings.callback_enter, element);\n\tif (managedTags.indexOf(element.tagName) > -1) {\n\t\taddOneShotEventListeners(element, instance);\n\t\taddClass(element, settings.class_loading);\n\t}\n\tsetSources(element, instance);\n\tsetWasProcessedData(element);\n\tcallbackIfSet(settings.callback_set, element);\n}\n\n/* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and\n entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */\nconst isIntersecting = entry =>\n\tentry.isIntersecting || entry.intersectionRatio > 0;\n\nconst getObserverSettings = settings => ({\n\troot: settings.container === document ? null : settings.container,\n\trootMargin: settings.thresholds || settings.threshold + \"px\"\n});\n\nconst LazyLoad = function(customSettings, elements) {\n\tthis._settings = getInstanceSettings(customSettings);\n\tthis._setObserver();\n\tthis._loadingCount = 0;\n\tthis.update(elements);\n};\n\nLazyLoad.prototype = {\n\t_manageIntersection: function(entry) {\n\t\tvar observer = this._observer;\n\t\tvar loadDelay = this._settings.load_delay;\n\t\tvar element = entry.target;\n\n\t\t// WITHOUT LOAD DELAY\n\t\tif (!loadDelay) {\n\t\t\tif (isIntersecting(entry)) {\n\t\t\t\tloadAndUnobserve(element, observer, this);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// WITH LOAD DELAY\n\t\tif (isIntersecting(entry)) {\n\t\t\tdelayLoad(element, observer, this);\n\t\t} else {\n\t\t\tcancelDelayLoad(element);\n\t\t}\n\t},\n\n\t_onIntersection: function(entries) {\n\t\tentries.forEach(this._manageIntersection.bind(this));\n\t},\n\n\t_setObserver: function() {\n\t\tif (!supportsIntersectionObserver) {\n\t\t\treturn;\n\t\t}\n\t\tthis._observer = new IntersectionObserver(\n\t\t\tthis._onIntersection.bind(this),\n\t\t\tgetObserverSettings(this._settings)\n\t\t);\n\t},\n\n\t_updateLoadingCount: function(plusMinus) {\n\t\tthis._loadingCount += plusMinus;\n\t\tif (this._elements.length === 0 && this._loadingCount === 0) {\n\t\t\tcallbackIfSet(this._settings.callback_finish);\n\t\t}\n\t},\n\n\tupdate: function(elements) {\n\t\tconst settings = this._settings;\n\t\tconst nodeSet =\n\t\t\telements ||\n\t\t\tsettings.container.querySelectorAll(settings.elements_selector);\n\n\t\tthis._elements = purgeProcessedElements(\n\t\t\tArray.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility\n\t\t);\n\n\t\tif (isBot || !this._observer) {\n\t\t\tthis.loadAll();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._elements.forEach(element => {\n\t\t\tthis._observer.observe(element);\n\t\t});\n\t},\n\n\tdestroy: function() {\n\t\tif (this._observer) {\n\t\t\tthis._elements.forEach(element => {\n\t\t\t\tthis._observer.unobserve(element);\n\t\t\t});\n\t\t\tthis._observer = null;\n\t\t}\n\t\tthis._elements = null;\n\t\tthis._settings = null;\n\t},\n\n\tload: function(element, force) {\n\t\trevealElement(element, this, force);\n\t},\n\n\tloadAll: function() {\n\t\tvar elements = this._elements;\n\t\telements.forEach(element => {\n\t\t\tthis.load(element);\n\t\t});\n\t}\n};\n\n/* Automatic instances creation if required (useful for async script loading) */\nif (runningOnBrowser) {\n\tautoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nreturn LazyLoad;\n\n})));\n"]}
assets/js/lazyload-10.3.5.js DELETED
@@ -1,249 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var defaultSettings = {
11
- elements_selector: "img",
12
- container: document,
13
- threshold: 300,
14
- data_src: "src",
15
- data_srcset: "srcset",
16
- class_loading: "loading",
17
- class_loaded: "loaded",
18
- class_error: "error",
19
- callback_load: null,
20
- callback_error: null,
21
- callback_set: null
22
- };
23
-
24
- var dataPrefix = "data-";
25
-
26
- var getData = function getData(element, attribute) {
27
- return element.getAttribute(dataPrefix + attribute);
28
- };
29
-
30
- var setData = function setData(element, attribute, value) {
31
- return element.setAttribute(dataPrefix + attribute, value);
32
- };
33
-
34
- var purgeElements = function purgeElements(elements) {
35
- return elements.filter(function (element) {
36
- return !getData(element, "was-processed");
37
- });
38
- };
39
-
40
- /* Creates instance and notifies it through the window element */
41
- var createInstance = function createInstance(classObj, options) {
42
- var event;
43
- var eventString = "LazyLoad::Initialized";
44
- var instance = new classObj(options);
45
- try {
46
- // Works in modern browsers
47
- event = new CustomEvent(eventString, { detail: { instance: instance } });
48
- } catch (err) {
49
- // Works in Internet Explorer (all versions)
50
- event = document.createEvent("CustomEvent");
51
- event.initCustomEvent(eventString, false, false, { instance: instance });
52
- }
53
- window.dispatchEvent(event);
54
- };
55
-
56
- /* Auto initialization of one or more instances of lazyload, depending on the
57
- options passed in (plain object or an array) */
58
- var autoInitialize = function autoInitialize(classObj, options) {
59
- if (!options.length) {
60
- // Plain object
61
- createInstance(classObj, options);
62
- } else {
63
- // Array of objects
64
- for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
65
- createInstance(classObj, optionsItem);
66
- }
67
- }
68
- };
69
-
70
- var setSourcesForPicture = function setSourcesForPicture(element, settings) {
71
- var dataSrcSet = settings.data_srcset;
72
-
73
- var parent = element.parentNode;
74
- if (parent.tagName !== "PICTURE") {
75
- return;
76
- }
77
- for (var i = 0, pictureChild; pictureChild = parent.children[i]; i += 1) {
78
- if (pictureChild.tagName === "SOURCE") {
79
- var sourceSrcset = getData(pictureChild, dataSrcSet);
80
- if (sourceSrcset) {
81
- pictureChild.setAttribute("srcset", sourceSrcset);
82
- }
83
- }
84
- }
85
- };
86
-
87
- var setSources = function setSources(element, settings) {
88
- var dataSrc = settings.data_src,
89
- dataSrcSet = settings.data_srcset;
90
-
91
- var tagName = element.tagName;
92
- var elementSrc = getData(element, dataSrc);
93
- if (tagName === "IMG") {
94
- setSourcesForPicture(element, settings);
95
- var imgSrcset = getData(element, dataSrcSet);
96
- if (imgSrcset) {
97
- element.setAttribute("srcset", imgSrcset);
98
- }
99
- if (elementSrc) {
100
- element.setAttribute("src", elementSrc);
101
- }
102
- return;
103
- }
104
- if (tagName === "IFRAME") {
105
- if (elementSrc) {
106
- element.setAttribute("src", elementSrc);
107
- }
108
- return;
109
- }
110
- if (elementSrc) {
111
- element.style.backgroundImage = 'url("' + elementSrc + '")';
112
- }
113
- };
114
-
115
- var supportsClassList = "classList" in document.createElement("p");
116
-
117
- var addClass = function addClass(element, className) {
118
- if (supportsClassList) {
119
- element.classList.add(className);
120
- return;
121
- }
122
- element.className += (element.className ? " " : "") + className;
123
- };
124
-
125
- var removeClass = function removeClass(element, className) {
126
- if (supportsClassList) {
127
- element.classList.remove(className);
128
- return;
129
- }
130
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
131
- };
132
-
133
- var callCallback = function callCallback(callback, argument) {
134
- if (callback) {
135
- callback(argument);
136
- }
137
- };
138
-
139
- var loadString = "load";
140
- var errorString = "error";
141
-
142
- var removeListeners = function removeListeners(element, loadHandler, errorHandler) {
143
- element.removeEventListener(loadString, loadHandler);
144
- element.removeEventListener(errorString, errorHandler);
145
- };
146
-
147
- var addOneShotListeners = function addOneShotListeners(element, settings) {
148
- var onLoad = function onLoad(event) {
149
- onEvent(event, true, settings);
150
- removeListeners(element, onLoad, onError);
151
- };
152
- var onError = function onError(event) {
153
- onEvent(event, false, settings);
154
- removeListeners(element, onLoad, onError);
155
- };
156
- element.addEventListener(loadString, onLoad);
157
- element.addEventListener(errorString, onError);
158
- };
159
-
160
- var onEvent = function onEvent(event, success, settings) {
161
- var element = event.target;
162
- removeClass(element, settings.class_loading);
163
- addClass(element, success ? settings.class_loaded : settings.class_error); // Setting loaded or error class
164
- callCallback(success ? settings.callback_load : settings.callback_error, element); // Calling loaded or error callback
165
- };
166
-
167
- var revealElement = function revealElement(element, settings) {
168
- if (["IMG", "IFRAME"].indexOf(element.tagName) > -1) {
169
- addOneShotListeners(element, settings);
170
- addClass(element, settings.class_loading);
171
- }
172
- setSources(element, settings);
173
- setData(element, "was-processed", true);
174
- callCallback(settings.callback_set, element);
175
- };
176
-
177
- var LazyLoad = function LazyLoad(instanceSettings, elements) {
178
- this._settings = _extends({}, defaultSettings, instanceSettings);
179
- this._setObserver();
180
- this.update(elements);
181
- };
182
-
183
- LazyLoad.prototype = {
184
- _setObserver: function _setObserver() {
185
- var _this = this;
186
-
187
- if (!("IntersectionObserver" in window)) {
188
- return;
189
- }
190
-
191
- var settings = this._settings;
192
- var onIntersection = function onIntersection(entries) {
193
- entries.forEach(function (entry) {
194
- if (entry.intersectionRatio > 0) {
195
- var element = entry.target;
196
- revealElement(element, settings);
197
- _this._observer.unobserve(element);
198
- }
199
- });
200
- _this._elements = purgeElements(_this._elements);
201
- };
202
- this._observer = new IntersectionObserver(onIntersection, {
203
- root: settings.container === document ? null : settings.container,
204
- rootMargin: settings.threshold + "px"
205
- });
206
- },
207
-
208
- update: function update(elements) {
209
- var _this2 = this;
210
-
211
- var settings = this._settings;
212
- var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
213
-
214
- this._elements = purgeElements(Array.prototype.slice.call(nodeSet)); // nodeset to array for IE compatibility
215
- if (this._observer) {
216
- this._elements.forEach(function (element) {
217
- _this2._observer.observe(element);
218
- });
219
- return;
220
- }
221
- // Fallback: load all elements at once
222
- this._elements.forEach(function (element) {
223
- revealElement(element, settings);
224
- });
225
- this._elements = purgeElements(this._elements);
226
- },
227
-
228
- destroy: function destroy() {
229
- var _this3 = this;
230
-
231
- if (this._observer) {
232
- purgeElements(this._elements).forEach(function (element) {
233
- _this3._observer.unobserve(element);
234
- });
235
- this._observer = null;
236
- }
237
- this._elements = null;
238
- this._settings = null;
239
- }
240
- };
241
-
242
- /* Automatic instances creation if required (useful for async script loading!) */
243
- var autoInitOptions = window.lazyLoadOptions;
244
- if (autoInitOptions) {
245
- autoInitialize(LazyLoad, autoInitOptions);
246
- }
247
-
248
- return LazyLoad;
249
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-10.3.5.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},r=function(e){return e.filter(function(e){return!t(e,"was-processed")})},s=function(e,t){var n,r=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:r}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:r})}window.dispatchEvent(n)},o=function(e,n){var r=n.data_srcset,s=e.parentNode;if("PICTURE"===s.tagName)for(var o,a=0;o=s.children[a];a+=1)if("SOURCE"===o.tagName){var i=t(o,r);i&&o.setAttribute("srcset",i)}},a=function(e,n){var r=n.data_src,s=n.data_srcset,a=e.tagName,i=t(e,r);if("IMG"===a){o(e,n);var c=t(e,s);return c&&e.setAttribute("srcset",c),void(i&&e.setAttribute("src",i))}"IFRAME"!==a?i&&(e.style.backgroundImage='url("'+i+'")'):i&&e.setAttribute("src",i)},i="classList"in document.createElement("p"),c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},d=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},f=function(e,t){var n=function n(s){v(s,!0,t),d(e,n,r)},r=function r(s){v(s,!1,t),d(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)},v=function(e,t,n){var r=e.target;l(r,n.class_loading),c(r,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,r)},_=function(e,t){["IMG","IFRAME"].indexOf(e.tagName)>-1&&(f(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},m=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};m.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.intersectionRatio>0){var r=n.target;_(r,t),e._observer.unobserve(r)}}),e._elements=r(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,s=e||n.container.querySelectorAll(n.elements_selector);this._elements=r(Array.prototype.slice.call(s)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){_(e,n)}),this._elements=r(this._elements))},destroy:function(){var e=this;this._observer&&(r(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var b=window.lazyLoadOptions;return b&&function(e,t){if(t.length)for(var n,r=0;n=t[r];r+=1)s(e,n);else s(e,t)}(m,b),m});
 
assets/js/lazyload-10.8.js DELETED
@@ -1,273 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var getInstanceSettings = function getInstanceSettings(customSettings) {
11
- var defaultSettings = {
12
- elements_selector: "img",
13
- container: document,
14
- threshold: 300,
15
- data_src: "src",
16
- data_srcset: "srcset",
17
- class_loading: "loading",
18
- class_loaded: "loaded",
19
- class_error: "error",
20
- callback_load: null,
21
- callback_error: null,
22
- callback_set: null,
23
- callback_enter: null
24
- };
25
-
26
- return _extends({}, defaultSettings, customSettings);
27
- };
28
-
29
- var dataPrefix = "data-";
30
-
31
- var getData = function getData(element, attribute) {
32
- return element.getAttribute(dataPrefix + attribute);
33
- };
34
-
35
- var setData = function setData(element, attribute, value) {
36
- return element.setAttribute(dataPrefix + attribute, value);
37
- };
38
-
39
- var purgeElements = function purgeElements(elements) {
40
- return elements.filter(function (element) {
41
- return !getData(element, "was-processed");
42
- });
43
- };
44
-
45
- /* Creates instance and notifies it through the window element */
46
- var createInstance = function createInstance(classObj, options) {
47
- var event;
48
- var eventString = "LazyLoad::Initialized";
49
- var instance = new classObj(options);
50
- try {
51
- // Works in modern browsers
52
- event = new CustomEvent(eventString, { detail: { instance: instance } });
53
- } catch (err) {
54
- // Works in Internet Explorer (all versions)
55
- event = document.createEvent("CustomEvent");
56
- event.initCustomEvent(eventString, false, false, { instance: instance });
57
- }
58
- window.dispatchEvent(event);
59
- };
60
-
61
- /* Auto initialization of one or more instances of lazyload, depending on the
62
- options passed in (plain object or an array) */
63
- var autoInitialize = function autoInitialize(classObj, options) {
64
- if (!options.length) {
65
- // Plain object
66
- createInstance(classObj, options);
67
- } else {
68
- // Array of objects
69
- for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
70
- createInstance(classObj, optionsItem);
71
- }
72
- }
73
- };
74
-
75
- var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName) {
76
- for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
77
- if (childTag.tagName === "SOURCE") {
78
- var attributeValue = getData(childTag, dataAttrName);
79
- if (attributeValue) {
80
- childTag.setAttribute(attrName, attributeValue);
81
- }
82
- }
83
- }
84
- };
85
-
86
- var setAttributeIfNotNullOrEmpty = function setAttributeIfNotNullOrEmpty(element, attrName, value) {
87
- if (!value) {
88
- return;
89
- }
90
- element.setAttribute(attrName, value);
91
- };
92
-
93
- var setSources = function setSources(element, settings) {
94
- var dataAttrSrcName = settings.data_src;
95
- var elementSrc = getData(element, dataAttrSrcName);
96
- var tagName = element.tagName;
97
- if (tagName === "IMG") {
98
- var dataAttrSrcSetName = settings.data_srcset;
99
- var elementSrcSet = getData(element, dataAttrSrcSetName);
100
- var parent = element.parentNode;
101
- if (parent && parent.tagName === "PICTURE") {
102
- setSourcesInChildren(parent, "srcset", dataAttrSrcSetName);
103
- }
104
- setAttributeIfNotNullOrEmpty(element, "srcset", elementSrcSet);
105
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
106
- return;
107
- }
108
- if (tagName === "IFRAME") {
109
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
110
- return;
111
- }
112
- if (tagName === "VIDEO") {
113
- setSourcesInChildren(element, "src", dataAttrSrcName);
114
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
115
- return;
116
- }
117
- if (elementSrc) {
118
- element.style.backgroundImage = 'url("' + elementSrc + '")';
119
- }
120
- };
121
-
122
- var runningOnBrowser = typeof window !== "undefined";
123
-
124
- var supportsIntersectionObserver = runningOnBrowser && "IntersectionObserver" in window;
125
-
126
- var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
127
-
128
- var addClass = function addClass(element, className) {
129
- if (supportsClassList) {
130
- element.classList.add(className);
131
- return;
132
- }
133
- element.className += (element.className ? " " : "") + className;
134
- };
135
-
136
- var removeClass = function removeClass(element, className) {
137
- if (supportsClassList) {
138
- element.classList.remove(className);
139
- return;
140
- }
141
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
142
- };
143
-
144
- var callCallback = function callCallback(callback, argument) {
145
- if (callback) {
146
- callback(argument);
147
- }
148
- };
149
-
150
- var loadString = "load";
151
- var errorString = "error";
152
-
153
- var removeListeners = function removeListeners(element, loadHandler, errorHandler) {
154
- element.removeEventListener(loadString, loadHandler);
155
- element.removeEventListener(errorString, errorHandler);
156
- };
157
-
158
- var addOneShotListeners = function addOneShotListeners(element, settings) {
159
- var onLoad = function onLoad(event) {
160
- onEvent(event, true, settings);
161
- removeListeners(element, onLoad, onError);
162
- };
163
- var onError = function onError(event) {
164
- onEvent(event, false, settings);
165
- removeListeners(element, onLoad, onError);
166
- };
167
- element.addEventListener(loadString, onLoad);
168
- element.addEventListener(errorString, onError);
169
- };
170
-
171
- var onEvent = function onEvent(event, success, settings) {
172
- var element = event.target;
173
- removeClass(element, settings.class_loading);
174
- addClass(element, success ? settings.class_loaded : settings.class_error); // Setting loaded or error class
175
- callCallback(success ? settings.callback_load : settings.callback_error, element); // Calling loaded or error callback
176
- };
177
-
178
- var revealElement = function revealElement(element, settings) {
179
- callCallback(settings.callback_enter, element);
180
- if (["IMG", "IFRAME", "VIDEO"].indexOf(element.tagName) > -1) {
181
- addOneShotListeners(element, settings);
182
- addClass(element, settings.class_loading);
183
- }
184
- setSources(element, settings);
185
- setData(element, "was-processed", true);
186
- callCallback(settings.callback_set, element);
187
- };
188
-
189
- /* entry.isIntersecting needs fallback because is null on some versions of MS Edge, and
190
- entry.intersectionRatio is not enough alone because it could be 0 on some intersecting elements */
191
- var isIntersecting = function isIntersecting(element) {
192
- return element.isIntersecting || element.intersectionRatio > 0;
193
- };
194
-
195
- var LazyLoad = function LazyLoad(customSettings, elements) {
196
- this._settings = getInstanceSettings(customSettings);
197
- this._setObserver();
198
- this.update(elements);
199
- };
200
-
201
- LazyLoad.prototype = {
202
- _setObserver: function _setObserver() {
203
- var _this = this;
204
-
205
- if (!supportsIntersectionObserver) {
206
- return;
207
- }
208
-
209
- var settings = this._settings;
210
- var observerSettings = {
211
- root: settings.container === document ? null : settings.container,
212
- rootMargin: settings.threshold + "px"
213
- };
214
- var revealIntersectingElements = function revealIntersectingElements(entries) {
215
- entries.forEach(function (entry) {
216
- if (isIntersecting(entry)) {
217
- var element = entry.target;
218
- revealElement(element, _this._settings);
219
- _this._observer.unobserve(element);
220
- }
221
- });
222
- _this._elements = purgeElements(_this._elements);
223
- };
224
- this._observer = new IntersectionObserver(revealIntersectingElements, observerSettings);
225
- },
226
-
227
- loadAll: function loadAll() {
228
- var settings = this._settings;
229
- // Fallback: load all elements at once
230
- this._elements.forEach(function (element) {
231
- revealElement(element, settings);
232
- });
233
- this._elements = purgeElements(this._elements);
234
- },
235
-
236
- update: function update(elements) {
237
- var _this2 = this;
238
-
239
- var settings = this._settings;
240
- var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
241
-
242
- this._elements = purgeElements(Array.prototype.slice.call(nodeSet)); // nodeset to array for IE compatibility
243
- if (this._observer) {
244
- this._elements.forEach(function (element) {
245
- _this2._observer.observe(element);
246
- });
247
- return;
248
- }
249
- this.loadAll();
250
- },
251
-
252
- destroy: function destroy() {
253
- var _this3 = this;
254
-
255
- if (this._observer) {
256
- purgeElements(this._elements).forEach(function (element) {
257
- _this3._observer.unobserve(element);
258
- });
259
- this._observer = null;
260
- }
261
- this._elements = null;
262
- this._settings = null;
263
- }
264
- };
265
-
266
- /* Automatic instances creation if required (useful for async script loading!) */
267
- var autoInitOptions = window.lazyLoadOptions;
268
- if (runningOnBrowser && autoInitOptions) {
269
- autoInitialize(LazyLoad, autoInitOptions);
270
- }
271
-
272
- return LazyLoad;
273
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-10.8.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e=function(e){var t={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null,callback_enter:null};return _extends({},t,e)},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},r=function(e){return e.filter(function(e){return!t(e,"was-processed")})},s=function(e,t){var n,r=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:r}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:r})}window.dispatchEvent(n)},o=function(e,n,r){for(var s,o=0;s=e.children[o];o+=1)if("SOURCE"===s.tagName){var i=t(s,r);i&&s.setAttribute(n,i)}},i=function(e,t,n){n&&e.setAttribute(t,n)},a=function(e,n){var r=n.data_src,s=t(e,r),a=e.tagName;if("IMG"===a){var c=n.data_srcset,l=t(e,c),u=e.parentNode;return u&&"PICTURE"===u.tagName&&o(u,"srcset",c),i(e,"srcset",l),void i(e,"src",s)}if("IFRAME"!==a)return"VIDEO"===a?(o(e,"src",r),void i(e,"src",s)):void(s&&(e.style.backgroundImage='url("'+s+'")'));i(e,"src",s)},c="undefined"!=typeof window,l=c&&"IntersectionObserver"in window,u=c&&"classList"in document.createElement("p"),d=function(e,t){u?e.classList.add(t):e.className+=(e.className?" ":"")+t},f=function(e,t){u?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},v=function(e,t){e&&e(t)},_=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},m=function(e,t){var n=function n(s){b(s,!0,t),_(e,n,r)},r=function r(s){b(s,!1,t),_(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)},b=function(e,t,n){var r=e.target;f(r,n.class_loading),d(r,t?n.class_loaded:n.class_error),v(t?n.callback_load:n.callback_error,r)},h=function(e,t){v(t.callback_enter,e),["IMG","IFRAME","VIDEO"].indexOf(e.tagName)>-1&&(m(e,t),d(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),v(t.callback_set,e)},p=function(e){return e.isIntersecting||e.intersectionRatio>0},y=function(t,n){this._settings=e(t),this._setObserver(),this.update(n)};y.prototype={_setObserver:function(){var e=this;if(l){var t=this._settings,n={root:t.container===document?null:t.container,rootMargin:t.threshold+"px"};this._observer=new IntersectionObserver(function(t){t.forEach(function(t){if(p(t)){var n=t.target;h(n,e._settings),e._observer.unobserve(n)}}),e._elements=r(e._elements)},n)}},loadAll:function(){var e=this._settings;this._elements.forEach(function(t){h(t,e)}),this._elements=r(this._elements)},update:function(e){var t=this,n=this._settings,s=e||n.container.querySelectorAll(n.elements_selector);this._elements=r(Array.prototype.slice.call(s)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):this.loadAll()},destroy:function(){var e=this;this._observer&&(r(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var g=window.lazyLoadOptions;return c&&g&&function(e,t){if(t.length)for(var n,r=0;n=t[r];r+=1)s(e,n);else s(e,t)}(y,g),y});
 
assets/js/lazyload-8.11.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var d=!("onscroll"in window)||/glebot/.test(navigator.userAgent),h=function(e,t){e&&e(t)},o=function(e){return e.getBoundingClientRect().top+window.pageYOffset-e.ownerDocument.documentElement.clientTop},f=function(e,t,n){return(t===window?window.innerHeight+window.pageYOffset:o(t)+t.offsetHeight)<=o(e)-n},i=function(e){return e.getBoundingClientRect().left+window.pageXOffset-e.ownerDocument.documentElement.clientLeft},_=function(e,t,n){var o=window.innerWidth;return(t===window?o+window.pageXOffset:i(t)+o)<=i(e)-n},p=function(e,t,n){return(t===window?window.pageYOffset:o(t))>=o(e)+n+e.offsetHeight},m=function(e,t,n){return(t===window?window.pageXOffset:i(t))>=i(e)+n+e.offsetWidth};var s=function(e,t){var n,o="LazyLoad::Initialized",i=new e(t);try{n=new CustomEvent(o,{detail:{instance:i}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent(o,!1,!1,{instance:i})}window.dispatchEvent(n)};var r="data-",l="was-processed",a="true",u=function(e,t){return e.getAttribute(r+t)},g=function(e){return t=l,n=a,e.setAttribute(r+t,n);var t,n},c=function(e){return u(e,l)===a},v=function(e,t,n){for(var o,i=0;o=e.children[i];i+=1)if("SOURCE"===o.tagName){var s=u(o,n);s&&o.setAttribute(t,s)}},w=function(e,t,n){n&&e.setAttribute(t,n)};var e="undefined"!=typeof window,n=e&&"classList"in document.createElement("p"),b=function(e,t){n?e.classList.add(t):e.className+=(e.className?" ":"")+t},y=function(e,t){n?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},t=function(e){this._settings=_extends({},{elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_processed:null,callback_enter:null},e),this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};t.prototype={_reveal:function(t,e){if(e||!c(t)){var n=this._settings,o=function e(){n&&(t.removeEventListener("load",i),t.removeEventListener("error",e),y(t,n.class_loading),b(t,n.class_error),h(n.callback_error,t))},i=function e(){n&&(y(t,n.class_loading),b(t,n.class_loaded),t.removeEventListener("load",e),t.removeEventListener("error",o),h(n.callback_load,t))};h(n.callback_enter,t),-1<["IMG","IFRAME","VIDEO"].indexOf(t.tagName)&&(t.addEventListener("load",i),t.addEventListener("error",o),b(t,n.class_loading)),function(e,t){var n=t.data_sizes,o=t.data_srcset,i=t.data_src,s=u(e,i),r=e.tagName;if("IMG"===r){var l=e.parentNode;l&&"PICTURE"===l.tagName&&v(l,"srcset",o);var a=u(e,n);w(e,"sizes",a);var c=u(e,o);return w(e,"srcset",c),w(e,"src",s)}if("IFRAME"!==r)return"VIDEO"===r?(v(e,"src",i),w(e,"src",s)):s&&(e.style.backgroundImage='url("'+s+'")');w(e,"src",s)}(t,n),h(n.callback_set,t)}},_loopThroughElements:function(e){var t,n,o,i=this._settings,s=this._elements,r=s?s.length:0,l=void 0,a=[],c=this._isFirstLoop;for(l=0;l<r;l++){var u=s[l];i.skip_invisible&&null===u.offsetParent||(!d&&!e&&(t=u,n=i.container,o=i.threshold,f(t,n,o)||p(t,n,o)||_(t,n,o)||m(t,n,o))||(c&&b(u,i.class_initial),this.load(u),a.push(l),g(u)))}for(;a.length;)s.splice(a.pop(),1),h(i.callback_processed,s.length);0===r&&this._stopScrollHandler(),c&&(this._isFirstLoop=!1)},_purgeElements:function(){var e=this._elements,t=e.length,n=void 0,o=[];for(n=0;n<t;n++){var i=e[n];c(i)&&o.push(n)}for(;0<o.length;)e.splice(o.pop(),1)},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},handleScroll:function(){var e=this._settings.throttle;if(0!==e){var t=Date.now(),n=e-(t-this._previousLoopTime);n<=0||e<n?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=t,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},loadAll:function(){this._loopThroughElements(!0)},update:function(){this._elements=Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector)),this._purgeElements(),this._loopThroughElements(),this._startScrollHandler()},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null},load:function(e,t){this._reveal(e,t)}};var E=window.lazyLoadOptions;return e&&E&&function(e,t){var n=t.length;if(n)for(var o=0;o<n;o++)s(e,t[o]);else s(e,t)}(t,E),t});
 
assets/js/{lazyload-8.11.js → lazyload-8.17.js} RENAMED
@@ -16,6 +16,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
16
  data_src: "src",
17
  data_srcset: "srcset",
18
  data_sizes: "sizes",
 
19
  class_loading: "loading",
20
  class_loaded: "loaded",
21
  class_error: "error",
@@ -24,17 +25,47 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
24
  callback_load: null,
25
  callback_error: null,
26
  callback_set: null,
27
- callback_processed: null,
28
- callback_enter: null
 
29
  };
30
  };
31
 
32
- var isBot = !("onscroll" in window) || /glebot/.test(navigator.userAgent);
 
 
33
 
34
- var callCallback = function callCallback(callback, argument) {
35
- if (callback) {
36
- callback(argument);
 
 
 
 
 
 
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  };
39
 
40
  var getTopOffset = function getTopOffset(element) {
@@ -89,107 +120,216 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
89
  /* Auto initialization of one or more instances of lazyload, depending on the
90
  options passed in (plain object or an array) */
91
  function autoInitialize(classObj, options) {
92
- var optsLength = options.length;
93
- if (!optsLength) {
 
 
94
  // Plain object
95
  createInstance(classObj, options);
96
  } else {
97
  // Array of objects
98
- for (var i = 0; i < optsLength; i++) {
99
- createInstance(classObj, options[i]);
100
  }
101
  }
102
  }
103
 
104
- var dataPrefix = "data-";
105
- var processedDataName = "was-processed";
106
- var processedDataValue = "true";
107
-
108
- var getData = function getData(element, attribute) {
109
- return element.getAttribute(dataPrefix + attribute);
110
  };
111
 
112
- var setData = function setData(element, attribute, value) {
113
- return element.setAttribute(dataPrefix + attribute, value);
 
 
 
 
 
 
 
114
  };
115
 
116
- var setWasProcessed = function setWasProcessed(element) {
117
- return setData(element, processedDataName, processedDataValue);
 
 
 
 
 
 
 
 
 
 
 
118
  };
119
 
120
- var getWasProcessed = function getWasProcessed(element) {
121
- return getData(element, processedDataName) === processedDataValue;
 
 
 
 
122
  };
123
 
124
- var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName) {
125
  for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
126
  if (childTag.tagName === "SOURCE") {
127
- var attributeValue = getData(childTag, dataAttrName);
128
- if (attributeValue) {
129
- childTag.setAttribute(attrName, attributeValue);
130
- }
131
  }
132
  }
133
  };
134
 
135
- var setAttributeIfNotNullOrEmpty = function setAttributeIfNotNullOrEmpty(element, attrName, value) {
136
  if (!value) {
137
  return;
138
  }
139
- element.setAttribute(attrName, value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  };
141
 
142
- function setSources(element, settings) {
143
- var sizesDataName = settings.data_sizes,
144
- srcsetDataName = settings.data_srcset,
145
- srcDataName = settings.data_src;
146
 
 
 
 
 
 
147
  var srcDataValue = getData(element, srcDataName);
148
- var tagName = element.tagName;
149
- if (tagName === "IMG") {
150
- var parent = element.parentNode;
151
- if (parent && parent.tagName === "PICTURE") {
152
- setSourcesInChildren(parent, "srcset", srcsetDataName);
153
- }
154
- var sizesDataValue = getData(element, sizesDataName);
155
- setAttributeIfNotNullOrEmpty(element, "sizes", sizesDataValue);
156
- var srcsetDataValue = getData(element, srcsetDataName);
157
- setAttributeIfNotNullOrEmpty(element, "srcset", srcsetDataValue);
158
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
159
- return;
 
 
160
  }
161
- if (tagName === "IFRAME") {
162
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
163
- return;
 
164
  }
165
- if (tagName === "VIDEO") {
166
- setSourcesInChildren(element, "src", srcDataName);
167
- setAttributeIfNotNullOrEmpty(element, "src", srcDataValue);
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  return;
169
  }
170
- if (srcDataValue) {
171
- element.style.backgroundImage = 'url("' + srcDataValue + '")';
 
 
 
 
172
  }
173
- }
174
 
175
- var runningOnBrowser = typeof window !== "undefined";
 
 
176
 
177
- var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
 
 
178
 
179
- var addClass = function addClass(element, className) {
180
- if (supportsClassList) {
181
- element.classList.add(className);
182
- return;
183
- }
184
- element.className += (element.className ? " " : "") + className;
185
  };
186
 
187
- var removeClass = function removeClass(element, className) {
188
- if (supportsClassList) {
189
- element.classList.remove(className);
190
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  }
192
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
193
  };
194
 
195
  /*
@@ -198,6 +338,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
198
 
199
  var LazyLoad = function LazyLoad(instanceSettings) {
200
  this._settings = _extends({}, getDefaultSettings(), instanceSettings);
 
201
  this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
202
 
203
  this._previousLoopTime = 0;
@@ -210,54 +351,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
210
  };
211
 
212
  LazyLoad.prototype = {
213
- _reveal: function _reveal(element, force) {
214
- if (!force && getWasProcessed(element)) {
215
- return; // element has already been processed and force wasn't true
216
- }
217
-
218
- var settings = this._settings;
219
-
220
- var errorCallback = function errorCallback() {
221
- /* As this method is asynchronous, it must be protected against external destroy() calls */
222
- if (!settings) {
223
- return;
224
- }
225
- element.removeEventListener("load", loadCallback);
226
- element.removeEventListener("error", errorCallback);
227
- removeClass(element, settings.class_loading);
228
- addClass(element, settings.class_error);
229
- callCallback(settings.callback_error, element);
230
- };
231
-
232
- var loadCallback = function loadCallback() {
233
- /* As this method is asynchronous, it must be protected against external destroy() calls */
234
- if (!settings) {
235
- return;
236
- }
237
- removeClass(element, settings.class_loading);
238
- addClass(element, settings.class_loaded);
239
- element.removeEventListener("load", loadCallback);
240
- element.removeEventListener("error", errorCallback);
241
- callCallback(settings.callback_load, element);
242
- };
243
-
244
- callCallback(settings.callback_enter, element);
245
- if (["IMG", "IFRAME", "VIDEO"].indexOf(element.tagName) > -1) {
246
- element.addEventListener("load", loadCallback);
247
- element.addEventListener("error", errorCallback);
248
- addClass(element, settings.class_loading);
249
- }
250
- setSources(element, settings);
251
- callCallback(settings.callback_set, element);
252
- },
253
-
254
  _loopThroughElements: function _loopThroughElements(forceDownload) {
255
  var settings = this._settings,
256
  elements = this._elements,
257
  elementsLength = !elements ? 0 : elements.length;
258
  var i = void 0,
259
  processedIndexes = [],
260
- firstLoop = this._isFirstLoop;
 
 
 
 
 
 
 
 
 
261
 
262
  for (i = 0; i < elementsLength; i++) {
263
  var element = elements[i];
@@ -266,49 +375,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
266
  continue;
267
  }
268
 
269
- if (isBot || forceDownload || isInsideViewport(element, settings.container, settings.threshold)) {
270
- if (firstLoop) {
271
  addClass(element, settings.class_initial);
272
  }
273
- /* Start loading the image */
274
  this.load(element);
275
- /* Marking the element as processed. */
276
  processedIndexes.push(i);
277
- setWasProcessed(element);
278
  }
279
  }
280
- /* Removing processed elements from this._elements. */
281
- while (processedIndexes.length) {
282
- elements.splice(processedIndexes.pop(), 1);
283
- callCallback(settings.callback_processed, elements.length);
284
- }
285
- /* Stop listening to scroll event when 0 elements remains */
286
- if (elementsLength === 0) {
287
- this._stopScrollHandler();
288
- }
289
- /* Sets isFirstLoop to false */
290
- if (firstLoop) {
291
- this._isFirstLoop = false;
292
- }
293
- },
294
-
295
- _purgeElements: function _purgeElements() {
296
- var elements = this._elements,
297
- elementsLength = elements.length;
298
- var i = void 0,
299
- elementsToPurge = [];
300
 
301
- for (i = 0; i < elementsLength; i++) {
302
- var element = elements[i];
303
- /* If the element has already been processed, skip it */
304
- if (getWasProcessed(element)) {
305
- elementsToPurge.push(i);
306
- }
307
- }
308
- /* Removing elements to purge from this._elements. */
309
- while (elementsToPurge.length > 0) {
310
- elements.splice(elementsToPurge.pop(), 1);
311
- }
312
  },
313
 
314
  _startScrollHandler: function _startScrollHandler() {
@@ -325,6 +402,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
325
  }
326
  },
327
 
 
 
 
 
 
 
 
328
  handleScroll: function handleScroll() {
329
  var throttle = this._settings.throttle;
330
 
@@ -354,10 +438,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
354
  this._loopThroughElements(true);
355
  },
356
 
357
- update: function update() {
358
- // Converts to array the nodeset obtained querying the DOM from _queryOriginNode with elements_selector
359
- this._elements = Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector));
360
- this._purgeElements();
 
 
 
 
 
 
 
 
361
  this._loopThroughElements();
362
  this._startScrollHandler();
363
  },
@@ -375,14 +467,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
375
  },
376
 
377
  load: function load(element, force) {
378
- this._reveal(element, force);
379
  }
380
  };
381
 
382
- /* Automatic instances creation if required (useful for async script loading!) */
383
- var autoInitOptions = window.lazyLoadOptions;
384
- if (runningOnBrowser && autoInitOptions) {
385
- autoInitialize(LazyLoad, autoInitOptions);
386
  }
387
 
388
  return LazyLoad;
16
  data_src: "src",
17
  data_srcset: "srcset",
18
  data_sizes: "sizes",
19
+ data_bg: "bg",
20
  class_loading: "loading",
21
  class_loaded: "loaded",
22
  class_error: "error",
25
  callback_load: null,
26
  callback_error: null,
27
  callback_set: null,
28
+ callback_enter: null,
29
+ callback_finish: null,
30
+ to_webp: false
31
  };
32
  };
33
 
34
+ var dataPrefix = "data-";
35
+ var processedDataName = "was-processed";
36
+ var processedDataValue = "true";
37
 
38
+ var getData = function getData(element, attribute) {
39
+ return element.getAttribute(dataPrefix + attribute);
40
+ };
41
+
42
+ var setData = function setData(element, attribute, value) {
43
+ var attrName = dataPrefix + attribute;
44
+ if (value === null) {
45
+ element.removeAttribute(attrName);
46
+ return;
47
  }
48
+ element.setAttribute(attrName, value);
49
+ };
50
+
51
+ var setWasProcessedData = function setWasProcessedData(element) {
52
+ return setData(element, processedDataName, processedDataValue);
53
+ };
54
+
55
+ var getWasProcessedData = function getWasProcessedData(element) {
56
+ return getData(element, processedDataName) === processedDataValue;
57
+ };
58
+
59
+ var purgeProcessedElements = function purgeProcessedElements(elements) {
60
+ return elements.filter(function (element) {
61
+ return !getWasProcessedData(element);
62
+ });
63
+ };
64
+
65
+ var purgeOneElement = function purgeOneElement(elements, elementToPurge) {
66
+ return elements.filter(function (element) {
67
+ return element !== elementToPurge;
68
+ });
69
  };
70
 
71
  var getTopOffset = function getTopOffset(element) {
120
  /* Auto initialization of one or more instances of lazyload, depending on the
121
  options passed in (plain object or an array) */
122
  function autoInitialize(classObj, options) {
123
+ if (!options) {
124
+ return;
125
+ }
126
+ if (!options.length) {
127
  // Plain object
128
  createInstance(classObj, options);
129
  } else {
130
  // Array of objects
131
+ for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
132
+ createInstance(classObj, optionsItem);
133
  }
134
  }
135
  }
136
 
137
+ var replaceExtToWebp = function replaceExtToWebp(value, condition) {
138
+ return condition ? value.replace(/\.(jpe?g|png)/gi, ".webp") : value;
 
 
 
 
139
  };
140
 
141
+ var detectWebp = function detectWebp() {
142
+ var webpString = "image/webp";
143
+ var canvas = document.createElement("canvas");
144
+
145
+ if (canvas.getContext && canvas.getContext("2d")) {
146
+ return canvas.toDataURL(webpString).indexOf('data:' + webpString) === 0;
147
+ }
148
+
149
+ return false;
150
  };
151
 
152
+ var runningOnBrowser = typeof window !== "undefined";
153
+
154
+ var isBot = runningOnBrowser && !("onscroll" in window) || /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);
155
+ var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
156
+
157
+ var supportsWebp = runningOnBrowser && detectWebp();
158
+
159
+ var addClass = function addClass(element, className) {
160
+ if (supportsClassList) {
161
+ element.classList.add(className);
162
+ return;
163
+ }
164
+ element.className += (element.className ? " " : "") + className;
165
  };
166
 
167
+ var removeClass = function removeClass(element, className) {
168
+ if (supportsClassList) {
169
+ element.classList.remove(className);
170
+ return;
171
+ }
172
+ element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
173
  };
174
 
175
+ var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName, toWebpFlag) {
176
  for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
177
  if (childTag.tagName === "SOURCE") {
178
+ var attrValue = getData(childTag, dataAttrName);
179
+ setAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);
 
 
180
  }
181
  }
182
  };
183
 
184
+ var setAttributeIfValue = function setAttributeIfValue(element, attrName, value, toWebpFlag) {
185
  if (!value) {
186
  return;
187
  }
188
+ element.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));
189
+ };
190
+
191
+ var setSourcesImg = function setSourcesImg(element, settings) {
192
+ var toWebpFlag = supportsWebp && settings.to_webp;
193
+ var srcsetDataName = settings.data_srcset;
194
+ var parent = element.parentNode;
195
+
196
+ if (parent && parent.tagName === "PICTURE") {
197
+ setSourcesInChildren(parent, "srcset", srcsetDataName, toWebpFlag);
198
+ }
199
+ var sizesDataValue = getData(element, settings.data_sizes);
200
+ setAttributeIfValue(element, "sizes", sizesDataValue);
201
+ var srcsetDataValue = getData(element, srcsetDataName);
202
+ setAttributeIfValue(element, "srcset", srcsetDataValue, toWebpFlag);
203
+ var srcDataValue = getData(element, settings.data_src);
204
+ setAttributeIfValue(element, "src", srcDataValue, toWebpFlag);
205
  };
206
 
207
+ var setSourcesIframe = function setSourcesIframe(element, settings) {
208
+ var srcDataValue = getData(element, settings.data_src);
 
 
209
 
210
+ setAttributeIfValue(element, "src", srcDataValue);
211
+ };
212
+
213
+ var setSourcesVideo = function setSourcesVideo(element, settings) {
214
+ var srcDataName = settings.data_src;
215
  var srcDataValue = getData(element, srcDataName);
216
+
217
+ setSourcesInChildren(element, "src", srcDataName);
218
+ setAttributeIfValue(element, "src", srcDataValue);
219
+ element.load();
220
+ };
221
+
222
+ var setSourcesBgImage = function setSourcesBgImage(element, settings) {
223
+ var toWebpFlag = supportsWebp && settings.to_webp;
224
+ var srcDataValue = getData(element, settings.data_src);
225
+ var bgDataValue = getData(element, settings.data_bg);
226
+
227
+ if (srcDataValue) {
228
+ var setValue = replaceExtToWebp(srcDataValue, toWebpFlag);
229
+ element.style.backgroundImage = 'url("' + setValue + '")';
230
  }
231
+
232
+ if (bgDataValue) {
233
+ var _setValue = replaceExtToWebp(bgDataValue, toWebpFlag);
234
+ element.style.backgroundImage = _setValue;
235
  }
236
+ };
237
+
238
+ var setSourcesFunctions = {
239
+ IMG: setSourcesImg,
240
+ IFRAME: setSourcesIframe,
241
+ VIDEO: setSourcesVideo
242
+ };
243
+
244
+ var setSources = function setSources(element, instance) {
245
+ var settings = instance._settings;
246
+ var tagName = element.tagName;
247
+ var setSourcesFunction = setSourcesFunctions[tagName];
248
+ if (setSourcesFunction) {
249
+ setSourcesFunction(element, settings);
250
+ instance._updateLoadingCount(1);
251
+ instance._elements = purgeOneElement(instance._elements, element);
252
  return;
253
  }
254
+ setSourcesBgImage(element, settings);
255
+ };
256
+
257
+ var callbackIfSet = function callbackIfSet(callback, argument) {
258
+ if (callback) {
259
+ callback(argument);
260
  }
261
+ };
262
 
263
+ var genericLoadEventName = "load";
264
+ var mediaLoadEventName = "loadeddata";
265
+ var errorEventName = "error";
266
 
267
+ var addEventListener = function addEventListener(element, eventName, handler) {
268
+ element.addEventListener(eventName, handler);
269
+ };
270
 
271
+ var removeEventListener = function removeEventListener(element, eventName, handler) {
272
+ element.removeEventListener(eventName, handler);
 
 
 
 
273
  };
274
 
275
+ var addAllEventListeners = function addAllEventListeners(element, loadHandler, errorHandler) {
276
+ addEventListener(element, genericLoadEventName, loadHandler);
277
+ addEventListener(element, mediaLoadEventName, loadHandler);
278
+ addEventListener(element, errorEventName, errorHandler);
279
+ };
280
+
281
+ var removeAllEventListeners = function removeAllEventListeners(element, loadHandler, errorHandler) {
282
+ removeEventListener(element, genericLoadEventName, loadHandler);
283
+ removeEventListener(element, mediaLoadEventName, loadHandler);
284
+ removeEventListener(element, errorEventName, errorHandler);
285
+ };
286
+
287
+ var eventHandler = function eventHandler(event, success, instance) {
288
+ var settings = instance._settings;
289
+ var className = success ? settings.class_loaded : settings.class_error;
290
+ var callback = success ? settings.callback_load : settings.callback_error;
291
+ var element = event.target;
292
+
293
+ removeClass(element, settings.class_loading);
294
+ addClass(element, className);
295
+ callbackIfSet(callback, element);
296
+
297
+ instance._updateLoadingCount(-1);
298
+ };
299
+
300
+ var addOneShotEventListeners = function addOneShotEventListeners(element, instance) {
301
+ var loadHandler = function loadHandler(event) {
302
+ eventHandler(event, true, instance);
303
+ removeAllEventListeners(element, loadHandler, errorHandler);
304
+ };
305
+ var errorHandler = function errorHandler(event) {
306
+ eventHandler(event, false, instance);
307
+ removeAllEventListeners(element, loadHandler, errorHandler);
308
+ };
309
+ addAllEventListeners(element, loadHandler, errorHandler);
310
+ };
311
+
312
+ var managedTags = ["IMG", "IFRAME", "VIDEO"];
313
+
314
+ function revealElement(element, instance, force) {
315
+ var settings = instance._settings;
316
+ if (!force && getWasProcessedData(element)) {
317
+ return; // element has already been processed and force wasn't true
318
+ }
319
+ callbackIfSet(settings.callback_enter, element);
320
+ if (managedTags.indexOf(element.tagName) > -1) {
321
+ addOneShotEventListeners(element, instance);
322
+ addClass(element, settings.class_loading);
323
+ }
324
+ setSources(element, instance);
325
+ setWasProcessedData(element);
326
+ callbackIfSet(settings.callback_set, element);
327
+ }
328
+
329
+ var removeFromArray = function removeFromArray(elements, indexes) {
330
+ while (indexes.length) {
331
+ elements.splice(indexes.pop(), 1);
332
  }
 
333
  };
334
 
335
  /*
338
 
339
  var LazyLoad = function LazyLoad(instanceSettings) {
340
  this._settings = _extends({}, getDefaultSettings(), instanceSettings);
341
+ this._loadingCount = 0;
342
  this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
343
 
344
  this._previousLoopTime = 0;
351
  };
352
 
353
  LazyLoad.prototype = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  _loopThroughElements: function _loopThroughElements(forceDownload) {
355
  var settings = this._settings,
356
  elements = this._elements,
357
  elementsLength = !elements ? 0 : elements.length;
358
  var i = void 0,
359
  processedIndexes = [],
360
+ isFirstLoop = this._isFirstLoop;
361
+
362
+ if (isFirstLoop) {
363
+ this._isFirstLoop = false;
364
+ }
365
+
366
+ if (elementsLength === 0) {
367
+ this._stopScrollHandler();
368
+ return;
369
+ }
370
 
371
  for (i = 0; i < elementsLength; i++) {
372
  var element = elements[i];
375
  continue;
376
  }
377
 
378
+ if (forceDownload || isInsideViewport(element, settings.container, settings.threshold)) {
379
+ if (isFirstLoop) {
380
  addClass(element, settings.class_initial);
381
  }
 
382
  this.load(element);
 
383
  processedIndexes.push(i);
 
384
  }
385
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
 
387
+ // Removing processed elements from this._elements.
388
+ removeFromArray(elements, processedIndexes);
 
 
 
 
 
 
 
 
 
389
  },
390
 
391
  _startScrollHandler: function _startScrollHandler() {
402
  }
403
  },
404
 
405
+ _updateLoadingCount: function _updateLoadingCount(plusMinus) {
406
+ this._loadingCount += plusMinus;
407
+ if (this._elements.length === 0 && this._loadingCount === 0) {
408
+ callbackIfSet(this._settings.callback_finish);
409
+ }
410
+ },
411
+
412
  handleScroll: function handleScroll() {
413
  var throttle = this._settings.throttle;
414
 
438
  this._loopThroughElements(true);
439
  },
440
 
441
+ update: function update(elements) {
442
+ var settings = this._settings;
443
+ var nodeSet = elements || this._queryOriginNode.querySelectorAll(settings.elements_selector);
444
+
445
+ this._elements = purgeProcessedElements(Array.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility
446
+ );
447
+
448
+ if (isBot) {
449
+ this.loadAll();
450
+ return;
451
+ }
452
+
453
  this._loopThroughElements();
454
  this._startScrollHandler();
455
  },
467
  },
468
 
469
  load: function load(element, force) {
470
+ revealElement(element, this, force);
471
  }
472
  };
473
 
474
+ /* Automatic instances creation if required (useful for async script loading) */
475
+ if (runningOnBrowser) {
476
+ autoInitialize(LazyLoad, window.lazyLoadOptions);
 
477
  }
478
 
479
  return LazyLoad;
assets/js/lazyload-8.17.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";function t(t,e,n){return!(u(t,e,n)||_(t,e,n)||f(t,e,n)||h(t,e,n))}function e(t,e,n){var o=e._settings;!n&&r(t)||(C(o.callback_enter,t),R.indexOf(t.tagName)>-1&&(x(t,e),y(t,o.class_loading)),H(t,e),s(t),C(o.callback_set,t))}var n=function(){return{elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1}},o=function(t,e){return t.getAttribute("data-"+e)},i=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},s=function(t){return i(t,"was-processed","true")},r=function(t){return"true"===o(t,"was-processed")},l=function(t){return t.filter(function(t){return!r(t)})},a=function(t,e){return t.filter(function(t){return t!==e})},c=function(t){return t.getBoundingClientRect().top+window.pageYOffset-t.ownerDocument.documentElement.clientTop},u=function(t,e,n){return(e===window?window.innerHeight+window.pageYOffset:c(e)+e.offsetHeight)<=c(t)-n},d=function(t){return t.getBoundingClientRect().left+window.pageXOffset-t.ownerDocument.documentElement.clientLeft},f=function(t,e,n){var o=window.innerWidth;return(e===window?o+window.pageXOffset:d(e)+o)<=d(t)-n},_=function(t,e,n){return(e===window?window.pageYOffset:c(e))>=c(t)+n+t.offsetHeight},h=function(t,e,n){return(e===window?window.pageXOffset:d(e))>=d(t)+n+t.offsetWidth},p=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},g=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},m="undefined"!=typeof window,w=m&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),v=m&&"classList"in document.createElement("p"),b=m&&function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))&&0===t.toDataURL("image/webp").indexOf("data:image/webp")}(),y=function(t,e){v?t.classList.add(e):t.className+=(t.className?" ":"")+e},E=function(t,e){v?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},L=function(t,e,n,i){for(var s,r=0;s=t.children[r];r+=1)if("SOURCE"===s.tagName){var l=o(s,n);T(s,e,l,i)}},T=function(t,e,n,o){n&&t.setAttribute(e,g(n,o))},S=function(t,e){var n=b&&e.to_webp,i=o(t,e.data_src),s=o(t,e.data_bg);if(i){var r=g(i,n);t.style.backgroundImage='url("'+r+'")'}if(s){var l=g(s,n);t.style.backgroundImage=l}},O={IMG:function(t,e){var n=b&&e.to_webp,i=e.data_srcset,s=t.parentNode;s&&"PICTURE"===s.tagName&&L(s,"srcset",i,n);var r=o(t,e.data_sizes);T(t,"sizes",r);var l=o(t,i);T(t,"srcset",l,n);var a=o(t,e.data_src);T(t,"src",a,n)},IFRAME:function(t,e){var n=o(t,e.data_src);T(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,i=o(t,n);L(t,"src",n),T(t,"src",i),t.load()}},H=function(t,e){var n=e._settings,o=t.tagName,i=O[o];if(i)return i(t,n),e._updateLoadingCount(1),void(e._elements=a(e._elements,t));S(t,n)},C=function(t,e){t&&t(e)},k=function(t,e,n){t.addEventListener(e,n)},z=function(t,e,n){t.removeEventListener(e,n)},N=function(t,e,n){k(t,"load",e),k(t,"loadeddata",e),k(t,"error",n)},A=function(t,e,n){z(t,"load",e),z(t,"loadeddata",e),z(t,"error",n)},I=function(t,e,n){var o=n._settings,i=e?o.class_loaded:o.class_error,s=e?o.callback_load:o.callback_error,r=t.target;E(r,o.class_loading),y(r,i),C(s,r),n._updateLoadingCount(-1)},x=function(t,e){var n=function n(i){I(i,!0,e),A(t,n,o)},o=function o(i){I(i,!1,e),A(t,n,o)};N(t,n,o)},R=["IMG","IFRAME","VIDEO"],D=function(t,e){for(;e.length;)t.splice(e.pop(),1)},F=function(t){this._settings=_extends({},n(),t),this._loadingCount=0,this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};return F.prototype={_loopThroughElements:function(e){var n=this._settings,o=this._elements,i=o?o.length:0,s=void 0,r=[],l=this._isFirstLoop;if(l&&(this._isFirstLoop=!1),0!==i){for(s=0;s<i;s++){var a=o[s];n.skip_invisible&&null===a.offsetParent||(e||t(a,n.container,n.threshold))&&(l&&y(a,n.class_initial),this.load(a),r.push(s))}D(o,r)}else this._stopScrollHandler()},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&C(this._settings.callback_finish)},handleScroll:function(){var t=this._settings.throttle;if(0!==t){var e=Date.now(),n=t-(e-this._previousLoopTime);n<=0||n>t?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=e,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},loadAll:function(){this._loopThroughElements(!0)},update:function(t){var e=this._settings,n=t||this._queryOriginNode.querySelectorAll(e.elements_selector);this._elements=l(Array.prototype.slice.call(n)),w?this.loadAll():(this._loopThroughElements(),this._startScrollHandler())},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null},load:function(t,n){e(t,this,n)}},m&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)p(t,n);else p(t,e)}(F,window.lazyLoadOptions),F});
2
+ //# sourceMappingURL=lazyload-8.17.min.js.map
assets/js/lazyload-8.17.min.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["lazyload.js"],"names":["global","factory","exports","_typeof","module","define","amd","LazyLoad","this","createInstance","element","classObj","isBelowViewport","eventString","container","threshold","isAboveViewport","isAtRightOfViewport","isAtLeftOfViewport","instanceSettings","settings","instance","_settings","force","_loadingCount","callbackIfSet","_previousLoopTime","callback_enter","managedTags","_loopTimeout","tagName","addOneShotEventListeners","handleScroll","addClass","class_loading","window","addEventListener","setWasProcessedData","callback_set","getDefaultSettings","elements_selector","throttle","data_src","data_srcset","data_sizes","data_bg","class_loaded","class_error","class_initial","skip_invisible","callback_load","callback_error","getData","attribute","dataPrefix","callback_finish","setData","value","attrName","removeAttribute","getWasProcessedData","purgeProcessedElements","processedDataName","elements","filter","purgeOneElement","elementToPurge","getTopOffset","getBoundingClientRect","top","pageYOffset","ownerDocument","documentElement","clientTop","fold","left","pageXOffset","getLeftOffset","documentWidth","innerWidth","offsetWidth","event","initCustomEvent","options","CustomEvent","dispatchEvent","detail","autoInitialize","document","createEvent","replaceExtToWebp","condition","replace","className","isBot","test","navigator","userAgent","supportsClassList","runningOnBrowser","removeClass","remove","getContext","createElement","detectWebp","classList","add","childTag","parentTag","children","setAttributeIfValue","RegExp","setSourcesInChildren","dataAttrName","toWebpFlag","parent","i","attrValue","setSourcesVideo","setSourcesFunction","setSourcesFunctions","to_webp","_updateLoadingCount","srcDataValue","setValue","setSourcesBgImage","callback","bgDataValue","argument","genericLoadEventName","IMG","srcDataName","parentNode","srcsetDataValue","srcsetDataName","backgroundImage","IFRAME","VIDEO","setSourcesImg","setSourcesIframe","setSources","removeEventListener","addAllEventListeners","_elements","loadHandler","eventName","handler","eventHandler","success","removeAllEventListeners","errorHandler","revealElement","length","splice","indexes","pop","_loopThroughElements","_extends","elementsLength","_queryOriginNode","_boundHandleScroll","offsetParent","_isFirstLoop","update","prototype","forceDownload","processedIndexes","push","removeFromArray","isFirstLoop","_startScrollHandler","_isHandlingScroll","remainingTime","_stopScrollHandler","loadAll","plusMinus","destroy","Date","now","clearTimeout","setTimeout","load","bind","nodeSet","querySelectorAll","Array","slice","call","optionsItem","webpString","lazyLoadOptions"],"mappings":"kYAAC,SAAUA,EAAQC,GACC,YAAnB,oBAAOC,QAAP,YAAAC,QAAOD,WAA0C,oBAAXE,OAAyBA,OAAOF,QAAUD,IAC9D,mBAAXI,QAAyBA,OAAOC,IAAMD,OAAOJ,GACnDD,EAAOO,SAAWN,IAHnB,CAAAO,KAAA,WAAkBP,aAkHnB,SAAMQ,EAAiBC,EAAjBD,EAA0BE,GAC/B,QACAC,EAAIC,EAAcC,EAAAC,IAClBC,EAAeN,EAAIC,EAAnBI,IACAE,EAAIP,EAAAI,EAAAC,IACHG,EAAAR,EAAAI,EAAAC,IAoPF,SAAMR,EAAWG,EAAXH,EAAoBY,GACzB,IAAAC,EAAAC,EAAiBC,WACjBC,GAAKC,EAALd,KAMAe,EAAKC,EAALC,eAAAjB,GACAkB,EAAKC,QAAenB,EAApBoB,UAAA,IACAC,EAAArB,EAA+BsB,GA3B9BC,EAASvB,EAASU,EAASc,gBA8B5BC,EAAOC,EAAAA,GACPC,EAAA3B,GACAe,EAfDL,EAAAkB,aAAA5B,IAvWC,IAAC6B,EAAmB,WAAA,OAAEC,kBAAA,MAItB1B,UAAWqB,OAFZpB,UAAIwB,IAAqBE,SAAO,IAC/BD,SAAAA,MACA1B,YAAWqB,SACXpB,WAAAA,QACA0B,QAAAA,KACAC,cAAU,UACVC,aAAAA,SACAC,YAAAA,QACAC,cAR+B,UAS/BX,gBAAAA,EACAY,cAAAA,KACAC,eAAa,KACbC,aAAAA,KACAC,eAAAA,KACAC,gBAAe,KACfC,SAAAA,IAWKC,EAAU,SAAC1C,EAAS2C,GAJ1B,OAAMC,EAAAA,aAJLC,QAIDF,IAQMG,EAAU,SAAC9C,EAAS2C,EAAWI,GAJrC,IAAML,EARLG,QAQKH,EACE1C,OAAP+C,EAIA/C,EAAIgD,aAAWJ,EAAaD,GAL7B3C,EAAAiD,gBAAAD,IAQErB,EAAA,SAAA3B,GAAA,OACA8C,EAAA9C,EAhBQ,gBAnBe,SA8BzBkD,EAAA,SAAAlD,GAAA,MA9ByB,SA2CxB0C,EAAQ1C,EAxBC,kBAoBkBmD,EACVC,SAAAA,GADU,OAA5BC,EAAAC,OAAA,SAAAtD,GAAA,OAAAkD,EAAAlD,MAG4BuD,EAC3B,SAAAF,EAAiBD,GADU,OAA5BC,EAAAC,OAAA,SAAAtD,GAAA,OAAAA,IAAAwD,KAICC,EAAgBH,SAAOtD,GAAA,OAAAA,EAAvB0D,wBAAAC,IADDlC,OAAAmC,YAYE5D,EAAQ6D,cAAcC,gBAAgBC,WAPvC7D,EAAA,SAAAF,EAAAI,EAAAC,GASA,OAICD,IAAcqB,OAVVgC,OAAAA,YAAehC,OAAfgC,YACLA,EACSC,GAAAA,EAAwBC,eAFlCF,EAAAzD,GAAAK,GASO2D,EACL5D,SAAcqB,GAGf,OALDzB,EAAA0D,wBAAAO,KAWExC,OAAOyC,YAHTlE,EAAMmE,cAAgBL,gBAAhBK,YAQA5D,EAAsB,SAAtBA,EAAAA,EAA+BP,GACpC,IAAMoE,EAAgB3C,OAAO4C,WAQ9B,OAHCjE,IAAO4D,OANRI,EAAA3C,OAAAyC,YAKKC,EAAc/D,GAAagE,IAI1B9D,EAAkBN,GAAlBM,GAANA,EAAA,SAAAN,EAAAI,EAAAC,GAOC,OADDD,IAAMI,OAAAA,OAAqBoD,YAArBpD,EAA8BR,KAElCI,EAAcqB,GAASA,EAAOyC,EAAcC,cAFxC3D,EAAqB,SAASR,EAASI,EAAWC,GAavD,OANAD,IACEF,OAAAA,OAAgBF,YAAoBK,EACrCD,KAID+D,EAAAnE,GAAAK,EAAAL,EAAAsE,aAaCC,EAAMC,SAAgBrE,EAAasE,GACnC,IAAAF,EAXF5D,EAAA,IAAAV,EAAAwE,GAIC,IAECF,EAAQ,IAAIG,YAMNC,yBANiCC,QAAUjE,SAAAA,KAWnD,MAASkE,IAEPN,EAAAO,SAAAC,YAAA,gBACAP,gBARMG,yBAQN,GAAA,GAAAhE,SAAAA,IAEAc,OAAAkD,cAAAJ,IAmBAS,EAAA,SAAAjC,EAAAkC,GAAA,OARDA,EAAYlC,EAAMmC,QAAQ,kBAAmB,SAAWnC,GAyBvD/C,EAAA,oBAAsBmF,OAEtBC,EACDpF,KAAsBA,aAAQmF,SAC9B,gCANDE,KAAAC,UAAAC,WALMC,EAaNC,GAAoB,cAAdC,SAAe1F,cAAD,KAElBA,EAAkB2F,GA/BpB,WACC,IAUKF,EAAAA,SAAAA,cAAmB,UAEzB,SAAML,EAAAA,aACJK,EAAoBG,WAAE,QAGqBC,IADvCL,EAAAA,UAfY,cAgBjBC,QADKD,mBAeJM,GAEAvE,EAAA,SAAAvB,EAAAmF,GACDnF,EALDA,EAAA+F,UAAAC,IAAAb,GAiBCnF,EAAKmF,YAAWc,EAAWA,UAAWC,IAAUC,IAAAA,GAG9CC,EAAAA,SAAAA,EAAoBH,GACpBT,EACDxF,EAAA+F,UAAAJ,OAAAR,GAGFnF,EAAMoG,UAAAA,EAAsBjB,UAM3BD,QAAKnC,IAAOsD,OAAA,WAAAlB,EAAA,YAAA,KACXD,QAAA,OAAA,IACAA,QAAA,OAAA,KAtBIoB,EAAuB,SA0B7BJ,EACClD,EACAuD,EACAC,GAEA,IAAIC,IAAUA,EAAVA,EAAAA,EAAiBrF,EAAY8E,EAAWC,SAAAO,GAAAA,GAAA,EAC3CJ,GAAqBG,WAArBH,EAAAA,QAA6B,CAC7B,IAAAK,EAAAjE,EAAAuD,EAAAM,GACDH,EAAuB1D,EAAQ1C,EAASU,EAASwB,KAKjDkE,EAAoBpG,SACpBA,EAxBAgD,EA0BDD,EACCyD,GAEAJ,GAGDpG,EAAM4G,aAAAA,EAAAA,EAAmB5G,EAADwG,KAkCjBK,EAAAA,SAAqBC,EAAAA,GAC3B,IAAID,EAAAA,GAAoBnG,EAAAqG,QACvBF,EAAmB7G,EAAnBA,EAAAU,EAAAsB,UACArB,EAASqG,EAAAA,EAATtG,EAAAyB,SAEA,GAAA8E,EAAA,CACA,IAAAC,EAAAlC,EAAAiC,EAAAT,GACDW,EAAAA,MAAAA,gBAAAA,QAAAD,EAAAC,KAGD,GAAMpG,EAAAA,CACL,IAAIqG,EAAUpC,EAAAqC,EAAAb,GACbY,EAAAA,MAASE,gBAATJ,IAIIK,GACNC,IAzEsB,SAACxH,EAASU,GA0B/B4F,IAAAA,EAAAA,GAA8B5F,EAAO+G,QACrCrB,EAAoBpG,EAASiC,YAC7BjC,EAAAA,EAAA0H,WAvBIjB,GAA6B,YAAnBA,EAAOrF,SA0BtBkF,EAAMa,EAAoB,SAApBA,EAAqBnH,GAE1B,IAAMiH,EAAevE,EAAQ1C,EAASU,EAASsB,YAC/CoE,EAAoB1D,EAAQ1C,QAASU,GAxBrC,IAAMiH,EAAkBjF,EAAQ1C,EAAS4H,GA0BzCxB,EAAkBpG,EAAA,SAAA2H,EAAAnB,GACjB,IAAIU,EAAWlC,EAAAA,EAAiBiC,EAAjBjF,UACfhC,EAAc6H,EAAAA,MAAdZ,EAAwCC,IAoC1CY,OAjCkB,SAAA9H,EAAAU,GAChB,IAAIwG,EAAWlC,EAAAA,EAAiBqC,EAAjBrF,UAEfoE,EAAApG,EAAA,MAAAiH,IAMDc,MAHKjB,SAAAA,EAAsBpG,GAC3B8G,IAAKQ,EADsBtH,EAAAsB,SAE3B8F,EAAQG,EAFmBjI,EAAAyH,GAAAnB,EAA5BtG,EAAA,MAAAyH,GApBCrB,EAAoBpG,EAAS,MAAOiH,GA0BrCjH,EAAMkI,SAuBNA,EAAA,SAAAlI,EAAAW,GAtBC,IAAMD,EAAWC,EAASC,UA0BrBuH,EAAAA,EAAAA,QACLnI,EAAQmI,EAAR/G,GACA,GAFDyF,EAMCnF,OA5BCmF,EAAmB7G,EAASU,GA0B9BC,EAAMyH,oBAAuB,QAC5B1G,EAAAA,UAAiB1B,EAASuH,EAA1Bc,UAAgDC,IAGhDnB,EAJDnH,EAAAU,IAOCyH,EAAoBnI,SAASuH,EAAAA,GAC7BY,GACAA,EAAAA,IAjBKzG,EAAmB,SAAC1B,EAASuI,EAAWC,GA0B7C9C,EAAAA,iBAAqBhF,EAASc,IAtBzB2G,EAAsB,SAACnI,EAASuI,EAAWC,GA0BhD7H,EAAAA,oBAASqG,EAATwB,IAGKnH,EAAAA,SAAAA,EAA2BiH,EAA3BjH,GACLK,EAAM4G,EAbkB1H,OAaK0H,GAC5BG,EAAalE,EAbImE,aAajBJ,GACAK,EAAAA,EAbgBD,QAaiBJ,IAGjCG,EAA2B9H,SAAAA,EAA3B2H,EAAAM,GACAD,EAAAA,EAnBuB/H,OAmBuBgI,GAC9CT,EAHDnI,EAhBkB0I,aAgBlBJ,GAIAF,EAAAA,EAnBiBM,QAmB0BE,IAGtC1H,EAAe,SAAOqD,EAAUmE,EAAtC/H,GAxBC,IAAID,EAAWC,EAASC,UA0BzBuE,EAAS0D,EAAc7I,EAASW,aAAiBD,EAAA2B,YAC5C3B,EAAWC,EAASC,EAAxB4B,cAAA9B,EAAA+B,eACK5B,EAASqC,EAAAA,OAEbwC,EAAA1F,EAAAU,EAAAc,eACDT,EAAAA,EAAcL,GACdK,EAAIG,EAAAlB,GAEHuB,EAAAA,qBAA2BC,IAG5BG,EAAA,SAAA3B,EAAAW,GACAI,IAAAA,EAAcL,SAAdK,EAAcL,GACd+H,EAAAlE,GAAA,EAAA5D,GAxBCgI,EAAwB3I,EAASsI,EAAaM,IA2B/CA,EAAeE,SAAfF,EAAeE,GACdzF,EAAS0F,GAAOC,EAAQC,GACxBN,EAAA3I,EAAAsI,EAAAM,IAvBDR,EAAqBpI,EAASsI,EAAaM,IAGtC1H,GAAe,MAAO,SAAU,SA6CrCgI,EAAsB,SAAA7F,EAAA2F,GACrB,KAAMtI,EAAAA,QAAN2C,EACCA,OAAW2F,EAAKX,MADjB,IASCxI,EAAA,SAAAY,GA3BFX,KAAKc,UAAYuI,YAAkBtH,IAAsBpB,GA6BxDX,KAAAgB,cAAIsI,EACHtJ,KAAAuJ,iBACAvJ,KAAAc,UAAAR,YAAAqB,OACAqD,SA3BEhF,KAAKc,UAAUR,UA8BjBN,KAAAkB,kBAAcqC,EACdvD,KAAAqB,aAAA,KACArB,KAAAwJ,mBAAa/G,KAATjB,aAAmCiI,KAAAA,MAEtCzJ,KAAA0J,cAAA,EA3BH/H,OAAOC,iBAAiB,SAAU5B,KAAKwJ,oBA6BrCxJ,KAAA2J,UAwHH,OA9GK5J,EAAA6J,WACDR,qBAAA,SAAAS,GACAC,IAAAA,EAAAA,KAAiBC,UACjBxG,EAAAvD,KAAAuI,UACDe,EAAA/F,EAAAA,EAAAyF,OAAA,EAlCGpC,OAAAA,EAoCJkD,KACAE,EAAAA,KAAgBzG,aAMf,GAvCG0G,IAoCLC,KAAAA,cAAqB,GAGJ5J,IAAfgJ,EAAA,CAQD,IAAI1C,EAAA,EAAKuD,EAAAA,EAAmBvD,IAAA,CAC3B,IAAA1G,EAAKiK,EAALvD,GAKAhG,EAAA6B,gBAAA,OAAAvC,EAAAuJ,eAKDI,GACC5I,EACAf,EArEkBU,EAAAN,UA8BhBM,EAASL,cAGN0J,GA0CNxI,EAAIQ,EAAgBrB,EAAA4B,eAEnBxC,KAAIoK,KAAAA,GACJN,EAAIM,KAAAxD,IAKHoD,EAAK9I,EAAL4I,QA/BD9J,KAAAqK,sBAkCCH,oBAAA,WAEElK,KAAKkB,oBACLlB,KAAAmK,mBAAoB,EACpBnK,KAAAc,UAAKsI,UAAAA,iBACL,SAGFpJ,KAAAwJ,sBAvCHa,mBAAoB,WA6CpBC,KAASH,oBACRnK,KAAKoJ,mBAAL,EArGmBpJ,KAAAc,UAAAR,UAAA+H,oBA2DjB,SA6CHsB,KAAAA,sBAMkBzC,oBAAjB,SAAAqD,GA5CAvK,KAAKgB,eAAiBuJ,EAgDX,IAAXvK,KAAIsF,UAAO0D,QAAA,IAAAhJ,KAAAgB,eACVC,EAAAjB,KAAAc,UAAAiC,kBAIDvB,aAAK4H,WACL,IAAKc,EAAAA,KAAAA,UAALjI,SA7CA,GAAiB,IAAbA,EAAgB,CAgDrBuI,IAAAA,EAASC,KAAAC,MACR/I,EAAO0G,GAAoBqC,EAAU1K,KAAKwJ,mBACtCY,GAAJ,GAAuBA,EAAAnI,GACtB0I,KAAAA,eACAA,aAAKtJ,KAALA,cACArB,KAAAqB,aAAA,MAEDrB,KAAKuI,kBAALmC,EACA1K,KAAKuJ,wBACAzI,KAAYO,eApIErB,KAAAqB,aAAAuJ,WAuFhB,WAgDJC,KAAM3J,kBAAkBH,KAAlB2J,MACL3B,KAAAA,aAAuB,KACvB/I,KAAAoJ,wBAzIF0B,KAAA9K,MA4FKoK,SAmDJpK,KAAAoJ,wBA3CAkB,QAAS,WACRtK,KAAKoJ,sBAAqB,IAG3BO,OAAQ,SAASpG,GAChB,IAAM3C,EAAWZ,KAAKc,UAChBiK,EACLxH,GACAvD,KAAKuJ,iBAAiByB,iBAAiBpK,EAASoB,mBAEjDhC,KAAKuI,UAAYlF,EAChB4H,MAAMrB,UAAUsB,MAAMC,KAAKJ,IAGxBzF,EACHtF,KAAKsK,WAINtK,KAAKoJ,uBACLpJ,KAAKkK,wBAGNM,QAAS,WACR7I,OAAO0G,oBAAoB,SAAUrI,KAAKwJ,oBACtCxJ,KAAKqB,eACRsJ,aAAa3K,KAAKqB,cAClBrB,KAAKqB,aAAe,MAErBrB,KAAKqK,qBACLrK,KAAKuI,UAAY,KACjBvI,KAAKuJ,iBAAmB,KACxBvJ,KAAKc,UAAY,MAGlB+J,KAAM,SAAS3K,EAASa,GACvBgI,EAAc7I,EAASF,KAAMe,KAK3B4E,GA5XD1F,SAAeE,EAAUiL,GACzB,GAAAzG,EAPF,GAAKA,EAAQqE,OAcd,IAAMhD,IAAaoF,EAAbpF,EAAAA,EAAAA,EAAmBrB,EAAAiC,GAAAA,GAAA,EACxB3G,EAAIoL,EAAaD,QAJOnL,EACxBkF,EAAkBC,GAuXlBL,CAAehF,EAAU4B,OAAO2J,iBAG1BvL","file":"lazyload.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.LazyLoad = factory());\n}(this, (function () { 'use strict';\n\nvar getDefaultSettings = () => ({\n\telements_selector: \"img\",\n\tcontainer: window,\n\tthreshold: 300,\n\tthrottle: 150,\n\tdata_src: \"src\",\n\tdata_srcset: \"srcset\",\n\tdata_sizes: \"sizes\",\n\tdata_bg: \"bg\",\n\tclass_loading: \"loading\",\n\tclass_loaded: \"loaded\",\n\tclass_error: \"error\",\n\tclass_initial: \"initial\",\n\tskip_invisible: true,\n\tcallback_load: null,\n\tcallback_error: null,\n\tcallback_set: null,\n\tcallback_enter: null,\n\tcallback_finish: null,\n\tto_webp: false\n});\n\nconst dataPrefix = \"data-\";\nconst processedDataName = \"was-processed\";\nconst processedDataValue = \"true\";\n\nconst getData = (element, attribute) => {\n\treturn element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n\tvar attrName = dataPrefix + attribute;\n\tif (value === null) {\n\t\telement.removeAttribute(attrName);\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, value);\n};\n\nconst setWasProcessedData = element =>\n\tsetData(element, processedDataName, processedDataValue);\n\nconst getWasProcessedData = element =>\n\tgetData(element, processedDataName) === processedDataValue;\n\nconst purgeProcessedElements = elements => {\n\treturn elements.filter(element => !getWasProcessedData(element));\n};\n\nconst purgeOneElement = (elements, elementToPurge) => {\n\treturn elements.filter(element => element !== elementToPurge);\n};\n\nconst getTopOffset = function(element) {\n\treturn (\n\t\telement.getBoundingClientRect().top +\n\t\twindow.pageYOffset -\n\t\telement.ownerDocument.documentElement.clientTop\n\t);\n};\n\nconst isBelowViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window\n\t\t\t? window.innerHeight + window.pageYOffset\n\t\t\t: getTopOffset(container) + container.offsetHeight;\n\treturn fold <= getTopOffset(element) - threshold;\n};\n\nconst getLeftOffset = function(element) {\n\treturn (\n\t\telement.getBoundingClientRect().left +\n\t\twindow.pageXOffset -\n\t\telement.ownerDocument.documentElement.clientLeft\n\t);\n};\n\nconst isAtRightOfViewport = function(element, container, threshold) {\n\tconst documentWidth = window.innerWidth;\n\tconst fold =\n\t\tcontainer === window\n\t\t\t? documentWidth + window.pageXOffset\n\t\t\t: getLeftOffset(container) + documentWidth;\n\treturn fold <= getLeftOffset(element) - threshold;\n};\n\nconst isAboveViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window ? window.pageYOffset : getTopOffset(container);\n\treturn fold >= getTopOffset(element) + threshold + element.offsetHeight;\n};\n\nconst isAtLeftOfViewport = function(element, container, threshold) {\n\tconst fold =\n\t\tcontainer === window ? window.pageXOffset : getLeftOffset(container);\n\treturn fold >= getLeftOffset(element) + threshold + element.offsetWidth;\n};\n\nfunction isInsideViewport(element, container, threshold) {\n\treturn (\n\t\t!isBelowViewport(element, container, threshold) &&\n\t\t!isAboveViewport(element, container, threshold) &&\n\t\t!isAtRightOfViewport(element, container, threshold) &&\n\t\t!isAtLeftOfViewport(element, container, threshold)\n\t);\n}\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n\tvar event;\n\tlet eventString = \"LazyLoad::Initialized\";\n\tlet instance = new classObj(options);\n\ttry {\n\t\t// Works in modern browsers\n\t\tevent = new CustomEvent(eventString, { detail: { instance } });\n\t} catch (err) {\n\t\t// Works in Internet Explorer (all versions)\n\t\tevent = document.createEvent(\"CustomEvent\");\n\t\tevent.initCustomEvent(eventString, false, false, { instance });\n\t}\n\twindow.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of lazyload, depending on the \n options passed in (plain object or an array) */\nfunction autoInitialize(classObj, options) {\n\tif (!options) {\n\t\treturn;\n\t}\n\tif (!options.length) {\n\t\t// Plain object\n\t\tcreateInstance(classObj, options);\n\t} else {\n\t\t// Array of objects\n\t\tfor (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n\t\t\tcreateInstance(classObj, optionsItem);\n\t\t}\n\t}\n}\n\nconst replaceExtToWebp = (value, condition) =>\n\tcondition ? value.replace(/\\.(jpe?g|png)/gi, \".webp\") : value;\n\nconst detectWebp = () => {\n\tvar webpString = \"image/webp\";\n\tvar canvas = document.createElement(\"canvas\");\n\n\tif (canvas.getContext && canvas.getContext(\"2d\")) {\n\t\treturn canvas.toDataURL(webpString).indexOf(`data:${webpString}`) === 0;\n\t}\n\n\treturn false;\n};\n\nconst runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n\t(runningOnBrowser && !(\"onscroll\" in window)) ||\n\t/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent);\nconst supportsClassList =\n\trunningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst supportsWebp = runningOnBrowser && detectWebp();\n\nconst addClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.add(className);\n\t\treturn;\n\t}\n\telement.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n\tif (supportsClassList) {\n\t\telement.classList.remove(className);\n\t\treturn;\n\t}\n\telement.className = element.className.\n\t\treplace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").\n\t\treplace(/^\\s+/, \"\").\n\t\treplace(/\\s+$/, \"\");\n};\n\nconst setSourcesInChildren = function(\n\tparentTag,\n\tattrName,\n\tdataAttrName,\n\ttoWebpFlag\n) {\n\tfor (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n\t\tif (childTag.tagName === \"SOURCE\") {\n\t\t\tlet attrValue = getData(childTag, dataAttrName);\n\t\t\tsetAttributeIfValue(childTag, attrName, attrValue, toWebpFlag);\n\t\t}\n\t}\n};\n\nconst setAttributeIfValue = function(\n\telement,\n\tattrName,\n\tvalue,\n\ttoWebpFlag\n) {\n\tif (!value) {\n\t\treturn;\n\t}\n\telement.setAttribute(attrName, replaceExtToWebp(value, toWebpFlag));\n};\n\nconst setSourcesImg = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcsetDataName = settings.data_srcset;\n\tconst parent = element.parentNode;\n\n\tif (parent && parent.tagName === \"PICTURE\") {\n\t\tsetSourcesInChildren(parent, \"srcset\", srcsetDataName, toWebpFlag);\n\t}\n\tconst sizesDataValue = getData(element, settings.data_sizes);\n\tsetAttributeIfValue(element, \"sizes\", sizesDataValue);\n\tconst srcsetDataValue = getData(element, srcsetDataName);\n\tsetAttributeIfValue(element, \"srcset\", srcsetDataValue, toWebpFlag);\n\tconst srcDataValue = getData(element, settings.data_src);\n\tsetAttributeIfValue(element, \"src\", srcDataValue, toWebpFlag);\n};\n\nconst setSourcesIframe = (element, settings) => {\n\tconst srcDataValue = getData(element, settings.data_src);\n\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n};\n\nconst setSourcesVideo = (element, settings) => {\n\tconst srcDataName = settings.data_src;\n\tconst srcDataValue = getData(element, srcDataName);\n\n\tsetSourcesInChildren(element, \"src\", srcDataName);\n\tsetAttributeIfValue(element, \"src\", srcDataValue);\n\telement.load();\n};\n\nconst setSourcesBgImage = (element, settings) => {\n\tconst toWebpFlag = supportsWebp && settings.to_webp;\n\tconst srcDataValue = getData(element, settings.data_src);\n\tconst bgDataValue = getData(element, settings.data_bg);\n\n\tif (srcDataValue) {\n\t\tlet setValue = replaceExtToWebp(srcDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = `url(\"${setValue}\")`;\n\t}\n\n\tif (bgDataValue) {\n\t\tlet setValue = replaceExtToWebp(bgDataValue, toWebpFlag);\n\t\telement.style.backgroundImage = setValue;\n\t}\n};\n\nconst setSourcesFunctions = {\n\tIMG: setSourcesImg,\n\tIFRAME: setSourcesIframe,\n\tVIDEO: setSourcesVideo\n};\n\nconst setSources = (element, instance) => {\n\tconst settings = instance._settings;\n\tconst tagName = element.tagName;\n\tconst setSourcesFunction = setSourcesFunctions[tagName];\n\tif (setSourcesFunction) {\n\t\tsetSourcesFunction(element, settings);\n\t\tinstance._updateLoadingCount(1);\n\t\tinstance._elements = purgeOneElement(instance._elements, element);\n\t\treturn;\n\t}\n\tsetSourcesBgImage(element, settings);\n};\n\nconst callbackIfSet = function(callback, argument) {\n\tif (callback) {\n\t\tcallback(argument);\n\t}\n};\n\nconst genericLoadEventName = \"load\";\nconst mediaLoadEventName = \"loadeddata\";\nconst errorEventName = \"error\";\n\nconst addEventListener = (element, eventName, handler) => {\n\telement.addEventListener(eventName, handler);\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n\telement.removeEventListener(eventName, handler);\n};\n\nconst addAllEventListeners = (element, loadHandler, errorHandler) => {\n\taddEventListener(element, genericLoadEventName, loadHandler);\n\taddEventListener(element, mediaLoadEventName, loadHandler);\n\taddEventListener(element, errorEventName, errorHandler);\n};\n\nconst removeAllEventListeners = (element, loadHandler, errorHandler) => {\n\tremoveEventListener(element, genericLoadEventName, loadHandler);\n\tremoveEventListener(element, mediaLoadEventName, loadHandler);\n\tremoveEventListener(element, errorEventName, errorHandler);\n};\n\nconst eventHandler = function(event, success, instance) {\n\tvar settings = instance._settings;\n\tconst className = success ? settings.class_loaded : settings.class_error;\n\tconst callback = success ? settings.callback_load : settings.callback_error;\n\tconst element = event.target;\n\n\tremoveClass(element, settings.class_loading);\n\taddClass(element, className);\n\tcallbackIfSet(callback, element);\n\n\tinstance._updateLoadingCount(-1);\n};\n\nconst addOneShotEventListeners = (element, instance) => {\n\tconst loadHandler = event => {\n\t\teventHandler(event, true, instance);\n\t\tremoveAllEventListeners(element, loadHandler, errorHandler);\n\t};\n\tconst errorHandler = event => {\n\t\teventHandler(event, false, instance);\n\t\tremoveAllEventListeners(element, loadHandler, errorHandler);\n\t};\n\taddAllEventListeners(element, loadHandler, errorHandler);\n};\n\nconst managedTags = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nfunction revealElement(element, instance, force) {\n\tvar settings = instance._settings;\n\tif (!force && getWasProcessedData(element)) {\n\t\treturn; // element has already been processed and force wasn't true\n\t}\n\tcallbackIfSet(settings.callback_enter, element);\n\tif (managedTags.indexOf(element.tagName) > -1) {\n\t\taddOneShotEventListeners(element, instance);\n\t\taddClass(element, settings.class_loading);\n\t}\n\tsetSources(element, instance);\n\tsetWasProcessedData(element);\n\tcallbackIfSet(settings.callback_set, element);\n}\n\nconst removeFromArray = (elements, indexes) => {\n\twhile (indexes.length) {\n\t\telements.splice(indexes.pop(), 1);\n\t}\n};\n\n/*\n * Constructor\n */\n\nconst LazyLoad = function(instanceSettings) {\n\tthis._settings = Object.assign({}, getDefaultSettings(), instanceSettings);\n\tthis._loadingCount = 0;\n\tthis._queryOriginNode =\n\t\tthis._settings.container === window\n\t\t\t? document\n\t\t\t: this._settings.container;\n\n\tthis._previousLoopTime = 0;\n\tthis._loopTimeout = null;\n\tthis._boundHandleScroll = this.handleScroll.bind(this);\n\n\tthis._isFirstLoop = true;\n\twindow.addEventListener(\"resize\", this._boundHandleScroll);\n\tthis.update();\n};\n\nLazyLoad.prototype = {\n\t_loopThroughElements: function(forceDownload) {\n\t\tconst settings = this._settings,\n\t\t\telements = this._elements,\n\t\t\telementsLength = !elements ? 0 : elements.length;\n\t\tlet i,\n\t\t\tprocessedIndexes = [],\n\t\t\tisFirstLoop = this._isFirstLoop;\n\n\t\tif (isFirstLoop) {\n\t\t\tthis._isFirstLoop = false;\n\t\t}\n\n\t\tif (elementsLength === 0) {\n\t\t\tthis._stopScrollHandler();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (i = 0; i < elementsLength; i++) {\n\t\t\tlet element = elements[i];\n\t\t\t/* If must skip_invisible and element is invisible, skip it */\n\t\t\tif (settings.skip_invisible && element.offsetParent === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tforceDownload ||\n\t\t\t\tisInsideViewport(\n\t\t\t\t\telement,\n\t\t\t\t\tsettings.container,\n\t\t\t\t\tsettings.threshold\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif (isFirstLoop) {\n\t\t\t\t\taddClass(element, settings.class_initial);\n\t\t\t\t}\n\t\t\t\tthis.load(element);\n\t\t\t\tprocessedIndexes.push(i);\n\t\t\t}\n\t\t}\n\n\t\t// Removing processed elements from this._elements.\n\t\tremoveFromArray(elements, processedIndexes);\n\t},\n\n\t_startScrollHandler: function() {\n\t\tif (!this._isHandlingScroll) {\n\t\t\tthis._isHandlingScroll = true;\n\t\t\tthis._settings.container.addEventListener(\n\t\t\t\t\"scroll\",\n\t\t\t\tthis._boundHandleScroll\n\t\t\t);\n\t\t}\n\t},\n\n\t_stopScrollHandler: function() {\n\t\tif (this._isHandlingScroll) {\n\t\t\tthis._isHandlingScroll = false;\n\t\t\tthis._settings.container.removeEventListener(\n\t\t\t\t\"scroll\",\n\t\t\t\tthis._boundHandleScroll\n\t\t\t);\n\t\t}\n\t},\n\n\t_updateLoadingCount: function(plusMinus) {\n\t\tthis._loadingCount += plusMinus;\n\t\tif (this._elements.length === 0 && this._loadingCount === 0) {\n\t\t\tcallbackIfSet(this._settings.callback_finish);\n\t\t}\n\t},\n\n\thandleScroll: function() {\n\t\tconst throttle = this._settings.throttle;\n\n\t\tif (throttle !== 0) {\n\t\t\tlet now = Date.now();\n\t\t\tlet remainingTime = throttle - (now - this._previousLoopTime);\n\t\t\tif (remainingTime <= 0 || remainingTime > throttle) {\n\t\t\t\tif (this._loopTimeout) {\n\t\t\t\t\tclearTimeout(this._loopTimeout);\n\t\t\t\t\tthis._loopTimeout = null;\n\t\t\t\t}\n\t\t\t\tthis._previousLoopTime = now;\n\t\t\t\tthis._loopThroughElements();\n\t\t\t} else if (!this._loopTimeout) {\n\t\t\t\tthis._loopTimeout = setTimeout(\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tthis._previousLoopTime = Date.now();\n\t\t\t\t\t\tthis._loopTimeout = null;\n\t\t\t\t\t\tthis._loopThroughElements();\n\t\t\t\t\t}.bind(this),\n\t\t\t\t\tremainingTime\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthis._loopThroughElements();\n\t\t}\n\t},\n\n\tloadAll: function() {\n\t\tthis._loopThroughElements(true);\n\t},\n\n\tupdate: function(elements) {\n\t\tconst settings = this._settings;\n\t\tconst nodeSet =\n\t\t\telements ||\n\t\t\tthis._queryOriginNode.querySelectorAll(settings.elements_selector);\n\n\t\tthis._elements = purgeProcessedElements(\n\t\t\tArray.prototype.slice.call(nodeSet) // NOTE: nodeset to array for IE compatibility\n\t\t);\n\n\t\tif (isBot) {\n\t\t\tthis.loadAll();\n\t\t\treturn;\n\t\t}\n\n\t\tthis._loopThroughElements();\n\t\tthis._startScrollHandler();\n\t},\n\n\tdestroy: function() {\n\t\twindow.removeEventListener(\"resize\", this._boundHandleScroll);\n\t\tif (this._loopTimeout) {\n\t\t\tclearTimeout(this._loopTimeout);\n\t\t\tthis._loopTimeout = null;\n\t\t}\n\t\tthis._stopScrollHandler();\n\t\tthis._elements = null;\n\t\tthis._queryOriginNode = null;\n\t\tthis._settings = null;\n\t},\n\n\tload: function(element, force) {\n\t\trevealElement(element, this, force);\n\t}\n};\n\n/* Automatic instances creation if required (useful for async script loading) */\nif (runningOnBrowser) {\n\tautoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nreturn LazyLoad;\n\n})));\n"]}
assets/js/lazyload-8.2.js DELETED
@@ -1,354 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var defaultSettings = {
11
- elements_selector: "img",
12
- container: window,
13
- threshold: 300,
14
- throttle: 150,
15
- data_src: "original",
16
- data_srcset: "original-set",
17
- class_loading: "loading",
18
- class_loaded: "loaded",
19
- class_error: "error",
20
- class_initial: "initial",
21
- skip_invisible: true,
22
- callback_load: null,
23
- callback_error: null,
24
- callback_set: null,
25
- callback_processed: null
26
- };
27
-
28
- var isBot = !("onscroll" in window) || /glebot/.test(navigator.userAgent);
29
-
30
- var callCallback = function callCallback(callback, argument) {
31
- if (callback) {
32
- callback(argument);
33
- }
34
- };
35
-
36
- var getTopOffset = function getTopOffset(element) {
37
- return element.getBoundingClientRect().top + window.pageYOffset - element.ownerDocument.documentElement.clientTop;
38
- };
39
-
40
- var isBelowViewport = function isBelowViewport(element, container, threshold) {
41
- var fold = container === window ? window.innerHeight + window.pageYOffset : getTopOffset(container) + container.offsetHeight;
42
- return fold <= getTopOffset(element) - threshold;
43
- };
44
-
45
- var getLeftOffset = function getLeftOffset(element) {
46
- return element.getBoundingClientRect().left + window.pageXOffset - element.ownerDocument.documentElement.clientLeft;
47
- };
48
-
49
- var isAtRightOfViewport = function isAtRightOfViewport(element, container, threshold) {
50
- var documentWidth = window.innerWidth;
51
- var fold = container === window ? documentWidth + window.pageXOffset : getLeftOffset(container) + documentWidth;
52
- return fold <= getLeftOffset(element) - threshold;
53
- };
54
-
55
- var isAboveViewport = function isAboveViewport(element, container, threshold) {
56
- var fold = container === window ? window.pageYOffset : getTopOffset(container);
57
- return fold >= getTopOffset(element) + threshold + element.offsetHeight;
58
- };
59
-
60
- var isAtLeftOfViewport = function isAtLeftOfViewport(element, container, threshold) {
61
- var fold = container === window ? window.pageXOffset : getLeftOffset(container);
62
- return fold >= getLeftOffset(element) + threshold + element.offsetWidth;
63
- };
64
-
65
- var isInsideViewport = function isInsideViewport(element, container, threshold) {
66
- return !isBelowViewport(element, container, threshold) && !isAboveViewport(element, container, threshold) && !isAtRightOfViewport(element, container, threshold) && !isAtLeftOfViewport(element, container, threshold);
67
- };
68
-
69
- /* Creates instance and notifies it through the window element */
70
- var createInstance = function createInstance(classObj, options) {
71
- var instance = new classObj(options);
72
- var event = new CustomEvent("LazyLoad::Initialized", { detail: { instance: instance } });
73
- window.dispatchEvent(event);
74
- };
75
-
76
- /* Auto initialization of one or more instances of lazyload, depending on the
77
- options passed in (plain object or an array) */
78
- var autoInitialize = function autoInitialize(classObj, options) {
79
- var optsLength = options.length;
80
- if (!optsLength) {
81
- // Plain object
82
- createInstance(classObj, options);
83
- } else {
84
- // Array of objects
85
- for (var i = 0; i < optsLength; i++) {
86
- createInstance(classObj, options[i]);
87
- }
88
- }
89
- };
90
-
91
- var dataPrefix = "data-";
92
-
93
- var getData = function getData(element, attribute) {
94
- return element.getAttribute(dataPrefix + attribute);
95
- };
96
-
97
- var setData = function setData(element, attribute, value) {
98
- return element.setAttribute(dataPrefix + attribute, value);
99
- };
100
-
101
- var setSourcesForPicture = function setSourcesForPicture(element, srcsetDataAttribute) {
102
- var parent = element.parentElement;
103
- if (parent.tagName !== "PICTURE") {
104
- return;
105
- }
106
- for (var i = 0; i < parent.children.length; i++) {
107
- var pictureChild = parent.children[i];
108
- if (pictureChild.tagName === "SOURCE") {
109
- var sourceSrcset = getData(pictureChild, srcsetDataAttribute);
110
- if (sourceSrcset) {
111
- pictureChild.setAttribute("srcset", sourceSrcset);
112
- }
113
- }
114
- }
115
- };
116
-
117
- var setSources = function setSources(element, srcsetDataAttribute, srcDataAttribute) {
118
- var tagName = element.tagName;
119
- var elementSrc = getData(element, srcDataAttribute);
120
- if (tagName === "IMG") {
121
- setSourcesForPicture(element, srcsetDataAttribute);
122
- var imgSrcset = getData(element, srcsetDataAttribute);
123
- if (imgSrcset) {
124
- element.setAttribute("srcset", imgSrcset);
125
- }
126
- if (elementSrc) {
127
- element.setAttribute("src", elementSrc);
128
- }
129
- return;
130
- }
131
- if (tagName === "IFRAME") {
132
- if (elementSrc) {
133
- element.setAttribute("src", elementSrc);
134
- }
135
- return;
136
- }
137
- if (elementSrc) {
138
- element.style.backgroundImage = 'url("' + elementSrc + '")';
139
- }
140
- };
141
-
142
- var supportsClassList = !!document.body.classList;
143
-
144
- var addClass = function addClass(element, className) {
145
- if (supportsClassList) {
146
- element.classList.add(className);
147
- return;
148
- }
149
- element.className += (element.className ? " " : "") + className;
150
- };
151
-
152
- var removeClass = function removeClass(element, className) {
153
- if (supportsClassList) {
154
- element.classList.remove(className);
155
- return;
156
- }
157
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
158
- };
159
-
160
- /*
161
- * Constructor
162
- */
163
-
164
- var LazyLoad = function LazyLoad(instanceSettings) {
165
- this._settings = _extends({}, defaultSettings, instanceSettings);
166
- this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
167
-
168
- this._previousLoopTime = 0;
169
- this._loopTimeout = null;
170
- this._boundHandleScroll = this.handleScroll.bind(this);
171
-
172
- this._isFirstLoop = true;
173
- window.addEventListener("resize", this._boundHandleScroll);
174
- this.update();
175
- };
176
-
177
- LazyLoad.prototype = {
178
-
179
- /*
180
- * Private methods
181
- */
182
-
183
- _reveal: function _reveal(element) {
184
- var settings = this._settings;
185
-
186
- var errorCallback = function errorCallback() {
187
- /* As this method is asynchronous, it must be protected against external destroy() calls */
188
- if (!settings) {
189
- return;
190
- }
191
- element.removeEventListener("load", loadCallback);
192
- element.removeEventListener("error", errorCallback);
193
- removeClass(element, settings.class_loading);
194
- addClass(element, settings.class_error);
195
- callCallback(settings.callback_error, element);
196
- };
197
-
198
- var loadCallback = function loadCallback() {
199
- /* As this method is asynchronous, it must be protected against external destroy() calls */
200
- if (!settings) {
201
- return;
202
- }
203
- removeClass(element, settings.class_loading);
204
- addClass(element, settings.class_loaded);
205
- element.removeEventListener("load", loadCallback);
206
- element.removeEventListener("error", errorCallback);
207
- /* Calling LOAD callback */
208
- callCallback(settings.callback_load, element);
209
- };
210
-
211
- if (element.tagName === "IMG" || element.tagName === "IFRAME") {
212
- element.addEventListener("load", loadCallback);
213
- element.addEventListener("error", errorCallback);
214
- addClass(element, settings.class_loading);
215
- }
216
-
217
- setSources(element, settings.data_srcset, settings.data_src);
218
- /* Calling SET callback */
219
- callCallback(settings.callback_set, element);
220
- },
221
-
222
- _loopThroughElements: function _loopThroughElements() {
223
- var settings = this._settings,
224
- elements = this._elements,
225
- elementsLength = !elements ? 0 : elements.length;
226
- var i = void 0,
227
- processedIndexes = [],
228
- firstLoop = this._isFirstLoop;
229
-
230
- for (i = 0; i < elementsLength; i++) {
231
- var element = elements[i];
232
- /* If must skip_invisible and element is invisible, skip it */
233
- if (settings.skip_invisible && element.offsetParent === null) {
234
- continue;
235
- }
236
-
237
- if (isBot || isInsideViewport(element, settings.container, settings.threshold)) {
238
- if (firstLoop) {
239
- addClass(element, settings.class_initial);
240
- }
241
- /* Start loading the image */
242
- this._reveal(element);
243
- /* Marking the element as processed. */
244
- processedIndexes.push(i);
245
- setData(element, "was-processed", true);
246
- }
247
- }
248
- /* Removing processed elements from this._elements. */
249
- while (processedIndexes.length) {
250
- elements.splice(processedIndexes.pop(), 1);
251
- /* Calling the end loop callback */
252
- callCallback(settings.callback_processed, elements.length);
253
- }
254
- /* Stop listening to scroll event when 0 elements remains */
255
- if (elementsLength === 0) {
256
- this._stopScrollHandler();
257
- }
258
- /* Sets isFirstLoop to false */
259
- if (firstLoop) {
260
- this._isFirstLoop = false;
261
- }
262
- },
263
-
264
- _purgeElements: function _purgeElements() {
265
- var elements = this._elements,
266
- elementsLength = elements.length;
267
- var i = void 0,
268
- elementsToPurge = [];
269
-
270
- for (i = 0; i < elementsLength; i++) {
271
- var element = elements[i];
272
- /* If the element has already been processed, skip it */
273
- if (getData(element, "was-processed")) {
274
- elementsToPurge.push(i);
275
- }
276
- }
277
- /* Removing elements to purge from this._elements. */
278
- while (elementsToPurge.length > 0) {
279
- elements.splice(elementsToPurge.pop(), 1);
280
- }
281
- },
282
-
283
- _startScrollHandler: function _startScrollHandler() {
284
- if (!this._isHandlingScroll) {
285
- this._isHandlingScroll = true;
286
- this._settings.container.addEventListener("scroll", this._boundHandleScroll);
287
- }
288
- },
289
-
290
- _stopScrollHandler: function _stopScrollHandler() {
291
- if (this._isHandlingScroll) {
292
- this._isHandlingScroll = false;
293
- this._settings.container.removeEventListener("scroll", this._boundHandleScroll);
294
- }
295
- },
296
-
297
- /*
298
- * Public methods
299
- */
300
-
301
- handleScroll: function handleScroll() {
302
- var throttle = this._settings.throttle;
303
-
304
- if (throttle !== 0) {
305
- var now = Date.now();
306
- var remainingTime = throttle - (now - this._previousLoopTime);
307
- if (remainingTime <= 0 || remainingTime > throttle) {
308
- if (this._loopTimeout) {
309
- clearTimeout(this._loopTimeout);
310
- this._loopTimeout = null;
311
- }
312
- this._previousLoopTime = now;
313
- this._loopThroughElements();
314
- } else if (!this._loopTimeout) {
315
- this._loopTimeout = setTimeout(function () {
316
- this._previousLoopTime = Date.now();
317
- this._loopTimeout = null;
318
- this._loopThroughElements();
319
- }.bind(this), remainingTime);
320
- }
321
- } else {
322
- this._loopThroughElements();
323
- }
324
- },
325
-
326
- update: function update() {
327
- // Converts to array the nodeset obtained querying the DOM from _queryOriginNode with elements_selector
328
- this._elements = Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector));
329
- this._purgeElements();
330
- this._loopThroughElements();
331
- this._startScrollHandler();
332
- },
333
-
334
- destroy: function destroy() {
335
- window.removeEventListener("resize", this._boundHandleScroll);
336
- if (this._loopTimeout) {
337
- clearTimeout(this._loopTimeout);
338
- this._loopTimeout = null;
339
- }
340
- this._stopScrollHandler();
341
- this._elements = null;
342
- this._queryOriginNode = null;
343
- this._settings = null;
344
- }
345
- };
346
-
347
- /* Automatic instances creation if required (useful for async script loading!) */
348
- var autoInitOptions = window.lazyLoadOptions;
349
- if (autoInitOptions) {
350
- autoInitialize(LazyLoad, autoInitOptions);
351
- }
352
-
353
- return LazyLoad;
354
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-8.2.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"original",data_srcset:"original-set",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_processed:null},t=!("onscroll"in window)||/glebot/.test(navigator.userAgent),n=function(e,t){e&&e(t)},o=function(e){return e.getBoundingClientRect().top+window.pageYOffset-e.ownerDocument.documentElement.clientTop},i=function(e,t,n){return(t===window?window.innerHeight+window.pageYOffset:o(t)+t.offsetHeight)<=o(e)-n},s=function(e){return e.getBoundingClientRect().left+window.pageXOffset-e.ownerDocument.documentElement.clientLeft},r=function(e,t,n){var o=window.innerWidth;return(t===window?o+window.pageXOffset:s(t)+o)<=s(e)-n},l=function(e,t,n){return(t===window?window.pageYOffset:o(t))>=o(e)+n+e.offsetHeight},a=function(e,t,n){return(t===window?window.pageXOffset:s(t))>=s(e)+n+e.offsetWidth},c=function(e,t,n){return!(i(e,t,n)||l(e,t,n)||r(e,t,n)||a(e,t,n))},u=function(e,t){var n=new e(t),o=new CustomEvent("LazyLoad::Initialized",{detail:{instance:n}});window.dispatchEvent(o)},d=function(e,t){return e.getAttribute("data-"+t)},h=function(e,t,n){return e.setAttribute("data-"+t,n)},f=function(e,t){var n=e.parentElement;if("PICTURE"===n.tagName)for(var o=0;o<n.children.length;o++){var i=n.children[o];if("SOURCE"===i.tagName){var s=d(i,t);s&&i.setAttribute("srcset",s)}}},_=function(e,t,n){var o=e.tagName,i=d(e,n);if("IMG"===o){f(e,t);var s=d(e,t);return s&&e.setAttribute("srcset",s),void(i&&e.setAttribute("src",i))}"IFRAME"!==o?i&&(e.style.backgroundImage='url("'+i+'")'):i&&e.setAttribute("src",i)},p=!!document.body.classList,m=function(e,t){p?e.classList.add(t):e.className+=(e.className?" ":"")+t},g=function(e,t){p?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},v=function(t){this._settings=_extends({},e,t),this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};v.prototype={_reveal:function(e){var t=this._settings,o=function o(){t&&(e.removeEventListener("load",i),e.removeEventListener("error",o),g(e,t.class_loading),m(e,t.class_error),n(t.callback_error,e))},i=function i(){t&&(g(e,t.class_loading),m(e,t.class_loaded),e.removeEventListener("load",i),e.removeEventListener("error",o),n(t.callback_load,e))};"IMG"!==e.tagName&&"IFRAME"!==e.tagName||(e.addEventListener("load",i),e.addEventListener("error",o),m(e,t.class_loading)),_(e,t.data_srcset,t.data_src),n(t.callback_set,e)},_loopThroughElements:function(){var e=this._settings,o=this._elements,i=o?o.length:0,s=void 0,r=[],l=this._isFirstLoop;for(s=0;s<i;s++){var a=o[s];e.skip_invisible&&null===a.offsetParent||(t||c(a,e.container,e.threshold))&&(l&&m(a,e.class_initial),this._reveal(a),r.push(s),h(a,"was-processed",!0))}for(;r.length;)o.splice(r.pop(),1),n(e.callback_processed,o.length);0===i&&this._stopScrollHandler(),l&&(this._isFirstLoop=!1)},_purgeElements:function(){var e=this._elements,t=e.length,n=void 0,o=[];for(n=0;n<t;n++){var i=e[n];d(i,"was-processed")&&o.push(n)}for(;o.length>0;)e.splice(o.pop(),1)},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},handleScroll:function(){var e=this._settings.throttle;if(0!==e){var t=Date.now(),n=e-(t-this._previousLoopTime);n<=0||n>e?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=t,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},update:function(){this._elements=Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector)),this._purgeElements(),this._loopThroughElements(),this._startScrollHandler()},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null}};var w=window.lazyLoadOptions;return w&&function(e,t){var n=t.length;if(n)for(var o=0;o<n;o++)u(e,t[o]);else u(e,t)}(v,w),v});
 
assets/js/lazyload-8.5.2.js DELETED
@@ -1,363 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var defaultSettings = {
11
- elements_selector: "img",
12
- container: window,
13
- threshold: 300,
14
- throttle: 150,
15
- data_src: "src",
16
- data_srcset: "srcset",
17
- class_loading: "loading",
18
- class_loaded: "loaded",
19
- class_error: "error",
20
- class_initial: "initial",
21
- skip_invisible: true,
22
- callback_load: null,
23
- callback_error: null,
24
- callback_set: null,
25
- callback_processed: null
26
- };
27
-
28
- var isBot = !("onscroll" in window) || /glebot/.test(navigator.userAgent);
29
-
30
- var callCallback = function callCallback(callback, argument) {
31
- if (callback) {
32
- callback(argument);
33
- }
34
- };
35
-
36
- var getTopOffset = function getTopOffset(element) {
37
- return element.getBoundingClientRect().top + window.pageYOffset - element.ownerDocument.documentElement.clientTop;
38
- };
39
-
40
- var isBelowViewport = function isBelowViewport(element, container, threshold) {
41
- var fold = container === window ? window.innerHeight + window.pageYOffset : getTopOffset(container) + container.offsetHeight;
42
- return fold <= getTopOffset(element) - threshold;
43
- };
44
-
45
- var getLeftOffset = function getLeftOffset(element) {
46
- return element.getBoundingClientRect().left + window.pageXOffset - element.ownerDocument.documentElement.clientLeft;
47
- };
48
-
49
- var isAtRightOfViewport = function isAtRightOfViewport(element, container, threshold) {
50
- var documentWidth = window.innerWidth;
51
- var fold = container === window ? documentWidth + window.pageXOffset : getLeftOffset(container) + documentWidth;
52
- return fold <= getLeftOffset(element) - threshold;
53
- };
54
-
55
- var isAboveViewport = function isAboveViewport(element, container, threshold) {
56
- var fold = container === window ? window.pageYOffset : getTopOffset(container);
57
- return fold >= getTopOffset(element) + threshold + element.offsetHeight;
58
- };
59
-
60
- var isAtLeftOfViewport = function isAtLeftOfViewport(element, container, threshold) {
61
- var fold = container === window ? window.pageXOffset : getLeftOffset(container);
62
- return fold >= getLeftOffset(element) + threshold + element.offsetWidth;
63
- };
64
-
65
- var isInsideViewport = function isInsideViewport(element, container, threshold) {
66
- return !isBelowViewport(element, container, threshold) && !isAboveViewport(element, container, threshold) && !isAtRightOfViewport(element, container, threshold) && !isAtLeftOfViewport(element, container, threshold);
67
- };
68
-
69
- /* Creates instance and notifies it through the window element */
70
- var createInstance = function createInstance(classObj, options) {
71
- var event;
72
- var eventString = "LazyLoad::Initialized";
73
- var instance = new classObj(options);
74
- try {
75
- // Works in modern browsers
76
- event = new CustomEvent(eventString, { detail: { instance: instance } });
77
- } catch (err) {
78
- // Works in Internet Explorer (all versions)
79
- event = document.createEvent("CustomEvent");
80
- event.initCustomEvent(eventString, false, false, { instance: instance });
81
- }
82
- window.dispatchEvent(event);
83
- };
84
-
85
- /* Auto initialization of one or more instances of lazyload, depending on the
86
- options passed in (plain object or an array) */
87
- var autoInitialize = function autoInitialize(classObj, options) {
88
- var optsLength = options.length;
89
- if (!optsLength) {
90
- // Plain object
91
- createInstance(classObj, options);
92
- } else {
93
- // Array of objects
94
- for (var i = 0; i < optsLength; i++) {
95
- createInstance(classObj, options[i]);
96
- }
97
- }
98
- };
99
-
100
- var dataPrefix = "data-";
101
-
102
- var getData = function getData(element, attribute) {
103
- return element.getAttribute(dataPrefix + attribute);
104
- };
105
-
106
- var setData = function setData(element, attribute, value) {
107
- return element.setAttribute(dataPrefix + attribute, value);
108
- };
109
-
110
- var setSourcesForPicture = function setSourcesForPicture(element, srcsetDataAttribute) {
111
- var parent = element.parentNode;
112
- if (parent.tagName !== "PICTURE") {
113
- return;
114
- }
115
- for (var i = 0; i < parent.children.length; i++) {
116
- var pictureChild = parent.children[i];
117
- if (pictureChild.tagName === "SOURCE") {
118
- var sourceSrcset = getData(pictureChild, srcsetDataAttribute);
119
- if (sourceSrcset) {
120
- pictureChild.setAttribute("srcset", sourceSrcset);
121
- }
122
- }
123
- }
124
- };
125
-
126
- var setSources = function setSources(element, srcsetDataAttribute, srcDataAttribute) {
127
- var tagName = element.tagName;
128
- var elementSrc = getData(element, srcDataAttribute);
129
- if (tagName === "IMG") {
130
- setSourcesForPicture(element, srcsetDataAttribute);
131
- var imgSrcset = getData(element, srcsetDataAttribute);
132
- if (imgSrcset) {
133
- element.setAttribute("srcset", imgSrcset);
134
- }
135
- if (elementSrc) {
136
- element.setAttribute("src", elementSrc);
137
- }
138
- return;
139
- }
140
- if (tagName === "IFRAME") {
141
- if (elementSrc) {
142
- element.setAttribute("src", elementSrc);
143
- }
144
- return;
145
- }
146
- if (elementSrc) {
147
- element.style.backgroundImage = 'url("' + elementSrc + '")';
148
- }
149
- };
150
-
151
- var supportsClassList = "classList" in document.createElement("p");
152
-
153
- var addClass = function addClass(element, className) {
154
- if (supportsClassList) {
155
- element.classList.add(className);
156
- return;
157
- }
158
- element.className += (element.className ? " " : "") + className;
159
- };
160
-
161
- var removeClass = function removeClass(element, className) {
162
- if (supportsClassList) {
163
- element.classList.remove(className);
164
- return;
165
- }
166
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
167
- };
168
-
169
- /*
170
- * Constructor
171
- */
172
-
173
- var LazyLoad = function LazyLoad(instanceSettings) {
174
- this._settings = _extends({}, defaultSettings, instanceSettings);
175
- this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
176
-
177
- this._previousLoopTime = 0;
178
- this._loopTimeout = null;
179
- this._boundHandleScroll = this.handleScroll.bind(this);
180
-
181
- this._isFirstLoop = true;
182
- window.addEventListener("resize", this._boundHandleScroll);
183
- this.update();
184
- };
185
-
186
- LazyLoad.prototype = {
187
-
188
- /*
189
- * Private methods
190
- */
191
-
192
- _reveal: function _reveal(element) {
193
- var settings = this._settings;
194
-
195
- var errorCallback = function errorCallback() {
196
- /* As this method is asynchronous, it must be protected against external destroy() calls */
197
- if (!settings) {
198
- return;
199
- }
200
- element.removeEventListener("load", loadCallback);
201
- element.removeEventListener("error", errorCallback);
202
- removeClass(element, settings.class_loading);
203
- addClass(element, settings.class_error);
204
- callCallback(settings.callback_error, element);
205
- };
206
-
207
- var loadCallback = function loadCallback() {
208
- /* As this method is asynchronous, it must be protected against external destroy() calls */
209
- if (!settings) {
210
- return;
211
- }
212
- removeClass(element, settings.class_loading);
213
- addClass(element, settings.class_loaded);
214
- element.removeEventListener("load", loadCallback);
215
- element.removeEventListener("error", errorCallback);
216
- /* Calling LOAD callback */
217
- callCallback(settings.callback_load, element);
218
- };
219
-
220
- if (element.tagName === "IMG" || element.tagName === "IFRAME") {
221
- element.addEventListener("load", loadCallback);
222
- element.addEventListener("error", errorCallback);
223
- addClass(element, settings.class_loading);
224
- }
225
-
226
- setSources(element, settings.data_srcset, settings.data_src);
227
- /* Calling SET callback */
228
- callCallback(settings.callback_set, element);
229
- },
230
-
231
- _loopThroughElements: function _loopThroughElements() {
232
- var settings = this._settings,
233
- elements = this._elements,
234
- elementsLength = !elements ? 0 : elements.length;
235
- var i = void 0,
236
- processedIndexes = [],
237
- firstLoop = this._isFirstLoop;
238
-
239
- for (i = 0; i < elementsLength; i++) {
240
- var element = elements[i];
241
- /* If must skip_invisible and element is invisible, skip it */
242
- if (settings.skip_invisible && element.offsetParent === null) {
243
- continue;
244
- }
245
-
246
- if (isBot || isInsideViewport(element, settings.container, settings.threshold)) {
247
- if (firstLoop) {
248
- addClass(element, settings.class_initial);
249
- }
250
- /* Start loading the image */
251
- this._reveal(element);
252
- /* Marking the element as processed. */
253
- processedIndexes.push(i);
254
- setData(element, "was-processed", true);
255
- }
256
- }
257
- /* Removing processed elements from this._elements. */
258
- while (processedIndexes.length) {
259
- elements.splice(processedIndexes.pop(), 1);
260
- /* Calling the end loop callback */
261
- callCallback(settings.callback_processed, elements.length);
262
- }
263
- /* Stop listening to scroll event when 0 elements remains */
264
- if (elementsLength === 0) {
265
- this._stopScrollHandler();
266
- }
267
- /* Sets isFirstLoop to false */
268
- if (firstLoop) {
269
- this._isFirstLoop = false;
270
- }
271
- },
272
-
273
- _purgeElements: function _purgeElements() {
274
- var elements = this._elements,
275
- elementsLength = elements.length;
276
- var i = void 0,
277
- elementsToPurge = [];
278
-
279
- for (i = 0; i < elementsLength; i++) {
280
- var element = elements[i];
281
- /* If the element has already been processed, skip it */
282
- if (getData(element, "was-processed")) {
283
- elementsToPurge.push(i);
284
- }
285
- }
286
- /* Removing elements to purge from this._elements. */
287
- while (elementsToPurge.length > 0) {
288
- elements.splice(elementsToPurge.pop(), 1);
289
- }
290
- },
291
-
292
- _startScrollHandler: function _startScrollHandler() {
293
- if (!this._isHandlingScroll) {
294
- this._isHandlingScroll = true;
295
- this._settings.container.addEventListener("scroll", this._boundHandleScroll);
296
- }
297
- },
298
-
299
- _stopScrollHandler: function _stopScrollHandler() {
300
- if (this._isHandlingScroll) {
301
- this._isHandlingScroll = false;
302
- this._settings.container.removeEventListener("scroll", this._boundHandleScroll);
303
- }
304
- },
305
-
306
- /*
307
- * Public methods
308
- */
309
-
310
- handleScroll: function handleScroll() {
311
- var throttle = this._settings.throttle;
312
-
313
- if (throttle !== 0) {
314
- var now = Date.now();
315
- var remainingTime = throttle - (now - this._previousLoopTime);
316
- if (remainingTime <= 0 || remainingTime > throttle) {
317
- if (this._loopTimeout) {
318
- clearTimeout(this._loopTimeout);
319
- this._loopTimeout = null;
320
- }
321
- this._previousLoopTime = now;
322
- this._loopThroughElements();
323
- } else if (!this._loopTimeout) {
324
- this._loopTimeout = setTimeout(function () {
325
- this._previousLoopTime = Date.now();
326
- this._loopTimeout = null;
327
- this._loopThroughElements();
328
- }.bind(this), remainingTime);
329
- }
330
- } else {
331
- this._loopThroughElements();
332
- }
333
- },
334
-
335
- update: function update() {
336
- // Converts to array the nodeset obtained querying the DOM from _queryOriginNode with elements_selector
337
- this._elements = Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector));
338
- this._purgeElements();
339
- this._loopThroughElements();
340
- this._startScrollHandler();
341
- },
342
-
343
- destroy: function destroy() {
344
- window.removeEventListener("resize", this._boundHandleScroll);
345
- if (this._loopTimeout) {
346
- clearTimeout(this._loopTimeout);
347
- this._loopTimeout = null;
348
- }
349
- this._stopScrollHandler();
350
- this._elements = null;
351
- this._queryOriginNode = null;
352
- this._settings = null;
353
- }
354
- };
355
-
356
- /* Automatic instances creation if required (useful for async script loading!) */
357
- var autoInitOptions = window.lazyLoadOptions;
358
- if (autoInitOptions) {
359
- autoInitialize(LazyLoad, autoInitOptions);
360
- }
361
-
362
- return LazyLoad;
363
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-8.5.2.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_processed:null},t=!("onscroll"in window)||/glebot/.test(navigator.userAgent),n=function(e,t){e&&e(t)},o=function(e){return e.getBoundingClientRect().top+window.pageYOffset-e.ownerDocument.documentElement.clientTop},i=function(e,t,n){return(t===window?window.innerHeight+window.pageYOffset:o(t)+t.offsetHeight)<=o(e)-n},s=function(e){return e.getBoundingClientRect().left+window.pageXOffset-e.ownerDocument.documentElement.clientLeft},r=function(e,t,n){var o=window.innerWidth;return(t===window?o+window.pageXOffset:s(t)+o)<=s(e)-n},l=function(e,t,n){return(t===window?window.pageYOffset:o(t))>=o(e)+n+e.offsetHeight},a=function(e,t,n){return(t===window?window.pageXOffset:s(t))>=s(e)+n+e.offsetWidth},c=function(e,t,n){return!(i(e,t,n)||l(e,t,n)||r(e,t,n)||a(e,t,n))},u=function(e,t){var n,o=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},d=function(e,t){return e.getAttribute("data-"+t)},h=function(e,t,n){return e.setAttribute("data-"+t,n)},f=function(e,t){var n=e.parentNode;if("PICTURE"===n.tagName)for(var o=0;o<n.children.length;o++){var i=n.children[o];if("SOURCE"===i.tagName){var s=d(i,t);s&&i.setAttribute("srcset",s)}}},_=function(e,t,n){var o=e.tagName,i=d(e,n);if("IMG"===o){f(e,t);var s=d(e,t);return s&&e.setAttribute("srcset",s),void(i&&e.setAttribute("src",i))}"IFRAME"!==o?i&&(e.style.backgroundImage='url("'+i+'")'):i&&e.setAttribute("src",i)},p="classList"in document.createElement("p"),m=function(e,t){p?e.classList.add(t):e.className+=(e.className?" ":"")+t},g=function(e,t){p?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},v=function(t){this._settings=_extends({},e,t),this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};v.prototype={_reveal:function(e){var t=this._settings,o=function o(){t&&(e.removeEventListener("load",i),e.removeEventListener("error",o),g(e,t.class_loading),m(e,t.class_error),n(t.callback_error,e))},i=function i(){t&&(g(e,t.class_loading),m(e,t.class_loaded),e.removeEventListener("load",i),e.removeEventListener("error",o),n(t.callback_load,e))};"IMG"!==e.tagName&&"IFRAME"!==e.tagName||(e.addEventListener("load",i),e.addEventListener("error",o),m(e,t.class_loading)),_(e,t.data_srcset,t.data_src),n(t.callback_set,e)},_loopThroughElements:function(){var e=this._settings,o=this._elements,i=o?o.length:0,s=void 0,r=[],l=this._isFirstLoop;for(s=0;s<i;s++){var a=o[s];e.skip_invisible&&null===a.offsetParent||(t||c(a,e.container,e.threshold))&&(l&&m(a,e.class_initial),this._reveal(a),r.push(s),h(a,"was-processed",!0))}for(;r.length;)o.splice(r.pop(),1),n(e.callback_processed,o.length);0===i&&this._stopScrollHandler(),l&&(this._isFirstLoop=!1)},_purgeElements:function(){var e=this._elements,t=e.length,n=void 0,o=[];for(n=0;n<t;n++){var i=e[n];d(i,"was-processed")&&o.push(n)}for(;o.length>0;)e.splice(o.pop(),1)},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},handleScroll:function(){var e=this._settings.throttle;if(0!==e){var t=Date.now(),n=e-(t-this._previousLoopTime);n<=0||n>e?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=t,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},update:function(){this._elements=Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector)),this._purgeElements(),this._loopThroughElements(),this._startScrollHandler()},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null}};var w=window.lazyLoadOptions;return w&&function(e,t){var n=t.length;if(n)for(var o=0;o<n;o++)u(e,t[o]);else u(e,t)}(v,w),v});
 
assets/js/lazyload-8.9.js DELETED
@@ -1,375 +0,0 @@
1
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
-
3
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
-
5
- (function (global, factory) {
6
- (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
- })(this, function () {
8
- 'use strict';
9
-
10
- var getDefaultSettings = function getDefaultSettings() {
11
- return {
12
- elements_selector: "img",
13
- container: window,
14
- threshold: 300,
15
- throttle: 150,
16
- data_src: "src",
17
- data_srcset: "srcset",
18
- class_loading: "loading",
19
- class_loaded: "loaded",
20
- class_error: "error",
21
- class_initial: "initial",
22
- skip_invisible: true,
23
- callback_load: null,
24
- callback_error: null,
25
- callback_set: null,
26
- callback_processed: null,
27
- callback_enter: null
28
- };
29
- };
30
-
31
- var isBot = !("onscroll" in window) || /glebot/.test(navigator.userAgent);
32
-
33
- var callCallback = function callCallback(callback, argument) {
34
- if (callback) {
35
- callback(argument);
36
- }
37
- };
38
-
39
- var getTopOffset = function getTopOffset(element) {
40
- return element.getBoundingClientRect().top + window.pageYOffset - element.ownerDocument.documentElement.clientTop;
41
- };
42
-
43
- var isBelowViewport = function isBelowViewport(element, container, threshold) {
44
- var fold = container === window ? window.innerHeight + window.pageYOffset : getTopOffset(container) + container.offsetHeight;
45
- return fold <= getTopOffset(element) - threshold;
46
- };
47
-
48
- var getLeftOffset = function getLeftOffset(element) {
49
- return element.getBoundingClientRect().left + window.pageXOffset - element.ownerDocument.documentElement.clientLeft;
50
- };
51
-
52
- var isAtRightOfViewport = function isAtRightOfViewport(element, container, threshold) {
53
- var documentWidth = window.innerWidth;
54
- var fold = container === window ? documentWidth + window.pageXOffset : getLeftOffset(container) + documentWidth;
55
- return fold <= getLeftOffset(element) - threshold;
56
- };
57
-
58
- var isAboveViewport = function isAboveViewport(element, container, threshold) {
59
- var fold = container === window ? window.pageYOffset : getTopOffset(container);
60
- return fold >= getTopOffset(element) + threshold + element.offsetHeight;
61
- };
62
-
63
- var isAtLeftOfViewport = function isAtLeftOfViewport(element, container, threshold) {
64
- var fold = container === window ? window.pageXOffset : getLeftOffset(container);
65
- return fold >= getLeftOffset(element) + threshold + element.offsetWidth;
66
- };
67
-
68
- var isInsideViewport = function isInsideViewport(element, container, threshold) {
69
- return !isBelowViewport(element, container, threshold) && !isAboveViewport(element, container, threshold) && !isAtRightOfViewport(element, container, threshold) && !isAtLeftOfViewport(element, container, threshold);
70
- };
71
-
72
- /* Creates instance and notifies it through the window element */
73
- var createInstance = function createInstance(classObj, options) {
74
- var event;
75
- var eventString = "LazyLoad::Initialized";
76
- var instance = new classObj(options);
77
- try {
78
- // Works in modern browsers
79
- event = new CustomEvent(eventString, { detail: { instance: instance } });
80
- } catch (err) {
81
- // Works in Internet Explorer (all versions)
82
- event = document.createEvent("CustomEvent");
83
- event.initCustomEvent(eventString, false, false, { instance: instance });
84
- }
85
- window.dispatchEvent(event);
86
- };
87
-
88
- /* Auto initialization of one or more instances of lazyload, depending on the
89
- options passed in (plain object or an array) */
90
- var autoInitialize = function autoInitialize(classObj, options) {
91
- var optsLength = options.length;
92
- if (!optsLength) {
93
- // Plain object
94
- createInstance(classObj, options);
95
- } else {
96
- // Array of objects
97
- for (var i = 0; i < optsLength; i++) {
98
- createInstance(classObj, options[i]);
99
- }
100
- }
101
- };
102
-
103
- var dataPrefix = "data-";
104
-
105
- var getData = function getData(element, attribute) {
106
- return element.getAttribute(dataPrefix + attribute);
107
- };
108
-
109
- var setData = function setData(element, attribute, value) {
110
- return element.setAttribute(dataPrefix + attribute, value);
111
- };
112
-
113
- var setSourcesInChildren = function setSourcesInChildren(parentTag, attrName, dataAttrName) {
114
- for (var i = 0, childTag; childTag = parentTag.children[i]; i += 1) {
115
- if (childTag.tagName === "SOURCE") {
116
- var attributeValue = getData(childTag, dataAttrName);
117
- if (attributeValue) {
118
- childTag.setAttribute(attrName, attributeValue);
119
- }
120
- }
121
- }
122
- };
123
-
124
- var setAttributeIfNotNullOrEmpty = function setAttributeIfNotNullOrEmpty(element, attrName, value) {
125
- if (!value) {
126
- return;
127
- }
128
- element.setAttribute(attrName, value);
129
- };
130
-
131
- function setSources(element, settings) {
132
- var dataAttrSrcName = settings.data_src;
133
- var elementSrc = getData(element, dataAttrSrcName);
134
- var tagName = element.tagName;
135
- if (tagName === "IMG") {
136
- var dataAttrSrcSetName = settings.data_srcset;
137
- var elementSrcSet = getData(element, dataAttrSrcSetName);
138
- var parent = element.parentNode;
139
- if (parent && parent.tagName === "PICTURE") {
140
- setSourcesInChildren(parent, "srcset", dataAttrSrcSetName);
141
- }
142
- setAttributeIfNotNullOrEmpty(element, "srcset", elementSrcSet);
143
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
144
- return;
145
- }
146
- if (tagName === "IFRAME") {
147
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
148
- return;
149
- }
150
- if (tagName === "VIDEO") {
151
- setSourcesInChildren(element, "src", dataAttrSrcName);
152
- setAttributeIfNotNullOrEmpty(element, "src", elementSrc);
153
- return;
154
- }
155
- if (elementSrc) {
156
- element.style.backgroundImage = 'url("' + elementSrc + '")';
157
- }
158
- }
159
-
160
- var runningOnBrowser = typeof window !== "undefined";
161
-
162
- var supportsClassList = runningOnBrowser && "classList" in document.createElement("p");
163
-
164
- var addClass = function addClass(element, className) {
165
- if (supportsClassList) {
166
- element.classList.add(className);
167
- return;
168
- }
169
- element.className += (element.className ? " " : "") + className;
170
- };
171
-
172
- var removeClass = function removeClass(element, className) {
173
- if (supportsClassList) {
174
- element.classList.remove(className);
175
- return;
176
- }
177
- element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
178
- };
179
-
180
- /*
181
- * Constructor
182
- */
183
-
184
- var LazyLoad = function LazyLoad(instanceSettings) {
185
- this._settings = _extends({}, getDefaultSettings(), instanceSettings);
186
- this._queryOriginNode = this._settings.container === window ? document : this._settings.container;
187
-
188
- this._previousLoopTime = 0;
189
- this._loopTimeout = null;
190
- this._boundHandleScroll = this.handleScroll.bind(this);
191
-
192
- this._isFirstLoop = true;
193
- window.addEventListener("resize", this._boundHandleScroll);
194
- this.update();
195
- };
196
-
197
- LazyLoad.prototype = {
198
-
199
- /*
200
- * Private methods
201
- */
202
-
203
- _reveal: function _reveal(element) {
204
- var settings = this._settings;
205
-
206
- var errorCallback = function errorCallback() {
207
- /* As this method is asynchronous, it must be protected against external destroy() calls */
208
- if (!settings) {
209
- return;
210
- }
211
- element.removeEventListener("load", loadCallback);
212
- element.removeEventListener("error", errorCallback);
213
- removeClass(element, settings.class_loading);
214
- addClass(element, settings.class_error);
215
- callCallback(settings.callback_error, element);
216
- };
217
-
218
- var loadCallback = function loadCallback() {
219
- /* As this method is asynchronous, it must be protected against external destroy() calls */
220
- if (!settings) {
221
- return;
222
- }
223
- removeClass(element, settings.class_loading);
224
- addClass(element, settings.class_loaded);
225
- element.removeEventListener("load", loadCallback);
226
- element.removeEventListener("error", errorCallback);
227
- callCallback(settings.callback_load, element);
228
- };
229
-
230
- callCallback(settings.callback_enter, element);
231
- if (["IMG", "IFRAME", "VIDEO"].indexOf(element.tagName) > -1) {
232
- element.addEventListener("load", loadCallback);
233
- element.addEventListener("error", errorCallback);
234
- addClass(element, settings.class_loading);
235
- }
236
- setSources(element, settings);
237
- callCallback(settings.callback_set, element);
238
- },
239
-
240
- _loopThroughElements: function _loopThroughElements(forceDownload) {
241
- var settings = this._settings,
242
- elements = this._elements,
243
- elementsLength = !elements ? 0 : elements.length;
244
- var i = void 0,
245
- processedIndexes = [],
246
- firstLoop = this._isFirstLoop;
247
-
248
- for (i = 0; i < elementsLength; i++) {
249
- var element = elements[i];
250
- /* If must skip_invisible and element is invisible, skip it */
251
- if (settings.skip_invisible && element.offsetParent === null) {
252
- continue;
253
- }
254
-
255
- if (isBot || forceDownload || isInsideViewport(element, settings.container, settings.threshold)) {
256
- if (firstLoop) {
257
- addClass(element, settings.class_initial);
258
- }
259
- /* Start loading the image */
260
- this._reveal(element);
261
- /* Marking the element as processed. */
262
- processedIndexes.push(i);
263
- setData(element, "was-processed", true);
264
- }
265
- }
266
- /* Removing processed elements from this._elements. */
267
- while (processedIndexes.length) {
268
- elements.splice(processedIndexes.pop(), 1);
269
- callCallback(settings.callback_processed, elements.length);
270
- }
271
- /* Stop listening to scroll event when 0 elements remains */
272
- if (elementsLength === 0) {
273
- this._stopScrollHandler();
274
- }
275
- /* Sets isFirstLoop to false */
276
- if (firstLoop) {
277
- this._isFirstLoop = false;
278
- }
279
- },
280
-
281
- _purgeElements: function _purgeElements() {
282
- var elements = this._elements,
283
- elementsLength = elements.length;
284
- var i = void 0,
285
- elementsToPurge = [];
286
-
287
- for (i = 0; i < elementsLength; i++) {
288
- var element = elements[i];
289
- /* If the element has already been processed, skip it */
290
- if (getData(element, "was-processed")) {
291
- elementsToPurge.push(i);
292
- }
293
- }
294
- /* Removing elements to purge from this._elements. */
295
- while (elementsToPurge.length > 0) {
296
- elements.splice(elementsToPurge.pop(), 1);
297
- }
298
- },
299
-
300
- _startScrollHandler: function _startScrollHandler() {
301
- if (!this._isHandlingScroll) {
302
- this._isHandlingScroll = true;
303
- this._settings.container.addEventListener("scroll", this._boundHandleScroll);
304
- }
305
- },
306
-
307
- _stopScrollHandler: function _stopScrollHandler() {
308
- if (this._isHandlingScroll) {
309
- this._isHandlingScroll = false;
310
- this._settings.container.removeEventListener("scroll", this._boundHandleScroll);
311
- }
312
- },
313
-
314
- /*
315
- * Public methods
316
- */
317
-
318
- handleScroll: function handleScroll() {
319
- var throttle = this._settings.throttle;
320
-
321
- if (throttle !== 0) {
322
- var now = Date.now();
323
- var remainingTime = throttle - (now - this._previousLoopTime);
324
- if (remainingTime <= 0 || remainingTime > throttle) {
325
- if (this._loopTimeout) {
326
- clearTimeout(this._loopTimeout);
327
- this._loopTimeout = null;
328
- }
329
- this._previousLoopTime = now;
330
- this._loopThroughElements();
331
- } else if (!this._loopTimeout) {
332
- this._loopTimeout = setTimeout(function () {
333
- this._previousLoopTime = Date.now();
334
- this._loopTimeout = null;
335
- this._loopThroughElements();
336
- }.bind(this), remainingTime);
337
- }
338
- } else {
339
- this._loopThroughElements();
340
- }
341
- },
342
-
343
- loadAll: function loadAll() {
344
- this._loopThroughElements(true);
345
- },
346
-
347
- update: function update() {
348
- // Converts to array the nodeset obtained querying the DOM from _queryOriginNode with elements_selector
349
- this._elements = Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector));
350
- this._purgeElements();
351
- this._loopThroughElements();
352
- this._startScrollHandler();
353
- },
354
-
355
- destroy: function destroy() {
356
- window.removeEventListener("resize", this._boundHandleScroll);
357
- if (this._loopTimeout) {
358
- clearTimeout(this._loopTimeout);
359
- this._loopTimeout = null;
360
- }
361
- this._stopScrollHandler();
362
- this._elements = null;
363
- this._queryOriginNode = null;
364
- this._settings = null;
365
- }
366
- };
367
-
368
- /* Automatic instances creation if required (useful for async script loading!) */
369
- var autoInitOptions = window.lazyLoadOptions;
370
- if (runningOnBrowser && autoInitOptions) {
371
- autoInitialize(LazyLoad, autoInitOptions);
372
- }
373
-
374
- return LazyLoad;
375
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/lazyload-8.9.min.js DELETED
@@ -1 +0,0 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";function e(e,t){var n=t.data_src,o=h(e,n),i=e.tagName;if("IMG"===i){var s=t.data_srcset,l=h(e,s),r=e.parentNode;return r&&"PICTURE"===r.tagName&&_(r,"srcset",s),p(e,"srcset",l),void p(e,"src",o)}if("IFRAME"!==i)return"VIDEO"===i?(_(e,"src",n),void p(e,"src",o)):void(o&&(e.style.backgroundImage='url("'+o+'")'));p(e,"src",o)}var t=function(){return{elements_selector:"img",container:window,threshold:300,throttle:150,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_initial:"initial",skip_invisible:!0,callback_load:null,callback_error:null,callback_set:null,callback_processed:null,callback_enter:null}},n=!("onscroll"in window)||/glebot/.test(navigator.userAgent),o=function(e,t){e&&e(t)},i=function(e){return e.getBoundingClientRect().top+window.pageYOffset-e.ownerDocument.documentElement.clientTop},s=function(e,t,n){return(t===window?window.innerHeight+window.pageYOffset:i(t)+t.offsetHeight)<=i(e)-n},l=function(e){return e.getBoundingClientRect().left+window.pageXOffset-e.ownerDocument.documentElement.clientLeft},r=function(e,t,n){var o=window.innerWidth;return(t===window?o+window.pageXOffset:l(t)+o)<=l(e)-n},a=function(e,t,n){return(t===window?window.pageYOffset:i(t))>=i(e)+n+e.offsetHeight},c=function(e,t,n){return(t===window?window.pageXOffset:l(t))>=l(e)+n+e.offsetWidth},u=function(e,t,n){return!(s(e,t,n)||a(e,t,n)||r(e,t,n)||c(e,t,n))},d=function(e,t){var n,o=new e(t);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)},h=function(e,t){return e.getAttribute("data-"+t)},f=function(e,t,n){return e.setAttribute("data-"+t,n)},_=function(e,t,n){for(var o,i=0;o=e.children[i];i+=1)if("SOURCE"===o.tagName){var s=h(o,n);s&&o.setAttribute(t,s)}},p=function(e,t,n){n&&e.setAttribute(t,n)},m="undefined"!=typeof window,g=m&&"classList"in document.createElement("p"),v=function(e,t){g?e.classList.add(t):e.className+=(e.className?" ":"")+t},w=function(e,t){g?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},b=function(e){this._settings=_extends({},t(),e),this._queryOriginNode=this._settings.container===window?document:this._settings.container,this._previousLoopTime=0,this._loopTimeout=null,this._boundHandleScroll=this.handleScroll.bind(this),this._isFirstLoop=!0,window.addEventListener("resize",this._boundHandleScroll),this.update()};b.prototype={_reveal:function(t){var n=this._settings,i=function e(){n&&(t.removeEventListener("load",s),t.removeEventListener("error",e),w(t,n.class_loading),v(t,n.class_error),o(n.callback_error,t))},s=function e(){n&&(w(t,n.class_loading),v(t,n.class_loaded),t.removeEventListener("load",e),t.removeEventListener("error",i),o(n.callback_load,t))};o(n.callback_enter,t),["IMG","IFRAME","VIDEO"].indexOf(t.tagName)>-1&&(t.addEventListener("load",s),t.addEventListener("error",i),v(t,n.class_loading)),e(t,n),o(n.callback_set,t)},_loopThroughElements:function(e){var t=this._settings,i=this._elements,s=i?i.length:0,l=void 0,r=[],a=this._isFirstLoop;for(l=0;l<s;l++){var c=i[l];t.skip_invisible&&null===c.offsetParent||(n||e||u(c,t.container,t.threshold))&&(a&&v(c,t.class_initial),this._reveal(c),r.push(l),f(c,"was-processed",!0))}for(;r.length;)i.splice(r.pop(),1),o(t.callback_processed,i.length);0===s&&this._stopScrollHandler(),a&&(this._isFirstLoop=!1)},_purgeElements:function(){var e=this._elements,t=e.length,n=void 0,o=[];for(n=0;n<t;n++){var i=e[n];h(i,"was-processed")&&o.push(n)}for(;o.length>0;)e.splice(o.pop(),1)},_startScrollHandler:function(){this._isHandlingScroll||(this._isHandlingScroll=!0,this._settings.container.addEventListener("scroll",this._boundHandleScroll))},_stopScrollHandler:function(){this._isHandlingScroll&&(this._isHandlingScroll=!1,this._settings.container.removeEventListener("scroll",this._boundHandleScroll))},handleScroll:function(){var e=this._settings.throttle;if(0!==e){var t=Date.now(),n=e-(t-this._previousLoopTime);n<=0||n>e?(this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._previousLoopTime=t,this._loopThroughElements()):this._loopTimeout||(this._loopTimeout=setTimeout(function(){this._previousLoopTime=Date.now(),this._loopTimeout=null,this._loopThroughElements()}.bind(this),n))}else this._loopThroughElements()},loadAll:function(){this._loopThroughElements(!0)},update:function(){this._elements=Array.prototype.slice.call(this._queryOriginNode.querySelectorAll(this._settings.elements_selector)),this._purgeElements(),this._loopThroughElements(),this._startScrollHandler()},destroy:function(){window.removeEventListener("resize",this._boundHandleScroll),this._loopTimeout&&(clearTimeout(this._loopTimeout),this._loopTimeout=null),this._stopScrollHandler(),this._elements=null,this._queryOriginNode=null,this._settings=null}};var y=window.lazyLoadOptions;return m&&y&&function(e,t){var n=t.length;if(n)for(var o=0;o<n;o++)d(e,t[o]);else d(e,t)}(b,y),b});
 
composer.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wp-media/rocket-lazy-load",
3
+ "description": "Lazy Load images and iframes without jQuery",
4
+ "keywords": [
5
+ "wordpress",
6
+ "lazyload"
7
+ ],
8
+ "homepage": "https://github.com/wp-media/rocket-lazy-load",
9
+ "license": "GPL-2.0+",
10
+ "authors": [
11
+ {
12
+ "name": "WP Media",
13
+ "email": "contact@wp-media.me",
14
+ "homepage": "https://wp-media.me"
15
+ }
16
+ ],
17
+ "type": "wordpress-plugin",
18
+ "config": {
19
+ "sort-packages": true
20
+ },
21
+ "repositories": [
22
+ {
23
+ "type": "vcs",
24
+ "url": "https://github.com/wp-media/rocket-lazyload-common"
25
+ }
26
+ ],
27
+ "support": {
28
+ "issues": "https://github.com/wp-media/rocket-lazy-load/issues",
29
+ "source": "https://github.com/wp-media/rocket-lazy-load"
30
+ },
31
+ "autoload": {
32
+ "psr-4": {
33
+ "RocketLazyLoadPlugin\\": "src/"
34
+ }
35
+ },
36
+ "require": {
37
+ "php": ">=5.4.0",
38
+ "league/container": "^2.4",
39
+ "wp-media/rocket-lazyload-common": "^1.0.0"
40
+ },
41
+ "require-dev": {
42
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
43
+ "phpcompatibility/phpcompatibility-wp": "*",
44
+ "squizlabs/php_codesniffer": "^3.2",
45
+ "wp-coding-standards/wpcs": "^1.0.0"
46
+ }
47
+ }
composer.lock ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "f29400f3ee27894ea8fb972d21229ce3",
8
+ "packages": [
9
+ {
10
+ "name": "container-interop/container-interop",
11
+ "version": "1.2.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/container-interop/container-interop.git",
15
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
20
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "psr/container": "^1.0"
25
+ },
26
+ "type": "library",
27
+ "autoload": {
28
+ "psr-4": {
29
+ "Interop\\Container\\": "src/Interop/Container/"
30
+ }
31
+ },
32
+ "notification-url": "https://packagist.org/downloads/",
33
+ "license": [
34
+ "MIT"
35
+ ],
36
+ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
37
+ "homepage": "https://github.com/container-interop/container-interop",
38
+ "time": "2017-02-14T19:40:03+00:00"
39
+ },
40
+ {
41
+ "name": "league/container",
42
+ "version": "2.4.1",
43
+ "source": {
44
+ "type": "git",
45
+ "url": "https://github.com/thephpleague/container.git",
46
+ "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0"
47
+ },
48
+ "dist": {
49
+ "type": "zip",
50
+ "url": "https://api.github.com/repos/thephpleague/container/zipball/43f35abd03a12977a60ffd7095efd6a7808488c0",
51
+ "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0",
52
+ "shasum": ""
53
+ },
54
+ "require": {
55
+ "container-interop/container-interop": "^1.2",
56
+ "php": "^5.4.0 || ^7.0"
57
+ },
58
+ "provide": {
59
+ "container-interop/container-interop-implementation": "^1.2",
60
+ "psr/container-implementation": "^1.0"
61
+ },
62
+ "replace": {
63
+ "orno/di": "~2.0"
64
+ },
65
+ "require-dev": {
66
+ "phpunit/phpunit": "4.*"
67
+ },
68
+ "type": "library",
69
+ "extra": {
70
+ "branch-alias": {
71
+ "dev-2.x": "2.x-dev",
72
+ "dev-1.x": "1.x-dev"
73
+ }
74
+ },
75
+ "autoload": {
76
+ "psr-4": {
77
+ "League\\Container\\": "src"
78
+ }
79
+ },
80
+ "notification-url": "https://packagist.org/downloads/",
81
+ "license": [
82
+ "MIT"
83
+ ],
84
+ "authors": [
85
+ {
86
+ "name": "Phil Bennett",
87
+ "email": "philipobenito@gmail.com",
88
+ "homepage": "http://www.philipobenito.com",
89
+ "role": "Developer"
90
+ }
91
+ ],
92
+ "description": "A fast and intuitive dependency injection container.",
93
+ "homepage": "https://github.com/thephpleague/container",
94
+ "keywords": [
95
+ "container",
96
+ "dependency",
97
+ "di",
98
+ "injection",
99
+ "league",
100
+ "provider",
101
+ "service"
102
+ ],
103
+ "time": "2017-05-10T09:20:27+00:00"
104
+ },
105
+ {
106
+ "name": "psr/container",
107
+ "version": "1.0.0",
108
+ "source": {
109
+ "type": "git",
110
+ "url": "https://github.com/php-fig/container.git",
111
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
112
+ },
113
+ "dist": {
114
+ "type": "zip",
115
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
116
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
117
+ "shasum": ""
118
+ },
119
+ "require": {
120
+ "php": ">=5.3.0"
121
+ },
122
+ "type": "library",
123
+ "extra": {
124
+ "branch-alias": {
125
+ "dev-master": "1.0.x-dev"
126
+ }
127
+ },
128
+ "autoload": {
129
+ "psr-4": {
130
+ "Psr\\Container\\": "src/"
131
+ }
132
+ },
133
+ "notification-url": "https://packagist.org/downloads/",
134
+ "license": [
135
+ "MIT"
136
+ ],
137
+ "authors": [
138
+ {
139
+ "name": "PHP-FIG",
140
+ "homepage": "http://www.php-fig.org/"
141
+ }
142
+ ],
143
+ "description": "Common Container Interface (PHP FIG PSR-11)",
144
+ "homepage": "https://github.com/php-fig/container",
145
+ "keywords": [
146
+ "PSR-11",
147
+ "container",
148
+ "container-interface",
149
+ "container-interop",
150
+ "psr"
151
+ ],
152
+ "time": "2017-02-14T16:28:37+00:00"
153
+ },
154
+ {
155
+ "name": "wp-media/rocket-lazyload-common",
156
+ "version": "v1.2",
157
+ "source": {
158
+ "type": "git",
159
+ "url": "https://github.com/wp-media/rocket-lazyload-common.git",
160
+ "reference": "db45190dd9fb3dddcdc335e180fa522d6789d0bc"
161
+ },
162
+ "dist": {
163
+ "type": "zip",
164
+ "url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/db45190dd9fb3dddcdc335e180fa522d6789d0bc",
165
+ "reference": "db45190dd9fb3dddcdc335e180fa522d6789d0bc",
166
+ "shasum": ""
167
+ },
168
+ "require": {
169
+ "php": ">=5.4"
170
+ },
171
+ "require-dev": {
172
+ "squizlabs/php_codesniffer": "^3.2"
173
+ },
174
+ "type": "library",
175
+ "autoload": {
176
+ "psr-4": {
177
+ "RocketLazyload\\": "src"
178
+ }
179
+ },
180
+ "license": [
181
+ "GPLv3"
182
+ ],
183
+ "authors": [
184
+ {
185
+ "name": "WP Media",
186
+ "email": "contact@wp-media.me"
187
+ }
188
+ ],
189
+ "description": "Common Code between WP Rocket and Lazyload by WP Rocket",
190
+ "support": {
191
+ "source": "https://github.com/wp-media/rocket-lazyload-common/tree/v1.2",
192
+ "issues": "https://github.com/wp-media/rocket-lazyload-common/issues"
193
+ },
194
+ "time": "2019-01-08T22:32:27+00:00"
195
+ }
196
+ ],
197
+ "packages-dev": [
198
+ {
199
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
200
+ "version": "v0.4.4",
201
+ "source": {
202
+ "type": "git",
203
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
204
+ "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08"
205
+ },
206
+ "dist": {
207
+ "type": "zip",
208
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/2e41850d5f7797cbb1af7b030d245b3b24e63a08",
209
+ "reference": "2e41850d5f7797cbb1af7b030d245b3b24e63a08",
210
+ "shasum": ""
211
+ },
212
+ "require": {
213
+ "composer-plugin-api": "^1.0",
214
+ "php": "^5.3|^7",
215
+ "squizlabs/php_codesniffer": "*"
216
+ },
217
+ "require-dev": {
218
+ "composer/composer": "*",
219
+ "wimg/php-compatibility": "^8.0"
220
+ },
221
+ "suggest": {
222
+ "dealerdirect/qa-tools": "All the PHP QA tools you'll need"
223
+ },
224
+ "type": "composer-plugin",
225
+ "extra": {
226
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
227
+ },
228
+ "autoload": {
229
+ "psr-4": {
230
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
231
+ }
232
+ },
233
+ "notification-url": "https://packagist.org/downloads/",
234
+ "license": [
235
+ "MIT"
236
+ ],
237
+ "authors": [
238
+ {
239
+ "name": "Franck Nijhof",
240
+ "email": "f.nijhof@dealerdirect.nl",
241
+ "homepage": "http://workingatdealerdirect.eu",
242
+ "role": "Developer"
243
+ }
244
+ ],
245
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
246
+ "homepage": "http://workingatdealerdirect.eu",
247
+ "keywords": [
248
+ "PHPCodeSniffer",
249
+ "PHP_CodeSniffer",
250
+ "code quality",
251
+ "codesniffer",
252
+ "composer",
253
+ "installer",
254
+ "phpcs",
255
+ "plugin",
256
+ "qa",
257
+ "quality",
258
+ "standard",
259
+ "standards",
260
+ "style guide",
261
+ "stylecheck",
262
+ "tests"
263
+ ],
264
+ "time": "2017-12-06T16:27:17+00:00"
265
+ },
266
+ {
267
+ "name": "phpcompatibility/php-compatibility",
268
+ "version": "9.1.1",
269
+ "source": {
270
+ "type": "git",
271
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
272
+ "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c"
273
+ },
274
+ "dist": {
275
+ "type": "zip",
276
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
277
+ "reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
278
+ "shasum": ""
279
+ },
280
+ "require": {
281
+ "php": ">=5.3",
282
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
283
+ },
284
+ "conflict": {
285
+ "squizlabs/php_codesniffer": "2.6.2"
286
+ },
287
+ "require-dev": {
288
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
289
+ },
290
+ "suggest": {
291
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
292
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
293
+ },
294
+ "type": "phpcodesniffer-standard",
295
+ "notification-url": "https://packagist.org/downloads/",
296
+ "license": [
297
+ "LGPL-3.0-or-later"
298
+ ],
299
+ "authors": [
300
+ {
301
+ "name": "Contributors",
302
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
303
+ },
304
+ {
305
+ "name": "Wim Godden",
306
+ "homepage": "https://github.com/wimg",
307
+ "role": "lead"
308
+ },
309
+ {
310
+ "name": "Juliette Reinders Folmer",
311
+ "homepage": "https://github.com/jrfnl",
312
+ "role": "lead"
313
+ }
314
+ ],
315
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
316
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
317
+ "keywords": [
318
+ "compatibility",
319
+ "phpcs",
320
+ "standards"
321
+ ],
322
+ "time": "2018-12-30T23:16:27+00:00"
323
+ },
324
+ {
325
+ "name": "phpcompatibility/phpcompatibility-paragonie",
326
+ "version": "1.0.1",
327
+ "source": {
328
+ "type": "git",
329
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
330
+ "reference": "9160de79fcd683b5c99e9c4133728d91529753ea"
331
+ },
332
+ "dist": {
333
+ "type": "zip",
334
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/9160de79fcd683b5c99e9c4133728d91529753ea",
335
+ "reference": "9160de79fcd683b5c99e9c4133728d91529753ea",
336
+ "shasum": ""
337
+ },
338
+ "require": {
339
+ "phpcompatibility/php-compatibility": "^9.0"
340
+ },
341
+ "require-dev": {
342
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4"
343
+ },
344
+ "suggest": {
345
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
346
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
347
+ },
348
+ "type": "phpcodesniffer-standard",
349
+ "notification-url": "https://packagist.org/downloads/",
350
+ "license": [
351
+ "LGPL-3.0-or-later"
352
+ ],
353
+ "authors": [
354
+ {
355
+ "name": "Wim Godden",
356
+ "role": "lead"
357
+ },
358
+ {
359
+ "name": "Juliette Reinders Folmer",
360
+ "role": "lead"
361
+ }
362
+ ],
363
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
364
+ "homepage": "http://phpcompatibility.com/",
365
+ "keywords": [
366
+ "compatibility",
367
+ "paragonie",
368
+ "phpcs",
369
+ "polyfill",
370
+ "standards"
371
+ ],
372
+ "time": "2018-12-16T19:10:44+00:00"
373
+ },
374
+ {
375
+ "name": "phpcompatibility/phpcompatibility-wp",
376
+ "version": "2.0.0",
377
+ "source": {
378
+ "type": "git",
379
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
380
+ "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd"
381
+ },
382
+ "dist": {
383
+ "type": "zip",
384
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
385
+ "reference": "cb303f0067cd5b366a41d4fb0e254fb40ff02efd",
386
+ "shasum": ""
387
+ },
388
+ "require": {
389
+ "phpcompatibility/php-compatibility": "^9.0",
390
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
391
+ },
392
+ "require-dev": {
393
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3"
394
+ },
395
+ "suggest": {
396
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
397
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
398
+ },
399
+ "type": "phpcodesniffer-standard",
400
+ "notification-url": "https://packagist.org/downloads/",
401
+ "license": [
402
+ "LGPL-3.0-or-later"
403
+ ],
404
+ "authors": [
405
+ {
406
+ "name": "Wim Godden",
407
+ "role": "lead"
408
+ },
409
+ {
410
+ "name": "Juliette Reinders Folmer",
411
+ "role": "lead"
412
+ }
413
+ ],
414
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
415
+ "homepage": "http://phpcompatibility.com/",
416
+ "keywords": [
417
+ "compatibility",
418
+ "phpcs",
419
+ "standards",
420
+ "wordpress"
421
+ ],
422
+ "time": "2018-10-07T18:31:37+00:00"
423
+ },
424
+ {
425
+ "name": "squizlabs/php_codesniffer",
426
+ "version": "3.4.0",
427
+ "source": {
428
+ "type": "git",
429
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
430
+ "reference": "379deb987e26c7cd103a7b387aea178baec96e48"
431
+ },
432
+ "dist": {
433
+ "type": "zip",
434
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
435
+ "reference": "379deb987e26c7cd103a7b387aea178baec96e48",
436
+ "shasum": ""
437
+ },
438
+ "require": {
439
+ "ext-simplexml": "*",
440
+ "ext-tokenizer": "*",
441
+ "ext-xmlwriter": "*",
442
+ "php": ">=5.4.0"
443
+ },
444
+ "require-dev": {
445
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
446
+ },
447
+ "bin": [
448
+ "bin/phpcs",
449
+ "bin/phpcbf"
450
+ ],
451
+ "type": "library",
452
+ "extra": {
453
+ "branch-alias": {
454
+ "dev-master": "3.x-dev"
455
+ }
456
+ },
457
+ "notification-url": "https://packagist.org/downloads/",
458
+ "license": [
459
+ "BSD-3-Clause"
460
+ ],
461
+ "authors": [
462
+ {
463
+ "name": "Greg Sherwood",
464
+ "role": "lead"
465
+ }
466
+ ],
467
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
468
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
469
+ "keywords": [
470
+ "phpcs",
471
+ "standards"
472
+ ],
473
+ "time": "2018-12-19T23:57:18+00:00"
474
+ },
475
+ {
476
+ "name": "wp-coding-standards/wpcs",
477
+ "version": "1.2.1",
478
+ "source": {
479
+ "type": "git",
480
+ "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
481
+ "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c"
482
+ },
483
+ "dist": {
484
+ "type": "zip",
485
+ "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
486
+ "reference": "f328bcafd97377e8e5e5d7b244d5ddbf301a3a5c",
487
+ "shasum": ""
488
+ },
489
+ "require": {
490
+ "php": ">=5.3",
491
+ "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2"
492
+ },
493
+ "require-dev": {
494
+ "phpcompatibility/php-compatibility": "^9.0"
495
+ },
496
+ "suggest": {
497
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
498
+ },
499
+ "type": "phpcodesniffer-standard",
500
+ "notification-url": "https://packagist.org/downloads/",
501
+ "license": [
502
+ "MIT"
503
+ ],
504
+ "authors": [
505
+ {
506
+ "name": "Contributors",
507
+ "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
508
+ }
509
+ ],
510
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
511
+ "keywords": [
512
+ "phpcs",
513
+ "standards",
514
+ "wordpress"
515
+ ],
516
+ "time": "2018-12-18T09:43:51+00:00"
517
+ }
518
+ ],
519
+ "aliases": [],
520
+ "minimum-stability": "stable",
521
+ "stability-flags": [],
522
+ "prefer-stable": false,
523
+ "prefer-lowest": false,
524
+ "platform": {
525
+ "php": ">=5.4.0"
526
+ },
527
+ "platform-dev": []
528
+ }
main.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die('Cheatin&#8217; uh?');
3
+
4
+ // Composer autoload.
5
+ if (file_exists(ROCKET_LL_PATH . 'vendor/autoload.php')) {
6
+ require ROCKET_LL_PATH . 'vendor/autoload.php';
7
+ }
8
+
9
+ $rocket_lazyload = new RocketLazyLoadPlugin\Plugin();
10
+
11
+ add_action('plugins_loaded', [ $rocket_lazyload, 'load' ]);
phpcs.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="Rocket Lazyload">
3
+ <description>Rocket LazyLoad</description>
4
+
5
+ <arg name="extensions" value="php"/>
6
+
7
+ <file>.</file>
8
+
9
+ <!-- Run against the PHPCompatibility ruleset -->
10
+ <rule ref="PHPCompatibility"/>
11
+ <rule ref="PSR2" />
12
+ <!-- Check for cross-version support for PHP 5.4 and higher. -->
13
+ <config name="testVersion" value="5.4-"/>
14
+ <config name="minimum_supported_wp_version" value="4.7"/>
15
+
16
+ <exclude-pattern>*.js</exclude-pattern>
17
+ <exclude-pattern>/vendor/*</exclude-pattern>
18
+ <exclude-pattern>/assets/*</exclude-pattern>
19
+
20
+ <rule ref="WordPress.WP.I18n">
21
+ <properties>
22
+ <property name="text_domain" type="array" value="rocket-lazy-load" />
23
+ </properties>
24
+ </rule>
25
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
26
+ <properties>
27
+ <property name="prefixes" type="array" value="rocket_lazyload,ROCKET_LL,RocketLazyLoadPlugin" />
28
+ </properties>
29
+ </rule>
30
+ </ruleset>
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: creativejuiz, tabrisrp, wp_media
3
  Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
4
  Requires at least: 4.7
5
- Tested up to: 4.9
6
  Requires PHP: 5.4
7
- Stable tag: 1.4.9
8
 
9
  Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
10
 
@@ -69,7 +69,26 @@ add_filter( 'rocket_lazyload_threshold', 'rocket_lazyload_custom_threshold' );
69
 
70
  Some plugins are not compatible without lazy loading. Please open a support thread, and we will see how we can solve the issue by excluding lazy loading for this plugin.
71
 
 
 
 
 
 
 
 
 
72
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
73
  = 1.4.9 =
74
  * Enhancement: Update lazyload script to the latest available version
75
  * Enhancement: Use lazy-sizes to prevent W3C validation error when sizes is defined but srcset is not
2
  Contributors: creativejuiz, tabrisrp, wp_media
3
  Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar, youtube
4
  Requires at least: 4.7
5
+ Tested up to: 5.0.2
6
  Requires PHP: 5.4
7
+ Stable tag: 2.0
8
 
9
  Lazy Load your images and iframes, replace Youtube videos by a preview thumbnail.
10
 
69
 
70
  Some plugins are not compatible without lazy loading. Please open a support thread, and we will see how we can solve the issue by excluding lazy loading for this plugin.
71
 
72
+ = How can I lazyload a background-image? =
73
+
74
+ The element you want to apply lazyload on must have this specific markup:
75
+
76
+ `<div class="rocket-lazyload-bg" data-bg="url(../img/image.jpg)"></div>`
77
+
78
+ The element must have the class `rocket-lazyload-bg`, and a `data-bg` attribute, which value is the CSS url for the image.
79
+
80
  == Changelog ==
81
+ = 2.0 =
82
+ * Enhancement: Lazyload is now applied on the template_redirect hook, which should allow the plugin to apply the optimization on more images and encountering less conflicts at the same time
83
+ * Enhancement: Specifically target with the lazyload script images/iframes elements with a data-lazy-src attribute
84
+ * Enhancement: Update lazyload script to the latest version
85
+ * Enhancement: Possibility to apply lazyload on background-images with a specific markup, see FAQ
86
+ * Enhancement: Use a svg image as placeholder instead of a base64 gif
87
+ * Bugfix: Only use MutationObserver if available in the browser
88
+ * Bugfix: When using the Youtube thumbnail option, correctly format the Youtube query if the video URL is encoded
89
+ * Bugfix: Improve iframe matching to prevent unexpected results
90
+ * Bugfix: Update CSS for the Youtube thumbnail option to prevent issue with the Gutenberg embeds block
91
+
92
  = 1.4.9 =
93
  * Enhancement: Update lazyload script to the latest available version
94
  * Enhancement: Use lazy-sizes to prevent W3C validation error when sizes is defined but srcset is not
rocket-lazy-load.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
- * Version: 1.4.9
7
  * Author: WP Media
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
10
  * Domain Path: /languages
11
  *
12
- * Copyright 2015-2017 WP Media
13
  *
14
  * This program is free software; you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
@@ -25,592 +25,52 @@
25
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
 
28
- defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' );
29
 
30
- define( 'ROCKET_LL_VERSION', '1.4.9' );
31
- define( 'ROCKET_LL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . '/' );
32
- define( 'ROCKET_LL_3RD_PARTY_PATH', ROCKET_LL_PATH . '3rd-party/' );
33
- define( 'ROCKET_LL_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' );
34
- define( 'ROCKET_LL_FRONT_JS_URL', ROCKET_LL_ASSETS_URL . 'js/' );
 
 
 
35
 
 
36
 
37
  /**
38
- * Initialize the plugin.
39
  *
40
- * @since 1.1
41
- * @return void
42
- */
43
- function rocket_lazyload_init() {
44
- load_plugin_textdomain( 'rocket-lazy-load', false, basename( dirname( __FILE__ ) ) . '/languages/' );
45
-
46
- require ROCKET_LL_3RD_PARTY_PATH . '3rd-party.php';
47
-
48
- if ( is_admin() ) {
49
- require ROCKET_LL_PATH . 'admin/actions.php';
50
- require ROCKET_LL_PATH . 'admin/notices.php';
51
- require ROCKET_LL_PATH . 'admin/admin.php';
52
- }
53
- }
54
-
55
- if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
56
- /**
57
- * Warning if PHP version is less than 5.3.
58
- *
59
- * @since 1.3
60
- */
61
- function rocket_lazyload_php_warning() {
62
- echo '<div class="error"><p>' . esc_html( __( 'Rocket LazyLoad requires PHP 5.3 to function properly. Please upgrade PHP. The Plugin has been auto-deactivated.', 'rocket-lazy-load' ) ) . '</p></div>';
63
- if ( isset( $_GET['activate'] ) ) { // WPCS: CSRF ok.
64
- unset( $_GET['activate'] );
65
- }
66
- }
67
- add_action( 'admin_notices', 'rocket_lazyload_php_warning' );
68
-
69
- /**
70
- * Deactivate plugin if needed.
71
- *
72
- * @since 1.3
73
- */
74
- function rocket_lazyload_deactivate_self() {
75
- deactivate_plugins( plugin_basename( __FILE__ ) );
76
- }
77
- add_action( 'admin_init', 'rocket_lazyload_deactivate_self' );
78
-
79
- return;
80
- } else {
81
- add_action( 'plugins_loaded', 'rocket_lazyload_init' );
82
- }
83
-
84
- /**
85
- * A wrapper to easily get rocket lazyload option
86
- *
87
- * @since 1.1
88
  * @author Remy Perona
89
  *
90
- * @param string $option The option name.
91
- * @param bool $default (default: false) The default value of option.
92
- * @return mixed The option value
93
- */
94
- function rocket_lazyload_get_option( $option, $default = false ) {
95
- $options = get_option( 'rocket_lazyload_options' );
96
- return isset( $options[ $option ] ) && '' !== $options[ $option ] ? $options[ $option ] : $default;
97
- }
98
-
99
- /**
100
- * Set lazyload options
101
- *
102
- * @since 1.0
103
- */
104
- function rocket_lazyload_script() {
105
- if ( ! rocket_lazyload_get_option( 'images' ) && ! rocket_lazyload_get_option( 'iframes' ) || ! apply_filters( 'do_rocket_lazyload', true ) ) {
106
- return;
107
- }
108
-
109
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
110
-
111
- /**
112
- * Filters the threshold at which lazyload is triggered
113
- *
114
- * @since 1.2
115
- * @author Remy Perona
116
- *
117
- * @param int $threshold Threshold value.
118
- */
119
- $threshold = apply_filters( 'rocket_lazyload_threshold', 300 );
120
-
121
- $elements = [];
122
-
123
- if ( rocket_lazyload_get_option( 'images' ) ) {
124
- $elements[] = 'img';
125
- }
126
-
127
- if ( rocket_lazyload_get_option( 'iframes' ) ) {
128
- $elements[] = 'iframe';
129
- }
130
-
131
- echo '<script>(function(w, d){
132
- var b = d.getElementsByTagName("body")[0];
133
- var s = d.createElement("script"); s.async = true;
134
- s.src = !("IntersectionObserver" in w) ? "' . ROCKET_LL_FRONT_JS_URL . 'lazyload-8.11' . $suffix . '.js" : "' . ROCKET_LL_FRONT_JS_URL . 'lazyload-10.11.1' . $suffix . '.js";
135
- w.lazyLoadOptions = {
136
- elements_selector: "' . esc_attr( implode( ',', $elements ) ) . '",
137
- data_src: "lazy-src",
138
- data_srcset: "lazy-srcset",
139
- data_sizes: "lazy-sizes",
140
- skip_invisible: false,
141
- class_loading: "lazyloading",
142
- class_loaded: "lazyloaded",
143
- threshold: ' . esc_attr( $threshold ) . ',
144
- callback_load: function(element) {
145
- if ( element.tagName === "IFRAME" && element.dataset.rocketLazyload == "fitvidscompatible" ) {
146
- if (element.classList.contains("lazyloaded") ) {
147
- if (typeof window.jQuery != "undefined") {
148
- if (jQuery.fn.fitVids) {
149
- jQuery(element).parent().fitVids();
150
- }
151
- }
152
- }
153
- }
154
- }
155
- };
156
- b.appendChild(s);
157
- }(window, document));
158
-
159
- // Listen to the Initialized event
160
- window.addEventListener(\'LazyLoad::Initialized\', function (e) {
161
- // Get the instance and puts it in the lazyLoadInstance variable
162
- var lazyLoadInstance = e.detail.instance;
163
-
164
- var observer = new MutationObserver(function(mutations) {
165
- mutations.forEach(function(mutation) {
166
- lazyLoadInstance.update();
167
- } );
168
- } );
169
-
170
- var b = document.getElementsByTagName("body")[0];
171
- var config = { childList: true, subtree: true };
172
-
173
- observer.observe(b, config);
174
- }, false);
175
- </script>';
176
-
177
- if ( rocket_lazyload_get_option( 'youtube' ) ) {
178
- /**
179
- * Filters the resolution of the YouTube thumbnail
180
- *
181
- * @since 1.4.8
182
- * @author Arun Basil Lal
183
- *
184
- * @param string $thumbnail_resolution The resolution of the thumbnail. Accepted values: default, mqdefault, sddefault, hqdefault, maxresdefault
185
- */
186
- $thumbnail_resolution = apply_filters( 'rocket_lazyload_youtube_thumbnail_resolution', 'hqdefault' );
187
-
188
- echo <<<HTML
189
- <script>function lazyLoadThumb(e){var t='<img src="https://i.ytimg.com/vi/ID/$thumbnail_resolution.jpg">',a='<div class="play"></div>';return t.replace("ID",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement("iframe"),t="https://www.youtube.com/embed/ID?autoplay=1";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute("src",t.replace("ID",this.dataset.id)),e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","1"),this.parentNode.replaceChild(e,this)}document.addEventListener("DOMContentLoaded",function(){var e,t,a=document.getElementsByClassName("rll-youtube-player");for(t=0;t<a.length;t++)e=document.createElement("div"),e.setAttribute("data-id",a[t].dataset.id),e.setAttribute("data-query", a[t].dataset.query),e.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script>
190
- HTML;
191
- }
192
- }
193
- add_action( 'wp_footer', 'rocket_lazyload_script', PHP_INT_MAX );
194
-
195
- /**
196
- * Enqueue the lazyload script
197
- *
198
- * @since 1.2
199
- * @author Remy Perona
200
- */
201
- function rocket_lazyload_enqueue() {
202
- if ( ! rocket_lazyload_get_option( 'images' ) && ! rocket_lazyload_get_option( 'iframes' ) || ! apply_filters( 'do_rocket_lazyload', true ) ) {
203
- return;
204
- }
205
-
206
- if ( rocket_lazyload_get_option( 'youtube' ) ) {
207
- $css = '.rll-youtube-player{position:relative;padding-bottom:56.23%;height:0;overflow:hidden;max-width:100%;background:#000;margin:5px}.rll-youtube-player iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;background:0 0}.rll-youtube-player img{bottom:0;display:block;left:0;margin:auto;max-width:100%;width:100%;position:absolute;right:0;top:0;border:none;height:auto;cursor:pointer;-webkit-transition:.4s all;-moz-transition:.4s all;transition:.4s all}.rll-youtube-player img:hover{-webkit-filter:brightness(75%)}.rll-youtube-player .play{height:72px;width:72px;left:50%;top:50%;margin-left:-36px;margin-top:-36px;position:absolute;background:url(' . ROCKET_LL_ASSETS_URL . 'img/youtube.png) no-repeat;cursor:pointer}';
208
-
209
- wp_register_style( 'rocket-lazyload', false );
210
- wp_enqueue_style( 'rocket-lazyload' );
211
- wp_add_inline_style( 'rocket-lazyload', $css );
212
- }
213
- }
214
- add_action( 'wp_enqueue_scripts', 'rocket_lazyload_enqueue', PHP_INT_MAX );
215
-
216
- /**
217
- * Replace Gravatar, thumbnails, images in post content and in widget text by LazyLoad
218
- *
219
- * @since 1.1 Support for get_image_tag filter.
220
- * @since 1.0
221
- *
222
- * @param string $html HTML code to parse.
223
- * @return string Updated HTML code
224
- */
225
- function rocket_lazyload_images( $html ) {
226
- // Don't LazyLoad if the thumbnail is in admin, a feed, REST API or a post preview.
227
- if ( ! rocket_lazyload_get_option( 'images' ) || is_admin() || is_feed() || is_preview() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || empty( $html ) || ( defined( 'DONOTLAZYLOAD' ) && DONOTLAZYLOAD ) || wp_script_is( 'twentytwenty-twentytwenty', 'enqueued' ) ) {
228
- return $html;
229
- }
230
-
231
- // You can stop the LalyLoad process with a hook.
232
- if ( ! apply_filters( 'do_rocket_lazyload', true ) ) {
233
- return $html;
234
- }
235
-
236
- return preg_replace_callback( '#<img([^>]*) src=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))([^>]*)>#', 'rocket_lazyload_replace_callback', $html );
237
- }
238
- add_filter( 'get_avatar', 'rocket_lazyload_images', PHP_INT_MAX );
239
- add_filter( 'the_content', 'rocket_lazyload_images', PHP_INT_MAX );
240
- add_filter( 'widget_text', 'rocket_lazyload_images', PHP_INT_MAX );
241
- add_filter( 'get_image_tag', 'rocket_lazyload_images', PHP_INT_MAX );
242
- add_filter( 'post_thumbnail_html', 'rocket_lazyload_images', PHP_INT_MAX );
243
-
244
- /**
245
- * Used to check if we have to LazyLoad this or not
246
- *
247
- * @since 1.1 Don't apply LazyLoad on images from WP Retina x2
248
- * @since 1.0.1
249
- *
250
- * @param string $matches a string matching the pattern to find images in HTML code.
251
- * @return string Updated string with lazyload data
252
- */
253
- function rocket_lazyload_replace_callback( $matches ) {
254
- if ( function_exists( 'wr2x_picture_rewrite' ) ) {
255
- if ( wr2x_get_retina( trailingslashit( ABSPATH ) . wr2x_get_pathinfo_from_image_src( trim( $matches[2], '"' ) ) ) ) {
256
- return $matches[0];
257
- }
258
- }
259
- $excluded_attributes = apply_filters( 'rocket_lazyload_excluded_attributes', array(
260
- 'data-no-lazy=',
261
- 'data-lazy-original=',
262
- 'data-lazy-src=',
263
- 'data-src=',
264
- 'data-lazysrc=',
265
- 'data-lazyload=',
266
- 'data-bgposition=',
267
- 'data-envira-src=',
268
- 'fullurl=',
269
- 'lazy-slider-img=',
270
- 'data-srcset=',
271
- 'class="ls-l',
272
- 'class="ls-bg',
273
- ) );
274
-
275
- $excluded_src = apply_filters( 'rocket_lazyload_excluded_src', array(
276
- '/wpcf7_captcha/',
277
- 'timthumb.php?src',
278
- ) );
279
-
280
- if ( rocket_is_excluded_lazyload( $matches[1] . $matches[3], $excluded_attributes ) || rocket_is_excluded_lazyload( $matches[2], $excluded_src ) ) {
281
- return $matches[0];
282
- }
283
-
284
- /**
285
- * Filter the LazyLoad placeholder on src attribute
286
- *
287
- * @since 1.1
288
- *
289
- * @param string $placeholder Placeholder that will be printed.
290
- */
291
- $placeholder = apply_filters( 'rocket_lazyload_placeholder', '' );
292
-
293
- $img = sprintf( '<img%1$s src="%4$s" data-lazy-src=%2$s%3$s>', $matches[1], $matches[2], $matches[3], $placeholder );
294
-
295
- $img_noscript = sprintf( '<noscript><img%1$s src=%2$s%3$s></noscript>', $matches[1], $matches[2], $matches[3] );
296
-
297
- /**
298
- * Filter the LazyLoad HTML output
299
- *
300
- * @since 1.0.2
301
- *
302
- * @param array $img Output that will be printed
303
- */
304
- $img = apply_filters( 'rocket_lazyload_html', $img, true );
305
-
306
- return $img . $img_noscript;
307
- }
308
-
309
- /**
310
- * Determine if the current image should be excluded from lazyload
311
- *
312
- * @since 1.1
313
- * @author Remy Perona
314
- *
315
- * @param string $string String to search.
316
- * @param array $excluded_values Array of excluded values to search in the string.
317
- * @return bool True if one of the excluded values was found, false otherwise
318
- */
319
- function rocket_is_excluded_lazyload( $string, $excluded_values ) {
320
- foreach ( $excluded_values as $excluded_value ) {
321
- if ( strpos( $string, $excluded_value ) !== false ) {
322
- return true;
323
- }
324
- }
325
- return false;
326
- }
327
-
328
- /**
329
- * Compatibility with images with srcset attribute
330
- *
331
- * @since 1.1
332
- * @author Geoffrey Crofte (code from WP Rocket plugin)
333
- *
334
- * @param string $html the HTML code to parse.
335
- * @return string the updated HTML code
336
- */
337
- function rocket_lazyload_on_srcset( $html ) {
338
- if ( preg_match( '/srcset=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))/i', $html ) ) {
339
- $html = str_replace( 'srcset=', 'data-lazy-srcset=', $html );
340
- }
341
-
342
- if ( preg_match( '/sizes=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))/i', $html ) ) {
343
- $html = str_replace( 'sizes=', 'data-lazy-sizes=', $html );
344
- }
345
-
346
- return $html;
347
- }
348
- add_filter( 'rocket_lazyload_html', 'rocket_lazyload_on_srcset' );
349
-
350
- /**
351
- * Applies lazyload on images displayed using wp_get_attachment_image()
352
- *
353
- * @since 1.4.8
354
- * @author Remy Perona
355
- *
356
- * @param array $attr Attributes for the image markup.
357
- * @return array
358
- */
359
- function rocket_lazyload_get_attachment_image( $attr ) {
360
- // Don't LazyLoad if the thumbnail is in admin, a feed, REST API or a post preview.
361
- if ( ! rocket_lazyload_get_option( 'images' ) || is_admin() || is_feed() || is_preview() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || empty( $attr ) || ( defined( 'DONOTLAZYLOAD' ) && DONOTLAZYLOAD ) || wp_script_is( 'twentytwenty-twentytwenty', 'enqueued' ) ) {
362
- return $attr;
363
- }
364
-
365
- // You can stop the LalyLoad process with a hook.
366
- if ( ! apply_filters( 'do_rocket_lazyload', true ) ) {
367
- return $attr;
368
- }
369
-
370
- $attr['data-lazy-src'] = $attr['src'];
371
- $attr['src'] = apply_filters( 'rocket_lazyload_placeholder', '' );
372
-
373
- if ( isset( $attr['srcset'] ) ) {
374
- $attr['data-lazy-srcset'] = $attr['srcset'];
375
- unset( $attr['srcset'] );
376
- }
377
-
378
- if ( isset( $attr['sizes'] ) ) {
379
- $attr['data-lazy-sizes'] = $attr['sizes'];
380
- unset( $attr['sizes'] );
381
- }
382
-
383
- return $attr;
384
- }
385
- add_filter( 'wp_get_attachment_image_attributes', 'rocket_lazyload_get_attachment_image', 11 );
386
-
387
- /**
388
- * Replace WordPress smilies by Lazy Load
389
- *
390
- * @since 1.0
391
- */
392
- function rocket_lazyload_smilies() {
393
- if ( ! rocket_lazyload_get_option( 'images' ) || ! apply_filters( 'do_rocket_lazyload', true ) ) {
394
- return;
395
- }
396
-
397
- remove_filter( 'the_content', 'convert_smilies' );
398
- remove_filter( 'the_excerpt', 'convert_smilies' );
399
- remove_filter( 'comment_text', 'convert_smilies', 20 );
400
-
401
- add_filter( 'the_content', 'rocket_convert_smilies' );
402
- add_filter( 'the_excerpt', 'rocket_convert_smilies' );
403
- add_filter( 'comment_text', 'rocket_convert_smilies', 20 );
404
- }
405
- add_action( 'init', 'rocket_lazyload_smilies' );
406
-
407
- /**
408
- * Convert text equivalent of smilies to images.
409
- *
410
- * @source convert_smilies() in /wp-includes/formattings.php
411
- * @since 1.0
412
- *
413
- * @param string $text Text to process.
414
- * @return string Modified text
415
- */
416
- function rocket_convert_smilies( $text ) {
417
- global $wp_smiliessearch;
418
-
419
- if ( ! get_option( 'use_smilies' ) || empty( $wp_smiliessearch ) ) {
420
- return $text;
421
- }
422
-
423
- $output = '';
424
- // HTML loop taken from texturize function, could possible be consolidated.
425
- $textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between.
426
- $stop = count( $textarr );// loop stuff.
427
-
428
- // Ignore proessing of specific tags.
429
- $tags_to_ignore = 'code|pre|style|script|textarea';
430
- $ignore_block_element = '';
431
-
432
- for ( $i = 0; $i < $stop; $i++ ) {
433
- $content = $textarr[ $i ];
434
-
435
- // If we're in an ignore block, wait until we find its closing tag.
436
- if ( '' === $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) ) {
437
- $ignore_block_element = $matches[1];
438
- }
439
-
440
- // If it's not a tag and not in ignore block.
441
- if ( '' === $ignore_block_element && strlen( $content ) > 0 && '<' !== $content[0] ) {
442
- $content = preg_replace_callback( $wp_smiliessearch, 'rocket_translate_smiley', $content );
443
- }
444
-
445
- // did we exit ignore block.
446
- if ( '' !== $ignore_block_element && '</' . $ignore_block_element . '>' === $content ) {
447
- $ignore_block_element = '';
448
- }
449
-
450
- $output .= $content;
451
- }
452
-
453
- return $output;
454
- }
455
-
456
- /**
457
- * Convert one smiley code to the icon graphic file equivalent.
458
- *
459
- * @source translate_smiley() in /wp-includes/formattings.php
460
- * @since 1.0
461
- *
462
- * @param array $matches An array of matching content.
463
- * @return string HTML code for smiley
464
  */
465
- function rocket_translate_smiley( $matches ) {
466
- global $wpsmiliestrans;
467
-
468
- if ( count( $matches ) === 0 ) {
469
- return '';
470
- }
471
-
472
- $smiley = trim( reset( $matches ) );
473
- $img = $wpsmiliestrans[ $smiley ];
474
-
475
- $matches = array();
476
- $ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
477
- $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
478
-
479
- // Don't convert smilies that aren't images - they're probably emoji.
480
- if ( ! in_array( $ext, $image_exts, true ) ) {
481
- return $img;
482
- }
483
-
484
- /**
485
- * Filter the Smiley image URL before it's used in the image element.
486
- *
487
- * @since 2.9.0
488
- *
489
- * @param string $smiley_url URL for the smiley image.
490
- * @param string $img Filename for the smiley image.
491
- * @param string $site_url Site URL, as returned by site_url().
492
- */
493
- $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
494
-
495
- // Don't LazyLoad if process is stopped for these reasons.
496
- if ( ! apply_filters( 'do_rocket_lazyload', true ) || is_feed() || is_preview() ) {
497
- return sprintf( ' <img src="%s" alt="%s" class="wp-smiley" /> ', esc_url( $src_url ), esc_attr( $smiley ) );
498
- }
499
 
500
- /** This filter is documented in inc/front/lazyload.php */
501
- $placeholder = apply_filters( 'rocket_lazyload_placeholder', '' );
 
502
 
503
- return sprintf( ' <img src="%s" data-lazy-src="%s" alt="%s" class="wp-smiley" /> ', $placeholder, esc_url( $src_url ), esc_attr( $smiley ) );
504
  }
505
 
506
- /**
507
- * Replace iframes by LazyLoad
508
- *
509
- * @since 1.1
510
- * @author Geoffrey Crofte (code from WP Rocket plugin)
511
- *
512
- * @param string $html the HTML code to parse.
513
- * @return string the updated HTML code
514
- */
515
- function rocket_lazyload_iframes( $html ) {
516
- // Don't LazyLoad if process is stopped for these reasons.
517
- if ( ! rocket_lazyload_get_option( 'iframes' ) || ! apply_filters( 'do_rocket_lazyload_iframes', true ) || is_feed() || is_preview() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || empty( $html ) || ( defined( 'DONOTLAZYLOAD' ) && DONOTLAZYLOAD ) ) {
518
- return $html;
519
- }
520
-
521
- preg_match_all( '/<iframe.*\ssrc=["|\'](.+)["|\'].*(>\s*<\/iframe>)/iU', $html, $matches, PREG_SET_ORDER );
522
-
523
- if ( empty( $matches ) ) {
524
- return $html;
525
- }
526
-
527
- foreach ( $matches as $iframe ) {
528
- // Don't mess with the Gravity Forms ajax iframe.
529
- if ( strpos( $iframe[0], 'gform_ajax_frame' ) ) {
530
- continue;
531
- }
532
-
533
- // Don't lazyload if iframe has data-no-lazy attribute.
534
- if ( strpos( $iframe[0], 'data-no-lazy=' ) ) {
535
- continue;
536
- }
537
-
538
- if ( rocket_lazyload_get_option( 'youtube' ) && false !== strpos( $iframe[1], 'youtube' ) ) {
539
- $youtube_id = rocket_lazyload_get_youtube_id_from_url( $iframe[1] );
540
 
541
- if ( ! $youtube_id ) {
542
- continue;
543
- }
 
 
 
 
 
544
 
545
- $query = wp_parse_url( $iframe[1], PHP_URL_QUERY );
546
-
547
- /**
548
- * Filter the LazyLoad HTML output on Youtube iframes
549
- *
550
- * @since 1.4.3
551
- *
552
- * @param array $html Output that will be printed.
553
- */
554
- $youtube_lazyload = apply_filters( 'rocket_lazyload_youtube_html', '<div class="rll-youtube-player" data-id="' . esc_attr( $youtube_id ) . '" data-query="' . esc_attr( $query ) . '"></div>' );
555
- $youtube_lazyload .= '<noscript>' . $iframe[0] . '</noscript>';
556
-
557
- $html = str_replace( $iframe[0], $youtube_lazyload, $html );
558
-
559
- continue;
560
- }
561
-
562
- /**
563
- * Filter the LazyLoad placeholder on src attribute
564
- *
565
- * @since 1.1
566
- *
567
- * @param string $placeholder placeholder that will be printed.
568
- */
569
- $placeholder = apply_filters( 'rocket_lazyload_placeholder', 'about:blank' );
570
-
571
- $iframe_noscript = '<noscript>' . $iframe[0] . '</noscript>';
572
-
573
- $iframe_lazyload = str_replace( $iframe[1], $placeholder, $iframe[0] );
574
-
575
- $iframe_lazyload = str_replace( $iframe[2], ' data-rocket-lazyload="fitvidscompatible" data-lazy-src="' . esc_url( $iframe[1] ) . '"' . $iframe[2], $iframe[0] );
576
- /**
577
- * Filter the LazyLoad HTML output on iframes
578
- *
579
- * @since 1.1
580
- *
581
- * @param array $html Output that will be printed.
582
- */
583
- $iframe_lazyload = apply_filters( 'rocket_lazyload_iframe_html', $iframe_lazyload );
584
- $iframe_lazyload .= $iframe_noscript;
585
-
586
- $html = str_replace( $iframe[0], $iframe_lazyload, $html );
587
- }
588
-
589
- return $html;
590
  }
591
- add_filter( 'the_content', 'rocket_lazyload_iframes', PHP_INT_MAX );
592
- add_filter( 'widget_text', 'rocket_lazyload_iframes', PHP_INT_MAX );
593
 
594
- /**
595
- * Gets youtube video ID from URL
596
- *
597
- * @author Remy Perona
598
- * @since 1.4
599
- *
600
- * @param string $url URL to parse.
601
- * @return string Youtube video id or false if none found.
602
- */
603
- function rocket_lazyload_get_youtube_id_from_url( $url ) {
604
- $pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be|youtube\.com|youtube-nocookie\.com)/(?:embed/|v/|watch/?\?v=)([\w-]{11})#iU';
605
- $result = preg_match( $pattern, $url, $matches );
606
-
607
- if ( ! $result ) {
608
- return false;
609
- }
610
-
611
- if ( 'videoseries' === $matches[1] ) {
612
- return false;
613
- }
614
-
615
- return $matches[1];
616
- }
3
  * Plugin Name: Lazy Load by WP Rocket
4
  * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
5
  * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
6
+ * Version: 2.0
7
  * Author: WP Media
8
  * Author URI: https://wp-rocket.me
9
  * Text Domain: rocket-lazy-load
10
  * Domain Path: /languages
11
  *
12
+ * Copyright 2015-2019 WP Media
13
  *
14
  * This program is free software; you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
25
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
 
28
+ defined('ABSPATH') || die('Cheatin\' uh?');
29
 
30
+ define('ROCKET_LL_VERSION', '2.0');
31
+ define('ROCKET_LL_WP_VERSION', '4.7');
32
+ define('ROCKET_LL_PHP_VERSION', '5.4');
33
+ define('ROCKET_LL_BASENAME', plugin_basename(__FILE__));
34
+ define('ROCKET_LL_PATH', realpath(plugin_dir_path(__FILE__)) . '/');
35
+ define('ROCKET_LL_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
36
+ define('ROCKET_LL_FRONT_JS_URL', ROCKET_LL_ASSETS_URL . 'js/');
37
+ define('ROCKET_LL_INT_MAX', PHP_INT_MAX - 15);
38
 
39
+ require ROCKET_LL_PATH . 'src/rocket-lazyload-requirements-check.php';
40
 
41
  /**
42
+ * Loads plugin translations
43
  *
44
+ * @since 2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  * @author Remy Perona
46
  *
47
+ * @return void
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  */
49
+ function rocket_lazyload_textdomain()
50
+ {
51
+ // Load translations from the languages directory.
52
+ $locale = get_locale();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
+ // This filter is documented in /wp-includes/l10n.php.
55
+ $locale = apply_filters('plugin_locale', $locale, 'rocket-lazy-load'); // WPCS: prefix ok.
56
+ load_textdomain('rocket-lazy-load', WP_LANG_DIR . '/plugins/rocket-lazy-load-' . $locale . '.mo');
57
 
58
+ load_plugin_textdomain('rocket-lazy-load', false, dirname(plugin_basename(__FILE__)) . '/languages/');
59
  }
60
 
61
+ add_action('plugins_loaded', 'rocket_lazyload_textdomain');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
+ $rocket_lazyload_requirement_checks = new Rocket_Lazyload_Requirements_Check(
64
+ array(
65
+ 'plugin_name' => 'Lazy Load by WP Rocket',
66
+ 'plugin_version' => ROCKET_LL_VERSION,
67
+ 'wp_version' => ROCKET_LL_WP_VERSION,
68
+ 'php_version' => ROCKET_LL_PHP_VERSION,
69
+ )
70
+ );
71
 
72
+ if ($rocket_lazyload_requirement_checks->check()) {
73
+ require ROCKET_LL_PATH . 'main.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
 
 
75
 
76
+ unset($rocket_lazyload_requirement_checks);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/Admin/AdminPage.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Admin;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ use RocketLazyLoadPlugin\Options\Options;
7
+ use RocketLazyLoadPlugin\Options\OptionArray;
8
+
9
+ /**
10
+ * Admin page configuration
11
+ *
12
+ * @since 2.0
13
+ * @author Remy Perona
14
+ */
15
+ class AdminPage
16
+ {
17
+ /**
18
+ * Plugin slug
19
+ *
20
+ * @since 2.0
21
+ * @author Remy Perona
22
+ *
23
+ * @var string
24
+ */
25
+ private $slug = 'rocket_lazyload';
26
+
27
+ /**
28
+ * Options instance
29
+ *
30
+ * @since 2.0
31
+ * @author Remy Perona
32
+ *
33
+ * @var Options
34
+ */
35
+ private $options;
36
+
37
+ /**
38
+ * OptionArray instance
39
+ *
40
+ * @since 2.0
41
+ * @author Remy Perona
42
+ *
43
+ * @var OptionArray
44
+ */
45
+ private $option_array;
46
+
47
+ /**
48
+ * Template path
49
+ *
50
+ * @since 2.0
51
+ * @author Remy Perona
52
+ *
53
+ * @var string
54
+ */
55
+ private $template_path;
56
+
57
+ /**
58
+ * Constructor
59
+ *
60
+ * @since 2.0
61
+ * @author Remy Perona
62
+ *
63
+ * @param Options $options Options instance.
64
+ * @param OptionArray $option_array OptionArray instance.
65
+ * @param string $template_path Template path.
66
+ */
67
+ public function __construct(Options $options, OptionArray $option_array, $template_path)
68
+ {
69
+ $this->options = $options;
70
+ $this->option_array = $option_array;
71
+ $this->template_path = $template_path;
72
+ }
73
+
74
+ /**
75
+ * Registers plugin settings with WordPress
76
+ *
77
+ * @since 2.0
78
+ * @author Remy Perona
79
+ *
80
+ * @return void
81
+ */
82
+ public function configure()
83
+ {
84
+ register_setting($this->getSlug(), $this->options->getOptionName('_options'));
85
+ }
86
+
87
+ /**
88
+ * Gets the settings page title
89
+ *
90
+ * @since 2.0
91
+ * @author Remy Perona
92
+ *
93
+ * @return string
94
+ */
95
+ public function getPageTitle()
96
+ {
97
+ return __('LazyLoad by WP Rocket', 'rocket-lazy-load');
98
+ }
99
+
100
+ /**
101
+ * Gets the settings submenu title
102
+ *
103
+ * @since 2.0
104
+ * @author Remy Perona
105
+ *
106
+ * @return string
107
+ */
108
+ public function getMenuTitle()
109
+ {
110
+ return __('LazyLoad', 'rocket-lazy-load');
111
+ }
112
+
113
+ /**
114
+ * Gets the plugin slug
115
+ *
116
+ * @since 2.0
117
+ * @author Remy Perona
118
+ *
119
+ * @return string
120
+ */
121
+ public function getSlug()
122
+ {
123
+ return $this->slug;
124
+ }
125
+
126
+ /**
127
+ * Gets the plugin required capability
128
+ *
129
+ * @since 2.0
130
+ * @author Remy Perona
131
+ *
132
+ * @return string
133
+ */
134
+ public function getCapability()
135
+ {
136
+ return 'manage_options';
137
+ }
138
+
139
+ /**
140
+ * Renders the admin page template
141
+ *
142
+ * @since 2.0
143
+ * @author Remy Perona
144
+ *
145
+ * @return void
146
+ */
147
+ public function renderPage()
148
+ {
149
+ $this->renderTemplate('admin-page');
150
+ }
151
+
152
+ /**
153
+ * Renders the given template if it's readable.
154
+ *
155
+ * @since 2.0
156
+ * @author Remy Perona
157
+ *
158
+ * @param string $template Template name.
159
+ */
160
+ protected function renderTemplate($template)
161
+ {
162
+ $template_path = $this->template_path . $template . '.php';
163
+
164
+ if (!is_readable($template_path)) {
165
+ return;
166
+ }
167
+
168
+ include $template_path;
169
+ }
170
+ }
src/Admin/ImagifyNotice.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Admin;
3
+
4
+ /**
5
+ * Imagify Notice display
6
+ *
7
+ * @since 2.0
8
+ * @author Remy Perona
9
+ */
10
+ class ImagifyNotice
11
+ {
12
+ /**
13
+ * Template path
14
+ *
15
+ * @since 2.0
16
+ * @author Remy Perona
17
+ *
18
+ * @var string
19
+ */
20
+ private $template_path;
21
+
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @since 2.0
26
+ * @author Remy Perona
27
+ *
28
+ * @param string $template_path Template path.
29
+ */
30
+ public function __construct($template_path)
31
+ {
32
+ $this->template_path = $template_path;
33
+ }
34
+
35
+ /**
36
+ * Renders the Imagify notice
37
+ *
38
+ * @since 2.0
39
+ * @author Remy Perona
40
+ *
41
+ * @return void
42
+ */
43
+ public function displayNotice()
44
+ {
45
+ $this->renderTemplate('imagify-notice');
46
+ }
47
+
48
+ /**
49
+ * Renders the given template if it's readable.
50
+ *
51
+ * @since 2.0
52
+ * @author Remy Perona
53
+ *
54
+ * @param string $template Template name.
55
+ */
56
+ protected function renderTemplate($template)
57
+ {
58
+ $template_path = $this->template_path . $template . '.php';
59
+
60
+ if (!is_readable($template_path)) {
61
+ return;
62
+ }
63
+
64
+ include $template_path;
65
+ }
66
+ }
src/EventManagement/EventManager.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\EventManagement;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ /**
7
+ * The event manager manages events using the WordPress plugin API.
8
+ *
9
+ * @since 3.1
10
+ * @author Carl Alexander <contact@carlalexander.ca>
11
+ */
12
+ class EventManager
13
+ {
14
+ /**
15
+ * Adds a callback to a specific hook of the WordPress plugin API.
16
+ *
17
+ * @uses add_filter()
18
+ *
19
+ * @param string $hook_name Name of the hook.
20
+ * @param callable $callback Callback function.
21
+ * @param int $priority Priority.
22
+ * @param int $accepted_args Number of arguments.
23
+ */
24
+ public function addCallback($hook_name, $callback, $priority = 10, $accepted_args = 1)
25
+ {
26
+ add_filter($hook_name, $callback, $priority, $accepted_args);
27
+ }
28
+
29
+ /**
30
+ * Add an event subscriber.
31
+ *
32
+ * The event manager registers all the hooks that the given subscriber
33
+ * wants to register with the WordPress Plugin API.
34
+ *
35
+ * @param SubscriberInterface $subscriber SubscriberInterface implementation.
36
+ */
37
+ public function addSubscriber(SubscriberInterface $subscriber)
38
+ {
39
+ if ($subscriber instanceof EventManagerAwareSubscriberInterface) {
40
+ $subscriber->setEventManager($this);
41
+ }
42
+
43
+ foreach ($subscriber->getSubscribedEvents() as $hook_name => $parameters) {
44
+ $this->addSubscriberCallback($subscriber, $hook_name, $parameters);
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Checks the WordPress plugin API to see if the given hook has
50
+ * the given callback. The priority of the callback will be returned
51
+ * or false. If no callback is given will return true or false if
52
+ * there's any callbacks registered to the hook.
53
+ *
54
+ * @uses has_filter()
55
+ *
56
+ * @param string $hook_name Hook name.
57
+ * @param mixed $callback Callback.
58
+ *
59
+ * @return bool|int
60
+ */
61
+ public function hasCallback($hook_name, $callback = false)
62
+ {
63
+ return has_filter($hook_name, $callback);
64
+ }
65
+
66
+ /**
67
+ * Removes the given callback from the given hook. The WordPress plugin API only
68
+ * removes the hook if the callback and priority match a registered hook.
69
+ *
70
+ * @uses remove_filter()
71
+ *
72
+ * @param string $hook_name Hook name.
73
+ * @param callable $callback Callback.
74
+ * @param int $priority Priority.
75
+ *
76
+ * @return bool
77
+ */
78
+ public function removeCallback($hook_name, $callback, $priority = 10)
79
+ {
80
+ return remove_filter($hook_name, $callback, $priority);
81
+ }
82
+
83
+ /**
84
+ * Remove an event subscriber.
85
+ *
86
+ * The event manager removes all the hooks that the given subscriber
87
+ * wants to register with the WordPress Plugin API.
88
+ *
89
+ * @param SubscriberInterface $subscriber SubscriberInterface implementation.
90
+ */
91
+ public function removeSubscriber(SubscriberInterface $subscriber)
92
+ {
93
+ foreach ($subscriber->getSubscribedEvents() as $hook_name => $parameters) {
94
+ $this->removeSubscriberCallback($subscriber, $hook_name, $parameters);
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Adds the given subscriber's callback to a specific hook
100
+ * of the WordPress plugin API.
101
+ *
102
+ * @param SubscriberInterface $subscriber SubscriberInterface implementation.
103
+ * @param string $hook_name Hook name.
104
+ * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array.
105
+ */
106
+ private function addSubscriberCallback(SubscriberInterface $subscriber, $hook_name, $parameters)
107
+ {
108
+ if (is_string($parameters)) {
109
+ $this->addCallback($hook_name, [ $subscriber, $parameters ]);
110
+ } elseif (is_array($parameters) && count($parameters) !== count($parameters, COUNT_RECURSIVE)) {
111
+ foreach ($parameters as $parameter) {
112
+ $this->addSubscriberCallback($subscriber, $hook_name, $parameter);
113
+ }
114
+ } elseif (is_array($parameters) && isset($parameters[0])) {
115
+ $this->addCallback($hook_name, [ $subscriber, $parameters[0] ], isset($parameters[1]) ? $parameters[1] : 10, isset($parameters[2]) ? $parameters[2] : 1);
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Removes the given subscriber's callback to a specific hook
121
+ * of the WordPress plugin API.
122
+ *
123
+ * @param SubscriberInterface $subscriber SubscriberInterface implementation.
124
+ * @param string $hook_name Hook name.
125
+ * @param mixed $parameters Parameters, can be a string, an array or a multidimensional array.
126
+ */
127
+ private function removeSubscriberCallback(SubscriberInterface $subscriber, $hook_name, $parameters)
128
+ {
129
+ if (is_string($parameters)) {
130
+ $this->removeCallback($hook_name, [ $subscriber, $parameters ]);
131
+ } elseif (is_array($parameters) && count($parameters) !== count($parameters, COUNT_RECURSIVE)) {
132
+ foreach ($parameters as $parameter) {
133
+ $this->removeSubscriberCallback($subscriber, $hook_name, $parameter);
134
+ }
135
+ } elseif (is_array($parameters) && isset($parameters[0])) {
136
+ $this->removeCallback($hook_name, [ $subscriber, $parameters[0] ], isset($parameters[1]) ? $parameters[1] : 10);
137
+ }
138
+ }
139
+ }
src/EventManagement/EventManagerAwareSubscriberInterface.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\EventManagement;
3
+
4
+ interface EventManagerAwareSubscriberInterface extends SubscriberInterface
5
+ {
6
+ /**
7
+ * Set the WordPress event manager for the subscriber.
8
+ *
9
+ * @since 3.1
10
+ * @author Remy Perona
11
+ *
12
+ * @param EventManager $event_manager EventManager instance.
13
+ */
14
+ public function setEventManager(EventManager $event_manager);
15
+ }
src/EventManagement/SubscriberInterface.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\EventManagement;
3
+
4
+ /**
5
+ * A Subscriber knows what specific WordPress events it wants to listen to.
6
+ *
7
+ * When an EventManager adds a Subscriber, it gets all the WordPress events that
8
+ * it wants to listen to. It then adds the subscriber as a listener for each of them.
9
+ *
10
+ * @author Carl Alexander <contact@carlalexander.ca>
11
+ */
12
+ interface SubscriberInterface
13
+ {
14
+ /**
15
+ * Returns an array of events that this subscriber wants to listen to.
16
+ *
17
+ * The array key is the event name. The value can be:
18
+ *
19
+ * * The method name
20
+ * * An array with the method name and priority
21
+ * * An array with the method name, priority and number of accepted arguments
22
+ *
23
+ * For instance:
24
+ *
25
+ * * array('hook_name' => 'method_name')
26
+ * * array('hook_name' => array('method_name', $priority))
27
+ * * array('hook_name' => array('method_name', $priority, $accepted_args))
28
+ * * array('hook_name' => array(array('method_name_1', $priority_1, $accepted_args_1)), array('method_name_2', $priority_2, $accepted_args_2)))
29
+ *
30
+ * @return array
31
+ */
32
+ public function getSubscribedEvents();
33
+ }
src/Options/AbstractOptions.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Options;
3
+
4
+ /**
5
+ * Manages options using the WordPress options API.
6
+ *
7
+ * @since 2.0
8
+ * @author Remy Perona
9
+ */
10
+ abstract class AbstractOptions
11
+ {
12
+ /**
13
+ * Gets the option for the given name. Returns the default value if the value does not exist.
14
+ *
15
+ * @since 2.0
16
+ * @author Remy Perona
17
+ *
18
+ * @param string $name Name of the option to get.
19
+ * @param mixed $default Default value to return if the value does not exist.
20
+ *
21
+ * @return mixed
22
+ */
23
+ abstract public function get($name, $default = null);
24
+
25
+ /**
26
+ * Sets the value of an option. Update the value if the option for the given name already exists.
27
+ *
28
+ * @since 2.0
29
+ * @author Remy Perona
30
+ * @param string $name Name of the option to set.
31
+ * @param mixed $value Value to set for the option.
32
+ *
33
+ * @return void
34
+ */
35
+ abstract public function set($name, $value);
36
+
37
+ /**
38
+ * Deletes the option with the given name.
39
+ *
40
+ * @since 2.0
41
+ * @author Remy Perona
42
+ *
43
+ * @param string $name Name of the option to delete.
44
+ *
45
+ * @return void
46
+ */
47
+ abstract public function delete($name);
48
+
49
+ /**
50
+ * Checks if the option with the given name exists.
51
+ *
52
+ * @since 2.0
53
+ * @author Remy Perona
54
+ *
55
+ * @param string $name Name of the option to check.
56
+ *
57
+ * @return boolean True if the option exists, false otherwise
58
+ */
59
+ public function has($name)
60
+ {
61
+ return null !== $this->get($name);
62
+ }
63
+ }
src/Options/OptionArray.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Options;
3
+
4
+ /**
5
+ * Manages the data inside an option.
6
+ *
7
+ * @since 2.0
8
+ * @author Remy Perona
9
+ */
10
+ class OptionArray
11
+ {
12
+ /**
13
+ * Option data
14
+ *
15
+ * @var Array Array of data inside the option
16
+ */
17
+ private $options;
18
+
19
+ /**
20
+ * Constructor
21
+ *
22
+ * @param Array $options Array of data coming from an option.
23
+ */
24
+ public function __construct($options)
25
+ {
26
+ $this->options = $options;
27
+ }
28
+
29
+ /**
30
+ * Checks if the provided key exists in the option data array.
31
+ *
32
+ * @since 2.0
33
+ * @author Remy Perona
34
+ *
35
+ * @param string $key key name.
36
+ * @return boolean
37
+ */
38
+ public function has($key)
39
+ {
40
+ return isset($this->options[ $key ]);
41
+ }
42
+
43
+ /**
44
+ * Gets the value associated with a specific key.
45
+ *
46
+ * @since 2.0
47
+ * @author Remy Perona
48
+ *
49
+ * @param string $key key name.
50
+ * @param mixed $default default value to return if key doesn't exist.
51
+ * @return mixed
52
+ */
53
+ public function get($key, $default = '')
54
+ {
55
+ if (! $this->has($key)) {
56
+ return $default;
57
+ }
58
+
59
+ return $this->options[ $key ];
60
+ }
61
+
62
+ /**
63
+ * Sets the value associated with a specific key.
64
+ *
65
+ * @since 2.0
66
+ * @author Remy Perona
67
+ *
68
+ * @param string $key key name.
69
+ * @param mixed $value Value to set.
70
+ * @return void
71
+ */
72
+ public function set($key, $value)
73
+ {
74
+ $this->options[ $key ] = $value;
75
+ }
76
+
77
+ /**
78
+ * Sets multiple values.
79
+ *
80
+ * @since 2.0
81
+ * @author Remy Perona
82
+ *
83
+ * @param array $options An array of key/value pairs to set.
84
+ * @return void
85
+ */
86
+ public function setValues($options)
87
+ {
88
+ foreach ($options as $key => $value) {
89
+ $this->set($key, $value);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Gets the option array.
95
+ *
96
+ * @since 2.0
97
+ * @author Remy Perona
98
+ *
99
+ * @return array
100
+ */
101
+ public function getOptions()
102
+ {
103
+ return $this->options;
104
+ }
105
+ }
src/Options/Options.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Options;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ class Options extends AbstractOptions
7
+ {
8
+ /**
9
+ * The prefix used by Rocket Lazyload options.
10
+ *
11
+ * @since 2.0
12
+ * @author Remy Perona
13
+ *
14
+ * @var string
15
+ */
16
+ private $prefix;
17
+
18
+ /**
19
+ * Constructor
20
+ *
21
+ * @since 2.0
22
+ * @author Remy Perona
23
+ *
24
+ * @param string $prefix options prefix.
25
+ */
26
+ public function __construct($prefix = '')
27
+ {
28
+ $this->prefix = $prefix;
29
+ }
30
+
31
+ /**
32
+ * Gets the option name used to store the option in the WordPress database.
33
+ *
34
+ * @since 2.0
35
+ * @author Remy Perona
36
+ *
37
+ * @param string $name Unprefixed name of the option.
38
+ *
39
+ * @return string
40
+ */
41
+ public function getOptionName($name)
42
+ {
43
+ return $this->prefix . $name;
44
+ }
45
+
46
+ /**
47
+ * Gets the option for the given name. Returns the default value if the value does not exist.
48
+ *
49
+ * @since 2.0
50
+ * @author Remy Perona
51
+ *
52
+ * @param string $name Name of the option to get.
53
+ * @param mixed $default Default value to return if the value does not exist.
54
+ *
55
+ * @return mixed
56
+ */
57
+ public function get($name, $default = null)
58
+ {
59
+ $option = get_option($this->getOptionName($name), $default);
60
+
61
+ if (is_array($default) && ! is_array($option)) {
62
+ $option = (array) $option;
63
+ }
64
+
65
+ return $option;
66
+ }
67
+
68
+ /**
69
+ * Sets the value of an option. Update the value if the option for the given name already exists.
70
+ *
71
+ * @since 2.0
72
+ * @author Remy Perona
73
+ * @param string $name Name of the option to set.
74
+ * @param mixed $value Value to set for the option.
75
+ *
76
+ * @return void
77
+ */
78
+ public function set($name, $value)
79
+ {
80
+ update_option($this->getOptionName($name), $value);
81
+ }
82
+
83
+ /**
84
+ * Deletes the option with the given name.
85
+ *
86
+ * @since 2.0
87
+ * @author Remy Perona
88
+ *
89
+ * @param string $name Name of the option to delete.
90
+ *
91
+ * @return void
92
+ */
93
+ public function delete($name)
94
+ {
95
+ delete_option($this->getOptionName($name));
96
+ }
97
+ }
src/Plugin.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin;
3
+
4
+ use League\Container\Container;
5
+ use RocketLazyLoadPlugin\EventManagement\EventManager;
6
+ use RocketLazyLoadPlugin\Options\Options;
7
+
8
+ /**
9
+ * Plugin initialize
10
+ *
11
+ * @since 2.0
12
+ * @author Remy Perona
13
+ */
14
+ class Plugin
15
+ {
16
+ /**
17
+ * Is the plugin loaded
18
+ *
19
+ * @since 2.0
20
+ * @author Remy Perona
21
+ *
22
+ * @var boolean
23
+ */
24
+ private $loaded = false;
25
+
26
+ /**
27
+ * Checks if the plugin is loaded
28
+ *
29
+ * @since 2.0
30
+ * @author Remy Perona
31
+ *
32
+ * @return boolean
33
+ */
34
+ private function isLoaded()
35
+ {
36
+ return $this->loaded;
37
+ }
38
+
39
+ /**
40
+ * Loads the plugin in WordPress
41
+ *
42
+ * @since 2.0
43
+ * @author Remy Perona
44
+ *
45
+ * @return void
46
+ */
47
+ public function load()
48
+ {
49
+ if ($this->isLoaded()) {
50
+ return;
51
+ }
52
+
53
+ $container = new Container;
54
+
55
+ $container->add('template_path', ROCKET_LL_PATH . 'views/');
56
+ $container->add('plugin_basename', ROCKET_LL_BASENAME);
57
+
58
+ $container->add('options', function () {
59
+ return new Options('rocket_lazyload');
60
+ });
61
+
62
+ $container->add('event_manager', function () {
63
+ return new EventManager();
64
+ });
65
+
66
+ $service_providers = [
67
+ 'RocketLazyLoadPlugin\ServiceProvider\OptionServiceProvider',
68
+ 'RocketLazyLoadPlugin\ServiceProvider\AdminServiceProvider',
69
+ 'RocketLazyLoadPlugin\ServiceProvider\ImagifyNoticeServiceProvider',
70
+ 'RocketLazyLoadPlugin\ServiceProvider\LazyloadServiceProvider',
71
+ 'RocketLazyLoadPlugin\ServiceProvider\SubscribersServiceProvider'
72
+ ];
73
+
74
+ foreach ($service_providers as $service) {
75
+ $container->addServiceProvider($service);
76
+ }
77
+
78
+ $subscribers = [
79
+ 'RocketLazyLoadPlugin\Subscriber\ThirdParty\AMPSubscriber',
80
+ 'RocketLazyLoadPlugin\Subscriber\AdminPageSubscriber',
81
+ 'RocketLazyLoadPlugin\Subscriber\ImagifyNoticeSubscriber',
82
+ 'RocketLazyLoadPlugin\Subscriber\LazyloadSubscriber',
83
+ ];
84
+
85
+ foreach ($subscribers as $subscriber) {
86
+ $container->get('event_manager')->addSubscriber($container->get($subscriber));
87
+ }
88
+
89
+ $this->loaded = true;
90
+ }
91
+ }
src/ServiceProvider/AdminServiceProvider.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\ServiceProvider;
3
+
4
+ use League\Container\ServiceProvider\AbstractServiceProvider;
5
+
6
+ /**
7
+ * Adds the admin page to the container
8
+ *
9
+ * @since 2.0
10
+ * @author Remy Perona
11
+ */
12
+ class AdminServiceProvider extends AbstractServiceProvider
13
+ {
14
+ /**
15
+ * Data provided by the service provider
16
+ *
17
+ * @since 2.0
18
+ * @author Remy Perona
19
+ *
20
+ * @var array
21
+ */
22
+ protected $provides = [
23
+ 'RocketLazyLoadPlugin\Admin\AdminPage',
24
+ ];
25
+
26
+ /**
27
+ * Registers the admin page in the container
28
+ *
29
+ * @since 2.0
30
+ * @author Remy Perona
31
+ *
32
+ * @return void
33
+ */
34
+ public function register()
35
+ {
36
+ $this->getContainer()->add('RocketLazyLoadPlugin\Admin\AdminPage')
37
+ ->withArgument($this->getContainer()->get('options'))
38
+ ->withArgument($this->getContainer()->get('RocketLazyLoadPlugin\Options\OptionArray'))
39
+ ->withArgument($this->getContainer()->get('template_path'));
40
+ }
41
+ }
src/ServiceProvider/ImagifyNoticeServiceProvider.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\ServiceProvider;
3
+
4
+ use League\Container\ServiceProvider\AbstractServiceProvider;
5
+
6
+ /**
7
+ * Adds the Imagify notice to the container
8
+ *
9
+ * @since 2.0
10
+ * @author Remy Perona
11
+ */
12
+ class ImagifyNoticeServiceProvider extends AbstractServiceProvider
13
+ {
14
+ /**
15
+ * Data provided by the service provider
16
+ *
17
+ * @since 2.0
18
+ * @author Remy Perona
19
+ *
20
+ * @var array
21
+ */
22
+ protected $provides = [
23
+ 'RocketLazyLoadPlugin\Admin\ImagifyNotice',
24
+ ];
25
+
26
+ /**
27
+ * Registers the Imagify notice in the container
28
+ *
29
+ * @since 2.0
30
+ * @author Remy Perona
31
+ *
32
+ * @return void
33
+ */
34
+ public function register()
35
+ {
36
+ $this->getContainer()->add('RocketLazyLoadPlugin\Admin\ImagifyNotice')
37
+ ->withArgument($this->getContainer()->get('template_path'));
38
+ }
39
+ }
src/ServiceProvider/LazyloadServiceProvider.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\ServiceProvider;
3
+
4
+ use League\Container\ServiceProvider\AbstractServiceProvider;
5
+
6
+ /**
7
+ * Adds the lazyload library to the container
8
+ *
9
+ * @since 2.0
10
+ * @author Remy Perona
11
+ */
12
+ class LazyloadServiceProvider extends AbstractServiceProvider
13
+ {
14
+ /**
15
+ * Data provided by the service provider
16
+ *
17
+ * @since 2.0
18
+ * @author Remy Perona
19
+ *
20
+ * @var array
21
+ */
22
+ protected $provides = [
23
+ 'RocketLazyload\Assets',
24
+ 'RocketLazyload\Image',
25
+ 'RocketLazyload\Iframe',
26
+ ];
27
+
28
+ /**
29
+ * Registers the lazyload library in the container
30
+ *
31
+ * @since 2.0
32
+ * @author Remy Perona
33
+ *
34
+ * @return void
35
+ */
36
+ public function register()
37
+ {
38
+ $this->getContainer()->add('RocketLazyload\Assets');
39
+ $this->getContainer()->add('RocketLazyload\Image');
40
+ $this->getContainer()->add('RocketLazyload\Iframe');
41
+ }
42
+ }
src/ServiceProvider/OptionServiceProvider.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\ServiceProvider;
3
+
4
+ use League\Container\ServiceProvider\AbstractServiceProvider;
5
+
6
+ /**
7
+ * Adds the option array to the container
8
+ *
9
+ * @since 2.0
10
+ * @author Remy Perona
11
+ */
12
+ class OptionServiceProvider extends AbstractServiceProvider
13
+ {
14
+ /**
15
+ * Data provided by the service provider
16
+ *
17
+ * @since 2.0
18
+ * @author Remy Perona
19
+ *
20
+ * @var array
21
+ */
22
+ protected $provides = [
23
+ 'RocketLazyLoadPlugin\Options\OptionArray',
24
+ ];
25
+
26
+ /**
27
+ * Registers the option array in the container
28
+ *
29
+ * @since 2.0
30
+ * @author Remy Perona
31
+ *
32
+ * @return void
33
+ */
34
+ public function register()
35
+ {
36
+ $this->getContainer()->add('RocketLazyLoadPlugin\Options\OptionArray')
37
+ ->withArgument($this->getContainer()->get('options')->get('_options'));
38
+ }
39
+ }
src/ServiceProvider/SubscribersServiceProvider.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\ServiceProvider;
3
+
4
+ use League\Container\ServiceProvider\AbstractServiceProvider;
5
+
6
+ /**
7
+ * Adds the subscribers to the container
8
+ *
9
+ * @since 2.0
10
+ * @author Remy Perona
11
+ */
12
+ class SubscribersServiceProvider extends AbstractServiceProvider
13
+ {
14
+ /**
15
+ * Data provided by the service provider
16
+ *
17
+ * @since 2.0
18
+ * @author Remy Perona
19
+ *
20
+ * @var array
21
+ */
22
+ protected $provides = [
23
+ 'RocketLazyLoadPlugin\Subscriber\ThirdParty\AMPSubscriber',
24
+ 'RocketLazyLoadPlugin\Subscriber\AdminPageSubscriber',
25
+ 'RocketLazyLoadPlugin\Subscriber\ImagifyNoticeSubscriber',
26
+ 'RocketLazyLoadPlugin\Subscriber\LazyloadSubscriber',
27
+ ];
28
+
29
+ /**
30
+ * Registers the subscribers in the container
31
+ *
32
+ * @since 2.0
33
+ * @author Remy Perona
34
+ *
35
+ * @return void
36
+ */
37
+ public function register()
38
+ {
39
+ $this->getContainer()->add('RocketLazyLoadPlugin\Subscriber\ThirdParty\AMPSubscriber');
40
+
41
+ $this->getContainer()->add('RocketLazyLoadPlugin\Subscriber\AdminPageSubscriber')
42
+ ->withArgument($this->getContainer()->get('RocketLazyLoadPlugin\Admin\AdminPage'))
43
+ ->withArgument($this->getContainer()->get('plugin_basename'));
44
+
45
+ $this->getContainer()->add('RocketLazyLoadPlugin\Subscriber\ImagifyNoticeSubscriber')
46
+ ->withArgument($this->getContainer()->get('RocketLazyLoadPlugin\Admin\ImagifyNotice'));
47
+
48
+ $this->getContainer()->add('RocketLazyLoadPlugin\Subscriber\LazyloadSubscriber')
49
+ ->withArgument($this->getContainer()->get('RocketLazyLoadPlugin\Options\OptionArray'))
50
+ ->withArgument($this->getContainer()->get('RocketLazyload\Assets'))
51
+ ->withArgument($this->getContainer()->get('RocketLazyload\Image'))
52
+ ->withArgument($this->getContainer()->get('RocketLazyload\Iframe'));
53
+ }
54
+ }
src/Subscriber/AdminPageSubscriber.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Subscriber;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ use RocketLazyLoadPlugin\EventManagement\SubscriberInterface;
7
+ use RocketLazyLoadPlugin\Admin\AdminPage;
8
+
9
+ /**
10
+ * Admin Page Subscriber
11
+ *
12
+ * @since 2.0
13
+ * @author Remy Perona
14
+ */
15
+ class AdminPageSubscriber implements SubscriberInterface
16
+ {
17
+ /**
18
+ * AdminPage instance
19
+ *
20
+ * @since 2.0
21
+ * @author Remy Perona
22
+ *
23
+ * @var AdminPage
24
+ */
25
+ private $page;
26
+
27
+ /**
28
+ * Plugin basename
29
+ *
30
+ * @since 2.0
31
+ * @author Remy Perona
32
+ *
33
+ * @var string
34
+ */
35
+ private $plugin_basename;
36
+
37
+ /**
38
+ * Constructor
39
+ *
40
+ * @since 2.0
41
+ * @author Remy Perona
42
+ *
43
+ * @param AdminPage $page AdminPage instance.
44
+ * @param string $plugin_basename Plugin basename.
45
+ */
46
+ public function __construct(AdminPage $page, $plugin_basename)
47
+ {
48
+ $this->page = $page;
49
+ $this->plugin_basename = $plugin_basename;
50
+ }
51
+
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ public function getSubscribedEvents()
56
+ {
57
+ return [
58
+ 'admin_init' => 'configure',
59
+ 'admin_menu' => 'addAdminPage',
60
+ 'plugin_action_links_' . $this->plugin_basename => 'addPluginPageLink',
61
+ 'admin_enqueue_scripts' => 'enqueueAdminStyle',
62
+ ];
63
+ }
64
+
65
+ /**
66
+ * Registers the plugin settings in WordPress
67
+ *
68
+ * @since 2.0
69
+ * @author Remy Perona
70
+ *
71
+ * @return void
72
+ */
73
+ public function configure()
74
+ {
75
+ $this->page->configure();
76
+ }
77
+
78
+ /**
79
+ * Adds the admin page to the settings menu
80
+ *
81
+ * @since 2.0
82
+ * @author Remy Perona
83
+ *
84
+ * @return void
85
+ */
86
+ public function addAdminPage()
87
+ {
88
+ add_options_page(
89
+ $this->page->getPageTitle(),
90
+ $this->page->getMenuTitle(),
91
+ $this->page->getCapability(),
92
+ $this->page->getSlug(),
93
+ [ $this->page, 'renderPage' ]
94
+ );
95
+ }
96
+
97
+ /**
98
+ * Adds a link to the plugin settings on the plugins page
99
+ *
100
+ * @since 2.0
101
+ * @author Remy Perona
102
+ *
103
+ * @param array $actions Actions for the plugin.
104
+ * @return array
105
+ */
106
+ public function addPluginPageLink($actions)
107
+ {
108
+ array_unshift(
109
+ $actions,
110
+ sprintf(
111
+ '<a href="%s">%s</a>',
112
+ admin_url('options-general.php?page=' . $this->page->getSlug()),
113
+ __('Settings', 'rocket-lazy-load')
114
+ )
115
+ );
116
+
117
+ return $actions;
118
+ }
119
+
120
+ /**
121
+ * Enqueue the css for the option page
122
+ *
123
+ * @since 2.0
124
+ * @author Remy Perona
125
+ *
126
+ * @param string $hook_suffix Current page hook.
127
+ */
128
+ public function enqueueAdminStyle($hook_suffix)
129
+ {
130
+ if ('settings_page_rocket_lazyload' !== $hook_suffix) {
131
+ return;
132
+ }
133
+
134
+ wp_enqueue_style('rocket-lazyload', ROCKET_LL_ASSETS_URL . 'css/admin.css', null, ROCKET_LL_VERSION);
135
+ }
136
+ }
src/Subscriber/ImagifyNoticeSubscriber.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Subscriber;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ use RocketLazyLoadPlugin\EventManagement\SubscriberInterface;
7
+ use RocketLazyLoadPlugin\Admin\ImagifyNotice;
8
+
9
+ /**
10
+ * Imagify Notice Subscriber
11
+ *
12
+ * @since 2.0
13
+ * @author Remy Perona
14
+ */
15
+ class ImagifyNoticeSubscriber implements SubscriberInterface
16
+ {
17
+ /**
18
+ * ImagifyNotice instance
19
+ *
20
+ * @since 2.0
21
+ * @author Remy Perona
22
+ *
23
+ * @var ImagifyNotice
24
+ */
25
+ private $imagify_notice;
26
+
27
+ /**
28
+ * Constructor
29
+ *
30
+ * @since 2.0
31
+ * @author Remy Perona
32
+ *
33
+ * @param ImagifyNotice $imagify_notice ImagifyNotice instance.
34
+ */
35
+ public function __construct(ImagifyNotice $imagify_notice)
36
+ {
37
+ $this->imagify_notice = $imagify_notice;
38
+ }
39
+
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ public function getSubscribedEvents()
44
+ {
45
+ return [
46
+ 'admin_notices' => 'imagifyNotice',
47
+ 'admin_footer-settings_page_rocket_lazyload' => 'dismissNoticeJS',
48
+ 'wp_ajax_rocket_lazyload_ignore' => 'dismissBoxes',
49
+ 'admin_post_rocket_lazyload_ignore' => 'dismissBoxes',
50
+ ];
51
+ }
52
+
53
+ /**
54
+ * Displays the Imagify notice
55
+ *
56
+ * @since 2.0
57
+ * @author Remy Perona
58
+ *
59
+ * @return void
60
+ */
61
+ public function imagifyNotice()
62
+ {
63
+ $current_screen = get_current_screen();
64
+
65
+ if ('admin_notices' === current_filter() && (isset($current_screen) && 'settings_page_rocket_lazyload' !== $current_screen->base)) {
66
+ return;
67
+ }
68
+
69
+ $boxes = get_user_meta(get_current_user_id(), 'rocket_lazyload_boxes', true);
70
+
71
+ if (defined('IMAGIFY_VERSION') || in_array('rocket_lazyload_imagify_notice', (array) $boxes, true) || 1 === get_option('rocket_lazyload_dismiss_imagify_notice') || ! current_user_can('manage_options')) {
72
+ return;
73
+ }
74
+
75
+ $this->imagify_notice->displayNotice();
76
+ }
77
+
78
+ /**
79
+ * Inserts the javascript to dismiss the notice
80
+ *
81
+ * @since 2.0
82
+ * @author Remy Perona
83
+ *
84
+ * @return void
85
+ */
86
+ public function dismissNoticeJS()
87
+ {
88
+ echo "<script>
89
+ jQuery( document ).ready( function( $ ){
90
+ $( '.rktll-cross' ).on( 'click', function( e ) {
91
+ e.preventDefault();
92
+ var url = $( this ).attr( 'href' ).replace( 'admin-post', 'admin-ajax' );
93
+ $.get( url ).done( $( this ).parent().hide( 'slow' ) );
94
+ });
95
+ } );
96
+ </script>";
97
+ }
98
+
99
+ /**
100
+ * Saves the dismiss for the user
101
+ *
102
+ * @since 2.0
103
+ * @author Remy Perona
104
+ *
105
+ * @return void
106
+ */
107
+ public function dismissBoxes()
108
+ {
109
+ if (! isset($_GET['box'], $_GET['action'], $_GET['_wpnonce'])) {
110
+ return;
111
+ }
112
+
113
+ if (! wp_verify_nonce($_GET['_wpnonce'], $_GET['action'] . '_' . $_GET['box'])) {
114
+ if (defined('DOING_AJAX')) {
115
+ wp_send_json(array('error' => 1));
116
+ } else {
117
+ wp_nonce_ays('');
118
+ }
119
+ }
120
+
121
+ if ('rocket_lazyload_imagify_notice' === $_GET['box']) {
122
+ update_option('rocket_lazyload_dismiss_imagify_notice', 0);
123
+ }
124
+
125
+ $actual = get_user_meta(get_current_user_id(), 'rocket_lazyload_boxes', true);
126
+ $actual = array_merge((array) $actual, array( $_GET['box'] ));
127
+ $actual = array_filter($actual);
128
+ $actual = array_unique($actual);
129
+
130
+ update_user_meta(get_current_user_id(), 'rocket_lazyload_boxes', $actual);
131
+ delete_transient($_GET['box']);
132
+
133
+ if (empty($GLOBALS['pagenow']) || 'admin-post.php' !== $GLOBALS['pagenow']) {
134
+ return;
135
+ }
136
+
137
+ if (defined('DOING_AJAX')) {
138
+ wp_send_json(array('error' => 0));
139
+ } else {
140
+ wp_safe_redirect(esc_url_raw(wp_get_referer()));
141
+ die();
142
+ }
143
+ }
144
+ }
src/Subscriber/LazyloadSubscriber.php ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Subscriber;
3
+
4
+ defined('ABSPATH') || die('Cheatin\' uh?');
5
+
6
+ use RocketLazyLoadPlugin\EventManagement\SubscriberInterface;
7
+ use RocketLazyLoadPlugin\Options\OptionArray;
8
+ use RocketLazyload\Assets;
9
+ use RocketLazyload\Image;
10
+ use RocketLazyload\Iframe;
11
+
12
+ /**
13
+ * Lazyload Subscriber
14
+ *
15
+ * @since 2.0
16
+ * @author Remy Perona
17
+ */
18
+ class LazyloadSubscriber implements SubscriberInterface
19
+ {
20
+ /**
21
+ * OptionArray instance
22
+ *
23
+ * @since 2.0
24
+ * @author Remy Perona
25
+ *
26
+ * @var OptionArray
27
+ */
28
+ private $option_array;
29
+
30
+ /**
31
+ * Assets instance
32
+ *
33
+ * @since 2.0
34
+ * @author Remy Perona
35
+ *
36
+ * @var Assets
37
+ */
38
+ private $assets;
39
+
40
+ /**
41
+ * Image instance
42
+ *
43
+ * @since 2.0
44
+ * @author Remy Perona
45
+ *
46
+ * @var Image
47
+ */
48
+ private $image;
49
+
50
+ /**
51
+ * Iframe instance
52
+ *
53
+ * @since 2.0
54
+ * @author Remy Perona
55
+ *
56
+ * @var Iframe
57
+ */
58
+ private $iframe;
59
+
60
+ /**
61
+ * Constructor
62
+ *
63
+ * @since 2.0
64
+ * @author Remy Perona
65
+ *
66
+ * @param OptionArray $option_array OptionArray instance.
67
+ * @param Assets $assets Assets instance.
68
+ * @param Image $image Image instance.
69
+ * @param Iframe $iframe Iframe instance.
70
+ */
71
+ public function __construct(OptionArray $option_array, Assets $assets, Image $image, Iframe $iframe)
72
+ {
73
+ $this->option_array = $option_array;
74
+ $this->assets = $assets;
75
+ $this->image = $image;
76
+ $this->iframe = $iframe;
77
+ }
78
+
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ public function getSubscribedEvents()
83
+ {
84
+ return [
85
+ 'wp_footer' => [
86
+ [ 'insertLazyloadScript', ROCKET_LL_INT_MAX ],
87
+ ['insertYoutubeThumbnailScript', ROCKET_LL_INT_MAX ],
88
+ ],
89
+ 'wp_enqueue_scripts' => ['insertYoutubeThumbnailStyle', ROCKET_LL_INT_MAX],
90
+ 'template_redirect' => ['lazyload', ROCKET_LL_INT_MAX],
91
+ 'rocket_lazyload_html' => 'lazyloadResponsive',
92
+ 'init' => 'lazyloadSmilies',
93
+ ];
94
+ }
95
+
96
+ /**
97
+ * Inserts the lazyload script in the footer
98
+ *
99
+ * @since 2.0
100
+ * @author Remy Perona
101
+ *
102
+ * @return void
103
+ */
104
+ public function insertLazyloadScript()
105
+ {
106
+ if (! $this->option_array->get('images') && ! $this->option_array->get('iframes')) {
107
+ return;
108
+ }
109
+
110
+ if (! $this->shouldlazyload()) { // WPCS: prefix ok.
111
+ return;
112
+ }
113
+
114
+ /**
115
+ * Filters the threshold at which lazyload is triggered
116
+ *
117
+ * @since 1.2
118
+ * @author Remy Perona
119
+ *
120
+ * @param int $threshold Threshold value.
121
+ */
122
+ $threshold = apply_filters('rocket_lazyload_threshold', 300);
123
+
124
+ $args = [
125
+ 'base_url' => ROCKET_LL_FRONT_JS_URL,
126
+ 'suffix' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min',
127
+ 'threshold' => $threshold,
128
+ 'version' => '10.19',
129
+ 'fallback' => '8.17',
130
+ ];
131
+
132
+ if ($this->option_array->get('images')) {
133
+ $args['elements']['image'] = 'img[data-lazy-src]';
134
+ $args['elements']['background_image'] = '.rocket-lazyload-bg';
135
+ }
136
+
137
+ if ($this->option_array->get('iframes')) {
138
+ $args['elements']['iframe'] = 'iframe[data-lazy-src]';
139
+ }
140
+
141
+ /**
142
+ * Filters the arguments array for the lazyload script options
143
+ *
144
+ * @since 2.0
145
+ * @author Remy Perona
146
+ *
147
+ * @param array $args Arguments used for the lazyload script options.
148
+ */
149
+ $args = apply_filters('rocket_lazyload_script_args', $args);
150
+
151
+ $this->assets->insertLazyloadScript($args);
152
+ }
153
+
154
+ /**
155
+ * Inserts the Youtube thumbnail script in the footer
156
+ *
157
+ * @since 2.0
158
+ * @author Remy Perona
159
+ *
160
+ * @return void
161
+ */
162
+ public function insertYoutubeThumbnailScript()
163
+ {
164
+ if (! $this->option_array->get('youtube')) {
165
+ return;
166
+ }
167
+
168
+ if (! $this->shouldlazyload()) { // WPCS: prefix ok.
169
+ return;
170
+ }
171
+
172
+ /**
173
+ * Filters the resolution of the YouTube thumbnail
174
+ *
175
+ * @since 1.4.8
176
+ * @author Arun Basil Lal
177
+ *
178
+ * @param string $thumbnail_resolution The resolution of the thumbnail. Accepted values: default, mqdefault, sddefault, hqdefault, maxresdefault
179
+ */
180
+ $thumbnail_resolution = apply_filters('rocket_lazyload_youtube_thumbnail_resolution', 'hqdefault');
181
+
182
+ $this->assets->insertYoutubeThumbnailScript(
183
+ [
184
+ 'resolution' => $thumbnail_resolution,
185
+ ]
186
+ );
187
+ }
188
+
189
+ /**
190
+ * Inserts the Youtube thumbnail CSS in the header
191
+ *
192
+ * @since 2.0
193
+ * @author Remy Perona
194
+ *
195
+ * @return void
196
+ */
197
+ public function insertYoutubeThumbnailStyle()
198
+ {
199
+ if (! $this->option_array->get('youtube')) {
200
+ return;
201
+ }
202
+
203
+ if (! $this->shouldlazyload()) {
204
+ return;
205
+ }
206
+
207
+ $this->assets->insertYoutubeThumbnailCSS(
208
+ [
209
+ 'base_url' => ROCKET_LL_ASSETS_URL,
210
+ ]
211
+ );
212
+ }
213
+
214
+ /**
215
+ * Checks if lazyload should be applied
216
+ *
217
+ * @since 2.0
218
+ * @author Remy Perona
219
+ *
220
+ * @return bool
221
+ */
222
+ private function shouldLazyload()
223
+ {
224
+ if (is_admin() || is_feed() || is_preview() || (defined('REST_REQUEST') && REST_REQUEST) || (defined('DONOTLAZYLOAD') && DONOTLAZYLOAD)) {
225
+ return false;
226
+ }
227
+
228
+ /**
229
+ * Filters the lazyload application
230
+ *
231
+ * @since 2.0
232
+ * @author Remy Perona
233
+ *
234
+ * @param bool $do_rocket_lazyload True to apply lazyload, false otherwise.
235
+ */
236
+ if (! apply_filters('do_rocket_lazyload', true)) { // WPCS: prefix ok.
237
+ return false;
238
+ }
239
+
240
+ return true;
241
+ }
242
+
243
+ /**
244
+ * Gets the content to lazyload
245
+ *
246
+ * @since 2.0
247
+ * @author Remy Perona
248
+ *
249
+ * @return void
250
+ */
251
+ public function lazyload()
252
+ {
253
+ if (! $this->shouldLazyload()) {
254
+ return;
255
+ }
256
+
257
+ ob_start([$this, 'lazyloadBuffer']);
258
+ }
259
+
260
+ /**
261
+ * Applies lazyload on the provided content
262
+ *
263
+ * @since 2.0
264
+ * @author Remy Perona
265
+ *
266
+ * @param string $html HTML content
267
+ * @return string
268
+ */
269
+ public function lazyloadBuffer($html)
270
+ {
271
+ if ($this->option_array->get('images')) {
272
+ $html = $this->image->lazyloadImages($html);
273
+ }
274
+
275
+ if ($this->option_array->get('iframes')) {
276
+ $args = [
277
+ 'youtube' => $this->option_array->get('youtube'),
278
+ ];
279
+
280
+ $html = $this->iframe->lazyloadIframes($html, $args);
281
+ }
282
+
283
+ return $html;
284
+ }
285
+
286
+ /**
287
+ * Applies lazyload on responsive images attributes srcset and sizes
288
+ *
289
+ * @since 2.0
290
+ * @author Remy Perona
291
+ *
292
+ * @param string $html Image HTML.
293
+ * @return string
294
+ */
295
+ public function lazyloadResponsive($html)
296
+ {
297
+ return $this->image->lazyloadResponsiveAttributes($html);
298
+ }
299
+
300
+ /**
301
+ * Applies lazyload on WordPress smilies
302
+ *
303
+ * @since 2.0
304
+ * @author Remy Perona
305
+ *
306
+ * @return void
307
+ */
308
+ public function lazyloadSmilies()
309
+ {
310
+ if (! $this->shouldLazyload()) {
311
+ return;
312
+ }
313
+
314
+ if (! $this->option_array->get('images')) {
315
+ return;
316
+ }
317
+
318
+ $filters = [
319
+ 'the_content' => 10,
320
+ 'the_excerpt' => 10,
321
+ 'comment_text' => 20,
322
+ ];
323
+
324
+ foreach ($filters as $filter => $prio) {
325
+ if (! has_filter($filter)) {
326
+ continue;
327
+ }
328
+
329
+ remove_filter($filter, 'convert_smilies', $prio);
330
+ add_filter($filter, [$this->image, 'convertSmilies'], $prio);
331
+ }
332
+ }
333
+ }
src/Subscriber/ThirdParty/AMPSubscriber.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyLoadPlugin\Subscriber\ThirdParty;
3
+
4
+ use RocketLazyLoadPlugin\EventManagement\SubscriberInterface;
5
+
6
+ defined('ABSPATH') || die('Cheatin\' uh?');
7
+
8
+ /**
9
+ * Manages compatibility with the AMP plugin
10
+ *
11
+ * @since 2.0
12
+ * @author Remy Perona
13
+ */
14
+ class AMPSubscriber implements SubscriberInterface
15
+ {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ public function getSubscribedEvents()
20
+ {
21
+ $events = [];
22
+
23
+ if ($this->isAmpEndpoint()) {
24
+ $events['do_rocket_lazyload'] = 'returnFalse';
25
+ $events['do_rocket_lazyload_iframes'] = 'returnFalse';
26
+ }
27
+
28
+ return $events;
29
+ }
30
+
31
+ /**
32
+ * Checks if current page uses AMP
33
+ *
34
+ * @since 2.0
35
+ * @author Remy Perona
36
+ *
37
+ * @return boolean
38
+ */
39
+ private function isAmpEndpoint()
40
+ {
41
+ if (function_exists('is_amp_endpoint') && \is_amp_endpoint()) {
42
+ return true;
43
+ }
44
+
45
+ return false;
46
+ }
47
+
48
+ /**
49
+ * Returns false
50
+ *
51
+ * @since 2.0
52
+ * @author Remy Perona
53
+ *
54
+ * @return void
55
+ */
56
+ public function returnFalse()
57
+ {
58
+ \__return_false();
59
+ }
60
+ }
src/rocket-lazyload-requirements-check.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die('Cheatin&#8217; uh?');
3
+
4
+ /**
5
+ * Class to check if the current WordPress and PHP versions meet our requirements
6
+ *
7
+ * @since 2.0
8
+ * @author Remy Perona
9
+ */
10
+ class Rocket_Lazyload_Requirements_Check
11
+ {
12
+ /**
13
+ * Plugin Name
14
+ *
15
+ * @var string
16
+ */
17
+ private $plugin_name;
18
+
19
+ /**
20
+ * Plugin version
21
+ *
22
+ * @var string
23
+ */
24
+ private $plugin_version;
25
+
26
+ /**
27
+ * Required WordPress version
28
+ *
29
+ * @var string
30
+ */
31
+ private $wp_version;
32
+
33
+ /**
34
+ * Required PHP version
35
+ *
36
+ * @var string
37
+ */
38
+ private $php_version;
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 3.0
44
+ * @author Remy Perona
45
+ *
46
+ * @param array $args {
47
+ * Arguments to populate the class properties.
48
+ *
49
+ * @type string $plugin_name Plugin name.
50
+ * @type string $wp_version Required WordPress version.
51
+ * @type string $php_version Required PHP version.
52
+ * }
53
+ */
54
+ public function __construct($args)
55
+ {
56
+ foreach (array('plugin_name', 'plugin_version', 'wp_version', 'php_version') as $setting) {
57
+ if (isset($args[ $setting])) {
58
+ $this->$setting = $args[ $setting ];
59
+ }
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Checks if all requirements are ok, if not, display a notice and the rollback
65
+ *
66
+ * @since 3.0
67
+ * @author Remy Perona
68
+ *
69
+ * @return bool
70
+ */
71
+ public function check()
72
+ {
73
+ if (! $this->phpPasses() || ! $this->wpPasses()) {
74
+ add_action('admin_notices', array($this, 'notice'));
75
+
76
+ return false;
77
+ }
78
+
79
+ return true;
80
+ }
81
+
82
+ /**
83
+ * Checks if the current PHP version is equal or superior to the required PHP version
84
+ *
85
+ * @since 3.0
86
+ * @author Remy Perona
87
+ *
88
+ * @return bool
89
+ */
90
+ private function phpPasses()
91
+ {
92
+ return version_compare(PHP_VERSION, $this->php_version) >= 0;
93
+ }
94
+
95
+ /**
96
+ * Checks if the current WordPress version is equal or superior to the required PHP version
97
+ *
98
+ * @since 3.0
99
+ * @author Remy Perona
100
+ *
101
+ * @return bool
102
+ */
103
+ private function wpPasses()
104
+ {
105
+ global $wp_version;
106
+
107
+ return version_compare($wp_version, $this->wp_version) >= 0;
108
+ }
109
+
110
+ /**
111
+ * Displays a notice if requirements are not met.
112
+ *
113
+ * @since 2.0
114
+ * @author Remy Perona
115
+ */
116
+ public function notice()
117
+ {
118
+ if (! current_user_can('manage_options')) {
119
+ return;
120
+ }
121
+
122
+ // Translators: %1$s = Plugin name, %2$s = Plugin version.
123
+ $message = '<p>' . sprintf(__('To function properly, %1$s %2$s requires at least:', 'rocket-lazy-load'), $this->plugin_name, $this->plugin_version) . '</p><ul>';
124
+
125
+ if (! $this->phpPasses()) {
126
+ // Translators: %1$s = PHP version required.
127
+ $message .= '<li>' . sprintf(__('PHP %1$s. To use this %2$s version, please ask your web host how to upgrade your server to PHP %1$s or higher.', 'rocket-lazy-load'), $this->php_version, $this->plugin_name) . '</li>';
128
+ }
129
+
130
+ if (! $this->wpPasses()) {
131
+ // Translators: %1$s = WordPress version required.
132
+ $message .= '<li>' . sprintf(__('WordPress %1$s. To use this %2$s version, please upgrade WordPress to version %1$s or higher.', 'rocket-lazy-load'), $this->wp_version, $this->plugin_name) . '</li>';
133
+ }
134
+
135
+ echo '<div class="notice notice-error">' . $message . '</div>';
136
+ }
137
+ }
vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit8cab473e8d87c25ebc69a5ad0b41d433::getLoader();
vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
+
60
+ public function getPrefixes()
61
+ {
62
+ if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+ }
65
+
66
+ return array();
67
+ }
68
+
69
+ public function getPrefixesPsr4()
70
+ {
71
+ return $this->prefixDirsPsr4;
72
+ }
73
+
74
+ public function getFallbackDirs()
75
+ {
76
+ return $this->fallbackDirsPsr0;
77
+ }
78
+
79
+ public function getFallbackDirsPsr4()
80
+ {
81
+ return $this->fallbackDirsPsr4;
82
+ }
83
+
84
+ public function getClassMap()
85
+ {
86
+ return $this->classMap;
87
+ }
88
+
89
+ /**
90
+ * @param array $classMap Class to filename map
91
+ */
92
+ public function addClassMap(array $classMap)
93
+ {
94
+ if ($this->classMap) {
95
+ $this->classMap = array_merge($this->classMap, $classMap);
96
+ } else {
97
+ $this->classMap = $classMap;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Registers a set of PSR-0 directories for a given prefix, either
103
+ * appending or prepending to the ones previously set for this prefix.
104
+ *
105
+ * @param string $prefix The prefix
106
+ * @param array|string $paths The PSR-0 root directories
107
+ * @param bool $prepend Whether to prepend the directories
108
+ */
109
+ public function add($prefix, $paths, $prepend = false)
110
+ {
111
+ if (!$prefix) {
112
+ if ($prepend) {
113
+ $this->fallbackDirsPsr0 = array_merge(
114
+ (array) $paths,
115
+ $this->fallbackDirsPsr0
116
+ );
117
+ } else {
118
+ $this->fallbackDirsPsr0 = array_merge(
119
+ $this->fallbackDirsPsr0,
120
+ (array) $paths
121
+ );
122
+ }
123
+
124
+ return;
125
+ }
126
+
127
+ $first = $prefix[0];
128
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+ return;
132
+ }
133
+ if ($prepend) {
134
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
135
+ (array) $paths,
136
+ $this->prefixesPsr0[$first][$prefix]
137
+ );
138
+ } else {
139
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
140
+ $this->prefixesPsr0[$first][$prefix],
141
+ (array) $paths
142
+ );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Registers a set of PSR-4 directories for a given namespace, either
148
+ * appending or prepending to the ones previously set for this namespace.
149
+ *
150
+ * @param string $prefix The prefix/namespace, with trailing '\\'
151
+ * @param array|string $paths The PSR-4 base directories
152
+ * @param bool $prepend Whether to prepend the directories
153
+ *
154
+ * @throws \InvalidArgumentException
155
+ */
156
+ public function addPsr4($prefix, $paths, $prepend = false)
157
+ {
158
+ if (!$prefix) {
159
+ // Register directories for the root namespace.
160
+ if ($prepend) {
161
+ $this->fallbackDirsPsr4 = array_merge(
162
+ (array) $paths,
163
+ $this->fallbackDirsPsr4
164
+ );
165
+ } else {
166
+ $this->fallbackDirsPsr4 = array_merge(
167
+ $this->fallbackDirsPsr4,
168
+ (array) $paths
169
+ );
170
+ }
171
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+ // Register directories for a new namespace.
173
+ $length = strlen($prefix);
174
+ if ('\\' !== $prefix[$length - 1]) {
175
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+ }
177
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+ } elseif ($prepend) {
180
+ // Prepend directories for an already registered namespace.
181
+ $this->prefixDirsPsr4[$prefix] = array_merge(
182
+ (array) $paths,
183
+ $this->prefixDirsPsr4[$prefix]
184
+ );
185
+ } else {
186
+ // Append directories for an already registered namespace.
187
+ $this->prefixDirsPsr4[$prefix] = array_merge(
188
+ $this->prefixDirsPsr4[$prefix],
189
+ (array) $paths
190
+ );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Registers a set of PSR-0 directories for a given prefix,
196
+ * replacing any others previously set for this prefix.
197
+ *
198
+ * @param string $prefix The prefix
199
+ * @param array|string $paths The PSR-0 base directories
200
+ */
201
+ public function set($prefix, $paths)
202
+ {
203
+ if (!$prefix) {
204
+ $this->fallbackDirsPsr0 = (array) $paths;
205
+ } else {
206
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Registers a set of PSR-4 directories for a given namespace,
212
+ * replacing any others previously set for this namespace.
213
+ *
214
+ * @param string $prefix The prefix/namespace, with trailing '\\'
215
+ * @param array|string $paths The PSR-4 base directories
216
+ *
217
+ * @throws \InvalidArgumentException
218
+ */
219
+ public function setPsr4($prefix, $paths)
220
+ {
221
+ if (!$prefix) {
222
+ $this->fallbackDirsPsr4 = (array) $paths;
223
+ } else {
224
+ $length = strlen($prefix);
225
+ if ('\\' !== $prefix[$length - 1]) {
226
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+ }
228
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Turns on searching the include path for class files.
235
+ *
236
+ * @param bool $useIncludePath
237
+ */
238
+ public function setUseIncludePath($useIncludePath)
239
+ {
240
+ $this->useIncludePath = $useIncludePath;
241
+ }
242
+
243
+ /**
244
+ * Can be used to check if the autoloader uses the include path to check
245
+ * for classes.
246
+ *
247
+ * @return bool
248
+ */
249
+ public function getUseIncludePath()
250
+ {
251
+ return $this->useIncludePath;
252
+ }
253
+
254
+ /**
255
+ * Turns off searching the prefix and fallback directories for classes
256
+ * that have not been registered with the class map.
257
+ *
258
+ * @param bool $classMapAuthoritative
259
+ */
260
+ public function setClassMapAuthoritative($classMapAuthoritative)
261
+ {
262
+ $this->classMapAuthoritative = $classMapAuthoritative;
263
+ }
264
+
265
+ /**
266
+ * Should class lookup fail if not found in the current class map?
267
+ *
268
+ * @return bool
269
+ */
270
+ public function isClassMapAuthoritative()
271
+ {
272
+ return $this->classMapAuthoritative;
273
+ }
274
+
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
+ /**
296
+ * Registers this instance as an autoloader.
297
+ *
298
+ * @param bool $prepend Whether to prepend the autoloader or not
299
+ */
300
+ public function register($prepend = false)
301
+ {
302
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+ }
304
+
305
+ /**
306
+ * Unregisters this instance as an autoloader.
307
+ */
308
+ public function unregister()
309
+ {
310
+ spl_autoload_unregister(array($this, 'loadClass'));
311
+ }
312
+
313
+ /**
314
+ * Loads the given class or interface.
315
+ *
316
+ * @param string $class The name of the class
317
+ * @return bool|null True if loaded, null otherwise
318
+ */
319
+ public function loadClass($class)
320
+ {
321
+ if ($file = $this->findFile($class)) {
322
+ includeFile($file);
323
+
324
+ return true;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Finds the path to the file where the class is defined.
330
+ *
331
+ * @param string $class The name of the class
332
+ *
333
+ * @return string|false The path if found, false otherwise
334
+ */
335
+ public function findFile($class)
336
+ {
337
+ // class map lookup
338
+ if (isset($this->classMap[$class])) {
339
+ return $this->classMap[$class];
340
+ }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+ return false;
343
+ }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
+
351
+ $file = $this->findFileWithExtension($class, '.php');
352
+
353
+ // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
+ $file = $this->findFileWithExtension($class, '.hh');
356
+ }
357
+
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
+ // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
+ }
366
+
367
+ return $file;
368
+ }
369
+
370
+ private function findFileWithExtension($class, $ext)
371
+ {
372
+ // PSR-4 lookup
373
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+ $first = $class[0];
376
+ if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath.'\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
+ $length = $this->prefixLengthsPsr4[$first][$search];
384
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
+ return $file;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ // PSR-4 fallback dirs
393
+ foreach ($this->fallbackDirsPsr4 as $dir) {
394
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
+ return $file;
396
+ }
397
+ }
398
+
399
+ // PSR-0 lookup
400
+ if (false !== $pos = strrpos($class, '\\')) {
401
+ // namespaced class name
402
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
+ } else {
405
+ // PEAR-like class name
406
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
+ }
408
+
409
+ if (isset($this->prefixesPsr0[$first])) {
410
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
+ if (0 === strpos($class, $prefix)) {
412
+ foreach ($dirs as $dir) {
413
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
+ return $file;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ // PSR-0 fallback dirs
422
+ foreach ($this->fallbackDirsPsr0 as $dir) {
423
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
+ return $file;
425
+ }
426
+ }
427
+
428
+ // PSR-0 include paths.
429
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
+ return $file;
431
+ }
432
+
433
+ return false;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Scope isolated include.
439
+ *
440
+ * Prevents access to $this/self from included files.
441
+ */
442
+ function includeFile($file)
443
+ {
444
+ include $file;
445
+ }
vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'RocketLazyload\\' => array($vendorDir . '/wp-media/rocket-lazyload-common/src'),
10
+ 'RocketLazyLoadPlugin\\' => array($baseDir . '/src'),
11
+ 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
12
+ 'League\\Container\\' => array($vendorDir . '/league/container/src'),
13
+ 'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'),
14
+ );
vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit8cab473e8d87c25ebc69a5ad0b41d433
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit8cab473e8d87c25ebc69a5ad0b41d433', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit8cab473e8d87c25ebc69a5ad0b41d433', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit8cab473e8d87c25ebc69a5ad0b41d433::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit8cab473e8d87c25ebc69a5ad0b41d433
8
+ {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'R' =>
11
+ array (
12
+ 'RocketLazyload\\' => 15,
13
+ 'RocketLazyLoadPlugin\\' => 21,
14
+ ),
15
+ 'P' =>
16
+ array (
17
+ 'Psr\\Container\\' => 14,
18
+ ),
19
+ 'L' =>
20
+ array (
21
+ 'League\\Container\\' => 17,
22
+ ),
23
+ 'I' =>
24
+ array (
25
+ 'Interop\\Container\\' => 18,
26
+ ),
27
+ );
28
+
29
+ public static $prefixDirsPsr4 = array (
30
+ 'RocketLazyload\\' =>
31
+ array (
32
+ 0 => __DIR__ . '/..' . '/wp-media/rocket-lazyload-common/src',
33
+ ),
34
+ 'RocketLazyLoadPlugin\\' =>
35
+ array (
36
+ 0 => __DIR__ . '/../..' . '/src',
37
+ ),
38
+ 'Psr\\Container\\' =>
39
+ array (
40
+ 0 => __DIR__ . '/..' . '/psr/container/src',
41
+ ),
42
+ 'League\\Container\\' =>
43
+ array (
44
+ 0 => __DIR__ . '/..' . '/league/container/src',
45
+ ),
46
+ 'Interop\\Container\\' =>
47
+ array (
48
+ 0 => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container',
49
+ ),
50
+ );
51
+
52
+ public static function getInitializer(ClassLoader $loader)
53
+ {
54
+ return \Closure::bind(function () use ($loader) {
55
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8cab473e8d87c25ebc69a5ad0b41d433::$prefixLengthsPsr4;
56
+ $loader->prefixDirsPsr4 = ComposerStaticInit8cab473e8d87c25ebc69a5ad0b41d433::$prefixDirsPsr4;
57
+
58
+ }, null, ClassLoader::class);
59
+ }
60
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "psr/container",
4
+ "version": "1.0.0",
5
+ "version_normalized": "1.0.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/php-fig/container.git",
9
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
14
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.0"
19
+ },
20
+ "time": "2017-02-14T16:28:37+00:00",
21
+ "type": "library",
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "1.0.x-dev"
25
+ }
26
+ },
27
+ "installation-source": "dist",
28
+ "autoload": {
29
+ "psr-4": {
30
+ "Psr\\Container\\": "src/"
31
+ }
32
+ },
33
+ "notification-url": "https://packagist.org/downloads/",
34
+ "license": [
35
+ "MIT"
36
+ ],
37
+ "authors": [
38
+ {
39
+ "name": "PHP-FIG",
40
+ "homepage": "http://www.php-fig.org/"
41
+ }
42
+ ],
43
+ "description": "Common Container Interface (PHP FIG PSR-11)",
44
+ "homepage": "https://github.com/php-fig/container",
45
+ "keywords": [
46
+ "PSR-11",
47
+ "container",
48
+ "container-interface",
49
+ "container-interop",
50
+ "psr"
51
+ ]
52
+ },
53
+ {
54
+ "name": "container-interop/container-interop",
55
+ "version": "1.2.0",
56
+ "version_normalized": "1.2.0.0",
57
+ "source": {
58
+ "type": "git",
59
+ "url": "https://github.com/container-interop/container-interop.git",
60
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
61
+ },
62
+ "dist": {
63
+ "type": "zip",
64
+ "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
65
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
66
+ "shasum": ""
67
+ },
68
+ "require": {
69
+ "psr/container": "^1.0"
70
+ },
71
+ "time": "2017-02-14T19:40:03+00:00",
72
+ "type": "library",
73
+ "installation-source": "dist",
74
+ "autoload": {
75
+ "psr-4": {
76
+ "Interop\\Container\\": "src/Interop/Container/"
77
+ }
78
+ },
79
+ "notification-url": "https://packagist.org/downloads/",
80
+ "license": [
81
+ "MIT"
82
+ ],
83
+ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
84
+ "homepage": "https://github.com/container-interop/container-interop"
85
+ },
86
+ {
87
+ "name": "league/container",
88
+ "version": "2.4.1",
89
+ "version_normalized": "2.4.1.0",
90
+ "source": {
91
+ "type": "git",
92
+ "url": "https://github.com/thephpleague/container.git",
93
+ "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0"
94
+ },
95
+ "dist": {
96
+ "type": "zip",
97
+ "url": "https://api.github.com/repos/thephpleague/container/zipball/43f35abd03a12977a60ffd7095efd6a7808488c0",
98
+ "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0",
99
+ "shasum": ""
100
+ },
101
+ "require": {
102
+ "container-interop/container-interop": "^1.2",
103
+ "php": "^5.4.0 || ^7.0"
104
+ },
105
+ "provide": {
106
+ "container-interop/container-interop-implementation": "^1.2",
107
+ "psr/container-implementation": "^1.0"
108
+ },
109
+ "replace": {
110
+ "orno/di": "~2.0"
111
+ },
112
+ "require-dev": {
113
+ "phpunit/phpunit": "4.*"
114
+ },
115
+ "time": "2017-05-10T09:20:27+00:00",
116
+ "type": "library",
117
+ "extra": {
118
+ "branch-alias": {
119
+ "dev-2.x": "2.x-dev",
120
+ "dev-1.x": "1.x-dev"
121
+ }
122
+ },
123
+ "installation-source": "dist",
124
+ "autoload": {
125
+ "psr-4": {
126
+ "League\\Container\\": "src"
127
+ }
128
+ },
129
+ "notification-url": "https://packagist.org/downloads/",
130
+ "license": [
131
+ "MIT"
132
+ ],
133
+ "authors": [
134
+ {
135
+ "name": "Phil Bennett",
136
+ "email": "philipobenito@gmail.com",
137
+ "homepage": "http://www.philipobenito.com",
138
+ "role": "Developer"
139
+ }
140
+ ],
141
+ "description": "A fast and intuitive dependency injection container.",
142
+ "homepage": "https://github.com/thephpleague/container",
143
+ "keywords": [
144
+ "container",
145
+ "dependency",
146
+ "di",
147
+ "injection",
148
+ "league",
149
+ "provider",
150
+ "service"
151
+ ]
152
+ },
153
+ {
154
+ "name": "wp-media/rocket-lazyload-common",
155
+ "version": "v1.2",
156
+ "version_normalized": "1.2.0.0",
157
+ "source": {
158
+ "type": "git",
159
+ "url": "https://github.com/wp-media/rocket-lazyload-common.git",
160
+ "reference": "db45190dd9fb3dddcdc335e180fa522d6789d0bc"
161
+ },
162
+ "dist": {
163
+ "type": "zip",
164
+ "url": "https://api.github.com/repos/wp-media/rocket-lazyload-common/zipball/db45190dd9fb3dddcdc335e180fa522d6789d0bc",
165
+ "reference": "db45190dd9fb3dddcdc335e180fa522d6789d0bc",
166
+ "shasum": ""
167
+ },
168
+ "require": {
169
+ "php": ">=5.4"
170
+ },
171
+ "require-dev": {
172
+ "squizlabs/php_codesniffer": "^3.2"
173
+ },
174
+ "time": "2019-01-08T22:32:27+00:00",
175
+ "type": "library",
176
+ "installation-source": "dist",
177
+ "autoload": {
178
+ "psr-4": {
179
+ "RocketLazyload\\": "src"
180
+ }
181
+ },
182
+ "license": [
183
+ "GPLv3"
184
+ ],
185
+ "authors": [
186
+ {
187
+ "name": "WP Media",
188
+ "email": "contact@wp-media.me"
189
+ }
190
+ ],
191
+ "description": "Common Code between WP Rocket and Lazyload by WP Rocket",
192
+ "support": {
193
+ "source": "https://github.com/wp-media/rocket-lazyload-common/tree/v1.2",
194
+ "issues": "https://github.com/wp-media/rocket-lazyload-common/issues"
195
+ }
196
+ }
197
+ ]
vendor/container-interop/container-interop/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ composer.lock
2
+ composer.phar
3
+ /vendor/
vendor/container-interop/container-interop/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 container-interop
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/container-interop/container-interop/README.md ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Container Interoperability
2
+
3
+ [![Latest Stable Version](https://poser.pugx.org/container-interop/container-interop/v/stable.png)](https://packagist.org/packages/container-interop/container-interop)
4
+ [![Total Downloads](https://poser.pugx.org/container-interop/container-interop/downloads.svg)](https://packagist.org/packages/container-interop/container-interop)
5
+
6
+ ## Deprecation warning!
7
+
8
+ Starting Feb. 13th 2017, container-interop is officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md).
9
+ Container-interop has been the test-bed of PSR-11. From v1.2, container-interop directly extends PSR-11 interfaces.
10
+ Therefore, all containers implementing container-interop are now *de-facto* compatible with PSR-11.
11
+
12
+ - Projects implementing container-interop interfaces are encouraged to directly implement PSR-11 interfaces instead.
13
+ - Projects consuming container-interop interfaces are very strongly encouraged to directly type-hint on PSR-11 interfaces, in order to be compatible with PSR-11 containers that are not compatible with container-interop.
14
+
15
+ Regarding the delegate lookup feature, that is present in container-interop and not in PSR-11, the feature is actually a design pattern. It is therefore not deprecated. Documentation regarding this design pattern will be migrated from this repository into a separate website in the future.
16
+
17
+ ## About
18
+
19
+ *container-interop* tries to identify and standardize features in *container* objects (service locators,
20
+ dependency injection containers, etc.) to achieve interoperability.
21
+
22
+ Through discussions and trials, we try to create a standard, made of common interfaces but also recommendations.
23
+
24
+ If PHP projects that provide container implementations begin to adopt these common standards, then PHP
25
+ applications and projects that use containers can depend on the common interfaces instead of specific
26
+ implementations. This facilitates a high-level of interoperability and flexibility that allows users to consume
27
+ *any* container implementation that can be adapted to these interfaces.
28
+
29
+ The work done in this project is not officially endorsed by the [PHP-FIG](http://www.php-fig.org/), but it is being
30
+ worked on by members of PHP-FIG and other good developers. We adhere to the spirit and ideals of PHP-FIG, and hope
31
+ this project will pave the way for one or more future PSRs.
32
+
33
+
34
+ ## Installation
35
+
36
+ You can install this package through Composer:
37
+
38
+ ```json
39
+ composer require container-interop/container-interop
40
+ ```
41
+
42
+ The packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility
43
+ between minor versions.
44
+
45
+ ## Standards
46
+
47
+ ### Available
48
+
49
+ - [`ContainerInterface`](src/Interop/Container/ContainerInterface.php).
50
+ [Description](docs/ContainerInterface.md) [Meta Document](docs/ContainerInterface-meta.md).
51
+ Describes the interface of a container that exposes methods to read its entries.
52
+ - [*Delegate lookup feature*](docs/Delegate-lookup.md).
53
+ [Meta Document](docs/Delegate-lookup-meta.md).
54
+ Describes the ability for a container to delegate the lookup of its dependencies to a third-party container. This
55
+ feature lets several containers work together in a single application.
56
+
57
+ ### Proposed
58
+
59
+ View open [request for comments](https://github.com/container-interop/container-interop/labels/RFC)
60
+
61
+ ## Compatible projects
62
+
63
+ ### Projects implementing `ContainerInterface`
64
+
65
+ - [Acclimate](https://github.com/jeremeamia/acclimate-container): Adapters for
66
+ Aura.Di, Laravel, Nette DI, Pimple, Symfony DI, ZF2 Service manager, ZF2
67
+ Dependency injection and any container using `ArrayAccess`
68
+ - [Aura.Di](https://github.com/auraphp/Aura.Di)
69
+ - [auryn-container-interop](https://github.com/elazar/auryn-container-interop)
70
+ - [Burlap](https://github.com/codeeverything/burlap)
71
+ - [Chernozem](https://github.com/pyrsmk/Chernozem)
72
+ - [Data Manager](https://github.com/chrismichaels84/data-manager)
73
+ - [Disco](https://github.com/bitexpert/disco)
74
+ - [InDI](https://github.com/idealogica/indi)
75
+ - [League/Container](http://container.thephpleague.com/)
76
+ - [Mouf](http://mouf-php.com)
77
+ - [Njasm Container](https://github.com/njasm/container)
78
+ - [PHP-DI](http://php-di.org)
79
+ - [Picotainer](https://github.com/thecodingmachine/picotainer)
80
+ - [PimpleInterop](https://github.com/moufmouf/pimple-interop)
81
+ - [Pimple3-ContainerInterop](https://github.com/Sam-Burns/pimple3-containerinterop) (using Pimple v3)
82
+ - [SitePoint Container](https://github.com/sitepoint/Container)
83
+ - [Thruster Container](https://github.com/ThrusterIO/container) (PHP7 only)
84
+ - [Ultra-Lite Container](https://github.com/ultra-lite/container)
85
+ - [Unbox](https://github.com/mindplay-dk/unbox)
86
+ - [XStatic](https://github.com/jeremeamia/xstatic)
87
+ - [Zend\ServiceManager](https://github.com/zendframework/zend-servicemanager)
88
+ - [Zit](https://github.com/inxilpro/Zit)
89
+
90
+ ### Projects implementing the *delegate lookup* feature
91
+
92
+ - [Aura.Di](https://github.com/auraphp/Aura.Di)
93
+ - [Burlap](https://github.com/codeeverything/burlap)
94
+ - [Chernozem](https://github.com/pyrsmk/Chernozem)
95
+ - [InDI](https://github.com/idealogica/indi)
96
+ - [League/Container](http://container.thephpleague.com/)
97
+ - [Mouf](http://mouf-php.com)
98
+ - [Picotainer](https://github.com/thecodingmachine/picotainer)
99
+ - [PHP-DI](http://php-di.org)
100
+ - [PimpleInterop](https://github.com/moufmouf/pimple-interop)
101
+ - [Ultra-Lite Container](https://github.com/ultra-lite/container)
102
+
103
+ ### Middlewares implementing `ContainerInterface`
104
+
105
+ - [Alias-Container](https://github.com/thecodingmachine/alias-container): add
106
+ aliases support to any container
107
+ - [Prefixer-Container](https://github.com/thecodingmachine/prefixer-container):
108
+ dynamically prefix identifiers
109
+ - [Lazy-Container](https://github.com/snapshotpl/lazy-container): lazy services
110
+
111
+ ### Projects using `ContainerInterface`
112
+
113
+ The list below contains only a sample of all the projects consuming `ContainerInterface`. For a more complete list have a look [here](http://packanalyst.com/class?q=Interop%5CContainer%5CContainerInterface).
114
+
115
+ | | Downloads |
116
+ | --- | --- |
117
+ | [Adroit](https://github.com/bitexpert/adroit) | ![](https://img.shields.io/packagist/dt/bitexpert/adroit.svg) |
118
+ | [Behat](https://github.com/Behat/Behat/pull/974) | ![](https://img.shields.io/packagist/dt/behat/behat.svg) |
119
+ | [blast-facades](https://github.com/phpthinktank/blast-facades): Minimize complexity and represent dependencies as facades. | ![](https://img.shields.io/packagist/dt/blast/facades.svg) |
120
+ | [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di): an extension to [Silex](http://silex.sensiolabs.org/) that adds support for any *container-interop* compatible container | ![](https://img.shields.io/packagist/dt/mouf/interop.silex.di.svg) |
121
+ | [mindplay/walkway](https://github.com/mindplay-dk/walkway): a modular request router | ![](https://img.shields.io/packagist/dt/mindplay/walkway.svg) |
122
+ | [mindplay/middleman](https://github.com/mindplay-dk/middleman): minimalist PSR-7 middleware dispatcher | ![](https://img.shields.io/packagist/dt/mindplay/middleman.svg) |
123
+ | [PHP-DI/Invoker](https://github.com/PHP-DI/Invoker): extensible and configurable invoker/dispatcher | ![](https://img.shields.io/packagist/dt/php-di/invoker.svg) |
124
+ | [Prophiler](https://github.com/fabfuel/prophiler) | ![](https://img.shields.io/packagist/dt/fabfuel/prophiler.svg) |
125
+ | [Silly](https://github.com/mnapoli/silly): CLI micro-framework | ![](https://img.shields.io/packagist/dt/mnapoli/silly.svg) |
126
+ | [Slim v3](https://github.com/slimphp/Slim) | ![](https://img.shields.io/packagist/dt/slim/slim.svg) |
127
+ | [Splash](http://mouf-php.com/packages/mouf/mvc.splash-common/version/8.0-dev/README.md) | ![](https://img.shields.io/packagist/dt/mouf/mvc.splash-common.svg) |
128
+ | [Woohoo Labs. Harmony](https://github.com/woohoolabs/harmony): a flexible micro-framework | ![](https://img.shields.io/packagist/dt/woohoolabs/harmony.svg) |
129
+ | [zend-expressive](https://github.com/zendframework/zend-expressive) | ![](https://img.shields.io/packagist/dt/zendframework/zend-expressive.svg) |
130
+
131
+
132
+ ## Workflow
133
+
134
+ Everyone is welcome to join and contribute.
135
+
136
+ The general workflow looks like this:
137
+
138
+ 1. Someone opens a discussion (GitHub issue) to suggest an interface
139
+ 1. Feedback is gathered
140
+ 1. The interface is added to a development branch
141
+ 1. We release alpha versions so that the interface can be experimented with
142
+ 1. Discussions and edits ensue until the interface is deemed stable by a general consensus
143
+ 1. A new minor version of the package is released
144
+
145
+ We try to not break BC by creating new interfaces instead of editing existing ones.
146
+
147
+ While we currently work on interfaces, we are open to anything that might help towards interoperability, may that
148
+ be code, best practices, etc.
vendor/container-interop/container-interop/composer.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "container-interop/container-interop",
3
+ "type": "library",
4
+ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
5
+ "homepage": "https://github.com/container-interop/container-interop",
6
+ "license": "MIT",
7
+ "autoload": {
8
+ "psr-4": {
9
+ "Interop\\Container\\": "src/Interop/Container/"
10
+ }
11
+ },
12
+ "require": {
13
+ "psr/container": "^1.0"
14
+ }
15
+ }
vendor/container-interop/container-interop/docs/ContainerInterface-meta.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ContainerInterface Meta Document
2
+
3
+ ## Introduction
4
+
5
+ This document describes the process and discussions that lead to the `ContainerInterface`.
6
+ Its goal is to explain the reasons behind each decision.
7
+
8
+ ## Goal
9
+
10
+ The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
11
+ container to obtain objects and parameters.
12
+
13
+ By standardizing such a behavior, frameworks and libraries using the `ContainerInterface`
14
+ could work with any compatible container.
15
+ That would allow end users to choose their own container based on their own preferences.
16
+
17
+ It is important to distinguish the two usages of a container:
18
+
19
+ - configuring entries
20
+ - fetching entries
21
+
22
+ Most of the time, those two sides are not used by the same party.
23
+ While it is often end users who tend to configure entries, it is generally the framework that fetch
24
+ entries to build the application.
25
+
26
+ This is why this interface focuses only on how entries can be fetched from a container.
27
+
28
+ ## Interface name
29
+
30
+ The interface name has been thoroughly discussed and was decided by a vote.
31
+
32
+ The list of options considered with their respective votes are:
33
+
34
+ - `ContainerInterface`: +8
35
+ - `ProviderInterface`: +2
36
+ - `LocatorInterface`: 0
37
+ - `ReadableContainerInterface`: -5
38
+ - `ServiceLocatorInterface`: -6
39
+ - `ObjectFactory`: -6
40
+ - `ObjectStore`: -8
41
+ - `ConsumerInterface`: -9
42
+
43
+ [Full results of the vote](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)
44
+
45
+ The complete discussion can be read in [the issue #1](https://github.com/container-interop/container-interop/issues/1).
46
+
47
+ ## Interface methods
48
+
49
+ The choice of which methods the interface would contain was made after a statistical analysis of existing containers.
50
+ The results of this analysis are available [in this document](https://gist.github.com/mnapoli/6159681).
51
+
52
+ The summary of the analysis showed that:
53
+
54
+ - all containers offer a method to get an entry by its id
55
+ - a large majority name such method `get()`
56
+ - for all containers, the `get()` method has 1 mandatory parameter of type string
57
+ - some containers have an optional additional argument for `get()`, but it doesn't have the same purpose between containers
58
+ - a large majority of the containers offer a method to test if it can return an entry by its id
59
+ - a majority name such method `has()`
60
+ - for all containers offering `has()`, the method has exactly 1 parameter of type string
61
+ - a large majority of the containers throw an exception rather than returning null when an entry is not found in `get()`
62
+ - a large majority of the containers don't implement `ArrayAccess`
63
+
64
+ The question of whether to include methods to define entries has been discussed in
65
+ [issue #1](https://github.com/container-interop/container-interop/issues/1).
66
+ It has been judged that such methods do not belong in the interface described here because it is out of its scope
67
+ (see the "Goal" section).
68
+
69
+ As a result, the `ContainerInterface` contains two methods:
70
+
71
+ - `get()`, returning anything, with one mandatory string parameter. Should throw an exception if the entry is not found.
72
+ - `has()`, returning a boolean, with one mandatory string parameter.
73
+
74
+ ### Number of parameters in `get()` method
75
+
76
+ While `ContainerInterface` only defines one mandatory parameter in `get()`, it is not incompatible with
77
+ existing containers that have additional optional parameters. PHP allows an implementation to offer more parameters
78
+ as long as they are optional, because the implementation *does* satisfy the interface.
79
+
80
+ This issue has been discussed in [issue #6](https://github.com/container-interop/container-interop/issues/6).
81
+
82
+ ### Type of the `$id` parameter
83
+
84
+ The type of the `$id` parameter in `get()` and `has()` has been discussed in
85
+ [issue #6](https://github.com/container-interop/container-interop/issues/6).
86
+ While `string` is used in all the containers that were analyzed, it was suggested that allowing
87
+ anything (such as objects) could allow containers to offer a more advanced query API.
88
+
89
+ An example given was to use the container as an object builder. The `$id` parameter would then be an
90
+ object that would describe how to create an instance.
91
+
92
+ The conclusion of the discussion was that this was beyond the scope of getting entries from a container without
93
+ knowing how the container provided them, and it was more fit for a factory.
94
+
95
+ ## Contributors
96
+
97
+ Are listed here all people that contributed in the discussions or votes, by alphabetical order:
98
+
99
+ - [Amy Stephen](https://github.com/AmyStephen)
100
+ - [David Négrier](https://github.com/moufmouf)
101
+ - [Don Gilbert](https://github.com/dongilbert)
102
+ - [Jason Judge](https://github.com/judgej)
103
+ - [Jeremy Lindblom](https://github.com/jeremeamia)
104
+ - [Marco Pivetta](https://github.com/Ocramius)
105
+ - [Matthieu Napoli](https://github.com/mnapoli)
106
+ - [Paul M. Jones](https://github.com/pmjones)
107
+ - [Stephan Hochdörfer](https://github.com/shochdoerfer)
108
+ - [Taylor Otwell](https://github.com/taylorotwell)
109
+
110
+ ## Relevant links
111
+
112
+ - [`ContainerInterface.php`](https://github.com/container-interop/container-interop/blob/master/src/Interop/Container/ContainerInterface.php)
113
+ - [List of all issues](https://github.com/container-interop/container-interop/issues?labels=ContainerInterface&milestone=&page=1&state=closed)
114
+ - [Vote for the interface name](https://github.com/container-interop/container-interop/wiki/%231-interface-name:-Vote)
vendor/container-interop/container-interop/docs/ContainerInterface.md ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Container interface
2
+ ===================
3
+
4
+ This document describes a common interface for dependency injection containers.
5
+
6
+ The goal set by `ContainerInterface` is to standardize how frameworks and libraries make use of a
7
+ container to obtain objects and parameters (called *entries* in the rest of this document).
8
+
9
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
10
+ "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
11
+ interpreted as described in [RFC 2119][].
12
+
13
+ The word `implementor` in this document is to be interpreted as someone
14
+ implementing the `ContainerInterface` in a dependency injection-related library or framework.
15
+ Users of dependency injections containers (DIC) are referred to as `user`.
16
+
17
+ [RFC 2119]: http://tools.ietf.org/html/rfc2119
18
+
19
+ 1. Specification
20
+ -----------------
21
+
22
+ ### 1.1 Basics
23
+
24
+ - The `Interop\Container\ContainerInterface` exposes two methods : `get` and `has`.
25
+
26
+ - `get` takes one mandatory parameter: an entry identifier. It MUST be a string.
27
+ A call to `get` can return anything (a *mixed* value), or throws an exception if the identifier
28
+ is not known to the container. Two successive calls to `get` with the same
29
+ identifier SHOULD return the same value. However, depending on the `implementor`
30
+ design and/or `user` configuration, different values might be returned, so
31
+ `user` SHOULD NOT rely on getting the same value on 2 successive calls.
32
+ While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations
33
+ MAY accept additional optional parameters.
34
+
35
+ - `has` takes one unique parameter: an entry identifier. It MUST return `true`
36
+ if an entry identifier is known to the container and `false` if it is not.
37
+ `has($id)` returning true does not mean that `get($id)` will not throw an exception.
38
+ It does however mean that `get($id)` will not throw a `NotFoundException`.
39
+
40
+ ### 1.2 Exceptions
41
+
42
+ Exceptions directly thrown by the container MUST implement the
43
+ [`Interop\Container\Exception\ContainerException`](../src/Interop/Container/Exception/ContainerException.php).
44
+
45
+ A call to the `get` method with a non-existing id SHOULD throw a
46
+ [`Interop\Container\Exception\NotFoundException`](../src/Interop/Container/Exception/NotFoundException.php).
47
+
48
+ ### 1.3 Additional features
49
+
50
+ This section describes additional features that MAY be added to a container. Containers are not
51
+ required to implement these features to respect the ContainerInterface.
52
+
53
+ #### 1.3.1 Delegate lookup feature
54
+
55
+ The goal of the *delegate lookup* feature is to allow several containers to share entries.
56
+ Containers implementing this feature can perform dependency lookups in other containers.
57
+
58
+ Containers implementing this feature will offer a greater lever of interoperability
59
+ with other containers. Implementation of this feature is therefore RECOMMENDED.
60
+
61
+ A container implementing this feature:
62
+
63
+ - MUST implement the `ContainerInterface`
64
+ - MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
65
+ or any possible way). The delegate container MUST implement the `ContainerInterface`.
66
+
67
+ When a container is configured to use a delegate container for dependencies:
68
+
69
+ - Calls to the `get` method should only return an entry if the entry is part of the container.
70
+ If the entry is not part of the container, an exception should be thrown
71
+ (as requested by the `ContainerInterface`).
72
+ - Calls to the `has` method should only return `true` if the entry is part of the container.
73
+ If the entry is not part of the container, `false` should be returned.
74
+ - If the fetched entry has dependencies, **instead** of performing
75
+ the dependency lookup in the container, the lookup is performed on the *delegate container*.
76
+
77
+ Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
78
+
79
+ It is however allowed for containers to provide exception cases for special entries, and a way to lookup
80
+ into the same container (or another container) instead of the delegate container.
81
+
82
+ 2. Package
83
+ ----------
84
+
85
+ The interfaces and classes described as well as relevant exception are provided as part of the
86
+ [container-interop/container-interop](https://packagist.org/packages/container-interop/container-interop) package.
87
+
88
+ 3. `Interop\Container\ContainerInterface`
89
+ -----------------------------------------
90
+
91
+ ```php
92
+ <?php
93
+ namespace Interop\Container;
94
+
95
+ use Interop\Container\Exception\ContainerException;
96
+ use Interop\Container\Exception\NotFoundException;
97
+
98
+ /**
99
+ * Describes the interface of a container that exposes methods to read its entries.
100
+ */
101
+ interface ContainerInterface
102
+ {
103
+ /**
104
+ * Finds an entry of the container by its identifier and returns it.
105
+ *
106
+ * @param string $id Identifier of the entry to look for.
107
+ *
108
+ * @throws NotFoundException No entry was found for this identifier.
109
+ * @throws ContainerException Error while retrieving the entry.
110
+ *
111
+ * @return mixed Entry.
112
+ */
113
+ public function get($id);
114
+
115
+ /**
116
+ * Returns true if the container can return an entry for the given identifier.
117
+ * Returns false otherwise.
118
+ *
119
+ * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
120
+ * It does however mean that `get($id)` will not throw a `NotFoundException`.
121
+ *
122
+ * @param string $id Identifier of the entry to look for.
123
+ *
124
+ * @return boolean
125
+ */
126
+ public function has($id);
127
+ }
128
+ ```
129
+
130
+ 4. `Interop\Container\Exception\ContainerException`
131
+ ---------------------------------------------------
132
+
133
+ ```php
134
+ <?php
135
+ namespace Interop\Container\Exception;
136
+
137
+ /**
138
+ * Base interface representing a generic exception in a container.
139
+ */
140
+ interface ContainerException
141
+ {
142
+ }
143
+ ```
144
+
145
+ 5. `Interop\Container\Exception\NotFoundException`
146
+ ---------------------------------------------------
147
+
148
+ ```php
149
+ <?php
150
+ namespace Interop\Container\Exception;
151
+
152
+ /**
153
+ * No entry was found in the container.
154
+ */
155
+ interface NotFoundException extends ContainerException
156
+ {
157
+ }
158
+ ```
vendor/container-interop/container-interop/docs/Delegate-lookup-meta.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Delegate lookup feature Meta Document
2
+ =====================================
3
+
4
+ 1. Summary
5
+ ----------
6
+
7
+ This document describes the *delegate lookup feature*.
8
+ Containers are not required to implement this feature to respect the `ContainerInterface`.
9
+ However, containers implementing this feature will offer a greater lever of interoperability
10
+ with other containers, allowing multiple containers to share entries in the same application.
11
+ Implementation of this feature is therefore recommanded.
12
+
13
+ 2. Why Bother?
14
+ --------------
15
+
16
+ The [`ContainerInterface`](../src/Interop/Container/ContainerInterface.php) ([meta doc](ContainerInterface.md))
17
+ standardizes how frameworks and libraries make use of a container to obtain objects and parameters.
18
+
19
+ By standardizing such a behavior, frameworks and libraries relying on the `ContainerInterface`
20
+ could work with any compatible container.
21
+ That would allow end users to choose their own container based on their own preferences.
22
+
23
+ The `ContainerInterface` is also enough if we want to have several containers side-by-side in the same
24
+ application. For instance, this is what the [CompositeContainer](https://github.com/jeremeamia/acclimate-container/blob/master/src/CompositeContainer.php)
25
+ class of [Acclimate](https://github.com/jeremeamia/acclimate-container) is designed for:
26
+
27
+ ![Side by side containers](images/side_by_side_containers.png)
28
+
29
+ However, an instance in container 1 cannot reference an instance in container 2.
30
+
31
+ It would be better if an instance of container 1 could reference an instance in container 2,
32
+ and the opposite should be true.
33
+
34
+ ![Interoperating containers](images/interoperating_containers.png)
35
+
36
+ In the sample above, entry 1 in container 1 is referencing entry 3 in container 2.
37
+
38
+ 3. Scope
39
+ --------
40
+
41
+ ### 3.1 Goals
42
+
43
+ The goal of the *delegate lookup* feature is to allow several containers to share entries.
44
+
45
+ 4. Approaches
46
+ -------------
47
+
48
+ ### 4.1 Chosen Approach
49
+
50
+ Containers implementing this feature can perform dependency lookups in other containers.
51
+
52
+ A container implementing this feature:
53
+
54
+ - must implement the `ContainerInterface`
55
+ - must provide a way to register a *delegate container* (using a constructor parameter, or a setter, or any
56
+ possible way). The *delegate container* must implement the `ContainerInterface`.
57
+
58
+ When a *delegate container* is configured on a container:
59
+
60
+ - Calls to the `get` method should only return an entry if the entry is part of the container.
61
+ If the entry is not part of the container, an exception should be thrown (as required in the `ContainerInterface`).
62
+ - Calls to the `has` method should only return *true* if the entry is part of the container.
63
+ If the entry is not part of the container, *false* should be returned.
64
+ - Finally, the important part: if the entry we are fetching has dependencies,
65
+ **instead** of perfoming the dependency lookup in the container, the lookup is performed on the *delegate container*.
66
+
67
+ Important! By default, the lookup should be performed on the delegate container **only**, not on the container itself.
68
+
69
+ It is however allowed for containers to provide exception cases for special entries, and a way to lookup into
70
+ the same container (or another container) instead of the delegate container.
71
+
72
+ ### 4.2 Typical usage
73
+
74
+ The *delegate container* will usually be a composite container. A composite container is a container that
75
+ contains several other containers. When performing a lookup on a composite container, the inner containers are
76
+ queried until one container returns an entry.
77
+ An inner container implementing the *delegate lookup feature* will return entries it contains, but if these
78
+ entries have dependencies, the dependencies lookup calls will be performed on the composite container, giving
79
+ a chance to all containers to answer.
80
+
81
+ Interestingly enough, the order in which containers are added in the composite container matters. Indeed,
82
+ the first containers to be added in the composite container can "override" the entries of containers with
83
+ lower priority.
84
+
85
+ ![Containers priority](images/priority.png)
86
+
87
+ In the example above, "container 2" contains a controller "myController" and the controller is referencing an
88
+ "entityManager" entry. "Container 1" contains also an entry named "entityManager".
89
+ Without the *delegate lookup* feature, when requesting the "myController" instance to container 2, it would take
90
+ in charge the instanciation of both entries.
91
+
92
+ However, using the *delegate lookup* feature, here is what happens when we ask the composite container for the
93
+ "myController" instance:
94
+
95
+ - The composite container asks container 1 if if contains the "myController" instance. The answer is no.
96
+ - The composite container asks container 2 if if contains the "myController" instance. The answer is yes.
97
+ - The composite container performs a `get` call on container 2 for the "myController" instance.
98
+ - Container 2 sees that "myController" has a dependency on "entityManager".
99
+ - Container 2 delegates the lookup of "entityManager" to the composite container.
100
+ - The composite container asks container 1 if if contains the "entityManager" instance. The answer is yes.
101
+ - The composite container performs a `get` call on container 1 for the "entityManager" instance.
102
+
103
+ In the end, we get a controller instanciated by container 2 that references an entityManager instanciated
104
+ by container 1.
105
+
106
+ ### 4.3 Alternative: the fallback strategy
107
+
108
+ The first proposed approach we tried was to perform all the lookups in the "local" container,
109
+ and if a lookup fails in the container, to use the delegate container. In this scenario, the
110
+ delegate container is used in "fallback" mode.
111
+
112
+ This strategy has been described in @moufmouf blog post: http://mouf-php.com/container-interop-whats-next (solution 1).
113
+ It was also discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-33570697) and
114
+ [here](https://github.com/container-interop/container-interop/pull/20#issuecomment-56599631).
115
+
116
+ Problems with this strategy:
117
+
118
+ - Heavy problem regarding infinite loops
119
+ - Unable to overload a container entry with the delegate container entry
120
+
121
+ ### 4.4 Alternative: force implementing an interface
122
+
123
+ The first proposed approach was to develop a `ParentAwareContainerInterface` interface.
124
+ It was proposed here: https://github.com/container-interop/container-interop/pull/8
125
+
126
+ The interface would have had the behaviour of the delegate lookup feature but would have forced the addition of
127
+ a `setParentContainter` method:
128
+
129
+ ```php
130
+ interface ParentAwareContainerInterface extends ReadableContainerInterface {
131
+ /**
132
+ * Sets the parent container associated to that container. This container will call
133
+ * the parent container to fetch dependencies.
134
+ *
135
+ * @param ContainerInterface $container
136
+ */
137
+ public function setParentContainer(ContainerInterface $container);
138
+ }
139
+ ```
140
+
141
+ The interface idea was first questioned by @Ocramius [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
142
+ @Ocramius expressed the idea that an interface should not contain setters, otherwise, it is forcing implementation
143
+ details on the class implementing the interface.
144
+ Then @mnapoli made a proposal for a "convention" [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51841079),
145
+ this idea was further discussed until all participants in the discussion agreed to remove the interface idea
146
+ and replace it with a "standard" feature.
147
+
148
+ **Pros:**
149
+
150
+ If we had had an interface, we could have delegated the registration of the delegate/composite container to the
151
+ the delegate/composite container itself.
152
+ For instance:
153
+
154
+ ```php
155
+ $containerA = new ContainerA();
156
+ $containerB = new ContainerB();
157
+
158
+ $compositeContainer = new CompositeContainer([$containerA, $containerB]);
159
+
160
+ // The call to 'setParentContainer' is delegated to the CompositeContainer
161
+ // It is not the responsibility of the user anymore.
162
+ class CompositeContainer {
163
+ ...
164
+
165
+ public function __construct($containers) {
166
+ foreach ($containers as $container) {
167
+ if ($container instanceof ParentAwareContainerInterface) {
168
+ $container->setParentContainer($this);
169
+ }
170
+ }
171
+ ...
172
+ }
173
+ }
174
+
175
+ ```
176
+
177
+ **Cons:**
178
+
179
+ Cons have been extensively discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-51721777).
180
+ Basically, forcing a setter into an interface is a bad idea. Setters are similar to constructor arguments,
181
+ and it's a bad idea to standardize a constructor: how the delegate container is configured into a container is an implementation detail. This outweights the benefits of the interface.
182
+
183
+ ### 4.4 Alternative: no exception case for delegate lookups
184
+
185
+ Originally, the proposed wording for delegate lookup calls was:
186
+
187
+ > Important! The lookup MUST be performed on the delegate container **only**, not on the container itself.
188
+
189
+ This was later replaced by:
190
+
191
+ > Important! By default, the lookup SHOULD be performed on the delegate container **only**, not on the container itself.
192
+ >
193
+ > It is however allowed for containers to provide exception cases for special entries, and a way to lookup
194
+ > into the same container (or another container) instead of the delegate container.
195
+
196
+ Exception cases have been allowed to avoid breaking dependencies with some services that must be provided
197
+ by the container (on @njasm proposal). This was proposed here: https://github.com/container-interop/container-interop/pull/20#issuecomment-56597235
198
+
199
+ ### 4.5 Alternative: having one of the containers act as the composite container
200
+
201
+ In real-life scenarios, we usually have a big framework (Symfony 2, Zend Framework 2, etc...) and we want to
202
+ add another DI container to this container. Most of the time, the "big" framework will be responsible for
203
+ creating the controller's instances, using it's own DI container. Until *container-interop* is fully adopted,
204
+ the "big" framework will not be aware of the existence of a composite container that it should use instead
205
+ of its own container.
206
+
207
+ For this real-life use cases, @mnapoli and @moufmouf proposed to extend the "big" framework's DI container
208
+ to make it act as a composite container.
209
+
210
+ This has been discussed [here](https://github.com/container-interop/container-interop/pull/8#issuecomment-40367194)
211
+ and [here](http://mouf-php.com/container-interop-whats-next#solution4).
212
+
213
+ This was implemented in Symfony 2 using:
214
+
215
+ - [interop.symfony.di](https://github.com/thecodingmachine/interop.symfony.di/tree/v0.1.0)
216
+ - [framework interop](https://github.com/mnapoli/framework-interop/)
217
+
218
+ This was implemented in Silex using:
219
+
220
+ - [interop.silex.di](https://github.com/thecodingmachine/interop.silex.di)
221
+
222
+ Having a container act as the composite container is not part of the delegate lookup standard because it is
223
+ simply a temporary design pattern used to make existing frameworks that do not support yet ContainerInterop
224
+ play nice with other DI containers.
225
+
226
+
227
+ 5. Implementations
228
+ ------------------
229
+
230
+ The following projects already implement the delegate lookup feature:
231
+
232
+ - [Mouf](http://mouf-php.com), through the [`setDelegateLookupContainer` method](https://github.com/thecodingmachine/mouf/blob/2.0/src/Mouf/MoufManager.php#L2120)
233
+ - [PHP-DI](http://php-di.org/), through the [`$wrapperContainer` parameter of the constructor](https://github.com/mnapoli/PHP-DI/blob/master/src/DI/Container.php#L72)
234
+ - [pimple-interop](https://github.com/moufmouf/pimple-interop), through the [`$container` parameter of the constructor](https://github.com/moufmouf/pimple-interop/blob/master/src/Interop/Container/Pimple/PimpleInterop.php#L62)
235
+
236
+ 6. People
237
+ ---------
238
+
239
+ Are listed here all people that contributed in the discussions, by alphabetical order:
240
+
241
+ - [Alexandru Pătrănescu](https://github.com/drealecs)
242
+ - [Ben Peachey](https://github.com/potherca)
243
+ - [David Négrier](https://github.com/moufmouf)
244
+ - [Jeremy Lindblom](https://github.com/jeremeamia)
245
+ - [Marco Pivetta](https://github.com/Ocramius)
246
+ - [Matthieu Napoli](https://github.com/mnapoli)
247
+ - [Nelson J Morais](https://github.com/njasm)
248
+ - [Phil Sturgeon](https://github.com/philsturgeon)
249
+ - [Stephan Hochdörfer](https://github.com/shochdoerfer)
250
+
251
+ 7. Relevant Links
252
+ -----------------
253
+
254
+ _**Note:** Order descending chronologically._
255
+
256
+ - [Pull request on the delegate lookup feature](https://github.com/container-interop/container-interop/pull/20)
257
+ - [Pull request on the interface idea](https://github.com/container-interop/container-interop/pull/8)
258
+ - [Original article exposing the delegate lookup idea along many others](http://mouf-php.com/container-interop-whats-next)
259
+
vendor/container-interop/container-interop/docs/Delegate-lookup.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Delegate lookup feature
2
+ =======================
3
+
4
+ This document describes a standard for dependency injection containers.
5
+
6
+ The goal set by the *delegate lookup* feature is to allow several containers to share entries.
7
+ Containers implementing this feature can perform dependency lookups in other containers.
8
+
9
+ Containers implementing this feature will offer a greater lever of interoperability
10
+ with other containers. Implementation of this feature is therefore RECOMMENDED.
11
+
12
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
13
+ "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
14
+ interpreted as described in [RFC 2119][].
15
+
16
+ The word `implementor` in this document is to be interpreted as someone
17
+ implementing the delegate lookup feature in a dependency injection-related library or framework.
18
+ Users of dependency injections containers (DIC) are referred to as `user`.
19
+
20
+ [RFC 2119]: http://tools.ietf.org/html/rfc2119
21
+
22
+ 1. Vocabulary
23
+ -------------
24
+
25
+ In a dependency injection container, the container is used to fetch entries.
26
+ Entries can have dependencies on other entries. Usually, these other entries are fetched by the container.
27
+
28
+ The *delegate lookup* feature is the ability for a container to fetch dependencies in
29
+ another container. In the rest of the document, the word "container" will reference the container
30
+ implemented by the implementor. The word "delegate container" will reference the container we are
31
+ fetching the dependencies from.
32
+
33
+ 2. Specification
34
+ ----------------
35
+
36
+ A container implementing the *delegate lookup* feature:
37
+
38
+ - MUST implement the [`ContainerInterface`](ContainerInterface.md)
39
+ - MUST provide a way to register a delegate container (using a constructor parameter, or a setter,
40
+ or any possible way). The delegate container MUST implement the [`ContainerInterface`](ContainerInterface.md).
41
+
42
+ When a container is configured to use a delegate container for dependencies:
43
+
44
+ - Calls to the `get` method should only return an entry if the entry is part of the container.
45
+ If the entry is not part of the container, an exception should be thrown
46
+ (as requested by the [`ContainerInterface`](ContainerInterface.md)).
47
+ - Calls to the `has` method should only return `true` if the entry is part of the container.
48
+ If the entry is not part of the container, `false` should be returned.
49
+ - If the fetched entry has dependencies, **instead** of performing
50
+ the dependency lookup in the container, the lookup is performed on the *delegate container*.
51
+
52
+ Important: By default, the dependency lookups SHOULD be performed on the delegate container **only**, not on the container itself.
53
+
54
+ It is however allowed for containers to provide exception cases for special entries, and a way to lookup
55
+ into the same container (or another container) instead of the delegate container.
56
+
57
+ 3. Package / Interface
58
+ ----------------------
59
+
60
+ This feature is not tied to any code, interface or package.
vendor/container-interop/container-interop/docs/images/interoperating_containers.png ADDED
Binary file
vendor/container-interop/container-interop/docs/images/priority.png ADDED
Binary file
vendor/container-interop/container-interop/docs/images/side_by_side_containers.png ADDED
Binary file
vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Interop\Container;
7
+
8
+ use Psr\Container\ContainerInterface as PsrContainerInterface;
9
+
10
+ /**
11
+ * Describes the interface of a container that exposes methods to read its entries.
12
+ */
13
+ interface ContainerInterface extends PsrContainerInterface
14
+ {
15
+ }
vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Interop\Container\Exception;
7
+
8
+ use Psr\Container\ContainerExceptionInterface as PsrContainerException;
9
+
10
+ /**
11
+ * Base interface representing a generic exception in a container.
12
+ */
13
+ interface ContainerException extends PsrContainerException
14
+ {
15
+ }
vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Interop\Container\Exception;
7
+
8
+ use Psr\Container\NotFoundExceptionInterface as PsrNotFoundException;
9
+
10
+ /**
11
+ * No entry was found in the container.
12
+ */
13
+ interface NotFoundException extends ContainerException, PsrNotFoundException
14
+ {
15
+ }
vendor/league/container/CHANGELOG.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ All Notable changes to `League\Container` will be documented in this file
4
+
5
+ ## 2.3.0
6
+
7
+ ### Added
8
+ - Now implementation of the PSR-11.
9
+
10
+ ### Changed
11
+ - Can now wrap shared objects as `RawArgument`.
12
+ - Ability to override shared items.
13
+
14
+ ### Fixed
15
+ - Booleans now recognised as accepted values.
16
+ - Various docblock fixes.
17
+ - Unused imports removed.
18
+ - Unreachable arguments no longer passed.
19
+
20
+ ## 2.2.0
21
+
22
+ ### Changed
23
+ - Service providers can now be added multiple times by giving them a signature.
24
+
25
+ ## 2.1.0
26
+
27
+ ### Added
28
+ - Allow resolving of `RawArgument` objects as first class dependencies.
29
+
30
+ ### Changed
31
+ - Unnecessary recursion removed from `Container::get`.
32
+
33
+ ## 2.0.3
34
+
35
+ ### Fixed
36
+ - Bug where delegating container was not passed to delegate when needed.
37
+ - Bug where `Container::extend` would not return a shared definition to extend.
38
+
39
+ ## 2.0.2
40
+
41
+ ### Fixed
42
+ - Bug introduced in 2.0.1 where shared definitions registered via a service provider would never be returned as shared.
43
+
44
+ ## 2.0.1
45
+
46
+ ### Fixed
47
+ - Bug where shared definitions were not stored as shared.
48
+
49
+ ## 2.0.0
50
+
51
+ ### Added
52
+ - Now implementation of the container-interop project.
53
+ - `BootableServiceProviderInterface` for eagerly loaded service providers.
54
+ - Delegate container functionality.
55
+ - `RawArgument` to ensure scalars are not resolved from the container but seen as an argument.
56
+
57
+ ### Altered
58
+ - Refactor of definition functionality.
59
+ - `Container::share` replaces `singleton` functionality to improve understanding.
60
+ - Auto wiring is now disabled by default.
61
+ - Auto wiring abstracted to be a delegate container `ReflectionContainer` handling all reflection based functionality.
62
+ - Inflection functionality abstracted to an aggregate.
63
+ - Service provider functionality abstracted to an aggregate.
64
+ - Much bloat removed.
65
+ - `Container::call` now proxies to `ReflectionContainer::call` and handles argument resolution in a much more efficient way.
66
+
67
+ ### Removed
68
+ - Ability to register invokables, this functionality added a layer of complexity too large for the problem it solved.
69
+ - Container no longer accepts a configuration array, this functionality will now be provided by an external service provider package.
70
+
71
+ ## 1.4.0
72
+
73
+ ### Added
74
+ - Added `isRegisteredCallable` method to public API.
75
+ - Invoking `call` now accepts named arguments at runtime.
76
+
77
+ ### Fixed
78
+ - Container now stores instantiated Service Providers after first instantiation.
79
+ - Extending a definition now looks in Service Providers as well as just Definitions.
80
+
81
+ ## 1.3.1 - 2015-02-21
82
+
83
+ ### Fixed
84
+ - Fixed bug where arbitrary values were attempted to be resolved as classes.
85
+
86
+ ## 1.3.0 - 2015-02-09
87
+
88
+ ### Added
89
+ - Added `ServiceProvider` functionality to allow cleaner resolving of complex dependencies.
90
+ - Added `Inflector` functionality to allow for manipulation of resolved objects of a specific type.
91
+ - Improvements to DRY throughout the package.
92
+
93
+ ### Fixed
94
+ - Setter in `ContainerAwareTrait` now returns self (`$this`).
95
+
96
+ ## 1.2.1 - 2015-01-29
97
+
98
+ ### Fixed
99
+ - Allow arbitrary values to be registered via container config.
100
+
101
+ ## 1.2.0 - 2015-01-13
102
+
103
+ ### Added
104
+ - Improvements to `Container::call` functionality.
105
+
106
+ ### Fixed
107
+ - General code tidy.
108
+ - Improvements to test suite.
109
+
110
+ ## 1.1.1 - 2015-01-13
111
+
112
+ ### Fixed
113
+ - Allow singleton to be passed as method argument.
114
+
115
+ ## 1.1.0 - 2015-01-12
116
+
117
+ ### Added
118
+ - Addition of `ContainerAwareTrait` to provide functionality from `ContainerAwareInterface`.
119
+
120
+ ## 1.0.0 - 2015-01-12
121
+
122
+ ### Added
123
+ - Migrated from [Orno\Di](https://github.com/orno/di).
vendor/league/container/CONTRIBUTING.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing
2
+
3
+ Contributions are **welcome** and will be fully **credited**.
4
+
5
+ We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/container).
6
+
7
+ ## Pull Requests
8
+
9
+ - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
10
+
11
+ - **Add tests!** - Your patch won't be accepted if it doesn't have tests.
12
+
13
+ - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
14
+
15
+ - **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
16
+
17
+ - **Create feature branches** - Don't ask us to pull from your master branch.
18
+
19
+ - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
20
+
21
+ - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
22
+
23
+ ## Running Tests
24
+
25
+ ``` bash
26
+ $ phpunit
27
+ ```
28
+
29
+ **Happy coding**!
vendor/league/container/LICENSE.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Phil Bennett <philipobenito@gmail.com>
4
+
5
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ > of this software and associated documentation files (the "Software"), to deal
7
+ > in the Software without restriction, including without limitation the rights
8
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ > copies of the Software, and to permit persons to whom the Software is
10
+ > furnished to do so, subject to the following conditions:
11
+ >
12
+ > The above copyright notice and this permission notice shall be included in
13
+ > all copies or substantial portions of the Software.
14
+ >
15
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ > THE SOFTWARE.
vendor/league/container/README.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Container (Dependency Injection)
2
+
3
+ [![Author](http://img.shields.io/badge/author-@philipobenito-blue.svg?style=flat-square)](https://twitter.com/philipobenito)
4
+ [![Latest Version](https://img.shields.io/github/release/thephpleague/container.svg?style=flat-square)](https://github.com/thephpleague/container/releases)
5
+ [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
6
+ [![Build Status](https://img.shields.io/travis/thephpleague/container/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/container)
7
+ [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/container.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/container/code-structure)
8
+ [![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/container.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/container)
9
+ [![Total Downloads](https://img.shields.io/packagist/dt/league/container.svg?style=flat-square)](https://packagist.org/packages/league/container)
10
+
11
+ [![SensioLabsInsight](https://insight.sensiolabs.com/projects/ad6b4c3e-8f93-4968-8dd3-391d39a4c3c2/big.png)](https://insight.sensiolabs.com/projects/ad6b4c3e-8f93-4968-8dd3-391d39a4c3c2)
12
+
13
+ This package is compliant with [PSR-1], [PSR-2] and [PSR-4]. If you notice compliance oversights,
14
+ please send a patch via pull request.
15
+
16
+ [PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
17
+ [PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
18
+ [PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
19
+ [PSR-11]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md
20
+
21
+ ## Install
22
+
23
+ Via Composer
24
+
25
+ ``` bash
26
+ $ composer require league/container
27
+ ```
28
+
29
+ ## Requirements
30
+
31
+ The following versions of PHP are supported by this version.
32
+
33
+ * PHP 5.4
34
+ * PHP 5.5
35
+ * PHP 5.6
36
+ * PHP 7.0
37
+ * PHP 7.1
38
+ * HHVM
39
+
40
+ ## Documentation
41
+
42
+ Container has [full documentation](http://container.thephpleague.com), powered by [Jekyll](http://jekyllrb.com/).
43
+
44
+ Contribute to this documentation in the [gh-pages branch](https://github.com/thephpleague/container/tree/gh-pages/).
45
+
46
+ ## Testing
47
+
48
+ ``` bash
49
+ $ vendor/bin/phpunit
50
+ ```
51
+
52
+ ## Contributing
53
+
54
+ Please see [CONTRIBUTING](https://github.com/thephpleague/container/blob/master/CONTRIBUTING.md) for details.
55
+
56
+ ## Security
57
+
58
+ If you discover any security related issues, please email philipobenito@gmail.com instead of using the issue tracker.
59
+
60
+ ## Credits
61
+
62
+ - [Phil Bennett](https://github.com/philipobenito)
63
+ - [All Contributors](https://github.com/thephpleague/container/contributors)
64
+
65
+ All `Orno\Di` contributions can be found [here](https://github.com/orno/di/graphs/contributors).
66
+
67
+ ## License
68
+
69
+ The MIT License (MIT). Please see [License File](https://github.com/thephpleague/container/blob/master/LICENSE.md) for more information.
vendor/league/container/composer.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "league/container",
3
+ "description": "A fast and intuitive dependency injection container.",
4
+ "keywords": [
5
+ "league",
6
+ "container",
7
+ "dependency",
8
+ "injection",
9
+ "di",
10
+ "service",
11
+ "provider"
12
+ ],
13
+ "homepage": "https://github.com/thephpleague/container",
14
+ "license": "MIT",
15
+ "authors": [
16
+ {
17
+ "name": "Phil Bennett",
18
+ "email": "philipobenito@gmail.com",
19
+ "homepage": "http://www.philipobenito.com",
20
+ "role": "Developer"
21
+ }
22
+ ],
23
+ "require": {
24
+ "php": "^5.4.0 || ^7.0",
25
+ "container-interop/container-interop": "^1.2"
26
+ },
27
+ "require-dev": {
28
+ "phpunit/phpunit" : "4.*"
29
+ },
30
+ "provide": {
31
+ "container-interop/container-interop-implementation": "^1.2",
32
+ "psr/container-implementation": "^1.0"
33
+ },
34
+ "replace": {
35
+ "orno/di": "~2.0"
36
+ },
37
+ "autoload": {
38
+ "psr-4": {
39
+ "League\\Container\\": "src"
40
+ }
41
+ },
42
+ "autoload-dev": {
43
+ "psr-4": {
44
+ "League\\Container\\Test\\": "tests"
45
+ }
46
+ },
47
+ "extra": {
48
+ "branch-alias": {
49
+ "dev-2.x": "2.x-dev",
50
+ "dev-1.x": "1.x-dev"
51
+ }
52
+ }
53
+ }
vendor/league/container/src/Argument/ArgumentResolverInterface.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Argument;
4
+
5
+ use League\Container\ImmutableContainerAwareInterface;
6
+ use ReflectionFunctionAbstract;
7
+
8
+ interface ArgumentResolverInterface extends ImmutableContainerAwareInterface
9
+ {
10
+ /**
11
+ * Resolve an array of arguments to their concrete implementations.
12
+ *
13
+ * @param array $arguments
14
+ * @return array
15
+ */
16
+ public function resolveArguments(array $arguments);
17
+
18
+ /**
19
+ * Resolves the correct arguments to be passed to a method.
20
+ *
21
+ * @param \ReflectionFunctionAbstract $method
22
+ * @param array $args
23
+ * @return array
24
+ */
25
+ public function reflectArguments(ReflectionFunctionAbstract $method, array $args = []);
26
+ }
vendor/league/container/src/Argument/ArgumentResolverTrait.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Argument;
4
+
5
+ use League\Container\Exception\NotFoundException;
6
+ use League\Container\ReflectionContainer;
7
+ use ReflectionFunctionAbstract;
8
+ use ReflectionParameter;
9
+
10
+ trait ArgumentResolverTrait
11
+ {
12
+ /**
13
+ * {@inheritdoc}
14
+ */
15
+ public function resolveArguments(array $arguments)
16
+ {
17
+ foreach ($arguments as &$arg) {
18
+ if ($arg instanceof RawArgumentInterface) {
19
+ $arg = $arg->getValue();
20
+ continue;
21
+ }
22
+
23
+ if (! is_string($arg)) {
24
+ continue;
25
+ }
26
+
27
+ $container = $this->getContainer();
28
+
29
+ if (is_null($container) && $this instanceof ReflectionContainer) {
30
+ $container = $this;
31
+ }
32
+
33
+ if (! is_null($container) && $container->has($arg)) {
34
+ $arg = $container->get($arg);
35
+
36
+ if ($arg instanceof RawArgumentInterface) {
37
+ $arg = $arg->getValue();
38
+ }
39
+
40
+ continue;
41
+ }
42
+ }
43
+
44
+ return $arguments;
45
+ }
46
+
47
+ /**
48
+ * {@inheritdoc}
49
+ */
50
+ public function reflectArguments(ReflectionFunctionAbstract $method, array $args = [])
51
+ {
52
+ $arguments = array_map(function (ReflectionParameter $param) use ($method, $args) {
53
+ $name = $param->getName();
54
+ $class = $param->getClass();
55
+
56
+ if (array_key_exists($name, $args)) {
57
+ return $args[$name];
58
+ }
59
+
60
+ if (! is_null($class)) {
61
+ return $class->getName();
62
+ }
63
+
64
+ if ($param->isDefaultValueAvailable()) {
65
+ return $param->getDefaultValue();
66
+ }
67
+
68
+ throw new NotFoundException(sprintf(
69
+ 'Unable to resolve a value for parameter (%s) in the function/method (%s)',
70
+ $name,
71
+ $method->getName()
72
+ ));
73
+ }, $method->getParameters());
74
+
75
+ return $this->resolveArguments($arguments);
76
+ }
77
+
78
+ /**
79
+ * @return \League\Container\ContainerInterface
80
+ */
81
+ abstract public function getContainer();
82
+ }
vendor/league/container/src/Argument/RawArgument.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Argument;
4
+
5
+ class RawArgument implements RawArgumentInterface
6
+ {
7
+ /**
8
+ * @var mixed
9
+ */
10
+ protected $value;
11
+
12
+ /**
13
+ * {@inheritdoc}
14
+ */
15
+ public function __construct($value)
16
+ {
17
+ $this->value = $value;
18
+ }
19
+
20
+ /**
21
+ * {@inheritdoc}
22
+ */
23
+ public function getValue()
24
+ {
25
+ return $this->value;
26
+ }
27
+ }
vendor/league/container/src/Argument/RawArgumentInterface.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Argument;
4
+
5
+ interface RawArgumentInterface
6
+ {
7
+ /**
8
+ * Return the value of the raw argument.
9
+ *
10
+ * @return mixed
11
+ */
12
+ public function getValue();
13
+ }
vendor/league/container/src/Container.php ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ use Interop\Container\ContainerInterface as InteropContainerInterface;
6
+ use League\Container\Argument\RawArgumentInterface;
7
+ use League\Container\Definition\DefinitionFactory;
8
+ use League\Container\Definition\DefinitionFactoryInterface;
9
+ use League\Container\Definition\DefinitionInterface;
10
+ use League\Container\Exception\NotFoundException;
11
+ use League\Container\Inflector\InflectorAggregate;
12
+ use League\Container\Inflector\InflectorAggregateInterface;
13
+ use League\Container\ServiceProvider\ServiceProviderAggregate;
14
+ use League\Container\ServiceProvider\ServiceProviderAggregateInterface;
15
+
16
+ class Container implements ContainerInterface
17
+ {
18
+ /**
19
+ * @var \League\Container\Definition\DefinitionFactoryInterface
20
+ */
21
+ protected $definitionFactory;
22
+
23
+ /**
24
+ * @var \League\Container\Definition\DefinitionInterface[]
25
+ */
26
+ protected $definitions = [];
27
+
28
+ /**
29
+ * @var \League\Container\Definition\DefinitionInterface[]
30
+ */
31
+ protected $sharedDefinitions = [];
32
+
33
+ /**
34
+ * @var \League\Container\Inflector\InflectorAggregateInterface
35
+ */
36
+ protected $inflectors;
37
+
38
+ /**
39
+ * @var \League\Container\ServiceProvider\ServiceProviderAggregateInterface
40
+ */
41
+ protected $providers;
42
+
43
+ /**
44
+ * @var array
45
+ */
46
+ protected $shared = [];
47
+
48
+ /**
49
+ * @var \Interop\Container\ContainerInterface[]
50
+ */
51
+ protected $delegates = [];
52
+
53
+ /**
54
+ * Constructor.
55
+ *
56
+ * @param \League\Container\ServiceProvider\ServiceProviderAggregateInterface|null $providers
57
+ * @param \League\Container\Inflector\InflectorAggregateInterface|null $inflectors
58
+ * @param \League\Container\Definition\DefinitionFactoryInterface|null $definitionFactory
59
+ */
60
+ public function __construct(
61
+ ServiceProviderAggregateInterface $providers = null,
62
+ InflectorAggregateInterface $inflectors = null,
63
+ DefinitionFactoryInterface $definitionFactory = null
64
+ ) {
65
+ // set required dependencies
66
+ $this->providers = (is_null($providers))
67
+ ? (new ServiceProviderAggregate)->setContainer($this)
68
+ : $providers->setContainer($this);
69
+
70
+ $this->inflectors = (is_null($inflectors))
71
+ ? (new InflectorAggregate)->setContainer($this)
72
+ : $inflectors->setContainer($this);
73
+
74
+ $this->definitionFactory = (is_null($definitionFactory))
75
+ ? (new DefinitionFactory)->setContainer($this)
76
+ : $definitionFactory->setContainer($this);
77
+ }
78
+
79
+ /**
80
+ * {@inheritdoc}
81
+ */
82
+ public function get($alias, array $args = [])
83
+ {
84
+ try {
85
+ return $this->getFromThisContainer($alias, $args);
86
+ } catch (NotFoundException $exception) {
87
+ if ($this->providers->provides($alias)) {
88
+ $this->providers->register($alias);
89
+
90
+ return $this->getFromThisContainer($alias, $args);
91
+ }
92
+
93
+ $resolved = $this->getFromDelegate($alias, $args);
94
+
95
+ return $this->inflectors->inflect($resolved);
96
+ }
97
+ }
98
+
99
+ /**
100
+ * {@inheritdoc}
101
+ */
102
+ public function has($alias)
103
+ {
104
+ if (array_key_exists($alias, $this->definitions) || $this->hasShared($alias)) {
105
+ return true;
106
+ }
107
+
108
+ if ($this->providers->provides($alias)) {
109
+ return true;
110
+ }
111
+
112
+ return $this->hasInDelegate($alias);
113
+ }
114
+
115
+ /**
116
+ * Returns a boolean to determine if the container has a shared instance of an alias.
117
+ *
118
+ * @param string $alias
119
+ * @param boolean $resolved
120
+ * @return boolean
121
+ */
122
+ public function hasShared($alias, $resolved = false)
123
+ {
124
+ $shared = ($resolved === false) ? array_merge($this->shared, $this->sharedDefinitions) : $this->shared;
125
+
126
+ return (array_key_exists($alias, $shared));
127
+ }
128
+
129
+ /**
130
+ * {@inheritdoc}
131
+ */
132
+ public function add($alias, $concrete = null, $share = false)
133
+ {
134
+ unset($this->shared[$alias]);
135
+ unset($this->definitions[$alias]);
136
+ unset($this->sharedDefinitions[$alias]);
137
+
138
+ if (is_null($concrete)) {
139
+ $concrete = $alias;
140
+ }
141
+
142
+ $definition = $this->definitionFactory->getDefinition($alias, $concrete);
143
+
144
+ if ($definition instanceof DefinitionInterface) {
145
+ if ($share === false) {
146
+ $this->definitions[$alias] = $definition;
147
+ } else {
148
+ $this->sharedDefinitions[$alias] = $definition;
149
+ }
150
+
151
+ return $definition;
152
+ }
153
+
154
+ // dealing with a value that cannot build a definition
155
+ $this->shared[$alias] = $concrete;
156
+ }
157
+
158
+ /**
159
+ * {@inheritdoc}
160
+ */
161
+ public function share($alias, $concrete = null)
162
+ {
163
+ return $this->add($alias, $concrete, true);
164
+ }
165
+
166
+ /**
167
+ * {@inheritdoc}
168
+ */
169
+ public function addServiceProvider($provider)
170
+ {
171
+ $this->providers->add($provider);
172
+
173
+ return $this;
174
+ }
175
+
176
+ /**
177
+ * {@inheritdoc}
178
+ */
179
+ public function extend($alias)
180
+ {
181
+ if ($this->providers->provides($alias)) {
182
+ $this->providers->register($alias);
183
+ }
184
+
185
+ if (array_key_exists($alias, $this->definitions)) {
186
+ return $this->definitions[$alias];
187
+ }
188
+
189
+ if (array_key_exists($alias, $this->sharedDefinitions)) {
190
+ return $this->sharedDefinitions[$alias];
191
+ }
192
+
193
+ throw new NotFoundException(
194
+ sprintf('Unable to extend alias (%s) as it is not being managed as a definition', $alias)
195
+ );
196
+ }
197
+
198
+ /**
199
+ * {@inheritdoc}
200
+ */
201
+ public function inflector($type, callable $callback = null)
202
+ {
203
+ return $this->inflectors->add($type, $callback);
204
+ }
205
+
206
+ /**
207
+ * {@inheritdoc}
208
+ */
209
+ public function call(callable $callable, array $args = [])
210
+ {
211
+ return (new ReflectionContainer)->setContainer($this)->call($callable, $args);
212
+ }
213
+
214
+ /**
215
+ * Delegate a backup container to be checked for services if it
216
+ * cannot be resolved via this container.
217
+ *
218
+ * @param \Interop\Container\ContainerInterface $container
219
+ * @return $this
220
+ */
221
+ public function delegate(InteropContainerInterface $container)
222
+ {
223
+ $this->delegates[] = $container;
224
+
225
+ if ($container instanceof ImmutableContainerAwareInterface) {
226
+ $container->setContainer($this);
227
+ }
228
+
229
+ return $this;
230
+ }
231
+
232
+ /**
233
+ * Returns true if service is registered in one of the delegated backup containers.
234
+ *
235
+ * @param string $alias
236
+ * @return boolean
237
+ */
238
+ public function hasInDelegate($alias)
239
+ {
240
+ foreach ($this->delegates as $container) {
241
+ if ($container->has($alias)) {
242
+ return true;
243
+ }
244
+ }
245
+
246
+ return false;
247
+ }
248
+
249
+ /**
250
+ * Attempt to get a service from the stack of delegated backup containers.
251
+ *
252
+ * @param string $alias
253
+ * @param array $args
254
+ * @return mixed
255
+ */
256
+ protected function getFromDelegate($alias, array $args = [])
257
+ {
258
+ foreach ($this->delegates as $container) {
259
+ if ($container->has($alias)) {
260
+ return $container->get($alias, $args);
261
+ }
262
+
263
+ continue;
264
+ }
265
+
266
+ throw new NotFoundException(
267
+ sprintf('Alias (%s) is not being managed by the container', $alias)
268
+ );
269
+
270
+ }
271
+
272
+ /**
273
+ * Get a service that has been registered in this container.
274
+ *
275
+ * @param string $alias
276
+ * @param array $args
277
+ * @return mixed
278
+ */
279
+ protected function getFromThisContainer($alias, array $args = [])
280
+ {
281
+ if ($this->hasShared($alias, true)) {
282
+ $shared = $this->inflectors->inflect($this->shared[$alias]);
283
+ if ($shared instanceof RawArgumentInterface) {
284
+ return $shared->getValue();
285
+ }
286
+ return $shared;
287
+ }
288
+
289
+ if (array_key_exists($alias, $this->sharedDefinitions)) {
290
+ $shared = $this->inflectors->inflect($this->sharedDefinitions[$alias]->build());
291
+ $this->shared[$alias] = $shared;
292
+ return $shared;
293
+ }
294
+
295
+ if (array_key_exists($alias, $this->definitions)) {
296
+ return $this->inflectors->inflect(
297
+ $this->definitions[$alias]->build($args)
298
+ );
299
+ }
300
+
301
+ throw new NotFoundException(
302
+ sprintf('Alias (%s) is not being managed by the container', $alias)
303
+ );
304
+ }
305
+ }
vendor/league/container/src/ContainerAwareInterface.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ interface ContainerAwareInterface
6
+ {
7
+ /**
8
+ * Set a container
9
+ *
10
+ * @param \League\Container\ContainerInterface $container
11
+ */
12
+ public function setContainer(ContainerInterface $container);
13
+
14
+ /**
15
+ * Get the container
16
+ *
17
+ * @return \League\Container\ContainerInterface
18
+ */
19
+ public function getContainer();
20
+ }
vendor/league/container/src/ContainerAwareTrait.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ trait ContainerAwareTrait
6
+ {
7
+ /**
8
+ * @var \League\Container\ContainerInterface
9
+ */
10
+ protected $container;
11
+
12
+ /**
13
+ * Set a container.
14
+ *
15
+ * @param \League\Container\ContainerInterface $container
16
+ * @return $this
17
+ */
18
+ public function setContainer(ContainerInterface $container)
19
+ {
20
+ $this->container = $container;
21
+
22
+ return $this;
23
+ }
24
+
25
+ /**
26
+ * Get the container.
27
+ *
28
+ * @return \League\Container\ContainerInterface
29
+ */
30
+ public function getContainer()
31
+ {
32
+ return $this->container;
33
+ }
34
+ }
vendor/league/container/src/ContainerInterface.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ interface ContainerInterface extends ImmutableContainerInterface
6
+ {
7
+ /**
8
+ * Add an item to the container.
9
+ *
10
+ * @param string $alias
11
+ * @param mixed|null $concrete
12
+ * @param boolean $share
13
+ * @return \League\Container\Definition\DefinitionInterface
14
+ */
15
+ public function add($alias, $concrete = null, $share = false);
16
+
17
+ /**
18
+ * Convenience method to add an item to the container as a shared item.
19
+ *
20
+ * @param string $alias
21
+ * @param mixed|null $concrete
22
+ * @return \League\Container\Definition\DefinitionInterface
23
+ */
24
+ public function share($alias, $concrete = null);
25
+
26
+ /**
27
+ * Add a service provider to the container.
28
+ *
29
+ * @param string|\League\Container\ServiceProvider\ServiceProviderInterface $provider
30
+ * @return void
31
+ */
32
+ public function addServiceProvider($provider);
33
+
34
+ /**
35
+ * Returns a definition of an item to be extended.
36
+ *
37
+ * @param string $alias
38
+ * @return \League\Container\Definition\DefinitionInterface
39
+ */
40
+ public function extend($alias);
41
+
42
+ /**
43
+ * Allows for manipulation of specific types on resolution.
44
+ *
45
+ * @param string $type
46
+ * @param callable|null $callback
47
+ * @return \League\Container\Inflector\Inflector|void
48
+ */
49
+ public function inflector($type, callable $callback = null);
50
+
51
+ /**
52
+ * Invoke a callable via the container.
53
+ *
54
+ * @param callable $callable
55
+ * @param array $args
56
+ * @return mixed
57
+ */
58
+ public function call(callable $callable, array $args = []);
59
+ }
vendor/league/container/src/Definition/AbstractDefinition.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ use League\Container\Argument\ArgumentResolverInterface;
6
+ use League\Container\Argument\ArgumentResolverTrait;
7
+ use League\Container\ImmutableContainerAwareTrait;
8
+
9
+ abstract class AbstractDefinition implements ArgumentResolverInterface, DefinitionInterface
10
+ {
11
+ use ArgumentResolverTrait;
12
+ use ImmutableContainerAwareTrait;
13
+
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $alias;
18
+
19
+ /**
20
+ * @var mixed
21
+ */
22
+ protected $concrete;
23
+
24
+ /**
25
+ * @var array
26
+ */
27
+ protected $arguments = [];
28
+
29
+ /**
30
+ * Constructor.
31
+ *
32
+ * @param string $alias
33
+ * @param mixed $concrete
34
+ */
35
+ public function __construct($alias, $concrete)
36
+ {
37
+ $this->alias = $alias;
38
+ $this->concrete = $concrete;
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function withArgument($arg)
45
+ {
46
+ $this->arguments[] = $arg;
47
+
48
+ return $this;
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ */
54
+ public function withArguments(array $args)
55
+ {
56
+ foreach ($args as $arg) {
57
+ $this->withArgument($arg);
58
+ }
59
+
60
+ return $this;
61
+ }
62
+ }
vendor/league/container/src/Definition/CallableDefinition.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ class CallableDefinition extends AbstractDefinition
6
+ {
7
+ /**
8
+ * {@inheritdoc}
9
+ */
10
+ public function build(array $args = [])
11
+ {
12
+ $args = (empty($args)) ? $this->arguments : $args;
13
+ $resolved = $this->resolveArguments($args);
14
+
15
+ if (is_array($this->concrete) && is_string($this->concrete[0])) {
16
+ $this->concrete[0] = ($this->getContainer()->has($this->concrete[0]))
17
+ ? $this->getContainer()->get($this->concrete[0])
18
+ : $this->concrete[0];
19
+ }
20
+
21
+ return call_user_func_array($this->concrete, $resolved);
22
+ }
23
+ }
vendor/league/container/src/Definition/ClassDefinition.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ use ReflectionClass;
6
+
7
+ class ClassDefinition extends AbstractDefinition implements ClassDefinitionInterface
8
+ {
9
+ /**
10
+ * @var array
11
+ */
12
+ protected $methods = [];
13
+
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ public function withMethodCall($method, array $args = [])
18
+ {
19
+ $this->methods[] = [
20
+ 'method' => $method,
21
+ 'arguments' => $args
22
+ ];
23
+
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * {@inheritdoc}
29
+ */
30
+ public function withMethodCalls(array $methods = [])
31
+ {
32
+ foreach ($methods as $method => $args) {
33
+ $this->withMethodCall($method, $args);
34
+ }
35
+
36
+ return $this;
37
+ }
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public function build(array $args = [])
43
+ {
44
+ $args = (empty($args)) ? $this->arguments : $args;
45
+ $resolved = $this->resolveArguments($args);
46
+ $reflection = new ReflectionClass($this->concrete);
47
+ $instance = $reflection->newInstanceArgs($resolved);
48
+
49
+ return $this->invokeMethods($instance);
50
+ }
51
+
52
+ /**
53
+ * Invoke methods on resolved instance.
54
+ *
55
+ * @param object $instance
56
+ * @return object
57
+ */
58
+ protected function invokeMethods($instance)
59
+ {
60
+ foreach ($this->methods as $method) {
61
+ $args = $this->resolveArguments($method['arguments']);
62
+ call_user_func_array([$instance, $method['method']], $args);
63
+ }
64
+
65
+ return $instance;
66
+ }
67
+ }
vendor/league/container/src/Definition/ClassDefinitionInterface.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ interface ClassDefinitionInterface extends DefinitionInterface
6
+ {
7
+ /**
8
+ * Add a method to be invoked
9
+ *
10
+ * @param string $method
11
+ * @param array $args
12
+ * @return $this
13
+ */
14
+ public function withMethodCall($method, array $args = []);
15
+
16
+ /**
17
+ * Add multiple methods to be invoked
18
+ *
19
+ * @param array $methods
20
+ * @return $this
21
+ */
22
+ public function withMethodCalls(array $methods = []);
23
+ }
vendor/league/container/src/Definition/DefinitionFactory.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ use League\Container\ImmutableContainerAwareTrait;
6
+
7
+ class DefinitionFactory implements DefinitionFactoryInterface
8
+ {
9
+ use ImmutableContainerAwareTrait;
10
+
11
+ /**
12
+ * {@inheritdoc}
13
+ */
14
+ public function getDefinition($alias, $concrete)
15
+ {
16
+ if (is_callable($concrete)) {
17
+ return (new CallableDefinition($alias, $concrete))->setContainer($this->getContainer());
18
+ }
19
+
20
+ if (is_string($concrete) && class_exists($concrete)) {
21
+ return (new ClassDefinition($alias, $concrete))->setContainer($this->getContainer());
22
+ }
23
+
24
+ // if the item is not definable we just return the value to be stored
25
+ // in the container as an arbitrary value/instance
26
+ return $concrete;
27
+ }
28
+ }
vendor/league/container/src/Definition/DefinitionFactoryInterface.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ use League\Container\ImmutableContainerAwareInterface;
6
+
7
+ interface DefinitionFactoryInterface extends ImmutableContainerAwareInterface
8
+ {
9
+ /**
10
+ * Return a definition based on type of concrete.
11
+ *
12
+ * @param string $alias
13
+ * @param mixed $concrete
14
+ * @return mixed
15
+ */
16
+ public function getDefinition($alias, $concrete);
17
+ }
vendor/league/container/src/Definition/DefinitionInterface.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Definition;
4
+
5
+ interface DefinitionInterface
6
+ {
7
+ /**
8
+ * Handle instantiation and manipulation of value and return.
9
+ *
10
+ * @param array $args
11
+ * @return mixed
12
+ */
13
+ public function build(array $args = []);
14
+
15
+ /**
16
+ * Add an argument to be injected.
17
+ *
18
+ * @param mixed $arg
19
+ * @return $this
20
+ */
21
+ public function withArgument($arg);
22
+
23
+ /**
24
+ * Add multiple arguments to be injected.
25
+ *
26
+ * @param array $args
27
+ * @return $this
28
+ */
29
+ public function withArguments(array $args);
30
+ }
vendor/league/container/src/Exception/NotFoundException.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Exception;
4
+
5
+ use Interop\Container\Exception\NotFoundException as NotFoundExceptionInterface;
6
+ use InvalidArgumentException;
7
+
8
+ class NotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface
9
+ {
10
+ }
vendor/league/container/src/ImmutableContainerAwareInterface.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ use Interop\Container\ContainerInterface as InteropContainerInterface;
6
+
7
+ interface ImmutableContainerAwareInterface
8
+ {
9
+ /**
10
+ * Set a container
11
+ *
12
+ * @param \Interop\Container\ContainerInterface $container
13
+ */
14
+ public function setContainer(InteropContainerInterface $container);
15
+
16
+ /**
17
+ * Get the container
18
+ *
19
+ * @return \League\Container\ImmutableContainerInterface
20
+ */
21
+ public function getContainer();
22
+ }
vendor/league/container/src/ImmutableContainerAwareTrait.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ use Interop\Container\ContainerInterface as InteropContainerInterface;
6
+
7
+ trait ImmutableContainerAwareTrait
8
+ {
9
+ /**
10
+ * @var \Interop\Container\ContainerInterface
11
+ */
12
+ protected $container;
13
+
14
+ /**
15
+ * Set a container.
16
+ *
17
+ * @param \Interop\Container\ContainerInterface $container
18
+ * @return $this
19
+ */
20
+ public function setContainer(InteropContainerInterface $container)
21
+ {
22
+ $this->container = $container;
23
+
24
+ return $this;
25
+ }
26
+
27
+ /**
28
+ * Get the container.
29
+ *
30
+ * @return \League\Container\ImmutableContainerInterface
31
+ */
32
+ public function getContainer()
33
+ {
34
+ return $this->container;
35
+ }
36
+ }
vendor/league/container/src/ImmutableContainerInterface.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ use Interop\Container\ContainerInterface as InteropContainerInterface;
6
+
7
+ interface ImmutableContainerInterface extends InteropContainerInterface
8
+ {
9
+
10
+ }
vendor/league/container/src/Inflector/Inflector.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Inflector;
4
+
5
+ use League\Container\ImmutableContainerAwareTrait;
6
+ use League\Container\Argument\ArgumentResolverInterface;
7
+ use League\Container\Argument\ArgumentResolverTrait;
8
+
9
+ class Inflector implements ArgumentResolverInterface
10
+ {
11
+ use ArgumentResolverTrait;
12
+ use ImmutableContainerAwareTrait;
13
+
14
+ /**
15
+ * @var array
16
+ */
17
+ protected $methods = [];
18
+
19
+ /**
20
+ * @var array
21
+ */
22
+ protected $properties = [];
23
+
24
+ /**
25
+ * Defines a method to be invoked on the subject object.
26
+ *
27
+ * @param string $name
28
+ * @param array $args
29
+ * @return $this
30
+ */
31
+ public function invokeMethod($name, array $args)
32
+ {
33
+ $this->methods[$name] = $args;
34
+
35
+ return $this;
36
+ }
37
+
38
+ /**
39
+ * Defines multiple methods to be invoked on the subject object.
40
+ *
41
+ * @param array $methods
42
+ * @return $this
43
+ */
44
+ public function invokeMethods(array $methods)
45
+ {
46
+ foreach ($methods as $name => $args) {
47
+ $this->invokeMethod($name, $args);
48
+ }
49
+
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ * Defines a property to be set on the subject object.
55
+ *
56
+ * @param string $property
57
+ * @param mixed $value
58
+ * @return $this
59
+ */
60
+ public function setProperty($property, $value)
61
+ {
62
+ $this->properties[$property] = $value;
63
+
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Defines multiple properties to be set on the subject object.
69
+ *
70
+ * @param array $properties
71
+ * @return $this
72
+ */
73
+ public function setProperties(array $properties)
74
+ {
75
+ foreach ($properties as $property => $value) {
76
+ $this->setProperty($property, $value);
77
+ }
78
+
79
+ return $this;
80
+ }
81
+
82
+ /**
83
+ * Apply inflections to an object.
84
+ *
85
+ * @param object $object
86
+ * @return void
87
+ */
88
+ public function inflect($object)
89
+ {
90
+ $properties = $this->resolveArguments(array_values($this->properties));
91
+ $properties = array_combine(array_keys($this->properties), $properties);
92
+
93
+ foreach ($properties as $property => $value) {
94
+ $object->{$property} = $value;
95
+ }
96
+
97
+ foreach ($this->methods as $method => $args) {
98
+ $args = $this->resolveArguments($args);
99
+
100
+ call_user_func_array([$object, $method], $args);
101
+ }
102
+ }
103
+ }
vendor/league/container/src/Inflector/InflectorAggregate.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Inflector;
4
+
5
+ use League\Container\ImmutableContainerAwareTrait;
6
+
7
+ class InflectorAggregate implements InflectorAggregateInterface
8
+ {
9
+ use ImmutableContainerAwareTrait;
10
+
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $inflectors = [];
15
+
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function add($type, callable $callback = null)
20
+ {
21
+ if (is_null($callback)) {
22
+ $inflector = new Inflector;
23
+ $this->inflectors[$type] = $inflector;
24
+
25
+ return $inflector;
26
+ }
27
+
28
+ $this->inflectors[$type] = $callback;
29
+ }
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public function inflect($object)
35
+ {
36
+ foreach ($this->inflectors as $type => $inflector) {
37
+ if (! $object instanceof $type) {
38
+ continue;
39
+ }
40
+
41
+ if ($inflector instanceof Inflector) {
42
+ $inflector->setContainer($this->getContainer());
43
+ $inflector->inflect($object);
44
+ continue;
45
+ }
46
+
47
+ // must be dealing with a callable as the inflector
48
+ call_user_func_array($inflector, [$object]);
49
+ }
50
+
51
+ return $object;
52
+ }
53
+ }
vendor/league/container/src/Inflector/InflectorAggregateInterface.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\Inflector;
4
+
5
+ use League\Container\ImmutableContainerAwareInterface;
6
+
7
+ interface InflectorAggregateInterface extends ImmutableContainerAwareInterface
8
+ {
9
+ /**
10
+ * Add an inflector to the aggregate.
11
+ *
12
+ * @param string $type
13
+ * @param callable $callback
14
+ * @return \League\Container\Inflector\Inflector
15
+ */
16
+ public function add($type, callable $callback = null);
17
+
18
+ /**
19
+ * Applies all inflectors to an object.
20
+ *
21
+ * @param object $object
22
+ * @return object
23
+ */
24
+ public function inflect($object);
25
+ }
vendor/league/container/src/ReflectionContainer.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container;
4
+
5
+ use League\Container\Argument\ArgumentResolverInterface;
6
+ use League\Container\Argument\ArgumentResolverTrait;
7
+ use League\Container\Exception\NotFoundException;
8
+ use ReflectionClass;
9
+ use ReflectionFunction;
10
+ use ReflectionMethod;
11
+
12
+ class ReflectionContainer implements
13
+ ArgumentResolverInterface,
14
+ ImmutableContainerInterface
15
+ {
16
+ use ArgumentResolverTrait;
17
+ use ImmutableContainerAwareTrait;
18
+
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public function get($alias, array $args = [])
23
+ {
24
+ if (! $this->has($alias)) {
25
+ throw new NotFoundException(
26
+ sprintf('Alias (%s) is not an existing class and therefore cannot be resolved', $alias)
27
+ );
28
+ }
29
+
30
+ $reflector = new ReflectionClass($alias);
31
+ $construct = $reflector->getConstructor();
32
+
33
+ if ($construct === null) {
34
+ return new $alias;
35
+ }
36
+
37
+ return $reflector->newInstanceArgs(
38
+ $this->reflectArguments($construct, $args)
39
+ );
40
+ }
41
+
42
+ /**
43
+ * {@inheritdoc}
44
+ */
45
+ public function has($alias)
46
+ {
47
+ return class_exists($alias);
48
+ }
49
+
50
+ /**
51
+ * Invoke a callable via the container.
52
+ *
53
+ * @param callable $callable
54
+ * @param array $args
55
+ * @return mixed
56
+ */
57
+ public function call(callable $callable, array $args = [])
58
+ {
59
+ if (is_string($callable) && strpos($callable, '::') !== false) {
60
+ $callable = explode('::', $callable);
61
+ }
62
+
63
+ if (is_array($callable)) {
64
+ if (is_string($callable[0])) {
65
+ $callable[0] = $this->getContainer()->get($callable[0]);
66
+ }
67
+
68
+ $reflection = new ReflectionMethod($callable[0], $callable[1]);
69
+
70
+ if ($reflection->isStatic()) {
71
+ $callable[0] = null;
72
+ }
73
+
74
+ return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args));
75
+ }
76
+
77
+ if (is_object($callable)) {
78
+ $reflection = new ReflectionMethod($callable, '__invoke');
79
+
80
+ return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args));
81
+ }
82
+
83
+ $reflection = new ReflectionFunction($callable);
84
+
85
+ return $reflection->invokeArgs($this->reflectArguments($reflection, $args));
86
+ }
87
+ }
vendor/league/container/src/ServiceProvider/AbstractServiceProvider.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ use League\Container\ContainerAwareTrait;
6
+
7
+ abstract class AbstractServiceProvider implements ServiceProviderInterface
8
+ {
9
+ use ContainerAwareTrait;
10
+
11
+ /**
12
+ * @var array
13
+ */
14
+ protected $provides = [];
15
+
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public function provides($alias = null)
20
+ {
21
+ if (! is_null($alias)) {
22
+ return (in_array($alias, $this->provides));
23
+ }
24
+
25
+ return $this->provides;
26
+ }
27
+ }
vendor/league/container/src/ServiceProvider/AbstractSignatureServiceProvider.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ abstract class AbstractSignatureServiceProvider
6
+ extends AbstractServiceProvider
7
+ implements SignatureServiceProviderInterface
8
+ {
9
+ /**
10
+ * @var string
11
+ */
12
+ protected $signature;
13
+
14
+ /**
15
+ * {@inheritdoc}
16
+ */
17
+ public function withSignature($signature)
18
+ {
19
+ $this->signature = $signature;
20
+
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public function getSignature()
28
+ {
29
+ return (is_null($this->signature)) ? get_class($this) : $this->signature;
30
+ }
31
+ }
vendor/league/container/src/ServiceProvider/BootableServiceProviderInterface.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ interface BootableServiceProviderInterface extends ServiceProviderInterface
6
+ {
7
+ /**
8
+ * Method will be invoked on registration of a service provider implementing
9
+ * this interface. Provides ability for eager loading of Service Providers.
10
+ *
11
+ * @return void
12
+ */
13
+ public function boot();
14
+ }
vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ use League\Container\ContainerAwareInterface;
6
+ use League\Container\ContainerAwareTrait;
7
+
8
+ class ServiceProviderAggregate implements ServiceProviderAggregateInterface
9
+ {
10
+ use ContainerAwareTrait;
11
+
12
+ /**
13
+ * @var array
14
+ */
15
+ protected $providers = [];
16
+
17
+ /**
18
+ * @var array
19
+ */
20
+ protected $registered = [];
21
+
22
+ /**
23
+ * {@inheritdoc}
24
+ */
25
+ public function add($provider)
26
+ {
27
+ if (is_string($provider) && class_exists($provider)) {
28
+ $provider = new $provider;
29
+ }
30
+
31
+ if ($provider instanceof ContainerAwareInterface) {
32
+ $provider->setContainer($this->getContainer());
33
+ }
34
+
35
+ if ($provider instanceof BootableServiceProviderInterface) {
36
+ $provider->boot();
37
+ }
38
+
39
+ if ($provider instanceof ServiceProviderInterface) {
40
+ foreach ($provider->provides() as $service) {
41
+ $this->providers[$service] = $provider;
42
+ }
43
+
44
+ return $this;
45
+ }
46
+
47
+ throw new \InvalidArgumentException(
48
+ 'A service provider must be a fully qualified class name or instance ' .
49
+ 'of (\League\Container\ServiceProvider\ServiceProviderInterface)'
50
+ );
51
+ }
52
+
53
+ /**
54
+ * {@inheritdoc}
55
+ */
56
+ public function provides($service)
57
+ {
58
+ return array_key_exists($service, $this->providers);
59
+ }
60
+
61
+ /**
62
+ * {@inheritdoc}
63
+ */
64
+ public function register($service)
65
+ {
66
+ if (! array_key_exists($service, $this->providers)) {
67
+ throw new \InvalidArgumentException(
68
+ sprintf('(%s) is not provided by a service provider', $service)
69
+ );
70
+ }
71
+
72
+ $provider = $this->providers[$service];
73
+ $signature = get_class($provider);
74
+
75
+ if ($provider instanceof SignatureServiceProviderInterface) {
76
+ $signature = $provider->getSignature();
77
+ }
78
+
79
+ // ensure that the provider hasn't already been invoked by any other service request
80
+ if (in_array($signature, $this->registered)) {
81
+ return;
82
+ }
83
+
84
+ $provider->register();
85
+
86
+ $this->registered[] = $signature;
87
+ }
88
+ }
vendor/league/container/src/ServiceProvider/ServiceProviderAggregateInterface.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ use League\Container\ContainerAwareInterface;
6
+
7
+ interface ServiceProviderAggregateInterface extends ContainerAwareInterface
8
+ {
9
+ /**
10
+ * Add a service provider to the aggregate.
11
+ *
12
+ * @param string|\League\Container\ServiceProvider\ServiceProviderInterface $provider
13
+ * @return $this
14
+ */
15
+ public function add($provider);
16
+
17
+ /**
18
+ * Determines whether a service is provided by the aggregate.
19
+ *
20
+ * @param string $service
21
+ * @return boolean
22
+ */
23
+ public function provides($service);
24
+
25
+ /**
26
+ * Invokes the register method of a provider that provides a specific service.
27
+ *
28
+ * @param string $service
29
+ * @return void
30
+ */
31
+ public function register($service);
32
+ }
vendor/league/container/src/ServiceProvider/ServiceProviderInterface.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ use League\Container\ContainerAwareInterface;
6
+
7
+ interface ServiceProviderInterface extends ContainerAwareInterface
8
+ {
9
+ /**
10
+ * Returns a boolean if checking whether this provider provides a specific
11
+ * service or returns an array of provided services if no argument passed.
12
+ *
13
+ * @param string $service
14
+ * @return boolean|array
15
+ */
16
+ public function provides($service = null);
17
+
18
+ /**
19
+ * Use the register method to register items with the container via the
20
+ * protected $this->container property or the `getContainer` method
21
+ * from the ContainerAwareTrait.
22
+ *
23
+ * @return void
24
+ */
25
+ public function register();
26
+ }
vendor/league/container/src/ServiceProvider/SignatureServiceProviderInterface.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace League\Container\ServiceProvider;
4
+
5
+ interface SignatureServiceProviderInterface
6
+ {
7
+ /**
8
+ * Set a custom signature for the service provider. This enables
9
+ * registering the same service provider multiple times.
10
+ *
11
+ * @param string $signature
12
+ * @return self
13
+ */
14
+ public function withSignature($signature);
15
+
16
+ /**
17
+ * The signature of the service provider uniquely identifies it, so
18
+ * that we can quickly determine if it has already been registered.
19
+ * Defaults to get_class($provider).
20
+ *
21
+ * @return string
22
+ */
23
+ public function getSignature();
24
+ }
vendor/psr/container/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ composer.lock
2
+ composer.phar
3
+ /vendor/
vendor/psr/container/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013-2016 container-interop
4
+ Copyright (c) 2016 PHP Framework Interoperability Group
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/psr/container/README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ # PSR Container
2
+
3
+ This repository holds all interfaces/classes/traits related to [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md).
4
+
5
+ Note that this is not a container implementation of its own. See the specification for more details.
vendor/psr/container/composer.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "psr/container",
3
+ "type": "library",
4
+ "description": "Common Container Interface (PHP FIG PSR-11)",
5
+ "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"],
6
+ "homepage": "https://github.com/php-fig/container",
7
+ "license": "MIT",
8
+ "authors": [
9
+ {
10
+ "name": "PHP-FIG",
11
+ "homepage": "http://www.php-fig.org/"
12
+ }
13
+ ],
14
+ "require": {
15
+ "php": ">=5.3.0"
16
+ },
17
+ "autoload": {
18
+ "psr-4": {
19
+ "Psr\\Container\\": "src/"
20
+ }
21
+ },
22
+ "extra": {
23
+ "branch-alias": {
24
+ "dev-master": "1.0.x-dev"
25
+ }
26
+ }
27
+ }
vendor/psr/container/src/ContainerExceptionInterface.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Psr\Container;
7
+
8
+ /**
9
+ * Base interface representing a generic exception in a container.
10
+ */
11
+ interface ContainerExceptionInterface
12
+ {
13
+ }
vendor/psr/container/src/ContainerInterface.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Psr\Container;
7
+
8
+ /**
9
+ * Describes the interface of a container that exposes methods to read its entries.
10
+ */
11
+ interface ContainerInterface
12
+ {
13
+ /**
14
+ * Finds an entry of the container by its identifier and returns it.
15
+ *
16
+ * @param string $id Identifier of the entry to look for.
17
+ *
18
+ * @throws NotFoundExceptionInterface No entry was found for **this** identifier.
19
+ * @throws ContainerExceptionInterface Error while retrieving the entry.
20
+ *
21
+ * @return mixed Entry.
22
+ */
23
+ public function get($id);
24
+
25
+ /**
26
+ * Returns true if the container can return an entry for the given identifier.
27
+ * Returns false otherwise.
28
+ *
29
+ * `has($id)` returning true does not mean that `get($id)` will not throw an exception.
30
+ * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.
31
+ *
32
+ * @param string $id Identifier of the entry to look for.
33
+ *
34
+ * @return bool
35
+ */
36
+ public function has($id);
37
+ }
vendor/psr/container/src/NotFoundExceptionInterface.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
4
+ */
5
+
6
+ namespace Psr\Container;
7
+
8
+ /**
9
+ * No entry was found in the container.
10
+ */
11
+ interface NotFoundExceptionInterface extends ContainerExceptionInterface
12
+ {
13
+ }
vendor/wp-media/rocket-lazyload-common/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ vendor/
vendor/wp-media/rocket-lazyload-common/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
vendor/wp-media/rocket-lazyload-common/README.md ADDED
@@ -0,0 +1,2 @@
 
 
1
+ # rocket-lazyload-common
2
+ Common code between WP Rocket and Lazyload by WP Rocket plugins
vendor/wp-media/rocket-lazyload-common/composer.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wp-media/rocket-lazyload-common",
3
+ "description": "Common Code between WP Rocket and Lazyload by WP Rocket",
4
+ "license": "GPLv3",
5
+ "authors": [
6
+ {
7
+ "name": "WP Media",
8
+ "email": "contact@wp-media.me"
9
+ }
10
+ ],
11
+ "minimum-stability": "stable",
12
+ "autoload": {
13
+ "psr-4": {
14
+ "RocketLazyload\\": "src"
15
+ }
16
+ },
17
+ "require": {
18
+ "php": ">=5.4"
19
+ },
20
+ "require-dev": {
21
+ "squizlabs/php_codesniffer": "^3.2"
22
+ }
23
+ }
vendor/wp-media/rocket-lazyload-common/composer.lock ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "f9b403fc49b8026e5db8d7f5acb01c74",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "squizlabs/php_codesniffer",
12
+ "version": "3.3.2",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
16
+ "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
21
+ "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "ext-simplexml": "*",
26
+ "ext-tokenizer": "*",
27
+ "ext-xmlwriter": "*",
28
+ "php": ">=5.4.0"
29
+ },
30
+ "require-dev": {
31
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
32
+ },
33
+ "bin": [
34
+ "bin/phpcs",
35
+ "bin/phpcbf"
36
+ ],
37
+ "type": "library",
38
+ "extra": {
39
+ "branch-alias": {
40
+ "dev-master": "3.x-dev"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "BSD-3-Clause"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Greg Sherwood",
50
+ "role": "lead"
51
+ }
52
+ ],
53
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
54
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
55
+ "keywords": [
56
+ "phpcs",
57
+ "standards"
58
+ ],
59
+ "time": "2018-09-23T23:08:17+00:00"
60
+ }
61
+ ],
62
+ "aliases": [],
63
+ "minimum-stability": "stable",
64
+ "stability-flags": [],
65
+ "prefer-stable": false,
66
+ "prefer-lowest": false,
67
+ "platform": {
68
+ "php": ">=5.4"
69
+ },
70
+ "platform-dev": []
71
+ }
vendor/wp-media/rocket-lazyload-common/phpcs.xml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="Rocket Lazyload">
3
+ <description>Rocket Lazyload Coding Standards</description>
4
+
5
+ <config name="testVersion" value="5.4-" />
6
+ <rule ref="PSR2" />
7
+ </ruleset>
vendor/wp-media/rocket-lazyload-common/src/Assets.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyload;
3
+
4
+ class Assets
5
+ {
6
+ /**
7
+ * Inserts the lazyload script in the HTML
8
+ *
9
+ * @param array $args Array of arguments to populate the lazyload script options.
10
+ * @return void
11
+ */
12
+ public function insertLazyloadScript($args)
13
+ {
14
+ $defaults = [
15
+ 'base_url' => '',
16
+ 'suffix' => 'min',
17
+ 'elements' => [
18
+ 'img',
19
+ 'iframe',
20
+ ],
21
+ 'threshold' => 300,
22
+ 'version' => '',
23
+ 'fallback' => '',
24
+ ];
25
+
26
+ $args = wp_parse_args($args, $defaults);
27
+
28
+ echo '<script>(function(w, d){
29
+ var b = d.getElementsByTagName("body")[0];
30
+ var s = d.createElement("script"); s.async = true;
31
+ s.src = !("IntersectionObserver" in w) ? "' . $args['base_url'] . 'lazyload-' . $args['fallback'] . $args['suffix'] . '.js" : "' . $args['base_url'] . 'lazyload-' . $args['version'] . $args['suffix'] . '.js";
32
+ w.lazyLoadOptions = {
33
+ elements_selector: "' . esc_attr(implode(',', $args['elements'])) . '",
34
+ data_src: "lazy-src",
35
+ data_srcset: "lazy-srcset",
36
+ data_sizes: "lazy-sizes",
37
+ skip_invisible: false,
38
+ class_loading: "lazyloading",
39
+ class_loaded: "lazyloaded",
40
+ threshold: ' . esc_attr($args['threshold']) . ',
41
+ callback_load: function(element) {
42
+ if ( element.tagName === "IFRAME" && element.dataset.rocketLazyload == "fitvidscompatible" ) {
43
+ if (element.classList.contains("lazyloaded") ) {
44
+ if (typeof window.jQuery != "undefined") {
45
+ if (jQuery.fn.fitVids) {
46
+ jQuery(element).parent().fitVids();
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }; // Your options here. See "recipes" for more information about async.
53
+ b.appendChild(s);
54
+ }(window, document));
55
+
56
+ // Listen to the Initialized event
57
+ window.addEventListener(\'LazyLoad::Initialized\', function (e) {
58
+ // Get the instance and puts it in the lazyLoadInstance variable
59
+ var lazyLoadInstance = e.detail.instance;
60
+
61
+ if (window.MutationObserver) {
62
+ var observer = new MutationObserver(function(mutations) {
63
+ mutations.forEach(function(mutation) {
64
+ lazyLoadInstance.update();
65
+ } );
66
+ } );
67
+
68
+ var b = document.getElementsByTagName("body")[0];
69
+ var config = { childList: true, subtree: true };
70
+
71
+ observer.observe(b, config);
72
+ }
73
+ }, false);
74
+ </script>';
75
+ }
76
+
77
+ /**
78
+ * Inserts in the HTML the script to replace the Youtube thumbnail by the iframe.
79
+ *
80
+ * @param array $args Array of arguments to populate the script options.
81
+ * @return void
82
+ */
83
+ public function insertYoutubeThumbnailScript($args)
84
+ {
85
+ $defaults = [
86
+ 'resolution' => 'hqdefault',
87
+ ];
88
+
89
+ $args = wp_parse_args($args, $defaults);
90
+
91
+ echo <<<HTML
92
+ <script>function lazyLoadThumb(e){var t='<img src="https://i.ytimg.com/vi/ID/{$args['resolution']}.jpg">',a='<div class="play"></div>';return t.replace("ID",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement("iframe"),t="https://www.youtube.com/embed/ID?autoplay=1";t+=0===this.dataset.query.length?'':'&'+this.dataset.query;e.setAttribute("src",t.replace("ID",this.dataset.id)),e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","1"),this.parentNode.replaceChild(e,this)}document.addEventListener("DOMContentLoaded",function(){var e,t,a=document.getElementsByClassName("rll-youtube-player");for(t=0;t<a.length;t++)e=document.createElement("div"),e.setAttribute("data-id",a[t].dataset.id),e.setAttribute("data-query", a[t].dataset.query),e.innerHTML=lazyLoadThumb(a[t].dataset.id),e.onclick=lazyLoadYoutubeIframe,a[t].appendChild(e)});</script>
93
+ HTML;
94
+ }
95
+
96
+ /**
97
+ * Inserts the CSS to style the Youtube thumbnail container
98
+ *
99
+ * @param array $args Array of arguments to populate the CSS.
100
+ * @return void
101
+ */
102
+ public function insertYoutubeThumbnailCSS($args)
103
+ {
104
+ $defaults = [
105
+ 'base_url' => '',
106
+ ];
107
+
108
+ $args = wp_parse_args($args, $defaults);
109
+
110
+ $css = '.rll-youtube-player{position:relative;padding-bottom:56.23%;height:0;overflow:hidden;max-width:100%;}.rll-youtube-player iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;background:0 0}.rll-youtube-player img{bottom:0;display:block;left:0;margin:auto;max-width:100%;width:100%;position:absolute;right:0;top:0;border:none;height:auto;cursor:pointer;-webkit-transition:.4s all;-moz-transition:.4s all;transition:.4s all}.rll-youtube-player img:hover{-webkit-filter:brightness(75%)}.rll-youtube-player .play{height:72px;width:72px;left:50%;top:50%;margin-left:-36px;margin-top:-36px;position:absolute;background:url(' . $args['base_url'] . 'img/youtube.png) no-repeat;cursor:pointer}.wp-has-aspect-ratio .rll-youtube-player{position:absolute;padding-bottom:0;width:100%;height:100%;top:0;bottom:0;left:0;right:0;';
111
+
112
+ wp_register_style('rocket-lazyload', false);
113
+ wp_enqueue_style('rocket-lazyload');
114
+ wp_add_inline_style('rocket-lazyload', $css);
115
+ }
116
+ }
vendor/wp-media/rocket-lazyload-common/src/Iframe.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyload;
3
+
4
+ /**
5
+ * A class to provide the methods needed to lazyload iframes in WP Rocket and Lazyload by WP Rocket
6
+ */
7
+ class Iframe
8
+ {
9
+ /**
10
+ * Finds iframes in the HTML provided and call the methods to lazyload them
11
+ *
12
+ * @param string $html HTML to parse
13
+ * @param array $args Array of arguments to use
14
+ * @return string
15
+ */
16
+ public function lazyloadIframes($html, $args)
17
+ {
18
+ $defaults = [
19
+ 'youtube' => false,
20
+ ];
21
+
22
+ $args = wp_parse_args($args, $defaults);
23
+
24
+ preg_match_all('@<iframe(?<atts>\s.+)>.*</iframe>@iUs', $html, $matches, PREG_SET_ORDER);
25
+
26
+ if (empty($matches)) {
27
+ return $html;
28
+ }
29
+
30
+ foreach ($matches as $iframe) {
31
+ if ($this->isIframeExcluded($iframe)) {
32
+ continue;
33
+ }
34
+
35
+ // Given the previous regex pattern, $iframe['atts'] starts with a whitespace character.
36
+ if (! preg_match('@\ssrc\s*=\s*(\'|")(?<src>.*)\1@iUs', $iframe['atts'], $atts)) {
37
+ continue;
38
+ }
39
+
40
+ $iframe['src'] = trim($atts['src']);
41
+
42
+ if ('' === $iframe['src']) {
43
+ continue;
44
+ }
45
+
46
+ if ($args['youtube']) {
47
+ $iframe_lazyload = $this->replaceYoutubeThumbnail($iframe);
48
+ }
49
+
50
+ if (empty($iframe_lazyload)) {
51
+ $iframe_lazyload = $this->replaceIframe($iframe);
52
+ }
53
+
54
+ $html = str_replace($iframe[0], $iframe_lazyload, $html);
55
+ }
56
+
57
+ return $html;
58
+ }
59
+
60
+ /**
61
+ * Checks if the provided iframe is excluded from lazyload
62
+ *
63
+ * @param array $iframe Array of matched patterns
64
+ * @return boolean
65
+ */
66
+ private function isIframeExcluded($iframe)
67
+ {
68
+ // Don't mess with the Gravity Forms ajax iframe.
69
+ if (strpos($iframe[0], 'gform_ajax_frame')) {
70
+ return true;
71
+ }
72
+
73
+ // Don't lazyload if iframe has data-no-lazy attribute.
74
+ if (strpos($iframe[0], 'data-no-lazy=')) {
75
+ return true;
76
+ }
77
+
78
+ // Don't lazyload if iframe is google recaptcha fallback.
79
+ if (strpos($iframe[0], 'recaptcha/api/fallback')) {
80
+ return true;
81
+ }
82
+
83
+ return false;
84
+ }
85
+
86
+ /**
87
+ * Applies lazyload on the iframe provided
88
+ *
89
+ * @param array $iframe Array of matched elements
90
+ * @return string
91
+ */
92
+ private function replaceIframe($iframe)
93
+ {
94
+ /**
95
+ * Filter the LazyLoad placeholder on src attribute
96
+ *
97
+ * @since 2.11
98
+ *
99
+ * @param string $placeholder placeholder that will be printed.
100
+ */
101
+ $placeholder = apply_filters('rocket_lazyload_placeholder', 'about:blank');
102
+
103
+ $placeholder_atts = str_replace($iframe['src'], $placeholder, $iframe['atts']);
104
+ $iframe_lazyload = str_replace($iframe['atts'], $placeholder_atts . ' data-rocket-lazyload="fitvidscompatible" data-lazy-src="' . esc_url($iframe['src']) . '"', $iframe[0]);
105
+
106
+ /**
107
+ * Filter the LazyLoad HTML output on iframes
108
+ *
109
+ * @since 2.11
110
+ *
111
+ * @param array $html Output that will be printed.
112
+ */
113
+ $iframe_lazyload = apply_filters('rocket_lazyload_iframe_html', $iframe_lazyload);
114
+ $iframe_lazyload .= '<noscript>' . $iframe[0] . '</noscript>';
115
+
116
+ return $iframe_lazyload;
117
+ }
118
+
119
+ /**
120
+ * Replaces the iframe provided by the Youtube thumbnail
121
+ *
122
+ * @param array $iframe Array of matched elements
123
+ * @return bool|string
124
+ */
125
+ private function replaceYoutubeThumbnail($iframe)
126
+ {
127
+ $youtube_id = $this->getYoutubeIDFromURL($iframe['src']);
128
+
129
+ if (! $youtube_id) {
130
+ return false;
131
+ }
132
+
133
+ $query = wp_parse_url(htmlspecialchars_decode($iframe['src']), PHP_URL_QUERY);
134
+
135
+ /**
136
+ * Filter the LazyLoad HTML output on Youtube iframes
137
+ *
138
+ * @since 2.11
139
+ *
140
+ * @param array $html Output that will be printed.
141
+ */
142
+ $youtube_lazyload = apply_filters('rocket_lazyload_youtube_html', '<div class="rll-youtube-player" data-id="' . esc_attr($youtube_id) . '" data-query="' . esc_attr($query) . '"></div>');
143
+ $youtube_lazyload .= '<noscript>' . $iframe[0] . '</noscript>';
144
+
145
+ return $youtube_lazyload;
146
+ }
147
+
148
+ /**
149
+ * Gets the Youtube ID from the URL provided
150
+ *
151
+ * @param string $url URL to search
152
+ * @return bool|string
153
+ */
154
+ private function getYoutubeIDFromURL($url)
155
+ {
156
+ $pattern = '#^(?:https?:)?(?://)?(?:www\.)?(?:youtu\.be|youtube\.com|youtube-nocookie\.com)/(?:embed/|v/|watch/?\?v=)([\w-]{11})#iU';
157
+ $result = preg_match($pattern, $url, $matches);
158
+
159
+ if (! $result) {
160
+ return false;
161
+ }
162
+
163
+ // exclude playlist.
164
+ if ('videoseries' === $matches[1]) {
165
+ return false;
166
+ }
167
+
168
+ return $matches[1];
169
+ }
170
+ }
vendor/wp-media/rocket-lazyload-common/src/Image.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace RocketLazyload;
3
+
4
+ /**
5
+ * A class to provide the methods needed to lazyload images in WP Rocket and Lazyload by WP Rocket
6
+ */
7
+ class Image
8
+ {
9
+ /**
10
+ * Finds the images to be lazyloaded and call the callback method to replace them.
11
+ *
12
+ * @param string $html
13
+ * @return string
14
+ */
15
+ public function lazyloadImages($html)
16
+ {
17
+ return preg_replace_callback('#<img([^>]*) src=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))([^>]*)>#', [$this,'imageReplaceCallback'], $html);
18
+ }
19
+
20
+ /**
21
+ * Modifies the HTML image tag provided to apply lazyload on it.
22
+ *
23
+ * @param array $image Array of matching patterns.
24
+ * @return string
25
+ */
26
+ private function imageReplaceCallback($image)
27
+ {
28
+ // Don't apply LazyLoad on images from WP Retina x2.
29
+ if (function_exists('wr2x_picture_rewrite')) {
30
+ if (wr2x_get_retina(trailingslashit(ABSPATH) . wr2x_get_pathinfo_from_image_src(trim($image[2], '"')))) {
31
+ return $image[0];
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Filters the attributes used to prevent lazylad from being applied
37
+ *
38
+ * @since 2.11
39
+ * @author Remy Perona
40
+ *
41
+ * @param array $excluded_attributes An array of excluded attributes.
42
+ */
43
+ $excluded_attributes = apply_filters(
44
+ 'rocket_lazyload_excluded_attributes',
45
+ [
46
+ 'data-src=',
47
+ 'data-no-lazy=',
48
+ 'data-lazy-original=',
49
+ 'data-lazy-src=',
50
+ 'data-lazysrc=',
51
+ 'data-lazyload=',
52
+ 'data-bgposition=',
53
+ 'data-envira-src=',
54
+ 'fullurl=',
55
+ 'lazy-slider-img=',
56
+ 'data-srcset=',
57
+ 'class="ls-l',
58
+ 'class="ls-bg',
59
+ ]
60
+ );
61
+
62
+ /**
63
+ * Filters the src used to prevent lazylad from being applied
64
+ *
65
+ * @since 2.11
66
+ * @author Remy Perona
67
+ *
68
+ * @param array $excluded_src An array of excluded src.
69
+ */
70
+ $excluded_src = apply_filters(
71
+ 'rocket_lazyload_excluded_src',
72
+ [
73
+ '/wpcf7_captcha/',
74
+ 'timthumb.php?src',
75
+ ]
76
+ );
77
+
78
+ if ($this->isExcluded($image[1] . $image[3], $excluded_attributes) || $this->isExcluded($image[2], $excluded_src)) {
79
+ return $image[0];
80
+ }
81
+
82
+ $html = sprintf('<img%1$s src="%4$s" data-lazy-src=%2$s%3$s>', $image[1], $image[2], $image[3], $this->getPlaceholder());
83
+
84
+ $html_noscript = sprintf('<noscript><img%1$s src=%2$s%3$s></noscript>', $image[1], $image[2], $image[3]);
85
+
86
+ /**
87
+ * Filter the LazyLoad HTML output
88
+ *
89
+ * @since 1.0.2
90
+ *
91
+ * @param array $html Output that will be printed
92
+ */
93
+ $html = apply_filters('rocket_lazyload_html', $html);
94
+
95
+ return $html . $html_noscript;
96
+ }
97
+
98
+ /**
99
+ * Checks if the provided string matches with the provided excluded patterns
100
+ *
101
+ * @param string $string String to check
102
+ * @param array $excluded_values Patterns to match against
103
+ * @return boolean
104
+ */
105
+ private function isExcluded($string, $excluded_values)
106
+ {
107
+ foreach ($excluded_values as $excluded_value) {
108
+ if (strpos($string, $excluded_value) !== false) {
109
+ return true;
110
+ }
111
+ }
112
+
113
+ return false;
114
+ }
115
+
116
+ /**
117
+ * Applies lazyload on srcset and sizes attributes
118
+ *
119
+ * @param string $html HTML image tag
120
+ * @return string
121
+ */
122
+ public function lazyloadResponsiveAttributes($html)
123
+ {
124
+ if (preg_match('/srcset=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))/i', $html)) {
125
+ $html = str_replace('srcset=', 'data-lazy-srcset=', $html);
126
+ }
127
+
128
+ if (preg_match('/sizes=("(?:[^"]+)"|\'(?:[^\']+)\'|(?:[^ >]+))/i', $html)) {
129
+ $html = str_replace('sizes=', 'data-lazy-sizes=', $html);
130
+ }
131
+
132
+ return $html;
133
+ }
134
+
135
+ /**
136
+ * Finds patterns matching smiley and call the callback method to replace them with the image
137
+ *
138
+ * @param string $text Content to search in
139
+ * @return string
140
+ */
141
+ public function convertSmilies($text)
142
+ {
143
+ global $wp_smiliessearch;
144
+
145
+ if (! get_option('use_smilies') || empty($wp_smiliessearch)) {
146
+ return $text;
147
+ }
148
+
149
+ $output = '';
150
+ // HTML loop taken from texturize function, could possible be consolidated.
151
+ $textarr = preg_split('/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between.
152
+ $stop = count($textarr);// loop stuff.
153
+
154
+ // Ignore proessing of specific tags.
155
+ $tags_to_ignore = 'code|pre|style|script|textarea';
156
+ $ignore_block_element = '';
157
+
158
+ for ($i = 0; $i < $stop; $i++) {
159
+ $content = $textarr[ $i ];
160
+
161
+ // If we're in an ignore block, wait until we find its closing tag.
162
+ if ('' === $ignore_block_element && preg_match('/^<(' . $tags_to_ignore . ')>/', $content, $matches)) {
163
+ $ignore_block_element = $matches[1];
164
+ }
165
+
166
+ // If it's not a tag and not in ignore block.
167
+ if ('' === $ignore_block_element && strlen($content) > 0 && '<' !== $content[0]) {
168
+ $content = preg_replace_callback($wp_smiliessearch, [$this, 'translateSmiley'], $content);
169
+ }
170
+
171
+ // did we exit ignore block.
172
+ if ('' !== $ignore_block_element && '</' . $ignore_block_element . '>' === $content) {
173
+ $ignore_block_element = '';
174
+ }
175
+
176
+ $output .= $content;
177
+ }
178
+
179
+ return $output;
180
+ }
181
+
182
+ /**
183
+ * Replace matches by smiley image, lazyloaded
184
+ *
185
+ * @param array $matches Array of matches
186
+ * @return string
187
+ */
188
+ private function translateSmiley($matches)
189
+ {
190
+ global $wpsmiliestrans;
191
+
192
+ if (count($matches) === 0) {
193
+ return '';
194
+ }
195
+
196
+ $smiley = trim(reset($matches));
197
+ $img = $wpsmiliestrans[ $smiley ];
198
+
199
+ $matches = [];
200
+ $ext = preg_match('/\.([^.]+)$/', $img, $matches) ? strtolower($matches[1]) : false;
201
+ $image_exts = ['jpg', 'jpeg', 'jpe', 'gif', 'png'];
202
+
203
+ // Don't convert smilies that aren't images - they're probably emoji.
204
+ if (! in_array($ext, $image_exts, true)) {
205
+ return $img;
206
+ }
207
+
208
+ /**
209
+ * Filter the Smiley image URL before it's used in the image element.
210
+ *
211
+ * @since 2.9.0
212
+ *
213
+ * @param string $smiley_url URL for the smiley image.
214
+ * @param string $img Filename for the smiley image.
215
+ * @param string $site_url Site URL, as returned by site_url().
216
+ */
217
+ $src_url = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
218
+
219
+ // Don't LazyLoad if process is stopped for these reasons.
220
+ if (is_feed() || is_preview()) {
221
+ return sprintf(' <img src="%s" alt="%s" class="wp-smiley" /> ', esc_url($src_url), esc_attr($smiley));
222
+ }
223
+
224
+ return sprintf(' <img src="%s" data-lazy-src="%s" alt="%s" class="wp-smiley" /> ', $this->getPlaceholder(), esc_url($src_url), esc_attr($smiley));
225
+ }
226
+
227
+ /**
228
+ * Returns the placeholder for the src attribute
229
+ *
230
+ * @since 1.2
231
+ * @author Remy Perona
232
+ *
233
+ * @param int $width Width of the placeholder image. Default 1.
234
+ * @param int $height Height of the placeholder image. Default 1.
235
+ * @return void
236
+ */
237
+ private function getPlaceholder($width = 1, $height = 1)
238
+ {
239
+ /**
240
+ * Filter the image lazyLoad placeholder on src attribute
241
+ *
242
+ * @since 1.1
243
+ *
244
+ * @param string $placeholder Placeholder that will be printed.
245
+ */
246
+ return apply_filters('rocket_lazyload_placeholder', "data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 $width $height\'%3E%3C/svg%3E");
247
+ }
248
+ }
views/admin-page.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
+
4
+ global $wp_version;
5
+
6
+ $options = [
7
+ 'images' => [
8
+ 'label' => __('Images', 'rocket-lazy-load'),
9
+ ],
10
+ 'iframes' => [
11
+ 'label' => __('Iframes &amp; Videos', 'rocket-lazy-load'),
12
+ ],
13
+ 'youtube' => [
14
+ 'label' => __('Replace Youtube videos by thumbnail', 'rocket-lazy-load'),
15
+ ],
16
+ ]; // WPCS: prefix ok.
17
+
18
+ ?>
19
+ <div class="wrap rocket-lazyload-settings">
20
+
21
+ <?php $heading_tag = version_compare($wp_version, '4.3') >= 0 ? 'h1' : 'h2'; // WPCS: prefix ok. ?>
22
+ <<?php echo $heading_tag; ?> class="screen-reader-text"><?php echo esc_html(get_admin_page_title()); ?></<?php echo $heading_tag; ?>>
23
+ <div class="rocket-lazyload-header">
24
+ <div>
25
+ <p class="rocket-lazyload-title"><img src="<?php echo esc_url(ROCKET_LL_ASSETS_URL . 'img/logo.png'); ?>" srcset="<?php echo esc_url(ROCKET_LL_ASSETS_URL . 'img/logo@2x.png 2x'); ?>" alt="<?php echo esc_attr(get_admin_page_title()); ?>" width="216" height="59"></p>
26
+ <p class="rocket-lazyload-subtitle"><?php esc_html_e('Settings', 'rocket-lazy-load'); ?></p>
27
+ </div>
28
+ <?php $rocket_lazyload_rate_url = 'https://wordpress.org/support/plugin/rocket-lazy-load/reviews/?rate=5#postform'; ?>
29
+ <p class="rocket-lazyload-rate-us">
30
+ <?php
31
+ // Translators: %1$s is a <strong> tag, %2$s is </strong><br>, %3$s is the complete link tag to Rocket Lazy Load review form, %4$s is the closing </a> tag.
32
+ printf(__('%1$sDo you like this plugin?%2$s Please take a few seconds to %3$srate it on WordPress.org%4$s!', 'rocket-lazy-load'), '<strong>', '</strong><br>', '<a href="' . $rocket_lazyload_rate_url . '">', '</a>');
33
+ ?>
34
+ <br>
35
+ <a class="stars" href="<?php echo $rocket_lazyload_rate_url; ?>"><?php echo str_repeat('<span class="dashicons dashicons-star-filled"></span>', 5); ?></a>
36
+ </p>
37
+ </div>
38
+ <div class="rocket-lazyload-body">
39
+ <form action="options.php" class="rocket-lazyload-form" method="post">
40
+ <fieldset>
41
+ <legend class="screen-reader-text"><?php esc_html_e('Lazyload', 'rocket-lazy-load'); ?></legend>
42
+ <p><?php esc_html_e('LazyLoad displays images, iframes and videos on a page only when they are visible to the user.', 'rocket-lazy-load'); ?></p>
43
+ <p><?php esc_html_e('This mechanism reduces the number of HTTP requests and improves the loading time.', 'rocket-lazy-load'); ?></p>
44
+ <ul class="rocket-lazyload-options">
45
+ <?php foreach ($options as $slug => $infos) : // WPCS: prefix ok. ?>
46
+ <li class="rocket-lazyload-option">
47
+ <input type="checkbox" value="1" id="lazyload-<?php echo esc_attr($slug); ?>" name="rocket_lazyload_options[<?php echo esc_attr($slug); ?>]" <?php checked($this->option_array->get($slug, 0), 1); ?> aria-labelledby="describe-lazyload-<?php echo esc_attr($slug); ?>">
48
+ <label for="lazyload-<?php echo esc_attr($slug); ?>">
49
+ <span id="describe-lazyload-<?php echo esc_attr($slug); ?>" class="rocket-lazyload-label-description"><?php echo esc_html($infos['label']); ?></span>
50
+ </label>
51
+ </li>
52
+
53
+ <?php endforeach; ?>
54
+
55
+ </ul>
56
+ </fieldset>
57
+ <?php settings_fields('rocket_lazyload'); ?>
58
+
59
+ <?php if (! is_plugin_active('wp-rocket/wp-rocket.php')) { ?>
60
+ <div class="rocket-lazyload-upgrade">
61
+
62
+ <div class="rocket-lazyload-upgrade-cta">
63
+ <p class="rocket-lazyload-subtitle"><?php esc_html_e('We recommend for you', 'rocket-lazy-load'); ?></p>
64
+ <p class="rocket-lazyload-bigtext">
65
+ <?php esc_html_e('Go Premium with', 'rocket-lazy-load'); ?>
66
+ <img class="rocket-lazyload-rocket-logo" src="<?php echo esc_url(ROCKET_LL_ASSETS_URL . 'img/wprocket.png'); ?>" srcset="<?php echo esc_url(ROCKET_LL_ASSETS_URL . 'img/wprocket@2x.png'); ?>" width="232" height="63" alt="WP Rocket">
67
+ </p>
68
+
69
+ <div class="rocket-lazyload-cta-block">
70
+ <a class="button button-primary" href="https://wp-rocket.me/?utm_source=wp_plugin&utm_medium=rocket_lazyload"><?php _e('Get WP&nbsp;Rocket Now!', 'rocket-lazy-load'); ?></a>
71
+ </div>
72
+ </div><!-- .rocket-lazyload-upgrade-cta -->
73
+
74
+ <div class="rocket-lazyload-upgrade-arguments">
75
+ <ul>
76
+ <li class="rll-upgrade-item"><?php
77
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
78
+ printf(__('%1$sMultiple new features%2$s to further improve your load time', 'rocket-lazy-load'), '<strong>', '</strong>')
79
+ ?></li>
80
+ <li class="rll-upgrade-item"><?php
81
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
82
+ printf(__('All you need to %1$simprove your Google PageSpeed%2$s score', 'rocket-lazy-load'), '<strong>', '</strong>')
83
+ ?></li>
84
+ <li class="rll-upgrade-item"><?php
85
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
86
+ printf(__('%1$sBoost your SEO%2$s by preloading your cache page for Google’s bots', 'rocket-lazy-load'), '<strong>', '</strong>')
87
+ ?></li>
88
+ <li class="rll-upgrade-item"><?php
89
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
90
+ printf(__('Watch your conversion rise with the %1$s100%% WooCommerce compatibility%2$s', 'rocket-lazy-load'), '<strong>', '</strong>')
91
+ ?></li>
92
+ <li class="rll-upgrade-item"><?php
93
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
94
+ printf(__('Minimal configuration, %1$sImmediate results%2$s', 'rocket-lazy-load'), '<strong>', '</strong>')
95
+ ?></li>
96
+ <li class="rll-upgrade-item"><?php
97
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
98
+ printf(__('Set up takes %1$s5 minutes flat%2$s', 'rocket-lazy-load'), '<strong>', '</strong>')
99
+ ?></li>
100
+ <li class="rll-upgrade-item"><?php
101
+ // Translators: %1$s = strong opening tag, %2$s = strong closing tag.
102
+ printf(__('%1$s24/7 support%2$s', 'rocket-lazy-load'), '<strong>', '</strong>')
103
+ ?></li>
104
+ </ul>
105
+ </div><!-- .rocket-lazyload-upgrade-arguments -->
106
+
107
+ </div><!-- .rocket-lazyload-upgrade -->
108
+ <?php } ?>
109
+
110
+ <p class="submit">
111
+ <button type="submit" class="button button-primary">
112
+ <span class="text"><?php esc_html_e('Save changes', 'rocket-lazy-load'); ?></span>
113
+ <span class="icon">✓</span>
114
+ </button>
115
+ </p>
116
+ </form>
117
+ </div>
118
+ </div>
views/imagify-notice.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die('Cheatin\' uh?');
3
+
4
+ $action_url = wp_nonce_url(
5
+ add_query_arg(
6
+ [
7
+ 'action' => 'install-plugin',
8
+ 'plugin' => 'imagify',
9
+ ],
10
+ admin_url('update.php')
11
+ ),
12
+ 'install-plugin_imagify'
13
+ ); // WPCS: prefix ok.
14
+
15
+ $dismiss_url = wp_nonce_url(
16
+ admin_url('admin-post.php?action=rocket_lazyload_ignore&box=rocket_lazyload_imagify_notice'),
17
+ 'rocket_lazyload_ignore_rocket_lazyload_imagify_notice'
18
+ ); // WPCS: prefix ok.
19
+
20
+ ?>
21
+ <div id="plugin-filter" class="updated plugin-card plugin-card-imagify rktll-imagify-notice">
22
+ <a href="<?php echo esc_url($dismiss_url); ?>" class="rktll-cross"><span class="dashicons dashicons-no"></span></a>
23
+
24
+ <p class="rktll-imagify-logo">
25
+ <img src="<?php echo esc_url(ROCKET_LL_ASSETS_URL . 'img/logo-imagify.png'); ?>" srcset="<?php echo esc_attr(ROCKET_LL_ASSETS_URL . 'img/logo-imagify.svg 2x'); ?>" alt="Imagify" width="150" height="18">
26
+ </p>
27
+ <p class="rktll-imagify-msg">
28
+ <?php esc_html_e('Speed up your website and boost your SEO by reducing image file sizes without losing quality with Imagify.', 'rocket-lazy-load'); ?>
29
+ </p>
30
+ <p class="rktll-imagify-cta">
31
+ <a data-slug="imagify" href="<?php echo esc_url($action_url); ?>" class="button button-primary install-now"><?php esc_html_e('Install Imagify for Free', 'rocket-lazy-load'); ?></a>
32
+ </p>
33
+ </div>