PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / trunk
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization vtrunk
4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 All 135 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Modules/Recommendation.php +12 -52 2.5.6 → trunk View file →
@@ -63,9 +63,9 @@
63 63 * @param array $themes_list - list of useful themes (in slug => nicename format).
64 64 * @param array $strings - list of translated strings.
65 65 * @param array $preferences - list of preferences.
66 66 */
67 - function render_products_box( $plugins_list, $themes_list, $strings, $preferences = array() ) {
67 + public function render_products_box( $plugins_list, $themes_list, $strings, $preferences = array() ) {
68 68
69 69 if ( empty( $plugins_list ) && empty( $themes_list ) ) {
70 70 return;
71 71 }
@@ -89,9 +89,9 @@
89 89 echo '<div class="recommend-product">';
90 90
91 91 foreach ( $list as $theme ) {
92 92 echo '<div class="plugin_box">';
93 - echo ' <img class="theme-banner" src="' . $theme->screenshot_url . '">';
93 + echo ' <img class="theme-banner" src="' . esc_url( $theme->screenshot_url ) . '">';
94 94 echo ' <div class="title-action-wrapper">';
95 95 echo ' <span class="plugin-name">' . esc_html( $theme->custom_name ) . '</span>';
96 96 if ( ! isset( $preferences['description'] ) || ( isset( $preferences['description'] ) && $preferences['description'] ) ) {
97 97 echo '<span class="plugin-desc">' . esc_html( substr( $theme->description, 0, strpos( $theme->description, '.' ) ) ) . '.</span>';
@@ -117,9 +117,9 @@
117 117 echo '<div class="recommend-product">';
118 118
119 119 foreach ( $list as $current_plugin ) {
120 120 echo '<div class="plugin_box">';
121 - echo ' <img class="plugin-banner" src="' . $current_plugin->custom_image . '">';
121 + echo ' <img class="plugin-banner" src="' . esc_url( $current_plugin->custom_image ) . '">';
122 122 echo ' <div class="title-action-wrapper">';
123 123 echo ' <span class="plugin-name">' . esc_html( $current_plugin->custom_name ) . '</span>';
124 124 if ( ! isset( $preferences['description'] ) || ( isset( $preferences['description'] ) && $preferences['description'] ) ) {
125 125 echo '<span class="plugin-desc">' . esc_html( substr( $current_plugin->short_description, 0, strpos( $current_plugin->short_description, '.' ) ) ) . '. </span>';
@@ -184,9 +184,9 @@
184 184 if ( false !== $theme ) {
185 185 return $theme;
186 186 }
187 187
188 - $products = wp_remote_get(
188 + $products = $this->safe_get(
189 189 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[theme]=' . $slug . '&request[per_page]=1'
190 190 );
191 191 $products = json_decode( wp_remote_retrieve_body( $products ) );
192 192 if ( is_object( $products ) ) {
@@ -238,51 +238,8 @@
238 238 return $list;
239 239 }
240 240
241 241 /**
242 - * Call plugin api
243 - *
244 - * @param string $slug plugin slug.
245 - *
246 - * @return array|mixed|object
247 - */
248 - private function call_plugin_api( $slug ) {
249 - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
250 -
251 - $call_api = get_transient( 'ti_plugin_info_' . $slug );
252 -
253 - if ( false === $call_api ) {
254 - $call_api = plugins_api(
255 - 'plugin_information',
256 - array(
257 - 'slug' => $slug,
258 - 'fields' => array(
259 - 'downloaded' => false,
260 - 'rating' => false,
261 - 'description' => false,
262 - 'short_description' => true,
263 - 'donate_link' => false,
264 - 'tags' => false,
265 - 'sections' => true,
266 - 'homepage' => true,
267 - 'added' => false,
268 - 'last_updated' => false,
269 - 'compatibility' => false,
270 - 'tested' => false,
271 - 'requires' => false,
272 - 'downloadlink' => false,
273 - 'icons' => true,
274 - 'banners' => true,
275 - ),
276 - )
277 - );
278 - set_transient( 'ti_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
279 - }
280 -
281 - return $call_api;
282 - }
283 -
284 - /**
285 242 * Load css and scripts for the plugin recommend page.
286 243 */
287 244 public function enqueue() {
288 245 $screen = get_current_screen();
@@ -302,29 +259,32 @@
302 259 flex-wrap: wrap;
303 260 }
304 261
305 262 .recommend-product .theme-banner {
306 - width:200px;
263 + width: 200px;
307 264 margin: auto;
308 265 }
266 +
309 267 .recommend-product .plugin-banner {
310 268 width: 100px;
311 269 margin: auto;
312 270 }
313 271
314 - .recommend-product .plugin_box .button span{
272 + .recommend-product .plugin_box .button span {
315 273
316 274 margin-top: 2px;
317 275 margin-right: 7px;
318 276 }
319 - .recommend-product .plugin_box .button{
320 - margin-bottom:10px;
277 +
278 + .recommend-product .plugin_box .button {
279 + margin-bottom: 10px;
321 280 }
281 +
322 282 .recommend-product .plugin_box {
323 283 margin-bottom: 20px;
324 284 padding-top: 5px;
325 285 display: flex;
326 - box-shadow: 0px 0px 10px -5px rgba(0,0,0,0.55);
286 + box-shadow: 0px 0px 10px -5px rgba(0, 0, 0, 0.55);
327 287 background: #fff;
328 288 border-radius: 5px;
329 289 flex-direction: column;
330 290 justify-content: flex-start;