PluginProbe
WP Ultimate Post Grid / 1.6
WP Ultimate Post Grid v1.6
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
← All changes | addons/custom-templates/templates/block.php +5 -57 2.7.01.6 View file →
@@ -18,16 +18,8 @@
18 18 // Max block size
19 19 public $max_width;
20 20 public $max_height;
21 21
22 - // Hover conditions
23 - public $show_on_hover = false;
24 - public $hide_on_hover = false;
25 - public $hover_in_transition = 'instant';
26 - public $hover_out_transition = 'instant';
27 - public $hover_in_time = 0;
28 - public $hover_out_time = 0;
29 -
30 22 // Responsive condition
31 23 protected $show_on_desktop = true;
32 24 protected $show_on_mobile = true;
33 25
@@ -182,20 +174,8 @@
182 174 }
183 175 }
184 176
185 177 /*
186 - * Hover
187 - */
188 - if( $this->present( $block, 'hover' ) ) {
189 - if( $block->hover == 'show' ) $this->show_on_hover = true;
190 - if( $block->hover == 'hide' ) $this->hide_on_hover = true;
191 - }
192 - if( $this->present( $block, 'hoverInTransition' ) ) $this->hover_in_transition = $block->hoverInTransition;
193 - if( $this->present( $block, 'hoverOutTransition' ) ) $this->hover_out_transition = $block->hoverOutTransition;
194 - if( $this->present( $block, 'hoverInTime' ) ) $this->hover_in_time = $block->hoverInTime;
195 - if( $this->present( $block, 'hoverOutTime' ) ) $this->hover_out_time = $block->hoverOutTime;
196 -
197 - /*
198 178 * Conditions
199 179 */
200 180 if( isset( $block->conditions ) ) {
201 181 foreach( $block->conditions as $condition ) {
@@ -259,9 +239,9 @@
259 239 $output = '';
260 240
261 241 foreach( $this->style[$name] as $property => $value )
262 242 {
263 - if( WPUltimatePostGrid::option( 'grid_template_force_style', '0' ) == '1' ) {
243 + if( WPUltimatePostGrid::option( 'grid_template_force_style', '1' ) == '1' ) {
264 244 $output .= $property . ':' . $value . ' !important;';
265 245 } else {
266 246 $output .= $property . ':' . $value . ';';
267 247 }
@@ -321,20 +301,11 @@
321 301 if( $this->present( $this->settings, 'customClass' ) ) {
322 302 $classes[] = esc_attr( $this->settings->customClass );
323 303 }
324 304
325 - if( $this->hide_on_hover || $this->show_on_hover ) {
326 - $classes[] = $this->hide_on_hover ? 'wpupg-hide-on-hover' : 'wpupg-show-on-hover';
327 - }
328 -
329 305 $classes = implode( ' ', $classes );
330 306
331 307 $class = ' class="' . $classes . '"';
332 -
333 - if( $this->hide_on_hover || $this->show_on_hover ) {
334 - $class .= ' data-hover-in="' . $this->hover_in_transition . '" data-hover-out="' . $this->hover_out_transition . '"';
335 - $class .= ' data-hover-in-duration="' . $this->hover_in_time . '" data-hover-out-duration="' . $this->hover_out_time . '"';
336 - }
337 308 }
338 309
339 310
340 311 if( $style == '' ) {
@@ -371,19 +342,9 @@
371 342
372 343 if( $condition['condition_type'] == 'field' ) {
373 344 switch( $condition['field'] ) {
374 345 case 'post_image':
375 - if( isset( $post->term ) && $post->term ) {
376 - $post_image_id = get_term_meta( $post->ID, 'wpupg_custom_image', true );
377 - } elseif( $post->post_type == 'attachment' ) {
378 - $post_image_id = $post->ID;
379 - } else {
380 - $post_image_id = get_post_thumbnail_id( $post->ID );
381 - if( !$post_image_id ) {
382 - $post_image_id = get_post_meta( $post->ID, 'wpupg_custom_image', true );
383 - }
384 - }
385 -
346 + $post_image_id = get_post_thumbnail_id( $post->ID );
386 347 $present = $post_image_id == '' ? false : true;
387 348 break;
388 349 case 'post_content':
389 350 $present = $post->post_content == '' ? false : true;
@@ -394,9 +355,9 @@
394 355 case 'post_title':
395 356 $present = $post->post_title == '' ? false : true;
396 357 break;
397 358 default:
398 - $present = trim( get_post_meta( $post->ID, $condition['field'], true ) );
359 + $present = false;
399 360 break;
400 361 }
401 362
402 363 if( isset( $condition['when'] ) && $condition['when'] == 'present' ) {
@@ -467,26 +428,13 @@
467 428 $text = substr( $text, 0, $limit );
468 429
469 430 $text = rtrim( $text ) . $this->cut_off['after_text'];
470 431 }
471 -
472 - if( $text ) {
473 - $text = $this->clean_html( $text );
474 - }
475 432 }
476 433
477 434 return $text;
478 435 }
479 436
480 - protected function clean_html( $html )
481 - {
482 - $doc = new DOMDocument();
483 - libxml_use_internal_errors( true );
484 - $doc->loadHTML( '<?xml version="1.0" encoding="UTF-8"?><html_tags>' . $html . '</html_tags>' );
485 - libxml_clear_errors();
486 - return substr( $doc->saveXML( $doc->getElementsByTagName( 'html_tags' )->item( 0 ) ), strlen( '<html_tags>' ), -strlen( '</html_tags>' ) );
487 - }
488 -
489 437 /*
490 438 * Output block, called before output of child.
491 439 * Return false to not output the child.
492 440 */
@@ -531,9 +479,9 @@
531 479
532 480 // TODO Better way of doing this?
533 481 if( $this->link_color ) {
534 482
535 - if( WPUltimatePostGrid::option( 'grid_template_force_style', '0' ) == '1' ) {
483 + if( WPUltimatePostGrid::option( 'grid_template_force_style', '1' ) == '1' ) {
536 484 $important = ' !important';
537 485 } else {
538 486 $important = '';
539 487 }
@@ -552,9 +500,9 @@
552 500 $output = str_ireplace( $link, $new_link, $output );
553 501 }
554 502 }
555 503
556 - return apply_filters( 'wpupg_output_grid_block_' . $this->type, $output, $post, $this );
504 + return apply_filters( 'wpupg_output_grid_block_' . $this->type, $output, $post );
557 505 }
558 506
559 507 /*
560 508 * Quick Access