Yet Another Related Posts Plugin (YARPP) - Version 5.27.2

Version Description

(12-August-2021) = * New: Conversion of legacy widget YARPP block into YARPP Block * Bugfix: New Blocks on widget's sections were showing on homepage * Bugfix: Remove the legacy widget YARPP block on the widgets interface * New: Option to add a custom reference ID on a YARPP Block * Enhancement: Consistency on "Heading" input fields on widgets and blocks * Enhancement: Show demo related post on the Widgets YARPP Blocks

Download this release

Release Info

Developer jeffparker
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 5.27.2
Comparing to
See all releases

Code changes from version 5.27.1 to 5.27.2

classes/YARPP_Block.php CHANGED
@@ -47,28 +47,75 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
47
  */
48
  public function yarpp_block_render_callback( $block_attributes, $content, $is_preview = false ) {
49
  global $yarpp, $post;
 
 
 
50
  // If preview then return preview image.
51
  if ( $is_preview && ! empty( $block_attributes['yarpp_preview'] ) ) {
52
  $preview_image = YARPP_URL . '/images/yarpp-grid.svg';
53
  return '<img style="width:100%;" src="' . esc_url( $preview_image ) . '">';
54
  }
 
 
55
  $yarpp_args = array(
56
- 'domain' => 'block',
57
  );
 
 
 
 
 
 
 
 
 
 
 
58
  if ( isset( $block_attributes['limit'] ) ) {
59
  $yarpp_args['limit'] = $block_attributes['limit'];
60
  }
61
  if ( isset( $block_attributes['template'] ) ) {
62
- $yarpp_args['template'] = $block_attributes['template'];
 
 
 
63
  }
64
 
65
- $post_ID = $post instanceof WP_Post ? $post->ID : null;
66
 
67
- return $yarpp->display_related(
68
- $post_ID,
69
- $yarpp_args,
70
- false
71
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
  /**
74
  * Get all yarpp theme style.
@@ -78,18 +125,7 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
78
  */
79
  public function yarpp_get_block_templates() {
80
  global $yarpp;
81
- $templates = $yarpp->get_templates();
82
- $block_templates = array(
83
- esc_attr( 'builtin' ) => esc_html__( 'List', 'yet-another-related-posts-plugin' ),
84
- esc_attr( 'thumbnails' ) => esc_html__( 'Thumbnail', 'yet-another-related-posts-plugin' ),
85
- );
86
- foreach ( $templates as $template ) {
87
- $block_templates[ esc_attr( $template['basename'] ) ] = sprintf(
88
- /* translators: %s: yarpp template name */
89
- esc_html__( 'Custom: %s', 'yet-another-related-posts-plugin' ),
90
- $template['name']
91
- );
92
- }
93
  /**
94
  * Filter the array containing templates.
95
  *
@@ -103,9 +139,8 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
103
  * YARPP yarpp_gutenberg_block_func.
104
  */
105
  public function yarpp_gutenberg_block_func() {
106
- global $pagenow;
107
- $version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : YARPP_VERSION;
108
-
109
  $default_deps = array(
110
  'wp-blocks',
111
  'wp-i18n',
@@ -114,10 +149,16 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
114
  'wp-block-editor',
115
  );
116
 
117
- if ( $pagenow === 'widgets.php' ) {
118
- $default_deps [] = 'wp-edit-widgets';
 
 
 
 
 
 
119
  } else {
120
- $default_deps [] = 'wp-editor';
121
  }
122
 
123
  // automatically load dependencies and version.
@@ -139,6 +180,8 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
139
  $localized_variables = array(
140
  'template' => $this->yarpp_get_block_templates(),
141
  'selected_theme_style' => $chosen_template,
 
 
142
  );
143
  wp_localize_script( 'yarpp-block', 'yarpp_localized', $localized_variables );
144
  $args = array(
@@ -150,6 +193,14 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
150
  'type' => 'string',
151
  'default' => '',
152
  ),
 
 
 
 
 
 
 
 
153
  'limit' => array(
154
  'type' => 'number',
155
  'default' => 6,
@@ -158,6 +209,13 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
158
  'type' => 'string',
159
  'default' => $chosen_template,
160
  ),
 
 
 
 
 
 
 
161
  'yarpp_preview' => array(
162
  'type' => 'string',
163
  ),
47
  */
48
  public function yarpp_block_render_callback( $block_attributes, $content, $is_preview = false ) {
49
  global $yarpp, $post;
50
+ $post_id = null;
51
+ $yarpp_is_admin = false;
52
+
53
  // If preview then return preview image.
54
  if ( $is_preview && ! empty( $block_attributes['yarpp_preview'] ) ) {
55
  $preview_image = YARPP_URL . '/images/yarpp-grid.svg';
56
  return '<img style="width:100%;" src="' . esc_url( $preview_image ) . '">';
57
  }
58
+
59
+ // Since WP 5.8, the widgets are now Gutenberg blocks too, this will help us to differentiate between block and widget
60
  $yarpp_args = array(
61
+ 'domain' => isset($block_attributes['domain']) ? $block_attributes['domain'] : 'block',
62
  );
63
+ if ( isset( $block_attributes['reference_id'] ) && ! empty($block_attributes['reference_id']) ) {
64
+ $reference_post = get_post( (int) $block_attributes['reference_id']);
65
+ $post_id = $reference_post->ID;
66
+ }
67
+ // Checks if the block is been used on the admin interface
68
+ if ( isset( $block_attributes['yarpp_is_admin'] ) ) {
69
+ $yarpp_is_admin = $block_attributes['yarpp_is_admin'];
70
+ }
71
+ if ( isset( $block_attributes['heading'] ) ) {
72
+ $yarpp_args['heading'] = $block_attributes['heading'];
73
+ }
74
  if ( isset( $block_attributes['limit'] ) ) {
75
  $yarpp_args['limit'] = $block_attributes['limit'];
76
  }
77
  if ( isset( $block_attributes['template'] ) ) {
78
+ $yarpp_args['template'] = ( $block_attributes['template'] !== 'builtin' && $block_attributes['template'] !== 'list' ) ? $block_attributes['template'] : false;
79
+ }
80
+ if ( isset( $block_attributes['domain'] ) ) {
81
+ $yarpp_args['domain'] = $block_attributes['domain'];
82
  }
83
 
84
+ $output = '';
85
 
86
+ // if there is no Reference ID specified on Block
87
+ if ( empty($post_id) ) {
88
+ // Check if the block is on the admin interface or if is preview (Gutenberg editor preview)
89
+ if ( $yarpp_is_admin ) {
90
+ $post_id = $post instanceof WP_Post ? $post->ID : null;
91
+ } else {
92
+ $queried_object = get_queried_object();
93
+ // queried_object corresponds to the post that is being called
94
+ // https://developer.wordpress.org/reference/functions/get_queried_object/
95
+ if ( $queried_object instanceof WP_Post ) {
96
+ $post_id = $queried_object->ID;
97
+ }
98
+ }
99
+ }
100
+
101
+ if ( $yarpp_args['domain'] === 'widget' && ! $yarpp_args['template'] && ( ! empty($post_id) || $yarpp_is_admin ) ) {
102
+ $output .= '<h3>' . $yarpp_args['heading'] . '</h3>';
103
+ }
104
+
105
+ if ( ! empty($post_id) ) {
106
+ $output .= $yarpp->display_related(
107
+ $post_id,
108
+ $yarpp_args,
109
+ false
110
+ );
111
+ } elseif ( $yarpp_is_admin ) {
112
+ $output .= $yarpp->display_demo_related(
113
+ $yarpp_args,
114
+ false
115
+ );
116
+ }
117
+
118
+ return $output;
119
  }
120
  /**
121
  * Get all yarpp theme style.
125
  */
126
  public function yarpp_get_block_templates() {
127
  global $yarpp;
128
+ $block_templates = $yarpp->get_all_templates();
 
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * Filter the array containing templates.
131
  *
139
  * YARPP yarpp_gutenberg_block_func.
140
  */
141
  public function yarpp_gutenberg_block_func() {
142
+ global $post;
143
+ $version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : YARPP_VERSION;
 
144
  $default_deps = array(
145
  'wp-blocks',
146
  'wp-i18n',
149
  'wp-block-editor',
150
  );
151
 
152
+ $uri = $_SERVER['REQUEST_URI'];
153
+ // batch/v1 is for the request on server_rendering
154
+ $is_widget_page = substr_count( $uri, 'widgets.php' ) > 0 || substr_count( $uri, 'v2/widgets' ) > 0 || substr_count( $uri, '/batch/v1' ) > 0;
155
+ $yarpp_is_admin = ( substr_count( $uri, 'block-renderer/yarpp/yarpp-block') > 0 && substr_count( $uri, '_locale=user') > 0 ) || is_admin() || ( substr_count( $uri, 'wp-json/wp/v2/posts/') > 0 && substr_count( $uri, '_locale=user') > 0 );
156
+
157
+ // checks if the current page is the widgets.php admin page, since WP 5.8 there is an error when enqueuing the wp-editor and wp-edit-widgets at the same time
158
+ if ( $is_widget_page ) {
159
+ $default_deps[] = 'wp-edit-widgets';
160
  } else {
161
+ $default_deps[] = 'wp-editor';
162
  }
163
 
164
  // automatically load dependencies and version.
180
  $localized_variables = array(
181
  'template' => $this->yarpp_get_block_templates(),
182
  'selected_theme_style' => $chosen_template,
183
+ 'default_domain' => $is_widget_page ? 'widget' : 'block',
184
+ 'yarpp_is_admin' => $yarpp_is_admin,
185
  );
186
  wp_localize_script( 'yarpp-block', 'yarpp_localized', $localized_variables );
187
  $args = array(
193
  'type' => 'string',
194
  'default' => '',
195
  ),
196
+ 'reference_id' => array(
197
+ 'type' => 'string',
198
+ 'default' => null,
199
+ ),
200
+ 'heading' => array(
201
+ 'type' => 'string',
202
+ 'default' => __( 'You may also like', 'yet-another-related-posts-plugin' ),
203
+ ),
204
  'limit' => array(
205
  'type' => 'number',
206
  'default' => 6,
209
  'type' => 'string',
210
  'default' => $chosen_template,
211
  ),
212
+ 'domain' => array(
213
+ 'type' => 'string',
214
+ ),
215
+ 'yarpp_is_admin' => array(
216
+ 'type' => 'boolean',
217
+ 'default' => $yarpp_is_admin,
218
+ ),
219
  'yarpp_preview' => array(
220
  'type' => 'string',
221
  ),
classes/YARPP_Core.php CHANGED
@@ -693,6 +693,11 @@ class YARPP {
693
  }
694
 
695
  private $templates = null;
 
 
 
 
 
696
  public function get_templates() {
697
  if ( is_null( $this->templates ) ) {
698
  $this->templates = glob( STYLESHEETPATH . '/yarpp-template-*.php' );
@@ -708,6 +713,29 @@ class YARPP {
708
  return (array) $this->templates;
709
  }
710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
  public function get_template_data( $file ) {
712
  $headers = array(
713
  'name' => 'YARPP Template',
@@ -1409,7 +1437,6 @@ class YARPP {
1409
  if ( true === $enqueue_related_style ) {
1410
  wp_enqueue_style( 'yarppRelatedCss' );
1411
  }
1412
- $output = null;
1413
 
1414
  if ( is_numeric( $reference_ID ) ) {
1415
  $reference_ID = (int) $reference_ID;
@@ -1427,11 +1454,8 @@ class YARPP {
1427
  $this->setup_active_cache( $args );
1428
 
1429
  $options = array(
1430
- 'domain',
1431
  'limit',
1432
- 'template',
1433
  'order',
1434
- 'promote_yarpp',
1435
  'optin',
1436
  );
1437
 
@@ -1482,8 +1506,38 @@ class YARPP {
1482
  $this->active_cache->end_yarpp_time();
1483
  }
1484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1485
  // CSS class "yarpp-related" exists for backwards compatibility in-case older custom themes are dependent on it.
1486
- $output .= "<div class='yarpp yarpp-related";
 
 
 
 
1487
 
1488
  // Add CSS class to identify domain.
1489
  if ( isset( $domain ) && $domain ) {
@@ -1516,10 +1570,6 @@ class YARPP {
1516
 
1517
  $output .= "'>\n";
1518
 
1519
- // Be careful to avoid infinite recursion, because those templates might show each related posts' body or
1520
- // excerpt, which would trigger finding its related posts, which would show its related posts body or excerpt...
1521
- $this->rendering_related_content = true;
1522
-
1523
  // avoid any monkeying around where someone could trya custom template like a template name like
1524
  // "yarpp-template-;../../wp-config.php". YARPP custom templates are only supported in the theme's root folder.
1525
  $template = str_replace( '/', '', $template );
@@ -1549,11 +1599,8 @@ class YARPP {
1549
  } else {
1550
  include YARPP_DIR . '/includes/template_builtin.php';
1551
  }
1552
- $this->rendering_related_content = false;
1553
- $output = trim( $output ) . "\n";
1554
 
1555
- unset( $related_query );
1556
- $this->restore_post_context();
1557
 
1558
  if ( $related_count > 0 && $promote_yarpp && $domain != 'metabox' ) {
1559
  $output .=
@@ -1570,9 +1617,6 @@ class YARPP {
1570
 
1571
  $output .= "</div>\n";
1572
 
1573
- if ( $echo ) {
1574
- echo $output;
1575
- }
1576
  return $output;
1577
  }
1578
 
@@ -1710,11 +1754,8 @@ class YARPP {
1710
  $options = array(
1711
  'domain',
1712
  'limit',
1713
- 'template',
1714
  'order',
1715
- 'promote_yarpp',
1716
  'size',
1717
- 'thumbnails_default'
1718
  );
1719
  extract( $this->parse_args( $args, $options ) );
1720
  $this->demo_cache_bypass->begin_demo_time( $limit, $order, $size );
@@ -1722,73 +1763,18 @@ class YARPP {
1722
  global $wp_query;
1723
  $wp_query = new WP_Query();
1724
 
1725
- $wp_query->query( '' );
 
 
 
1726
 
1727
  $this->prep_query( $domain === 'rss' );
1728
  $related_query = $wp_query; // backwards compatibility
1729
  $related_count = $related_query->post_count;
1730
 
1731
- $output = '';
1732
- // CSS class "yarpp-related" exists for backwards compatibility in-case older custom themes are dependent on it
1733
- $output .= "<div class='yarpp yarpp-related";
1734
-
1735
- // Add CSS class to identify domain
1736
- if ( isset( $domain ) && $domain ) {
1737
- $domain = esc_attr( $domain );
1738
- $output .= " yarpp-related-{$domain}";
1739
- }
1740
- // Add CSS class to identify no results
1741
- if ( $related_count < 1 ) {
1742
- $output .= ' yarpp-related-none';
1743
- }
1744
-
1745
- // Add CSS class to identify template
1746
- if ( isset( $template ) && $template ) {
1747
- // Normalize "thumbnail" and "thumbnails" to reference the same inbuilt template
1748
- if ( $template === 'thumbnail' ) {
1749
- $template = 'thumbnails';
1750
- }
1751
- // Sanitize template name; remove file extension if exists
1752
- if ( strpos( $template, '.php' ) ) {
1753
- $template_css_class_suffix = preg_replace( '/' . preg_quote( '.php', '/' ) . '$/', '', $template );
1754
- } else {
1755
- $template_css_class_suffix = $template;
1756
- }
1757
- $output .= " yarpp-template-$template_css_class_suffix";
1758
- } else {
1759
- // fallback to default template ("list")
1760
- $output .= ' yarpp-template-list';
1761
- }
1762
-
1763
- $output .= "'>\n";
1764
-
1765
- if ( (bool) $template && $template === 'thumbnails' ) {
1766
- include YARPP_DIR . '/includes/template_thumbnails.php';
1767
- } elseif ( (bool) $template && file_exists( STYLESHEETPATH . '/' . $template ) ) {
1768
- ob_start();
1769
- include STYLESHEETPATH . '/' . $template;
1770
- $output .= ob_get_contents();
1771
- ob_end_clean();
1772
- } else {
1773
- include YARPP_DIR . '/includes/template_builtin.php';
1774
- }
1775
- $output = trim( $output ) . "\n";
1776
-
1777
  $this->demo_cache_bypass->end_demo_time();
1778
 
1779
- if ( $promote_yarpp ) {
1780
- $output .=
1781
- '<p>' .
1782
- sprintf(
1783
- __(
1784
- "Powered by <a href='%s' title='WordPress Related Posts Plugin' target='_blank'>YARPP</a>.",
1785
- 'yarpp'
1786
- ),
1787
- 'https://yarpp.com'
1788
- ) .
1789
- "</p>\n";
1790
- }
1791
- $output .= '</div>';
1792
 
1793
  if ( $echo ) {
1794
  echo $output;
693
  }
694
 
695
  private $templates = null;
696
+ /**
697
+ * Returns an Array of all the custom templates
698
+ *
699
+ * @return array
700
+ */
701
  public function get_templates() {
702
  if ( is_null( $this->templates ) ) {
703
  $this->templates = glob( STYLESHEETPATH . '/yarpp-template-*.php' );
713
  return (array) $this->templates;
714
  }
715
 
716
+ /**
717
+ * Get all the available templates
718
+ *
719
+ * @since 5.28
720
+ * @return array
721
+ */
722
+ public function get_all_templates() {
723
+ $templates = $this->get_templates();
724
+ $block_templates = array(
725
+ esc_attr( 'builtin' ) => esc_html__( 'List', 'yet-another-related-posts-plugin' ),
726
+ esc_attr( 'thumbnails' ) => esc_html__( 'Thumbnail', 'yet-another-related-posts-plugin' ),
727
+ );
728
+ foreach ( $templates as $template ) {
729
+ $block_templates[ esc_attr( $template['basename'] ) ] = sprintf(
730
+ /* translators: %s: yarpp template name */
731
+ esc_html__( 'Custom: %s', 'yet-another-related-posts-plugin' ),
732
+ $template['name']
733
+ );
734
+ }
735
+
736
+ return $block_templates;
737
+ }
738
+
739
  public function get_template_data( $file ) {
740
  $headers = array(
741
  'name' => 'YARPP Template',
1437
  if ( true === $enqueue_related_style ) {
1438
  wp_enqueue_style( 'yarppRelatedCss' );
1439
  }
 
1440
 
1441
  if ( is_numeric( $reference_ID ) ) {
1442
  $reference_ID = (int) $reference_ID;
1454
  $this->setup_active_cache( $args );
1455
 
1456
  $options = array(
 
1457
  'limit',
 
1458
  'order',
 
1459
  'optin',
1460
  );
1461
 
1506
  $this->active_cache->end_yarpp_time();
1507
  }
1508
 
1509
+ // Be careful to avoid infinite recursion, because those templates might show each related posts' body or
1510
+ // excerpt, which would trigger finding its related posts, which would show its related posts body or excerpt...
1511
+ $this->rendering_related_content = true;
1512
+
1513
+ $output = $this->get_template_content($reference_ID, $args, $related_count);
1514
+
1515
+ $this->rendering_related_content = false;
1516
+
1517
+ unset( $related_query );
1518
+ $this->restore_post_context();
1519
+
1520
+ if ( $echo ) {
1521
+ echo $output;
1522
+ }
1523
+ return $output;
1524
+ }
1525
+
1526
+ protected function get_template_content( $reference_ID = null, $args, $related_count, $is_demo = false ) {
1527
+ $options = array(
1528
+ 'domain',
1529
+ 'template',
1530
+ 'promote_yarpp',
1531
+ );
1532
+
1533
+ extract( $this->parse_args( $args, $options ) );
1534
+
1535
  // CSS class "yarpp-related" exists for backwards compatibility in-case older custom themes are dependent on it.
1536
+ $output = "<div class='yarpp yarpp-related";
1537
+
1538
+ if ( $is_demo ) {
1539
+ $output .= ' yarpp-demo-related';
1540
+ }
1541
 
1542
  // Add CSS class to identify domain.
1543
  if ( isset( $domain ) && $domain ) {
1570
 
1571
  $output .= "'>\n";
1572
 
 
 
 
 
1573
  // avoid any monkeying around where someone could trya custom template like a template name like
1574
  // "yarpp-template-;../../wp-config.php". YARPP custom templates are only supported in the theme's root folder.
1575
  $template = str_replace( '/', '', $template );
1599
  } else {
1600
  include YARPP_DIR . '/includes/template_builtin.php';
1601
  }
 
 
1602
 
1603
+ $output = trim( $output ) . "\n";
 
1604
 
1605
  if ( $related_count > 0 && $promote_yarpp && $domain != 'metabox' ) {
1606
  $output .=
1617
 
1618
  $output .= "</div>\n";
1619
 
 
 
 
1620
  return $output;
1621
  }
1622
 
1754
  $options = array(
1755
  'domain',
1756
  'limit',
 
1757
  'order',
 
1758
  'size',
 
1759
  );
1760
  extract( $this->parse_args( $args, $options ) );
1761
  $this->demo_cache_bypass->begin_demo_time( $limit, $order, $size );
1763
  global $wp_query;
1764
  $wp_query = new WP_Query();
1765
 
1766
+ $wp_query->query( array(
1767
+ 'showposts' => $limit,
1768
+ 'ignore_sticky_posts' => true
1769
+ ) );
1770
 
1771
  $this->prep_query( $domain === 'rss' );
1772
  $related_query = $wp_query; // backwards compatibility
1773
  $related_count = $related_query->post_count;
1774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1775
  $this->demo_cache_bypass->end_demo_time();
1776
 
1777
+ $output = $this->get_template_content(null, $args, $related_count, true);
 
 
 
 
 
 
 
 
 
 
 
 
1778
 
1779
  if ( $echo ) {
1780
  echo $output;
classes/YARPP_Widget.php CHANGED
@@ -1,8 +1,5 @@
1
  <?php
2
- /**
3
- * Vaguely based on code by MK Safi
4
- * http://msafi.com/fix-yet-another-related-posts-plugin-yarpp-widget-and-add-it-to-the-sidebar/
5
- */
6
  class YARPP_Widget extends WP_Widget {
7
 
8
  public function __construct() {
@@ -10,6 +7,7 @@ class YARPP_Widget extends WP_Widget {
10
  'description' => 'Related Posts and/or Sponsored Content',
11
  'show_instance_in_rest' => true
12
  );
 
13
  parent::__construct( false, 'Related Posts (YARPP)', $widget_ops );
14
  }
15
 
@@ -26,11 +24,17 @@ class YARPP_Widget extends WP_Widget {
26
  $instance['template'] = ( $instance['use_template'] ) ? ( $instance['template_file'] ) : false;
27
  }
28
 
29
- $title = apply_filters( 'widget_title', $instance['title'] );
30
- $output = $before_widget;
 
 
 
 
 
 
31
  if ( ! $instance['template'] ) {
32
  $output .= $before_title;
33
- $output .= $title;
34
  $output .= $after_title;
35
  }
36
  $instance['domain'] = 'widget';
@@ -42,17 +46,23 @@ class YARPP_Widget extends WP_Widget {
42
  public function update( $new_instance, $old_instance ) {
43
  $instance = array(
44
  'template' => false,
45
- 'title' => $new_instance['title'],
46
- 'thumbnails_heading' => $new_instance['thumbnails_heading'],
47
  'use_pro' => false,
48
  'pro_dpid' => null,
49
  'promote_yarpp' => false,
50
  );
51
 
52
- if ( $new_instance['use_template'] === 'thumbnails' ) {
53
  $instance['template'] = 'thumbnails';
54
- } elseif ( $new_instance['use_template'] === 'custom' ) {
55
  $instance['template'] = $new_instance['template_file'];
 
 
 
 
 
 
 
56
  }
57
 
58
  return $instance;
@@ -64,8 +74,7 @@ class YARPP_Widget extends WP_Widget {
64
  $instance = wp_parse_args(
65
  $instance,
66
  array(
67
- 'title' => 'Related Posts (YARPP)',
68
- 'thumbnails_heading' => $yarpp->get_option( 'thumbnails_heading' ),
69
  'template' => false,
70
  'use_pro' => false,
71
  'pro_dpid' => null,
@@ -84,7 +93,7 @@ class YARPP_Widget extends WP_Widget {
84
  $choice = ( $instance['template'] ) ? ( ( $instance['template'] === 'thumbnails' ) ? 'thumbnails' : 'custom' ) : 'builtin';
85
 
86
  /* Check if YARPP templates are installed */
87
- $templates = $yarpp->get_templates();
88
 
89
  if ( ! $yarpp->diagnostic_custom_templates() && $choice === 'custom' ) {
90
  $choice = 'builtin';
@@ -92,6 +101,40 @@ class YARPP_Widget extends WP_Widget {
92
 
93
  include YARPP_DIR . '/includes/phtmls/yarpp_widget_form.phtml';
94
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
 
97
  /**
1
  <?php
2
+
 
 
 
3
  class YARPP_Widget extends WP_Widget {
4
 
5
  public function __construct() {
7
  'description' => 'Related Posts and/or Sponsored Content',
8
  'show_instance_in_rest' => true
9
  );
10
+ add_filter( 'widget_types_to_hide_from_legacy_widget_block', array($this,'hide_yarpp_widget_legacy_editor') );
11
  parent::__construct( false, 'Related Posts (YARPP)', $widget_ops );
12
  }
13
 
24
  $instance['template'] = ( $instance['use_template'] ) ? ( $instance['template_file'] ) : false;
25
  }
26
 
27
+ // Per display_related the template must be false if "list" template was selected
28
+ if ( $instance['template'] === 'list' || $instance['template'] === 'builtin' ) {
29
+ $instance['template'] = false;
30
+ }
31
+
32
+ $instance['heading'] = $this->get_heading($instance);
33
+ $heading = apply_filters( 'widget_title', $instance['heading'] );
34
+ $output = $before_widget;
35
  if ( ! $instance['template'] ) {
36
  $output .= $before_title;
37
+ $output .= $heading;
38
  $output .= $after_title;
39
  }
40
  $instance['domain'] = 'widget';
46
  public function update( $new_instance, $old_instance ) {
47
  $instance = array(
48
  'template' => false,
49
+ 'heading' => $new_instance['heading'],
 
50
  'use_pro' => false,
51
  'pro_dpid' => null,
52
  'promote_yarpp' => false,
53
  );
54
 
55
+ if ( isset($new_instance['use_template']) && $new_instance['use_template'] === 'thumbnails' ) {
56
  $instance['template'] = 'thumbnails';
57
+ } elseif ( isset($new_instance['use_template']) && $new_instance['use_template'] === 'custom' ) {
58
  $instance['template'] = $new_instance['template_file'];
59
+ } else {
60
+ $instance['template'] = isset($new_instance['template_file']) ? $new_instance['template_file'] : false;
61
+ }
62
+
63
+ // Legacy Widget block triggers this function on save but with the new instance.
64
+ if ( isset($new_instance['template']) ) {
65
+ $instance['template'] = $new_instance['template'];
66
  }
67
 
68
  return $instance;
74
  $instance = wp_parse_args(
75
  $instance,
76
  array(
77
+ 'heading' => $this->get_heading($instance),
 
78
  'template' => false,
79
  'use_pro' => false,
80
  'pro_dpid' => null,
93
  $choice = ( $instance['template'] ) ? ( ( $instance['template'] === 'thumbnails' ) ? 'thumbnails' : 'custom' ) : 'builtin';
94
 
95
  /* Check if YARPP templates are installed */
96
+ $block_templates = $yarpp->get_all_templates();
97
 
98
  if ( ! $yarpp->diagnostic_custom_templates() && $choice === 'custom' ) {
99
  $choice = 'builtin';
101
 
102
  include YARPP_DIR . '/includes/phtmls/yarpp_widget_form.phtml';
103
  }
104
+
105
+ /**
106
+ * Hides the yarpp widget from the block list
107
+ * WordPress 5.8.0 - https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/#3-hide-the-widget-from-the-legacy-widget-block
108
+ *
109
+ */
110
+ public function hide_yarpp_widget_legacy_editor( $widget_types ) {
111
+ $widget_types[] = 'yarpp_widget';
112
+ return $widget_types;
113
+ }
114
+
115
+ /**
116
+ * Get the heading of the widget backwards compatibility
117
+ *
118
+ * @param object $instance
119
+ * @return string
120
+ */
121
+ protected function get_heading( $instance ) {
122
+ $heading = __('You may also like', 'yet-another-related-posts-plugin');
123
+
124
+ if ( empty($instance) ) {
125
+ return $heading;
126
+ }
127
+
128
+ if ( $instance['template'] === 'thumbnails' && isset($instance['thumbnails_heading']) ) {
129
+ $heading = $instance['thumbnails_heading'];
130
+ } elseif ( $instance['template'] === false && isset($instance['title']) ) {
131
+ $heading = $instance['title'];
132
+ } elseif ( ! empty($instance['heading']) ) {
133
+ $heading = $instance['heading'];
134
+ }
135
+
136
+ return $heading;
137
+ }
138
  }
139
 
140
  /**
includes/phtmls/yarpp_widget_form.phtml CHANGED
@@ -1,70 +1,24 @@
1
  <div class="yarpp-widget-settings-switch">
2
  <div class="yarpp-widget-basic-settings" style="display: block;">
3
- <p class='yarpp-widget-type-control'>
4
- <label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id( 'use_template_builtin' ); ?>">
5
- <input
6
- type="radio"
7
- id="<?php echo $this->get_field_id( 'use_template_builtin' ); ?>"
8
- name="<?php echo $this->get_field_name( 'use_template' ); ?>"
9
- value="builtin" <?php checked( $choice === 'builtin' ); ?>
10
- />
11
- <?php _e( 'List', 'yet-another-related-posts-plugin' ); ?>
12
- </label>
13
- <br/>
14
- <label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id( 'use_template_thumbnails' ); ?>">
15
- <input
16
- type="radio"
17
- id="<?php echo $this->get_field_id( 'use_template_thumbnails' ); ?>"
18
- name="<?php echo $this->get_field_name( 'use_template' ); ?>"
19
- value="thumbnails" <?php checked( $choice === 'thumbnails' ); ?>
20
- />
21
- <?php _e( 'Thumbnails', 'yet-another-related-posts-plugin' ); ?>
22
- </label>
23
- <br/>
24
- <label style="padding-right: 10px; display: inline-block;" for="<?php echo $this->get_field_id( 'use_template_custom' ); ?>">
25
- <input
26
- type="radio"
27
- id="<?php echo $this->get_field_id( 'use_template_custom' ); ?>"
28
- name="<?php echo $this->get_field_name( 'use_template' ); ?>"
29
- value="custom"
30
- <?php
31
- checked( $choice === 'custom' );
32
- disabled( ! count( $templates ) );
33
- ?>
34
- />
35
- <?php _e( 'Custom', 'yet-another-related-posts-plugin' ); ?>
36
- </label>
37
- </p>
38
- <p>
39
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">
40
- <?php _e( 'Title:' ); ?>
41
- <input
42
- type="text"
43
- class="widefat"
44
- id="<?php echo $this->get_field_id( 'title' ); ?>"
45
- name="<?php echo $this->get_field_name( 'title' ); ?>"
46
- value="<?php echo esc_attr( $instance['title'] ); ?>"/>
47
- </label>
48
- </p>
49
- <p>
50
- <label for="<?php echo $this->get_field_id( 'thumbnails_heading' ); ?>">
51
  <?php _e( 'Heading:', 'yet-another-related-posts-plugin' ); ?>
52
  <input
53
  type="text"
54
  class="widefat"
55
- id="<?php echo $this->get_field_id( 'thumbnails_heading' ); ?>"
56
- name="<?php echo $this->get_field_name( 'thumbnails_heading' ); ?>"
57
- value="<?php echo esc_attr( $instance['thumbnails_heading'] ); ?>"/>
58
  </label>
59
  </p>
60
- <p>
61
  <label for="<?php echo $this->get_field_id( 'template_file' ); ?>">
62
  <?php _e( 'Template file:', 'yet-another-related-posts-plugin' ); ?>
63
  </label>
64
  <select name="<?php echo $this->get_field_name( 'template_file' ); ?>" id="<?php echo $this->get_field_id( 'template_file' ); ?>">
65
- <?php foreach ( $templates as $template ) : ?>
66
- <option value='<?php echo esc_attr( $template['basename'] ); ?>' <?php selected( $template['basename'], $instance['template'] ); ?>>
67
- <?php echo esc_html( $template['name'] ); ?>
68
  </option>
69
  <?php endforeach; ?>
70
  </select>
@@ -75,8 +29,8 @@
75
 
76
  <script type="text/javascript">
77
  jQuery(function($) {
78
- $('.yarpp-widget-type-control','#wpbody').each(ensureTemplateChoice);
79
- $('.yarpp-widget-type-control input','#wpbody').on('change', ensureTemplateChoice);
80
 
81
  function ensureTemplateChoice(e) {
82
  if (typeof e === 'object' && 'type' in e) e.stopImmediatePropagation();
@@ -84,12 +38,10 @@ jQuery(function($) {
84
  widget_id = this_form.find('.widget-id').val();
85
  // if this widget is just in staging:
86
  if (/__i__$/.test(widget_id)) return;
87
- var builtin = !! $('#widget-'+widget_id+'-use_template_builtin').prop('checked'),
88
- thumbnails = !! $('#widget-'+widget_id+'-use_template_thumbnails').prop('checked'),
89
- custom = !! $('#widget-'+widget_id+'-use_template_custom').prop('checked');
90
- $('#widget-'+widget_id+'-title').closest('p').toggle(builtin);
91
- $('#widget-'+widget_id+'-thumbnails_heading').closest('p').toggle(thumbnails);
92
- $('#widget-'+widget_id+'-template_file').closest('p').toggle(custom);
93
  }
94
  });
95
  </script>
1
  <div class="yarpp-widget-settings-switch">
2
  <div class="yarpp-widget-basic-settings" style="display: block;">
3
+ <p class="yarpp-widget-text-control">
4
+ <label for="<?php echo $this->get_field_id( 'heading' ); ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  <?php _e( 'Heading:', 'yet-another-related-posts-plugin' ); ?>
6
  <input
7
  type="text"
8
  class="widefat"
9
+ id="<?php echo $this->get_field_id( 'heading' ); ?>"
10
+ name="<?php echo $this->get_field_name( 'heading' ); ?>"
11
+ value="<?php echo esc_attr( $instance['heading'] ); ?>"/>
12
  </label>
13
  </p>
14
+ <p class="yarpp-widget-select-control">
15
  <label for="<?php echo $this->get_field_id( 'template_file' ); ?>">
16
  <?php _e( 'Template file:', 'yet-another-related-posts-plugin' ); ?>
17
  </label>
18
  <select name="<?php echo $this->get_field_name( 'template_file' ); ?>" id="<?php echo $this->get_field_id( 'template_file' ); ?>">
19
+ <?php foreach ( $block_templates as $template_base => $template_name ) : ?>
20
+ <option value='<?php echo esc_attr( $template_base ); ?>' <?php selected( $template_base, $instance['template'] ); ?>>
21
+ <?php echo esc_html( $template_name ); ?>
22
  </option>
23
  <?php endforeach; ?>
24
  </select>
29
 
30
  <script type="text/javascript">
31
  jQuery(function($) {
32
+ $('.yarpp-widget-select-control','#wpbody').each(ensureTemplateChoice);
33
+ $('.yarpp-widget-select-control select','#wpbody').on('change', ensureTemplateChoice);
34
 
35
  function ensureTemplateChoice(e) {
36
  if (typeof e === 'object' && 'type' in e) e.stopImmediatePropagation();
38
  widget_id = this_form.find('.widget-id').val();
39
  // if this widget is just in staging:
40
  if (/__i__$/.test(widget_id)) return;
41
+
42
+ const select = $('#widget-'+widget_id+'-template_file').val();
43
+ const show_heading = select === 'builtin' || select === 'thumbnails';
44
+ $('#widget-'+widget_id+'-heading').closest('p').toggle(show_heading);
 
 
45
  }
46
  });
47
  </script>
includes/template_functions.php CHANGED
@@ -42,6 +42,14 @@ function yarpp_thumbnail_inline_css( $dimension = array() ) {
42
  $yarpp_css .= 'margin: ' . $margin . 'px;';
43
  $yarpp_css .= '}';
44
 
 
 
 
 
 
 
 
 
45
  $yarpp_css .= '.yarpp-thumbnails-horizontal .yarpp-thumbnail-title {';
46
  $yarpp_css .= 'margin: ' . $extra_margin . 'px;';
47
  $yarpp_css .= 'margin-top: 0px;';
42
  $yarpp_css .= 'margin: ' . $margin . 'px;';
43
  $yarpp_css .= '}';
44
 
45
+ if ( is_admin() ) {
46
+ $yarpp_css .= '.yarpp-thumbnail > img {';
47
+ $yarpp_css .= 'width: ' . $width . 'px;';
48
+ $yarpp_css .= 'height: ' . $height . 'px !important;';
49
+ $yarpp_css .= 'margin: ' . $margin . 'px;';
50
+ $yarpp_css .= '}';
51
+ }
52
+
53
  $yarpp_css .= '.yarpp-thumbnails-horizontal .yarpp-thumbnail-title {';
54
  $yarpp_css .= 'margin: ' . $extra_margin . 'px;';
55
  $yarpp_css .= 'margin-top: 0px;';
includes/template_thumbnails.php CHANGED
@@ -12,9 +12,14 @@ if ( ! $this->diagnostic_using_thumbnails() ) {
12
  $this->set_option( 'manually_using_thumbnails', true );
13
  }
14
 
15
- $options = array( 'thumbnails_heading', 'thumbnails_default', 'no_results' );
 
16
  extract( $this->parse_args( $args, $options ) );
17
 
 
 
 
 
18
  // a little easter egg: if the default image URL is left blank,
19
  // default to the theme's header image. (hopefully it has one)
20
  if ( empty( $thumbnails_default ) ) {
12
  $this->set_option( 'manually_using_thumbnails', true );
13
  }
14
 
15
+ $options = array( 'thumbnails_heading', 'heading', 'thumbnails_default', 'no_results' );
16
+
17
  extract( $this->parse_args( $args, $options ) );
18
 
19
+ // heading is the new field used on widgets and blocks and the thumbnails_heading is the old implementation of it
20
+ // backward compatibility
21
+ $thumbnails_heading = isset($heading) ? $heading : $thumbnails_heading;
22
+
23
  // a little easter egg: if the default image URL is left blank,
24
  // default to the theme's header image. (hopefully it has one)
25
  if ( empty( $thumbnails_default ) ) {
js/block.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,a,r,l){var p=a.createElement;const{registerBlockType:n}=e,{__:o}=t;var s=wp.serverSideRender;const{InspectorControls:i}=l;l=p("svg",{width:"24px",height:"24px",viewBox:"0 0 145 191"},p("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},p("g",{id:"mark",transform:"translate(1.000000, 0.000000)",fill:"#000000",fillRule:"nonzero"},[p("g",{id:"coffee",transform:"translate(71.500000, 120.703704) scale(-1, 1) rotate(-180.000000) translate(-71.500000, -120.703704) translate(0.000000, 51.703704)"},[p("path",{d:"M42.8605706,136.08228 C32.8383705,134.783388 25.4669697,132.899997 20.7463681,130.432103 L17.3693225,127.801849 L17.6961333,113.286738 C17.9140072,99.3561292 17.9140072,98.6742113 15.626331,96.8232912 C9.85267229,92.1472827 0,79.2639855 0,68.5481325 C0,63.190206 1.55910743,60.0622836 4.82721619,54.4121066 C7.00595535,50.8076833 13.5249703,45.5370334 14.7232769,44.5628649 C17.0109529,43.0041953 18.4586919,44.1303138 17.6961333,33.1222102 C16.8246376,19.386435 16.0620789,17.4285621 24.0144768,12.8499703 C34.7992358,6.61529219 42.7516337,3.59536997 52.7738339,1.7444499 C76.6310277,-2.44447446 113.342783,1.25736568 126.30628,9.14813017 C133.931868,13.9215556 136.546355,16.844061 136.546355,20.9355684 C140.468085,87.8934137 142.537888,121.85942 142.755761,122.833589 C143.191509,125.074177 142.755761,125.658677 139.160842,127.314764 C134.040804,129.652769 127.831398,130.821771 106.588691,133.354609 C97.6558607,134.426194 87.0889758,135.692613 83.1672452,136.277114 C74.5612255,137.446116 52.55596,137.348699 42.8605706,136.08228 Z M84.5302734,132.078704 C90.2338167,131.384856 99.0983213,130.250086 109.038086,129.19345 C123.269589,127.025504 135.419901,125.626331 136.052413,123.330859 C136.26325,122.693228 123.934295,120.974239 120.350064,119.826503 C114.130371,117.786084 102.282696,120.185881 90.3749197,122.413563 C78.5049292,124.634175 65.4563408,123.330859 57.2545987,123.330859 C57.2545987,123.330859 52.4754466,122.523193 42.9171425,120.907861 C34.8760316,119.548931 36.2210561,119.122494 30.0013622,121.800545 C26.4171319,123.458385 23.2545757,125.243752 23.1491572,126.00891 C23.1491572,126.646541 23.4436238,128.461522 26.4171319,129.962221 C30.7587891,132.153411 43.5141602,132.441008 54.7143555,132.987395 C63.4858398,132.987395 78.8267301,132.772551 84.5302734,132.078704 Z M39.8706761,116.766844 C44.1268856,115.725876 53.6774041,114.21174 61.1517228,113.360038 C78.7994201,111.372734 134.960621,119.511215 135.168241,119.227315 C135.375861,119.038049 134.441571,54.1194625 131.327272,29.7040177 C129.873932,18.9157978 129.354882,17.9694627 122.088183,13.4270544 C110.461465,6.04564084 74.5432107,2.73346808 53.365974,6.9919759 C42.9849757,9.07391307 36.7563767,11.7236513 27.4134781,17.6855623 L22.2811694,21.5880854 L23.5725088,121.309253 L39.8706761,116.766844 Z M17.5997043,65.8013821 C17.5997043,50.8200023 18.1706592,50.7529753 17.5997043,50.7529753 C14.2258377,50.7529753 10.6869946,53.2086296 7.93345172,57.6428564 C5.8104668,61.0616507 5.50346166,65.6301628 5.50346166,67.2280714 C5.50346166,78.0260213 10.8676018,86.5101525 17.5997043,86.5101525 C17.5997043,86.5101525 17.5997043,79.607229 17.5997043,65.8013821 Z",id:"mug",stroke:"#000000"}),p("g",{id:"Face",transform:"translate(50.942850, 60.400797)"},[p("path",{d:"M62.160778,33.5475835 C58.4082262,26.6041533 60.1139316,19.0295022 64.8899066,19.0295022 C67.6190353,19.0295022 70.6893049,21.554386 71.7127282,24.7104906 C74.1007157,31.0226999 65.2310478,39.2285718 62.160778,33.5475835 Z",id:"Shape"}),p("path",{d:"M2.10303837,34.0061906 C-1.64951349,27.0627603 0.0561919019,19.4881092 4.832167,19.4881092 C7.56129563,19.4881092 10.6315653,22.0129929 11.6549885,25.1690976 C14.0429761,31.4813068 5.17330808,39.6871789 2.10303837,34.0061906 Z",id:"Shape"}),p("path",{d:"M31.2744481,13.4867788 C22.3526728,9.75718844 22.3526728,6.85639597 31.6992946,2.91960618 C42.1080324,-1.22438307 54.6410025,-0.809984147 59.1018902,3.74840403 C62.2882385,7.47799435 62.2882385,7.89239328 58.8894669,10.7931858 C53.1540399,15.7659729 39.3465305,17.0091696 31.2744481,13.4867788 Z M34.976751,7.90748093 C31.9007499,10.1104937 36.6921961,10.3294258 44.7947408,9.91788078 C56.0107659,9.20199741 56.1391309,4.42943021 44.7105432,4.91244623 C39.9559268,5.04429429 35.7457513,7.35672775 34.976751,7.90748093 Z",id:"Shape"})])]),p("g",{id:"Steam",transform:"translate(59.000000, 0.000000)"},[p("path",{d:"M4.16072763,0 C3.8378459,2.63060705 3.63689662,5.30305159 3.55986302,7.99095841 C3.50399,11.7470679 4.34571573,15.3721626 5.88012483,17.9837251 C6.89080993,19.79566 7.8953323,21.6238698 8.89369196,23.4683544 C9.94816663,25.3544895 10.6511261,27.7615875 10.9088994,30.3688969 C11.2199644,33.5056623 10.7257443,36.7238795 9.55926508,39.1573237 C8.32730672,41.7867086 6.67010618,43.6939485 4.8078126,44.6256781 L4.16072763,45 C4.54897862,43.79566 4.91874145,42.6889692 5.26077208,41.5660036 C5.72297563,40.0524412 6.18517917,38.5388789 6.61040644,36.9764919 C7.10981843,35.2326056 7.05009434,33.1543735 6.45325723,31.5081374 C6.2293797,30.9214149 5.97231446,30.3761351 5.68599934,29.880651 C4.66915153,28.0415914 3.62457152,26.2676311 2.63545592,24.4122966 C1.45178454,22.2681987 0.62382925,19.5948547 0.241241542,16.681736 C-0.438989396,11.7709757 0.340504342,6.58788172 2.31191343,2.91320073 C2.76487291,2.01808319 3.30102903,1.28571429 3.80020887,0.455696202 L4.06828692,5.05924416e-15 L4.16072763,0 Z",id:"Shape"}),p("path",{d:"M42,22.2784335 C41.5087566,23.247748 41.0367776,24.1755205 40.5551664,25.1586823 C40.1845249,25.9527384 39.8622545,26.7913079 39.591944,27.6650528 C39.2956943,28.8926755 39.2292571,30.2107229 39.3992994,31.4869214 C39.5437829,33.4255504 39.7267951,35.3641795 39.8038529,37.3028085 C39.8563132,38.9567993 39.5167155,40.587414 38.8406305,41.9278235 C38.0105027,43.6950754 36.6602155,44.8138092 35.1803853,44.9603932 C33.720005,45.1484608 32.2558855,44.6634774 31,43.5756581 L31.1348511,43.4094899 C32.0980736,42.4955649 33.1287215,41.5954871 34.1015762,40.6400199 C34.7603771,40.0681104 35.0780935,38.9403296 34.8817863,37.8705499 C34.5399208,35.5070657 34.3752325,33.0977166 34.390543,30.683775 C34.5530247,26.3626272 36.7924318,22.7913004 39.765324,22.1122653 C40.4194081,21.9625782 41.0858457,21.9625782 41.7399299,22.1122653 L41.8844134,22.1122653 L42,22.2784335 Z",id:"Shape"})])])));const{TextControl:C,SelectControl:d,PanelBody:u}=r;n("yarpp/yarpp-block",{title:o("Related Posts [YARPP]","yet-another-related-posts-plugin"),description:o("Display related posts by YARPP","yet-another-related-posts-plugin"),category:"yarpp",icon:l,keywords:[o("yarpp","yet-another-related-posts-plugin"),o("yet another","yet-another-related-posts-plugin"),o("related posts","yet-another-related-posts-plugin"),o("contextual","yet-another-related-posts-plugin"),o("popular","yet-another-related-posts-plugin"),o("similar","yet-another-related-posts-plugin"),o("thumbnail","yet-another-related-posts-plugin"),o("you may also","yet-another-related-posts-plugin"),o("posts","yet-another-related-posts-plugin")],supports:{html:!1},attributes:{limit:{type:"number",default:6},template:{type:"string",default:yarpp_localized.selected_theme_style},yarpp_preview:{type:"string"}},example:{attributes:{yarpp_preview:"yarpp_preview"}},edit:function(e){var t=e.attributes;const a=e.setAttributes;var r=Object.keys(yarpp_localized.template).map(function(e){return{value:e,label:yarpp_localized.template[e]}});return e.isSelected,[p("div",{className:e.className},p(s,{block:"yarpp/yarpp-block",attributes:t})),p(i,{},p(u,{title:"YARPP Posts Settings",initialOpen:!0},p(C,{label:o("Maximum number of posts","yet-another-related-posts-plugin"),value:t.limit,onChange:function(e){a({limit:parseInt(e)})},type:"number",min:1,step:1}),p(d,{value:t.template,label:o("Theme","yet-another-related-posts-plugin"),onChange:function(e){a({template:e})},options:r})))]},save(){return null}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,(window.wp.editor,window.wp.blockEditor),window.wp.serverSideRender);
1
+ !function(e,t,a,n,l){var i=a.createElement,o=a.useEffect;const{registerBlockType:r,createBlock:p}=e,{__:s}=t;var d=wp.serverSideRender;const{InspectorControls:C}=l;l=i("svg",{width:"24px",height:"24px",viewBox:"0 0 145 191"},i("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},i("g",{id:"mark",transform:"translate(1.000000, 0.000000)",fill:"#000000",fillRule:"nonzero"},[i("g",{id:"coffee",transform:"translate(71.500000, 120.703704) scale(-1, 1) rotate(-180.000000) translate(-71.500000, -120.703704) translate(0.000000, 51.703704)"},[i("path",{d:"M42.8605706,136.08228 C32.8383705,134.783388 25.4669697,132.899997 20.7463681,130.432103 L17.3693225,127.801849 L17.6961333,113.286738 C17.9140072,99.3561292 17.9140072,98.6742113 15.626331,96.8232912 C9.85267229,92.1472827 0,79.2639855 0,68.5481325 C0,63.190206 1.55910743,60.0622836 4.82721619,54.4121066 C7.00595535,50.8076833 13.5249703,45.5370334 14.7232769,44.5628649 C17.0109529,43.0041953 18.4586919,44.1303138 17.6961333,33.1222102 C16.8246376,19.386435 16.0620789,17.4285621 24.0144768,12.8499703 C34.7992358,6.61529219 42.7516337,3.59536997 52.7738339,1.7444499 C76.6310277,-2.44447446 113.342783,1.25736568 126.30628,9.14813017 C133.931868,13.9215556 136.546355,16.844061 136.546355,20.9355684 C140.468085,87.8934137 142.537888,121.85942 142.755761,122.833589 C143.191509,125.074177 142.755761,125.658677 139.160842,127.314764 C134.040804,129.652769 127.831398,130.821771 106.588691,133.354609 C97.6558607,134.426194 87.0889758,135.692613 83.1672452,136.277114 C74.5612255,137.446116 52.55596,137.348699 42.8605706,136.08228 Z M84.5302734,132.078704 C90.2338167,131.384856 99.0983213,130.250086 109.038086,129.19345 C123.269589,127.025504 135.419901,125.626331 136.052413,123.330859 C136.26325,122.693228 123.934295,120.974239 120.350064,119.826503 C114.130371,117.786084 102.282696,120.185881 90.3749197,122.413563 C78.5049292,124.634175 65.4563408,123.330859 57.2545987,123.330859 C57.2545987,123.330859 52.4754466,122.523193 42.9171425,120.907861 C34.8760316,119.548931 36.2210561,119.122494 30.0013622,121.800545 C26.4171319,123.458385 23.2545757,125.243752 23.1491572,126.00891 C23.1491572,126.646541 23.4436238,128.461522 26.4171319,129.962221 C30.7587891,132.153411 43.5141602,132.441008 54.7143555,132.987395 C63.4858398,132.987395 78.8267301,132.772551 84.5302734,132.078704 Z M39.8706761,116.766844 C44.1268856,115.725876 53.6774041,114.21174 61.1517228,113.360038 C78.7994201,111.372734 134.960621,119.511215 135.168241,119.227315 C135.375861,119.038049 134.441571,54.1194625 131.327272,29.7040177 C129.873932,18.9157978 129.354882,17.9694627 122.088183,13.4270544 C110.461465,6.04564084 74.5432107,2.73346808 53.365974,6.9919759 C42.9849757,9.07391307 36.7563767,11.7236513 27.4134781,17.6855623 L22.2811694,21.5880854 L23.5725088,121.309253 L39.8706761,116.766844 Z M17.5997043,65.8013821 C17.5997043,50.8200023 18.1706592,50.7529753 17.5997043,50.7529753 C14.2258377,50.7529753 10.6869946,53.2086296 7.93345172,57.6428564 C5.8104668,61.0616507 5.50346166,65.6301628 5.50346166,67.2280714 C5.50346166,78.0260213 10.8676018,86.5101525 17.5997043,86.5101525 C17.5997043,86.5101525 17.5997043,79.607229 17.5997043,65.8013821 Z",id:"mug",stroke:"#000000"}),i("g",{id:"Face",transform:"translate(50.942850, 60.400797)"},[i("path",{d:"M62.160778,33.5475835 C58.4082262,26.6041533 60.1139316,19.0295022 64.8899066,19.0295022 C67.6190353,19.0295022 70.6893049,21.554386 71.7127282,24.7104906 C74.1007157,31.0226999 65.2310478,39.2285718 62.160778,33.5475835 Z",id:"Shape"}),i("path",{d:"M2.10303837,34.0061906 C-1.64951349,27.0627603 0.0561919019,19.4881092 4.832167,19.4881092 C7.56129563,19.4881092 10.6315653,22.0129929 11.6549885,25.1690976 C14.0429761,31.4813068 5.17330808,39.6871789 2.10303837,34.0061906 Z",id:"Shape"}),i("path",{d:"M31.2744481,13.4867788 C22.3526728,9.75718844 22.3526728,6.85639597 31.6992946,2.91960618 C42.1080324,-1.22438307 54.6410025,-0.809984147 59.1018902,3.74840403 C62.2882385,7.47799435 62.2882385,7.89239328 58.8894669,10.7931858 C53.1540399,15.7659729 39.3465305,17.0091696 31.2744481,13.4867788 Z M34.976751,7.90748093 C31.9007499,10.1104937 36.6921961,10.3294258 44.7947408,9.91788078 C56.0107659,9.20199741 56.1391309,4.42943021 44.7105432,4.91244623 C39.9559268,5.04429429 35.7457513,7.35672775 34.976751,7.90748093 Z",id:"Shape"})])]),i("g",{id:"Steam",transform:"translate(59.000000, 0.000000)"},[i("path",{d:"M4.16072763,0 C3.8378459,2.63060705 3.63689662,5.30305159 3.55986302,7.99095841 C3.50399,11.7470679 4.34571573,15.3721626 5.88012483,17.9837251 C6.89080993,19.79566 7.8953323,21.6238698 8.89369196,23.4683544 C9.94816663,25.3544895 10.6511261,27.7615875 10.9088994,30.3688969 C11.2199644,33.5056623 10.7257443,36.7238795 9.55926508,39.1573237 C8.32730672,41.7867086 6.67010618,43.6939485 4.8078126,44.6256781 L4.16072763,45 C4.54897862,43.79566 4.91874145,42.6889692 5.26077208,41.5660036 C5.72297563,40.0524412 6.18517917,38.5388789 6.61040644,36.9764919 C7.10981843,35.2326056 7.05009434,33.1543735 6.45325723,31.5081374 C6.2293797,30.9214149 5.97231446,30.3761351 5.68599934,29.880651 C4.66915153,28.0415914 3.62457152,26.2676311 2.63545592,24.4122966 C1.45178454,22.2681987 0.62382925,19.5948547 0.241241542,16.681736 C-0.438989396,11.7709757 0.340504342,6.58788172 2.31191343,2.91320073 C2.76487291,2.01808319 3.30102903,1.28571429 3.80020887,0.455696202 L4.06828692,5.05924416e-15 L4.16072763,0 Z",id:"Shape"}),i("path",{d:"M42,22.2784335 C41.5087566,23.247748 41.0367776,24.1755205 40.5551664,25.1586823 C40.1845249,25.9527384 39.8622545,26.7913079 39.591944,27.6650528 C39.2956943,28.8926755 39.2292571,30.2107229 39.3992994,31.4869214 C39.5437829,33.4255504 39.7267951,35.3641795 39.8038529,37.3028085 C39.8563132,38.9567993 39.5167155,40.587414 38.8406305,41.9278235 C38.0105027,43.6950754 36.6602155,44.8138092 35.1803853,44.9603932 C33.720005,45.1484608 32.2558855,44.6634774 31,43.5756581 L31.1348511,43.4094899 C32.0980736,42.4955649 33.1287215,41.5954871 34.1015762,40.6400199 C34.7603771,40.0681104 35.0780935,38.9403296 34.8817863,37.8705499 C34.5399208,35.5070657 34.3752325,33.0977166 34.390543,30.683775 C34.5530247,26.3626272 36.7924318,22.7913004 39.765324,22.1122653 C40.4194081,21.9625782 41.0858457,21.9625782 41.7399299,22.1122653 L41.8844134,22.1122653 L42,22.2784335 Z",id:"Shape"})])])));const{TextControl:u,SelectControl:c,PanelBody:y}=n;r("yarpp/yarpp-block",{title:s("Related Posts [YARPP]","yet-another-related-posts-plugin"),description:s("Display related posts by YARPP","yet-another-related-posts-plugin"),category:"yarpp",icon:l,keywords:[s("yarpp","yet-another-related-posts-plugin"),s("yet another","yet-another-related-posts-plugin"),s("related posts","yet-another-related-posts-plugin"),s("contextual","yet-another-related-posts-plugin"),s("popular","yet-another-related-posts-plugin"),s("similar","yet-another-related-posts-plugin"),s("thumbnail","yet-another-related-posts-plugin"),s("you may also","yet-another-related-posts-plugin"),s("posts","yet-another-related-posts-plugin")],supports:{html:!1},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:({idBase:e,instance:t})=>!!t?.raw&&"yarpp_widget"===e,transform:({instance:e})=>{var t=e.raw.template,e="heading"in e.raw?e.raw.heading:"thumbnails"===t?e.raw.thumbnails_heading:e.raw.title;return p("yarpp/yarpp-block",{name:"yarpp_widget",template:t,heading:e,domain:"widget"})}}]},attributes:{reference_id:{type:"string",default:""},heading:{type:"string",default:s("You may also like","yet-another-related-posts-plugin")},limit:{type:"number",default:6},template:{type:"string",default:yarpp_localized.selected_theme_style},yarpp_preview:{type:"string"},domain:{type:"string",default:"block"},yarpp_is_admin:{type:"boolean",default:yarpp_localized.yarpp_is_admin}},example:{attributes:{yarpp_preview:"yarpp_preview"}},edit:function(e){var t=e.attributes;const a=e.setAttributes;var n,l=Object.keys(yarpp_localized.template).map(function(e){return{value:e,label:yarpp_localized.template[e]}});return e.isSelected,o(()=>{a({domain:yarpp_localized.default_domain})},[]),[i("div",{className:e.className},i(d,{block:"yarpp/yarpp-block",attributes:t})),i(C,{},i(y,{title:"YARPP Posts Settings",initialOpen:!0},i(u,{label:s("Reference ID (Optional)","yet-another-related-posts-plugin"),value:t.reference_id,help:s("The ID of the post to use for finding related posts. Defaults to current post.","yet-another-related-posts-plugin"),onChange:function(e){a({reference_id:e})}}),i(u,{label:s("Maximum number of posts","yet-another-related-posts-plugin"),value:t.limit,onChange:function(e){a({limit:parseInt(e)})},type:"number",min:1,step:1}),i(c,{value:t.template,label:s("Theme","yet-another-related-posts-plugin"),onChange:function(e){a({template:e})},options:l}),(n=t.template,("widget"===yarpp_localized.default_domain?["","builtin","list","thumbnail","thumbnails"]:["thumbnail","thumbnails"]).includes(n)&&i(u,{label:s("Heading","yet-another-related-posts-plugin"),value:t.heading,onChange:function(e){a({heading:e})}}))))]},save(){return null}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,(window.wp.editor,window.wp.blockEditor),window.wp.serverSideRender),function(a){a(document).on("widget-added",function(){function e(e){"object"==typeof e&&"type"in e&&e.stopImmediatePropagation();var t=a(this).closest("form").find(".widget-id").val();/__i__$/.test(t)||(e="builtin"===(e=a("#widget-"+t+"-template_file").val())||"thumbnails"===e,a("#widget-"+t+"-heading").closest("p").toggle(e))}a(".yarpp-widget-select-control","#wpbody").each(e),a(".yarpp-widget-select-control select","#wpbody").on("change",e)})}(jQuery);
readme.txt CHANGED
@@ -6,7 +6,7 @@ Requires at least: 3.7
6
  Requires PHP: 5.3
7
  License: GPLv2 or later
8
  Tested up to: 5.8
9
- Stable tag: 5.27.1
10
 
11
  The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
12
 
@@ -529,6 +529,14 @@ Beginning with version 4.0.7, YARPP includes clean uninstall functionality. If y
529
 
530
 
531
  == Changelog ==
 
 
 
 
 
 
 
 
532
  = 5.27.1 (03-August-2021) =
533
  * Bugfix: i18n / localization for new text strings was not working.
534
  + P.s. YARPP is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/yet-another-related-posts-plugin/). Please check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/).
@@ -1402,5 +1410,5 @@ After a break of many years, the plugin is 100% supported now that the baton has
1402
  * Initial upload
1403
 
1404
  == Upgrade Notice ==
1405
- = 5.27.1 =
1406
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
6
  Requires PHP: 5.3
7
  License: GPLv2 or later
8
  Tested up to: 5.8
9
+ Stable tag: 5.27.2
10
 
11
  The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
12
 
529
 
530
 
531
  == Changelog ==
532
+ = 5.27.2 (12-August-2021) =
533
+ * New: Conversion of legacy widget YARPP block into YARPP Block
534
+ * [Bugfix](https://wordpress.org/support/topic/display-in-sidebart-but-not-on-the-main-page/): New Blocks on widget's sections were showing on homepage
535
+ * Bugfix: Remove the legacy widget YARPP block on the widgets interface
536
+ * New: Option to add a custom reference ID on a YARPP Block
537
+ * Enhancement: Consistency on "Heading" input fields on widgets and blocks
538
+ * Enhancement: Show demo related post on the Widgets YARPP Blocks
539
+
540
  = 5.27.1 (03-August-2021) =
541
  * Bugfix: i18n / localization for new text strings was not working.
542
  + P.s. YARPP is available for [translation directly on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/yet-another-related-posts-plugin/). Please check out the official [Translator Handbook](https://make.wordpress.org/polyglots/handbook/rosetta/theme-plugin-directories/).
1410
  * Initial upload
1411
 
1412
  == Upgrade Notice ==
1413
+ = 5.27.2 =
1414
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
src/css/public/yarpp-block-editor.css CHANGED
@@ -1,4 +1,4 @@
1
- .wp-block-yarpp-yarpp-block .yarpp-related-block a {
2
  pointer-events: none;
3
  cursor: default;
4
  }
1
+ .wp-block-yarpp-yarpp-block .yarpp-related-block a, .yarpp-demo-related a {
2
  pointer-events: none;
3
  cursor: default;
4
  }
src/js/block.js CHANGED
@@ -1,6 +1,7 @@
1
  (function (blocks, i18n, element, components, editor, blockEditor) {
2
  var el = element.createElement;
3
- const { registerBlockType } = blocks;
 
4
  const { __ } = i18n; //translation functions
5
  var ServerSideRender = wp.serverSideRender;
6
  const { RichText, InspectorControls } = blockEditor;
@@ -115,7 +116,46 @@
115
  html: false,
116
  },
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  attributes: {
 
 
 
 
 
 
 
 
119
  limit: {
120
  type: 'number',
121
  default: 6,
@@ -127,6 +167,14 @@
127
  yarpp_preview: {
128
  type: 'string',
129
  },
 
 
 
 
 
 
 
 
130
  },
131
  example: {
132
  attributes: {
@@ -149,6 +197,22 @@
149
  setAttributes({ template });
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  return [
153
  /**
154
  * Server side render
@@ -171,7 +235,20 @@
171
  el(
172
  PanelBody,
173
  { title: 'YARPP Posts Settings', initialOpen: true },
174
-
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  el(TextControl, {
176
  label: __(
177
  'Maximum number of posts',
@@ -191,6 +268,14 @@
191
  onChange: changeThumbnail,
192
  options: template,
193
  }),
 
 
 
 
 
 
 
 
194
  ),
195
  ),
196
  ];
@@ -209,3 +294,28 @@
209
  window.wp.blockEditor,
210
  window.wp.serverSideRender,
211
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  (function (blocks, i18n, element, components, editor, blockEditor) {
2
  var el = element.createElement;
3
+ var useEffect = element.useEffect;
4
+ const { registerBlockType, createBlock } = blocks;
5
  const { __ } = i18n; //translation functions
6
  var ServerSideRender = wp.serverSideRender;
7
  const { RichText, InspectorControls } = blockEditor;
116
  html: false,
117
  },
118
 
119
+ transforms: {
120
+ from: [
121
+ {
122
+ type: 'block',
123
+ blocks: ['core/legacy-widget'],
124
+ isMatch: ({ idBase, instance }) => {
125
+ if (!instance?.raw) {
126
+ // Can't transform if raw instance is not shown in REST API.
127
+ return false;
128
+ }
129
+ return idBase === 'yarpp_widget';
130
+ },
131
+ transform: ({ instance, ...rest }) => {
132
+ const template = instance.raw.template;
133
+ const heading =
134
+ 'heading' in instance.raw
135
+ ? instance.raw.heading
136
+ : template === 'thumbnails'
137
+ ? instance.raw.thumbnails_heading
138
+ : instance.raw.title;
139
+ return createBlock('yarpp/yarpp-block', {
140
+ name: 'yarpp_widget',
141
+ template: template,
142
+ heading: heading,
143
+ domain: 'widget',
144
+ });
145
+ },
146
+ },
147
+ ],
148
+ },
149
+
150
  attributes: {
151
+ reference_id: {
152
+ type: 'string',
153
+ default: '',
154
+ },
155
+ heading: {
156
+ type: 'string',
157
+ default: __('You may also like', 'yet-another-related-posts-plugin'),
158
+ },
159
  limit: {
160
  type: 'number',
161
  default: 6,
167
  yarpp_preview: {
168
  type: 'string',
169
  },
170
+ domain: {
171
+ type: 'string',
172
+ default: 'block',
173
+ },
174
+ yarpp_is_admin: {
175
+ type: 'boolean',
176
+ default: yarpp_localized.yarpp_is_admin,
177
+ },
178
  },
179
  example: {
180
  attributes: {
197
  setAttributes({ template });
198
  }
199
 
200
+ function shouldShowHeading(template) {
201
+ const is_widget = yarpp_localized.default_domain === 'widget';
202
+
203
+ if (is_widget) {
204
+ return ['', 'builtin', 'list', 'thumbnail', 'thumbnails'].includes(
205
+ template,
206
+ );
207
+ }
208
+
209
+ return ['thumbnail', 'thumbnails'].includes(template);
210
+ }
211
+
212
+ useEffect(() => {
213
+ setAttributes({ domain: yarpp_localized.default_domain });
214
+ }, []);
215
+
216
  return [
217
  /**
218
  * Server side render
235
  el(
236
  PanelBody,
237
  { title: 'YARPP Posts Settings', initialOpen: true },
238
+ el(TextControl, {
239
+ label: __(
240
+ 'Reference ID (Optional)',
241
+ 'yet-another-related-posts-plugin',
242
+ ),
243
+ value: attributes.reference_id,
244
+ help: __(
245
+ 'The ID of the post to use for finding related posts. Defaults to current post.',
246
+ 'yet-another-related-posts-plugin',
247
+ ),
248
+ onChange: function (val) {
249
+ setAttributes({ reference_id: val });
250
+ },
251
+ }),
252
  el(TextControl, {
253
  label: __(
254
  'Maximum number of posts',
268
  onChange: changeThumbnail,
269
  options: template,
270
  }),
271
+ shouldShowHeading(attributes.template) &&
272
+ el(TextControl, {
273
+ label: __('Heading', 'yet-another-related-posts-plugin'),
274
+ value: attributes.heading,
275
+ onChange: function (val) {
276
+ setAttributes({ heading: val });
277
+ },
278
+ }),
279
  ),
280
  ),
281
  ];
294
  window.wp.blockEditor,
295
  window.wp.serverSideRender,
296
  );
297
+
298
+ // Support for Legacy Widgets per WP 5.8 widgets change
299
+ (function ($) {
300
+ $(document).on('widget-added', function () {
301
+ $('.yarpp-widget-select-control', '#wpbody').each(ensureTemplateChoice);
302
+ $('.yarpp-widget-select-control select', '#wpbody').on(
303
+ 'change',
304
+ ensureTemplateChoice,
305
+ );
306
+
307
+ function ensureTemplateChoice(e) {
308
+ if (typeof e === 'object' && 'type' in e) e.stopImmediatePropagation();
309
+ var this_form = $(this).closest('form'),
310
+ widget_id = this_form.find('.widget-id').val();
311
+ // if this widget is just in staging:
312
+ if (/__i__$/.test(widget_id)) return;
313
+
314
+ const select = $('#widget-' + widget_id + '-template_file').val();
315
+ const show_heading = select === 'builtin' || select === 'thumbnails';
316
+ $('#widget-' + widget_id + '-heading')
317
+ .closest('p')
318
+ .toggle(show_heading);
319
+ }
320
+ });
321
+ })(jQuery);
style/yarpp-block-editor.css CHANGED
@@ -1 +1 @@
1
- .wp-block-yarpp-yarpp-block .yarpp-related-block a{cursor:default;pointer-events:none}
1
+ .wp-block-yarpp-yarpp-block .yarpp-related-block a,.yarpp-demo-related a{cursor:default;pointer-events:none}
yarpp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
- Version: 5.27.1
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
@@ -25,7 +25,7 @@ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
25
  define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
26
  }
27
 
28
- define( 'YARPP_VERSION', '5.27.1' );
29
 
30
  define( 'YARPP_DIR', dirname( __FILE__ ) );
31
  /**
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
+ Version: 5.27.2
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
25
  define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
26
  }
27
 
28
+ define( 'YARPP_VERSION', '5.27.2' );
29
 
30
  define( 'YARPP_DIR', dirname( __FILE__ ) );
31
  /**