Skip to content

Commit 01685fc

Browse files
authored
Merge pull request #109 from lightspeedwp/2.0.0
2.0.0 Updates
2 parents d1e087f + 583524d commit 01685fc

25 files changed

+645
-1576
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<p align="center"><a target="_blank" href="https://www.lsdev.biz/lsx/extensions/tour-operator/team/"><img src="https://www.lsdev.biz/lsx/wp-content/uploads/2020/09/tour-operator-team-banner-1544x500-1.jpg" alt="LSX Tour Operator Team Extension"></a>
1+
<p align="center"><a target="_blank" href="https://touroperator.solutions/plugins/team/"><img src="https://www.lightspeedwp.agency/lsx/wp-content/uploads/2020/09/tour-operator-team-banner-1544x500-1.jpg" alt="Tour Operator Team Extension"></a>
22
</p>
3-
<h1 align="center">LSX Tour Operator Team Extension</h1>
3+
<h1 align="center">Tour Operator Team Extension</h1>
44

55
<p align="center">
6-
<a href="https://lsdev.biz/lsx/"><img src="https://www.lsdev.biz/lsx/wp-content/uploads/2019/06/Designed-for-LSX-Theme-blue.png" alt="Made for LSX Theme"></a>
7-
<a href="https://lsdev.biz/lsx/extensions/tour-operator/"><img src="https://www.lsdev.biz/lsx/wp-content/uploads/2019/06/Designed-for-Tour-Operator-plugin-1098ad.png" alt="LSX Tour Operator"></a>
6+
<a href="https://lsx.design/"><img src="https://www.lightspeedwp.agency/lsx/wp-content/uploads/2019/06/Designed-for-LSX-Theme-blue.png" alt="Made for LSX Theme"></a>
7+
<a href="https://lsdev.biz/lsx/extensions/tour-operator/"><img src="https://www.lightspeedwp.agency/lsx/wp-content/uploads/2019/06/Designed-for-Tour-Operator-plugin-1098ad.png" alt="Tour Operator"></a>
88
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://poser.pugx.org/woocommerce/woocommerce/license" alt="license"></a>
99
<a href="http://gulpjs.com/"><img src="https://img.shields.io/badge/built%20with-gulp.js-green.svg" alt="Built with gulp.js"></a>
1010
</p>
@@ -14,25 +14,25 @@
1414
<a href="https://travis-ci.org/github/lightspeeddevelopment/to-team"><img src="https://travis-ci.org/lightspeeddevelopment/to-team.svg?branch=master" alt="Build Status"></a>
1515
</p>
1616

17-
Welcome to the [LSX Tour Operator Team extension](https://www.lsdev.biz/lsx/extensions/tour-operator/team/).
17+
Welcome to the [Tour Operator Team extension](https://touroperator.solutions/plugins/team/).
1818

19-
If you haven't yet had the chance to [install and configure the Tour Operator Plugin](https://www.lsdev.biz/lsx/extensions/tour-operator/), you should do that before proceeding here!
19+
If you haven't yet had the chance to [install and configure the Tour Operator Plugin](https://touroperator.solutions/), you should do that before proceeding here!
2020

2121
People like to see a face behind a business, it gives you a more personal, approachable relationship with your users.
2222

2323
The to Team plugin allows you to display your team profiles beautifully on your website.
2424

2525
## Works with the LSX Theme
2626

27-
The [Tour Operator Plugin](https://tour-operator.lsdev.biz) and [Extensions](https://www.lsdev.biz/lsx/extensions/tour-operator/team/) are designed to work seamlessly with the LSX theme.
27+
The [Tour Operator Plugin](https://touroperator.solutions/) and [Extensions](https://touroperator.solutions/plugins/team/) are designed to work seamlessly with the LSX theme.
2828

2929
We are always updating our software to add functionality, and maintain latest security protocols.
3030

3131
## Gutenberg Compatible
3232

3333
Have you updated to the new WordPress Gutenberg editor? We've got you covered! The Tour Operator Team Plugin has been optimized for the Gutenberg update.
3434

35-
Check out our [Tour Operator dedicated website](https://tour-operator.lsdev.biz/) to check out all our available extensions and features.
35+
Check out our [Tour Operator dedicated website](https://touroperator.solutions/) to check out all our available extensions and features.
3636

3737
## It's free, and always will be.
3838
We’re firm believers in open source - that’s why this extension is free, and that won't change.
@@ -41,15 +41,15 @@ We are constantly maintaining and updating our extension so you have the latest
4141

4242
## Documentation
4343

44-
Anything you need to double check, or simply need a walkthrough for setting up the extension? Visit the [Tour Operator Team documentation](https://lsdev.biz/lsx/documentation/lsx-tour-operator/team/).
44+
Anything you need to double check, or simply need a walkthrough for setting up the extension? Visit the [Tour Operator Team documentation](https://touroperator.solutions/docs/team/).
4545

4646
## Support
4747

48-
We offer premium support for this plugin. Premium support that can be purchased [via our website](https://www.lsdev.biz/services/support/).
48+
We offer premium support for this plugin. Premium support that can be purchased [via our website](https://touroperator.solutions/support/).
4949

5050
If you are experiencing issues with the Tour Operator Team Plugin & have experience with Github, please log any bug issues you are having on the [Tour Operator Team Github Issues](https://github.com/lightspeeddevelopment/to-team/issues/) page.
5151

52-
You can also send an email to our Support Team at [support@lsdev.biz](mailto:support@lsdev.biz) if you have a request for the LightSpeed Development team.
52+
You can also send an email to our Support Team at [support@lightspeedwp.agency](mailto:support@lightspeedwp.agency) if you have a request for the LightSpeed Development team.
5353

5454
## Contributing
5555

@@ -61,11 +61,11 @@ Visit the [Tour Operator Team Plugin on Github](https://github.com/lightspeeddev
6161

6262
---
6363
<p align="center">
64-
<a href="https://www.lsdev.biz/contact/"><img src="https://www.lsdev.biz/wp-content/uploads/2020/02/work-with-lightspeed.png" width="850" alt="Work with us at LightSpeed"></a>
64+
<a href="https://lightspeedwp.agency/contact/"><img src="https://lightspeedwp.agency/wp-content/uploads/2020/02/work-with-lightspeed.png" width="850" alt="Work with us at LightSpeed"></a>
6565
</p>
6666
<p align="center">
67-
<a href="https://www.lsdev.biz">LightSpeed's Company Website</a> &nbsp;&middot;&nbsp;
68-
<a href="https://www.lsdev.biz/lsx/">LSX Product Website</a>
67+
<a href="https://lightspeedwp.agency/">LightSpeed's Company Website</a> &nbsp;&middot;&nbsp;
68+
<a href="https://lsx.design/">LSX Design Product Website</a>
6969
</p>
7070
<p align="center">
7171
<a href="https://github.com/lightspeeddevelopment">GitHub</a> &nbsp;&middot;&nbsp;

changelog.txt renamed to changelog.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Change log
22

3+
## [[2.0.0]](https://github.com/lightspeeddevelopment/to-reviews/releases/tag/2.0.0) - 2025-05-09
4+
5+
### Description
6+
The following PR contains the code for the block updates and the removal of the legacy code.
7+
8+
### Added
9+
- WordPress block editor support
10+
- Tour Operator 2.0 Support.
11+
12+
### Updated
13+
- Custom fields to CMB2 and its add-ons.
14+
- WPCS warnings notices fixed.
15+
16+
### Removed
17+
- Old PHP Templates, function and legacy template code.
18+
19+
### Security
20+
- Tested with WordPress 6.8.1
21+
322
## [[1.2.7]](https://github.com/lightspeeddevelopment/to-team/releases/tag/1.2.7) - 2023-08-09
423

524
### Security

classes/class-lsx-to-team-admin.php

Lines changed: 64 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@
1717
*/
1818
class LSX_TO_Team_Admin extends LSX_TO_Team {
1919

20+
/**
21+
* The post type slug
22+
*
23+
* @var string
24+
*/
25+
public $post_type = 'team';
26+
2027
/**
2128
* Constructor
2229
*/
2330
public function __construct() {
2431
$this->set_vars();
2532

2633
add_action( 'init', array( $this, 'init' ), 20 );
34+
add_action( 'init', array( $this, 'register_post_type' ), 100 );
35+
add_action( 'cmb2_admin_init', array( $this, 'register_cmb2_fields' ) );
2736

28-
add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29-
add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
3037
add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_config' ), 10, 1 );
3138

3239
add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) );
@@ -36,30 +43,6 @@ public function __construct() {
3643
add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
3744
add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) );
3845
add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
39-
40-
add_filter( 'lsx_to_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 );
41-
add_filter( 'lsx_to_framework_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 );
42-
add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'to_register_taxonomy_plural' ), 10, 1 );
43-
}
44-
45-
/**
46-
* Register the taxonomy with the TO plugin
47-
*
48-
* @since 0.1.0
49-
*/
50-
public function to_register_taxonomy( $taxonomies ) {
51-
$taxonomies['role'] = esc_attr__( 'Role', 'to-team' );
52-
return $taxonomies;
53-
}
54-
55-
/**
56-
* Register the taxonomy with the TO plugin
57-
*
58-
* @since 0.1.0
59-
*/
60-
public function to_register_taxonomy_plural( $taxonomies ) {
61-
$taxonomies['role'] = esc_attr__( 'Roles', 'to-team' );
62-
return $taxonomies;
6346
}
6447

6548
/**
@@ -72,8 +55,6 @@ public function init() {
7255
$this->taxonomies = array_keys( lsx_to_get_taxonomies() );
7356
}
7457

75-
add_filter( 'lsx_to_taxonomy_widget_taxonomies', array( $this, 'widget_taxonomies' ), 10, 1 );
76-
7758
if ( false !== $this->taxonomies ) {
7859
add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 );
7960
add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 );
@@ -82,41 +63,18 @@ public function init() {
8263
add_action( "{$taxonomy}_edit_form_fields", array( $this, 'add_expert_form_field' ), 3, 1 );
8364
}
8465
}
85-
86-
add_action( 'lsx_to_framework_team_tab_content', array( $this, 'general_settings' ), 10, 2 );
87-
add_action( 'lsx_to_framework_team_tab_content', array( $this, 'archive_settings' ), 10, 2 );
88-
}
89-
90-
/**
91-
* Register the activity post type config
92-
*
93-
* @param $objects
94-
* @return array
95-
*/
96-
public function post_type_config( $objects ) {
97-
foreach ( $this->post_types as $key => $label ) {
98-
if ( file_exists( LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
99-
$objects[ $key ] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php';
100-
}
101-
}
102-
103-
return $objects;
10466
}
10567

10668
/**
107-
* Register the activity metabox config
69+
* Registers the custom post type for the content model.
10870
*
109-
* @param $meta_boxes
110-
* @return array
71+
* @return void
11172
*/
112-
public function meta_box_config( $meta_boxes ) {
113-
foreach ( $this->post_types as $key => $label ) {
114-
if ( file_exists( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
115-
$meta_boxes[ $key ] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php';
116-
}
117-
}
118-
119-
return $meta_boxes;
73+
public function register_post_type() {
74+
register_post_type(
75+
'team',
76+
require_once LSX_TO_TEAM_PATH . '/includes/post-types/config-' . $this->post_type . '.php'
77+
);
12078
}
12179

12280
/**
@@ -139,6 +97,7 @@ public function taxonomy_config( $taxonomies ) {
13997
public function custom_fields( $fields ) {
14098
global $post, $typenow, $current_screen;
14199

100+
// @phpcs:disable WordPress.Security.NonceVerification.Recommended
142101
if ( $post && $post->post_type ) {
143102
$post_type = $post->post_type;
144103
} elseif ( $typenow ) {
@@ -152,30 +111,19 @@ public function custom_fields( $fields ) {
152111
} else {
153112
$post_type = false;
154113
}
114+
// @phpcs:enable WordPress.Security.NonceVerification.Recommended
155115

156116
if ( false !== $post_type ) {
157-
$fields[] = array(
158-
'id' => 'team_title',
159-
'name' => 'Teams',
160-
'type' => 'title',
161-
'cols' => 12,
162-
);
163-
164117
$fields[] = array(
165118
'id' => 'team_to_' . $post_type,
166119
'name' => 'Team members related to this ' . $post_type,
167-
'type' => 'post_select',
120+
'type' => 'pw_multiselect',
168121
'use_ajax' => false,
169-
'query' => array(
170-
'post_type' => 'team',
171-
'nopagin' => true,
172-
'posts_per_page' => '-1',
173-
'orderby' => 'title',
174-
'order' => 'ASC',
175-
),
176-
'repeatable' => true,
122+
'repeatable' => false,
177123
'allow_none' => true,
178-
'cols' => 12,
124+
'options' => array(
125+
'post_type_args' => 'team',
126+
),
179127
);
180128
}
181129

@@ -253,65 +201,51 @@ public function save_meta( $term_id = 0, $taxonomy = '' ) {
253201
}
254202

255203
/**
256-
* Adds the team specific options
204+
* Registers the CMB2 custom fields
205+
*
206+
* @return void
257207
*/
258-
public function general_settings( $post_type = false, $tab = false ) {
259-
if ( 'general' !== $tab ) {
260-
return false;
261-
}
208+
public function register_cmb2_fields() {
209+
/**
210+
* Initiate the metabox
211+
*/
212+
$cmb = [];
213+
$fields = include( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $this->post_type . '.php' );
214+
215+
$metabox_counter = 1;
216+
$cmb[ $metabox_counter ] = new_cmb2_box( array(
217+
'id' => 'lsx_to_metabox_' . $this->post_type . '_' . $metabox_counter,
218+
'title' => $fields['title'],
219+
'object_types' => array( $this->post_type ), // Post type
220+
'context' => 'normal',
221+
'priority' => 'high',
222+
'show_names' => true,
223+
) );
224+
225+
foreach ( $fields['fields'] as $field ) {
226+
227+
if ( 'title' === $field['type'] ) {
228+
$metabox_counter++;
229+
$cmb[ $metabox_counter ] = new_cmb2_box( array(
230+
'id' => 'lsx_to_metabox_' . $this->post_type . '_' . $metabox_counter,
231+
'title' => $field['name'],
232+
'object_types' => array( $this->post_type ), // Post type
233+
'context' => 'normal',
234+
'priority' => 'high',
235+
'show_names' => true,
236+
) );
237+
continue;
238+
}
262239

263-
$experts = get_posts(
264-
array(
265-
'post_type' => 'team',
266-
'posts_per_page' => -1,
267-
'orderby' => 'menu_order',
268-
'order' => 'ASC',
269-
)
270-
);
271-
?>
272-
<tr class="form-field">
273-
<th scope="row">
274-
<label for="disable_team_panel"><?php esc_html_e( 'Disable Team Panel', 'to-team' ); ?></label>
275-
</th>
276-
<td>
277-
<input type="checkbox" {{#if disable_team_panel}} checked="checked" {{/if}} name="disable_team_panel" />
278-
<small><?php esc_html_e( 'This disables the team member panel on all post types.', 'to-team' ); ?></small>
279-
</td>
280-
</tr>
281-
<tr class="form-field-wrap">
282-
<th scope="row">
283-
<label> Select your consultants</label>
284-
</th>
285-
<td>
286-
<?php foreach ( $experts as $expert ) : ?>
287-
<label for="expert-<?php echo esc_attr( $expert->ID ) ?>">
288-
<input type="checkbox" {{#if expert-<?php echo esc_attr( $expert->ID ) ?>}} checked="checked" {{/if}} name="expert-<?php echo esc_attr( $expert->ID ) ?>" id="expert-<?php echo esc_attr( $expert->ID ) ?>" value="<?php echo esc_attr( $expert->ID ) ?>" /> <?php echo esc_html( $expert->post_title ) ?>
289-
</label>
290-
<br>
291-
<?php endforeach ?>
292-
</td>
293-
</tr>
294-
<?php
295-
}
240+
/**
241+
* Fixes for the extensions
242+
*/
243+
if ( 'post_select' === $field['type'] || 'post_ajax_search' === $field['type'] ) {
244+
$field['type'] = 'pw_multiselect';
245+
}
296246

297-
/**
298-
* Adds the team specific options
299-
*/
300-
public function archive_settings( $post_type = false, $tab = false ) {
301-
if ( 'archives' !== $tab ) {
302-
return false;
247+
$cmb[ $metabox_counter ]->add_field( $field );
303248
}
304-
?>
305-
<tr class="form-field">
306-
<th scope="row">
307-
<label for="group_items_by_role"><?php esc_html_e( 'Group by Role', 'to-team' ); ?></label>
308-
</th>
309-
<td>
310-
<input type="checkbox" {{#if group_items_by_role}} checked="checked" {{/if}} name="group_items_by_role" />
311-
<small><?php esc_html_e( 'This groups archive items by role taxonomy and display the role title.', 'to-team' ); ?></small>
312-
</td>
313-
</tr>
314-
<?php
315249
}
316250
}
317251

0 commit comments

Comments
 (0)