Accordion - Version 2.2.26

Version Description

  • 2020-06-26 - add - Who can see edit link
Download this release

Release Info

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

Code changes from version 2.2.25 to 2.2.26

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.25
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
@@ -21,7 +21,7 @@ class Accordions{
21
 
22
  define('accordions_plugin_url', plugins_url('/', __FILE__) );
23
  define('accordions_plugin_dir', plugin_dir_path( __FILE__ ) );
24
- define('accordions_version', '2.2.25' );
25
  define('accordions_plugin_name', 'Accordions' );
26
  define('accordions_plugin_basename', plugin_basename( __FILE__ ) );
27
 
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.26
7
  Author: PickPlugins
8
  Author URI: http://pickplugins.com
9
  Text Domain: accordions
21
 
22
  define('accordions_plugin_url', plugins_url('/', __FILE__) );
23
  define('accordions_plugin_dir', plugin_dir_path( __FILE__ ) );
24
+ define('accordions_version', '2.2.26' );
25
  define('accordions_plugin_name', 'Accordions' );
26
  define('accordions_plugin_basename', plugin_basename( __FILE__ ) );
27
 
assets/settings-tabs/settings-tabs.js CHANGED
@@ -233,7 +233,6 @@ jQuery(document).ready(function($){
233
  wpautop: true,
234
  toolbar1: 'bold italic underline strikethrough | bullist numlist | blockquote hr wp_more | alignleft aligncenter alignright | link unlink | fullscreen | wp_adv',
235
  toolbar2: 'formatselect alignjustify forecolor | pastetext removeformat charmap table | outdent indent | undo redo | wp_help',
236
-
237
  },
238
  quicktags: true,
239
  } );
233
  wpautop: true,
234
  toolbar1: 'bold italic underline strikethrough | bullist numlist | blockquote hr wp_more | alignleft aligncenter alignright | link unlink | fullscreen | wp_adv',
235
  toolbar2: 'formatselect alignjustify forecolor | pastetext removeformat charmap table | outdent indent | undo redo | wp_help',
 
236
  },
237
  quicktags: true,
238
  } );
includes/class-functions.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
- /*
4
- * @Author pickplugins
5
- * Copyright: 2015 pickplugins
6
- */
7
 
8
  if ( ! defined('ABSPATH')) exit; // if direct access
9
 
1
  <?php
2
 
3
+
 
 
 
4
 
5
  if ( ! defined('ABSPATH')) exit; // if direct access
6
 
includes/class-post-meta-accordions-hook.php CHANGED
@@ -175,6 +175,7 @@ function accordions_metabox_content_general($post_id){
175
  $enable_shortcode = isset($accordions_options['enable_shortcode']) ? $accordions_options['enable_shortcode'] : '';
176
  $enable_wpautop = isset($accordions_options['enable_wpautop']) ? $accordions_options['enable_wpautop'] : '';
177
  $enable_schema = isset($accordions_options['enable_schema']) ? $accordions_options['enable_schema'] : '';
 
178
 
179
  //var_dump($lazy_load);
180
 
@@ -230,6 +231,22 @@ function accordions_metabox_content_general($post_id){
230
 
231
  $settings_tabs_field->generate_field($args);
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
  $args = array(
235
  'id' => 'enable_autoembed',
175
  $enable_shortcode = isset($accordions_options['enable_shortcode']) ? $accordions_options['enable_shortcode'] : '';
176
  $enable_wpautop = isset($accordions_options['enable_wpautop']) ? $accordions_options['enable_wpautop'] : '';
177
  $enable_schema = isset($accordions_options['enable_schema']) ? $accordions_options['enable_schema'] : '';
178
+ $edit_link_access_role = isset($accordions_options['edit_link_access_role']) ? $accordions_options['edit_link_access_role'] : array();
179
 
180
  //var_dump($lazy_load);
181
 
231
 
232
  $settings_tabs_field->generate_field($args);
233
 
234
+ $args = array(
235
+ 'id' => 'edit_link_access_role',
236
+ 'parent' => 'accordions_options',
237
+ 'title' => __('Who can see edit link','accordions'),
238
+ 'details' => __('Select which user role can access to edit link.','accordions'),
239
+ 'type' => 'select',
240
+ 'multiple' => true,
241
+ 'value' => $edit_link_access_role,
242
+ 'default' => array('administrator'),
243
+ 'args' => accordions_all_user_roles(),
244
+ );
245
+
246
+ $settings_tabs_field->generate_field($args);
247
+
248
+
249
+
250
 
251
  $args = array(
252
  'id' => 'enable_autoembed',
includes/class-settings-tabs.php CHANGED
@@ -1012,11 +1012,12 @@ class settings_tabs_field{
1012
 
1013
  $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1014
 
1015
- $editor_settings= isset( $option['editor_settings'] ) ? $option['editor_settings'] : array('textarea_name'=>$field_name, 'teeny' => true, 'textarea_rows' => 15, );
1016
 
1017
  ob_start();
1018
 
1019
  ?>
 
1020
  <div id="field-wrapper-<?php echo $id; ?>" class="<?php if(!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1021
  field-wp_editor-wrapper-<?php echo $id; ?>">
1022
  <?php
1012
 
1013
  $field_name = !empty($parent) ? $parent.'['.$id.']' : $id;
1014
 
1015
+ $editor_settings= isset( $option['editor_settings'] ) ? $option['editor_settings'] : array('textarea_name'=>$field_name,'tinymce' => true, 'textarea_rows' => 15, );
1016
 
1017
  ob_start();
1018
 
1019
  ?>
1020
+ Hello
1021
  <div id="field-wrapper-<?php echo $id; ?>" class="<?php if(!empty($depends)) echo 'dependency-field'; ?> field-wrapper field-wp_editor-wrapper
1022
  field-wp_editor-wrapper-<?php echo $id; ?>">
1023
  <?php
includes/class-shortcodes.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
- /*
4
- * @Author pickplugins
5
- * Copyright: 2015 pickplugins
6
- */
7
 
8
  if ( ! defined('ABSPATH')) exit; // if direct access
9
 
1
  <?php
2
 
3
+
 
 
 
4
 
5
  if ( ! defined('ABSPATH')) exit; // if direct access
6
 
includes/class-widget-accordions.php CHANGED
@@ -1,8 +1,5 @@
1
  <?php
2
- /*
3
- * @Author pickplugins
4
- * Copyright: 2015 pickplugins
5
- */
6
 
7
  if ( ! defined('ABSPATH')) exit; // if direct access
8
 
1
  <?php
2
+
 
 
 
3
 
4
  if ( ! defined('ABSPATH')) exit; // if direct access
5
 
includes/duplicate-post.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
- /*
4
- * @Author pickplugins
5
- * Copyright: 2015 pickplugins
6
- */
7
 
8
  if ( ! defined('ABSPATH')) exit; // if direct access
9
 
1
  <?php
2
 
3
+
 
 
 
4
 
5
  if ( ! defined('ABSPATH')) exit; // if direct access
6
 
includes/functions-wc.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
- /*
4
- * @Author pickplugins
5
- * Copyright: 2015 pickplugins
6
- */
7
 
8
  if ( ! defined('ABSPATH')) exit; // if direct access
9
 
1
  <?php
2
 
3
+
 
 
 
4
 
5
  if ( ! defined('ABSPATH')) exit; // if direct access
6
 
includes/functions.php CHANGED
@@ -1,7 +1,18 @@
1
  <?php
2
  if ( ! defined('ABSPATH')) exit; // if direct access
3
 
 
4
 
 
 
 
 
 
 
 
 
 
 
5
 
6
 
7
  function accordions_old_content($post_id){
1
  <?php
2
  if ( ! defined('ABSPATH')) exit; // if direct access
3
 
4
+ function accordions_all_user_roles() {
5
 
6
+ $wp_roles = new WP_Roles();
7
+
8
+ //var_dump($wp_roles);
9
+ $roles = $wp_roles->get_names();
10
+
11
+ return $roles;
12
+ // Below code will print the all list of roles.
13
+ //echo '<pre>'.var_export($wp_roles, true).'</pre>';
14
+
15
+ }
16
 
17
 
18
  function accordions_old_content($post_id){
readme.txt CHANGED
@@ -3,8 +3,8 @@
3
  Donate link: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
- Tested up to: 5.4
7
- Stable tag: 2.2.25
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -139,6 +139,11 @@ then paste this shortcode anywhere in your page to display accordions<br />
139
 
140
  == Changelog ==
141
 
 
 
 
 
 
142
  = 2.2.25 =
143
  * 2020-06-26 - fix - schema header text count text removed.
144
 
3
  Donate link: https://www.pickplugins.com/item/accordions-html-css3-responsive-accordion-grid-for-wordpress/?ref=dashboard
4
  Tags: accordion, tabs, FAQ, WooCommerce FAQ Tab, accordion short-code, accordions widget, tab
5
  Requires at least: 3.8
6
+ Tested up to: 5.5
7
+ Stable tag: 2.2.26
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.26 =
143
+ * 2020-06-26 - add - Who can see edit link
144
+
145
+
146
+
147
  = 2.2.25 =
148
  * 2020-06-26 - fix - schema header text count text removed.
149
 
templates/accordion/accordion-hook.php CHANGED
@@ -490,17 +490,45 @@ function accordions_main_edit_link($atts){
490
  $accordions_options = get_post_meta($post_id, 'accordions_options', true);
491
  $accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
492
 
 
493
  $hide_edit = isset($accordions_options['hide_edit']) ? $accordions_options['hide_edit'] : 'yes';
494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
- if(current_user_can('administrator') && $hide_edit == 'no'){
497
- $admin_url = admin_url();
498
- $accordion_edit_url = apply_filters('accordions_edit_url', ''.$admin_url.'post.php?post='.$post_id.'&action=edit', $post_id );
499
 
500
- ?>
501
- <div class="accordion-edit"><a href="<?php echo $accordion_edit_url; ?>"><?php echo __('Edit this accordion','accordions'); ?></a>, <?php echo __("Only admin can see this.",'accordions')?></div>
502
- <?php
503
- }
504
  }
505
 
506
 
490
  $accordions_options = get_post_meta($post_id, 'accordions_options', true);
491
  $accordions_options = !empty($accordions_options) ? $accordions_options : accordions_old_options($post_id);
492
 
493
+
494
  $hide_edit = isset($accordions_options['hide_edit']) ? $accordions_options['hide_edit'] : 'yes';
495
 
496
+ if($hide_edit =='yes') return;
497
+
498
+ //var_dump($hide_edit);
499
+
500
+ $edit_link_access_role = isset($accordions_options['edit_link_access_role']) ? $accordions_options['edit_link_access_role'] : array('administrator');
501
+
502
+
503
+
504
+ $user = wp_get_current_user();
505
+ $user_roles = !empty($user->roles) ? $user->roles : array();
506
+
507
+ //echo '<pre>'.var_export($user_roles, true).'</pre>';
508
+
509
+
510
+ if(!empty($edit_link_access_role))
511
+ foreach ($edit_link_access_role as $role):
512
+ //echo '<pre>'.var_export($role, true).'</pre>';
513
+
514
+ if(in_array($role, $user_roles)){
515
+ $admin_url = admin_url();
516
+ $accordion_edit_url = apply_filters('accordions_edit_url', ''.$admin_url.'post.php?post='.$post_id.'&action=edit', $post_id );
517
+
518
+ ?>
519
+ <div class="accordion-edit"><a href="<?php echo $accordion_edit_url; ?>"><?php echo __('Edit this accordion','accordions'); ?></a>, <?php echo __("Only admin can see this.",'accordions')?></div>
520
+ <?php
521
+
522
+ return;
523
+ }else{
524
+ continue;
525
+ }
526
+
527
+ endforeach;
528
+
529
+
530
 
 
 
 
531
 
 
 
 
 
532
  }
533
 
534