Accordion - Version 2.2.68

Version Description

  • 2022-12-10 - fix - Link target, hr escape issue fixed.
    • 2022-12-10 - fix - Generate new id on duplicate accrodions
Download this release

Release Info

Developer pickplugins
Plugin Icon 128x128 Accordion
Version 2.2.68
Comparing to
See all releases

Code changes from version 2.2.67 to 2.2.68

accordions.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accordions by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
5
  Description: Fully responsive and mobile ready accordion grid for wordpress.
6
- Version: 2.2.67
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
@@ -23,7 +23,7 @@ class Accordions
23
 
24
  define('accordions_plugin_url', plugins_url('/', __FILE__));
25
  define('accordions_plugin_dir', plugin_dir_path(__FILE__));
26
- define('accordions_version', '2.2.67');
27
  define('accordions_plugin_name', 'Accordions');
28
  define('accordions_plugin_basename', plugin_basename(__FILE__));
29
 
3
  Plugin Name: Accordions by PickPlugins
4
  Plugin URI: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
5
  Description: Fully responsive and mobile ready accordion grid for wordpress.
6
+ Version: 2.2.68
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
23
 
24
  define('accordions_plugin_url', plugins_url('/', __FILE__));
25
  define('accordions_plugin_dir', plugin_dir_path(__FILE__));
26
+ define('accordions_version', '2.2.68');
27
  define('accordions_plugin_name', 'Accordions');
28
  define('accordions_plugin_basename', plugin_basename(__FILE__));
29
 
includes/duplicate-post.php CHANGED
@@ -2,30 +2,31 @@
2
 
3
 
4
 
5
- if ( ! defined('ABSPATH')) exit; // if direct access
6
 
7
 
8
 
9
- function accordions_duplicate_post_as_draft(){
 
10
  global $wpdb;
11
- if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'accordions_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
12
  wp_die('No post to duplicate has been supplied!');
13
  }
14
 
15
  /*
16
  * Nonce verification
17
  */
18
- if ( !isset( $_GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE__ ) ) )
19
  return;
20
 
21
  /*
22
  * get the original post id
23
  */
24
- $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
25
  /*
26
  * and all the original post data then
27
  */
28
- $post = get_post( $post_id );
29
 
30
  /*
31
  * if you don't want current user to be the new post author,
@@ -37,7 +38,7 @@ function accordions_duplicate_post_as_draft(){
37
  /*
38
  * if post data exists, create the post duplicate
39
  */
40
- if (isset( $post ) && $post != null) {
41
 
42
  /*
43
  * new post data array
@@ -52,7 +53,7 @@ function accordions_duplicate_post_as_draft(){
52
  'post_parent' => $post->post_parent,
53
  'post_password' => $post->post_password,
54
  'post_status' => 'draft',
55
- 'post_title' => $post->post_title.' - Copy of #'.$post_id,
56
  'post_type' => $post->post_type,
57
  'to_ping' => $post->to_ping,
58
  'menu_order' => $post->menu_order
@@ -61,7 +62,7 @@ function accordions_duplicate_post_as_draft(){
61
  /*
62
  * insert the post by wp_insert_post() function
63
  */
64
- $new_post_id = wp_insert_post( $args );
65
 
66
  /*
67
  * get all current post terms ad set them to the new post draft
@@ -76,38 +77,59 @@ function accordions_duplicate_post_as_draft(){
76
  * duplicate all post meta just in two SQL queries
77
  */
78
  // Copy post metadata
79
- $data = get_post_custom($post_id);
80
- foreach ( $data as $key => $values) {
81
- foreach ($values as $value) {
82
- add_post_meta( $new_post_id, $key, maybe_unserialize( $value ) );// it is important to unserialize data to avoid conflicts.
83
- }
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
87
  /*
88
  * finally, redirect to the edit post screen for the new draft
89
  */
90
- wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
91
  exit;
92
  } else {
93
  wp_die('Post creation failed, could not find original post: ' . $post_id);
94
  }
95
  }
96
- add_action( 'admin_action_accordions_duplicate_post_as_draft', 'accordions_duplicate_post_as_draft' );
97
 
98
  /*
99
  * Add the duplicate link to action list for post_row_actions
100
  */
101
- function accordions_duplicate_post_link( $actions, $post ) {
 
102
 
103
 
104
- if (current_user_can('edit_posts') && $post->post_type=='accordions' ) {
105
- $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=accordions_duplicate_post_as_draft&post=' . $post->ID, basename(__FILE__), 'duplicate_nonce' ) . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
106
  }
107
  return $actions;
108
  }
109
 
110
- add_filter( 'post_row_actions', 'accordions_duplicate_post_link', 10, 2 );
111
-
112
-
113
-
2
 
3
 
4
 
5
+ if (!defined('ABSPATH')) exit; // if direct access
6
 
7
 
8
 
9
+ function accordions_duplicate_post_as_draft()
10
+ {
11
  global $wpdb;
12
+ if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'accordions_duplicate_post_as_draft' == $_REQUEST['action']))) {
13
  wp_die('No post to duplicate has been supplied!');
14
  }
15
 
16
  /*
17
  * Nonce verification
18
  */
19
+ if (!isset($_GET['duplicate_nonce']) || !wp_verify_nonce($_GET['duplicate_nonce'], basename(__FILE__)))
20
  return;
21
 
22
  /*
23
  * get the original post id
24
  */
25
+ $post_id = (isset($_GET['post']) ? absint($_GET['post']) : absint($_POST['post']));
26
  /*
27
  * and all the original post data then
28
  */
29
+ $post = get_post($post_id);
30
 
31
  /*
32
  * if you don't want current user to be the new post author,
38
  /*
39
  * if post data exists, create the post duplicate
40
  */
41
+ if (isset($post) && $post != null) {
42
 
43
  /*
44
  * new post data array
53
  'post_parent' => $post->post_parent,
54
  'post_password' => $post->post_password,
55
  'post_status' => 'draft',
56
+ 'post_title' => $post->post_title . ' - Copy of #' . $post_id,
57
  'post_type' => $post->post_type,
58
  'to_ping' => $post->to_ping,
59
  'menu_order' => $post->menu_order
62
  /*
63
  * insert the post by wp_insert_post() function
64
  */
65
+ $new_post_id = wp_insert_post($args);
66
 
67
  /*
68
  * get all current post terms ad set them to the new post draft
77
  * duplicate all post meta just in two SQL queries
78
  */
79
  // Copy post metadata
80
+ $data = get_post_custom($post_id);
81
+ foreach ($data as $key => $values) {
82
+ foreach ($values as $value) {
83
+ add_post_meta($new_post_id, $key, maybe_unserialize($value)); // it is important to unserialize data to avoid conflicts.
 
84
  }
85
+ }
86
+
87
+ $accordions_options = get_post_meta($post_id, 'accordions_options', true);
88
+
89
+ if (!empty($accordions_options['content'])) {
90
+
91
+ $content = [];
92
+ $now = time();
93
+ $i = 0;
94
+ foreach ($accordions_options['content'] as $index => $item) {
95
+
96
+ $content[$now . $i] = $item;
97
+ $i++;
98
+ }
99
+
100
+
101
+ $accordions_options['content'] = $content;
102
+
103
+ update_post_meta($post_id, 'accordions_options', $accordions_options);
104
+ }
105
+
106
+
107
+
108
+
109
 
110
 
111
  /*
112
  * finally, redirect to the edit post screen for the new draft
113
  */
114
+ wp_redirect(admin_url('post.php?action=edit&post=' . $new_post_id));
115
  exit;
116
  } else {
117
  wp_die('Post creation failed, could not find original post: ' . $post_id);
118
  }
119
  }
120
+ add_action('admin_action_accordions_duplicate_post_as_draft', 'accordions_duplicate_post_as_draft');
121
 
122
  /*
123
  * Add the duplicate link to action list for post_row_actions
124
  */
125
+ function accordions_duplicate_post_link($actions, $post)
126
+ {
127
 
128
 
129
+ if (current_user_can('edit_posts') && $post->post_type == 'accordions') {
130
+ $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=accordions_duplicate_post_as_draft&post=' . $post->ID, basename(__FILE__), 'duplicate_nonce') . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
131
  }
132
  return $actions;
133
  }
134
 
135
+ add_filter('post_row_actions', 'accordions_duplicate_post_link', 10, 2);
 
 
 
includes/functions.php CHANGED
@@ -678,7 +678,7 @@ function accordions_wp_kses($str)
678
 
679
 
680
  'p' => array('id' => array(), 'class' => array(), 'style' => array()),
681
- 'a' => array('id' => array(), 'class' => array(), 'style' => array(), 'href' => array()),
682
  'label' => array('id' => array(), 'class' => array(), 'style' => array(),),
683
  'code' => array('id' => array(), 'class' => array(), 'style' => array(),),
684
  'script' => array('id' => array(), 'class' => array(), 'style' => array(),),
@@ -688,6 +688,8 @@ function accordions_wp_kses($str)
688
  'li' => array('id' => array(), 'class' => array(), 'style' => array(), 'tabindex' => array(),),
689
 
690
  'br' => array('id' => array(), 'class' => array(), 'style' => array(),),
 
 
691
  'u' => array('id' => array(), 'class' => array(), 'style' => array(),),
692
  'video' => array('id' => array(), 'class' => array(), 'style' => array(),),
693
  'video' => array('id' => array(), 'class' => array(), 'style' => array(),),
678
 
679
 
680
  'p' => array('id' => array(), 'class' => array(), 'style' => array()),
681
+ 'a' => array('id' => array(), 'class' => array(), 'style' => array(), 'href' => array(), 'target' => array()),
682
  'label' => array('id' => array(), 'class' => array(), 'style' => array(),),
683
  'code' => array('id' => array(), 'class' => array(), 'style' => array(),),
684
  'script' => array('id' => array(), 'class' => array(), 'style' => array(),),
688
  'li' => array('id' => array(), 'class' => array(), 'style' => array(), 'tabindex' => array(),),
689
 
690
  'br' => array('id' => array(), 'class' => array(), 'style' => array(),),
691
+ 'hr' => array('id' => array(), 'class' => array(), 'style' => array(),),
692
+
693
  'u' => array('id' => array(), 'class' => array(), 'style' => array(),),
694
  'video' => array('id' => array(), 'class' => array(), 'style' => array(),),
695
  'video' => array('id' => array(), 'class' => array(), 'style' => array(),),
readme.txt CHANGED
@@ -4,7 +4,7 @@
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
  Tested up to: 6.1
7
- Stable tag: 2.2.67
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -139,6 +139,10 @@ then paste this shortcode anywhere in your page to display accordions<br />
139
 
140
  == Changelog ==
141
 
 
 
 
 
142
  = 2.2.67 =
143
  * 2022-11-29 - fix - Style issue fixed.
144
 
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
  Tested up to: 6.1
7
+ Stable tag: 2.2.68
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
139
 
140
  == Changelog ==
141
 
142
+ = 2.2.68 =
143
+ * 2022-12-10 - fix - Link target, hr escape issue fixed.
144
+ * 2022-12-10 - fix - Generate new id on duplicate accrodions
145
+
146
  = 2.2.67 =
147
  * 2022-11-29 - fix - Style issue fixed.
148