PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / vendor / intervention / image / src / Intervention / Image / ImageServiceProviderLaravelRecent.php

ImageServiceProviderLaravelRecent.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravelRecent.php

107 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\Image;
4
5 use Illuminate\Support\ServiceProvider;
6
7 class ImageServiceProviderLaravelRecent extends ServiceProvider
8 {
9 /**
10 * Determines if Intervention Imagecache is installed
11 *
12 * @return boolean
13 */
14 private function cacheIsInstalled()
15 {
16 return class_exists('Intervention\\Image\\ImageCache');
17 }
18
19 /**
20 * Bootstrap the application events.
21 *
22 * @return void
23 */
24 public function boot()
25 {
26 $this->publishes([
27 __DIR__.'/../../config/config.php' => config_path('image.php')
28 ]);
29
30 // setup intervention/imagecache if package is installed
31 $this->cacheIsInstalled() ? $this->bootstrapImageCache() : null;
32 }
33
34 /**
35 * Register the service provider.
36 *
37 * @return void
38 */
39 public function register()
40 {
41 $app = $this->app;
42
43 // merge default config
44 $this->mergeConfigFrom(
45 __DIR__.'/../../config/config.php',
46 'image'
47 );
48
49 // create image
50 $app->singleton('image', function ($app) {
51 return new ImageManager($this->getImageConfig($app));
52 });
53
54 $app->alias('image', 'Intervention\Image\ImageManager');
55 }
56
57 /**
58 * Bootstrap imagecache
59 *
60 * @return void
61 */
62 protected function bootstrapImageCache()
63 {
64 $app = $this->app;
65 $config = __DIR__.'/../../../../imagecache/src/config/config.php';
66
67 $this->publishes([
68 $config => config_path('imagecache.php')
69 ]);
70
71 // merge default config
72 $this->mergeConfigFrom(
73 $config,
74 'imagecache'
75 );
76
77 // imagecache route
78 if (is_string(config('imagecache.route'))) {
79
80 $filename_pattern = '[ \w\\.\\/\\-\\@\(\)\=]+';
81
82 // route to access template applied image file
83 $app['router']->get(config('imagecache.route').'/{template}/{filename}', [
84 'uses' => 'Intervention\Image\ImageCacheController@getResponse',
85 'as' => 'imagecache'
86 ])->where(['filename' => $filename_pattern]);
87 }
88 }
89
90 /**
91 * Return image configuration as array
92 *
93 * @param Application $app
94 * @return array
95 */
96 private function getImageConfig($app)
97 {
98 $config = $app['config']->get('image');
99
100 if (is_null($config)) {
101 return [];
102 }
103
104 return $config;
105 }
106 }
107