Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,66 @@ public function add_settings() {
'type' => 'html',
'html' => '<p>' . esc_html__( 'The following fields allow you to change the default labels. Inputting something other than the default will change that word everywhere it appears.', 'tribe-ext-relabeler' ) . '</p>',
],
'label_rsvp_single' => [
'type' => 'text',
'label' => esc_html__( 'RSVP', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'RSVP', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Singular label for RSVPs.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',

],
'label_rsvp_single_lowercase' => [
'type' => 'text',
'label' => esc_html__( 'rsvp', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'rsvp', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Lowercase singular label for RSVPs.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',

],
'label_rsvp_plural' => [
'type' => 'text',
'label' => esc_html__( 'RSVPs', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'RSVPs', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Plural label for RSVPs.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',

],
'label_rsvp_plural_lowercase' => [
'type' => 'text',
'label' => esc_html__( 'rsvps', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'rsvps', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Lowercase plural label for RSVPs.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',

],
'label_ticket_single' => [
'type' => 'text',
'label' => esc_html__( 'Ticket', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'Ticket', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Singular label for Tickets.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',
],
'label_ticket_single_lowercase' => [
'type' => 'text',
'label' => esc_html__( 'ticket', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'ticket', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Lowercase singular label for Tickets.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',
],
'label_ticket_plural' => [
'type' => 'text',
'label' => esc_html__( 'Tickets', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'Tickets', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Plural label for Tickets.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',
],
'label_ticket_plural_lowercase' => [
'type' => 'text',
'label' => esc_html__( 'tickets', 'tribe-ext-relabeler' ),
'default' => esc_attr__( 'tickets', 'tribe-ext-relabeler' ),
'tooltip' => esc_html__( 'Lowercase plural label for Tickets.', 'tribe-ext-relabeler' ),
'validation_type' => 'html',
],
'label_event_single' => [
'type' => 'text',
'label' => esc_html__( 'Event', 'the-events-calendar' ),
Expand Down
115 changes: 115 additions & 0 deletions tribe-ext-relabeler.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ public function init() {

$this->get_settings();


// rsvp
add_filter('tribe_get_rsvp_label_singular' , [ $this, 'get_rsvp_single' ] );
add_filter('tribe_get_rsvp_label_singular_lowercase' , [ $this, 'get_rsvp_single_lowercase' ] );
add_filter('tribe_get_rsvp_label_plural' , [ $this, 'get_rsvp_plural' ] );
add_filter('tribe_get_rsvp_label_plural_lowercase' , [ $this, 'get_rsvp_plural_lowercase' ] );

//TIcket
add_filter( 'tribe_get_ticket_label_singular', [ $this, 'get_ticket_single' ] );
add_filter( 'tribe_get_ticket_label_singular_lowercase', [ $this, 'get_ticket_single_lowercase' ] );
add_filter( 'tribe_get_ticket_label_plural', [ $this, 'get_ticket_plural' ] );
add_filter( 'tribe_get_ticket_label_plural_lowercase', [ $this, 'get_ticket_plural_lowercase' ] );


// Events.
add_filter( 'tribe_event_label_singular', [ $this, 'get_event_single' ] );
add_filter( 'tribe_event_label_singular_lowercase', [ $this, 'get_event_single_lowercase' ] );
Expand Down Expand Up @@ -178,13 +192,114 @@ public function get_label( $key, $default = null ) {
return $this->label_cache[ $key ];
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/

public function get_rsvp_single( $label ) {
return $this->get_label( 'label_rsvp_single', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/

public function get_rsvp_single_lowercase( $label ) {
return $this->get_label( 'label_rsvp_single_lowercase', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/

public function get_rsvp_plural( $label ) {
return $this->get_label( 'label_rsvp_plural', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/

public function get_rsvp_plural_lowercase( $label ) {
return $this->get_label( 'label_rsvp_plural_lowercase', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/
public function get_ticket_single( $label ) {
return $this->get_label( 'label_ticket_single', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/
public function get_ticket_single_lowercase( $label ) {
return $this->get_label( 'label_ticket_single_lowercase', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/
public function get_ticket_plural( $label ) {
return $this->get_label( 'label_ticket_plural', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/
public function get_ticket_plural_lowercase( $label ) {
return $this->get_label( 'label_ticket_plural_lowercase', $label );
}


/**
* Gets the label
*
* @param $label string
*
* @return string
*/
public function get_event_single( $label ) {
return $this->get_label( 'label_event_single', $label );
}
Expand Down