Fix code to follow latest upstream changes
Some checks are pending
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Waiting to run
Some checks are pending
Deploy to https://wordpress-test.event-federation.eu/ / deploy (push) Waiting to run
4c297acfd4
This commit is contained in:
parent
78d83c859a
commit
e861ade6b6
3 changed files with 20 additions and 21 deletions
|
@ -44,8 +44,8 @@ add_filter(
|
||||||
* Add admin notices for improved usability.
|
* Add admin notices for improved usability.
|
||||||
*/
|
*/
|
||||||
function check_some_other_plugin() {
|
function check_some_other_plugin() {
|
||||||
if ( is_plugin_active('activitypub/activitypub.php') ) {
|
if ( is_plugin_active( 'activitypub/activitypub.php' ) ) {
|
||||||
if ( is_plugin_active('very-simple-event-list/vsel.php') ) {
|
if ( is_plugin_active( 'very-simple-event-list/vsel.php' ) ) {
|
||||||
add_action( 'admin_notices', 'vsel_admin_notices' );
|
add_action( 'admin_notices', 'vsel_admin_notices' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,10 @@ function check_some_other_plugin() {
|
||||||
add_action( 'admin_init', 'check_some_other_plugin' );
|
add_action( 'admin_init', 'check_some_other_plugin' );
|
||||||
|
|
||||||
function vsel_admin_notices() {
|
function vsel_admin_notices() {
|
||||||
$is_vsel_edit_page = isset($_GET['post_type']) && $_GET['post_type'] === 'event';
|
$is_vsel_edit_page = isset( $_GET['post_type'] ) && $_GET['post_type'] === 'event';
|
||||||
$is_vsel_settings_page = strpos($_SERVER['REQUEST_URI'], '/wp-admin/options-general.php?page=vsel') !== false ;
|
$is_vsel_settings_page = strpos( $_SERVER['REQUEST_URI'], '/wp-admin/options-general.php?page=vsel' ) !== false;
|
||||||
$is_vsel_page = $is_vsel_edit_page || $is_vsel_settings_page;
|
$is_vsel_page = $is_vsel_edit_page || $is_vsel_settings_page;
|
||||||
$vsel_post_type_is_activitypub_enabeld = in_array( 'event', get_option( 'activitypub_support_post_types') );
|
$vsel_post_type_is_activitypub_enabeld = in_array( 'event', get_option( 'activitypub_support_post_types' ) );
|
||||||
if ( $is_vsel_page && ! $vsel_post_type_is_activitypub_enabeld ) {
|
if ( $is_vsel_page && ! $vsel_post_type_is_activitypub_enabeld ) {
|
||||||
$vsel_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/very-simple-event-list/vsel.php' );
|
$vsel_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/very-simple-event-list/vsel.php' );
|
||||||
$activitypub_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php' );
|
$activitypub_plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php' );
|
||||||
|
@ -69,7 +69,7 @@ function vsel_admin_notices() {
|
||||||
),
|
),
|
||||||
$activitypub_plugin_data['Name'],
|
$activitypub_plugin_data['Name'],
|
||||||
$vsel_plugin_data['Name'],
|
$vsel_plugin_data['Name'],
|
||||||
admin_url('options-general.php?page=activitypub&tab=settings')
|
admin_url( 'options-general.php?page=activitypub&tab=settings' )
|
||||||
);
|
);
|
||||||
wp_admin_notice(
|
wp_admin_notice(
|
||||||
$notice,
|
$notice,
|
||||||
|
|
|
@ -97,7 +97,7 @@ class Tribe extends Post {
|
||||||
// todo make it possible that one event can have multiple categories?
|
// todo make it possible that one event can have multiple categories?
|
||||||
|
|
||||||
// using cat_slugs isn't 100% nice way to do this, don't know if it's a good idea
|
// using cat_slugs isn't 100% nice way to do this, don't know if it's a good idea
|
||||||
$categories = tribe_get_event_cat_slugs( $this->object->ID );
|
$categories = tribe_get_event_cat_slugs( $this->wp_object->ID );
|
||||||
|
|
||||||
if ( count( $categories ) === 0 ) {
|
if ( count( $categories ) === 0 ) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -13,7 +13,6 @@ use Activitypub\Model\Blog_user;
|
||||||
|
|
||||||
use function Activitypub\get_rest_url_by_path;
|
use function Activitypub\get_rest_url_by_path;
|
||||||
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit; // Exit if accessed directly.
|
exit; // Exit if accessed directly.
|
||||||
}
|
}
|
||||||
|
@ -81,7 +80,7 @@ class VS_Event extends Post {
|
||||||
* @return array The Place.
|
* @return array The Place.
|
||||||
*/
|
*/
|
||||||
public function get_location() {
|
public function get_location() {
|
||||||
$address = get_post_meta( $this->object->ID, 'event-location', true );
|
$address = get_post_meta( $this->wp_object->ID, 'event-location', true );
|
||||||
$place = new Place();
|
$place = new Place();
|
||||||
$place->set_type( 'Place' );
|
$place->set_type( 'Place' );
|
||||||
$place->set_name( $address );
|
$place->set_name( $address );
|
||||||
|
@ -93,7 +92,7 @@ class VS_Event extends Post {
|
||||||
* Get the end time from the events metadata.
|
* Get the end time from the events metadata.
|
||||||
*/
|
*/
|
||||||
protected function get_end_time() {
|
protected function get_end_time() {
|
||||||
$end_time = get_post_meta( $this->object->ID, 'event-date', true );
|
$end_time = get_post_meta( $this->wp_object->ID, 'event-date', true );
|
||||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $end_time );
|
return \gmdate( 'Y-m-d\TH:i:s\Z', $end_time );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ class VS_Event extends Post {
|
||||||
* Get the end time from the events metadata.
|
* Get the end time from the events metadata.
|
||||||
*/
|
*/
|
||||||
protected function get_start_time() {
|
protected function get_start_time() {
|
||||||
$start_time = get_post_meta( $this->object->ID, 'event-start-date', true );
|
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
|
||||||
return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time );
|
return \gmdate( 'Y-m-d\TH:i:s\Z', $start_time );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +108,7 @@ class VS_Event extends Post {
|
||||||
* Get the event link from the events metadata.
|
* Get the event link from the events metadata.
|
||||||
*/
|
*/
|
||||||
private function get_event_link() {
|
private function get_event_link() {
|
||||||
$event_link = get_post_meta( $this->object->ID, 'event-link', true );
|
$event_link = get_post_meta( $this->wp_object->ID, 'event-link', true );
|
||||||
if ( $event_link ) {
|
if ( $event_link ) {
|
||||||
return array(
|
return array(
|
||||||
'type' => 'Link',
|
'type' => 'Link',
|
||||||
|
@ -140,7 +139,7 @@ class VS_Event extends Post {
|
||||||
* @return string $category
|
* @return string $category
|
||||||
*/
|
*/
|
||||||
protected function get_category() {
|
protected function get_category() {
|
||||||
$post_categories = wp_get_post_terms( $this->object->ID, 'event_cat' );
|
$post_categories = wp_get_post_terms( $this->wp_object->ID, 'event_cat' );
|
||||||
|
|
||||||
if ( empty( $post_categories ) ) {
|
if ( empty( $post_categories ) ) {
|
||||||
return 'MEETING';
|
return 'MEETING';
|
||||||
|
@ -201,16 +200,16 @@ class VS_Event extends Post {
|
||||||
* @return string $summary The custom event summary.
|
* @return string $summary The custom event summary.
|
||||||
*/
|
*/
|
||||||
public function get_summary() {
|
public function get_summary() {
|
||||||
if ( $this->object->excerpt ) {
|
if ( $this->wp_object->excerpt ) {
|
||||||
$excerpt = $this->object->post_excerpt;
|
$excerpt = $this->wp_object->post_excerpt;
|
||||||
} else if ( get_post_meta( $this->object->ID, 'event-summary', true ) ) {
|
} else if ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) {
|
||||||
$excerpt = get_post_meta( $this->object->ID, 'event-summary', true );
|
$excerpt = get_post_meta( $this->wp_object->ID, 'event-summary', true );
|
||||||
} else {
|
} else {
|
||||||
$excerpt = $this->get_content();
|
$excerpt = $this->get_content();
|
||||||
}
|
}
|
||||||
|
|
||||||
$address = get_post_meta( $this->object->ID, 'event-location', true );
|
$address = get_post_meta( $this->wp_object->ID, 'event-location', true );
|
||||||
$start_time = get_post_meta( $this->object->ID, 'event-start-date', true );
|
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
|
||||||
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
|
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
|
||||||
$start_time_string = wp_date( $datetime_format, $start_time );
|
$start_time_string = wp_date( $datetime_format, $start_time );
|
||||||
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
|
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
|
||||||
|
@ -231,7 +230,7 @@ class VS_Event extends Post {
|
||||||
->set_comments_enabled( true )
|
->set_comments_enabled( true )
|
||||||
->set_external_participation_url( $this->get_url() )
|
->set_external_participation_url( $this->get_url() )
|
||||||
->set_status( 'CONFIRMED' )
|
->set_status( 'CONFIRMED' )
|
||||||
->set_name( get_the_title( $this->object->ID ) )
|
->set_name( get_the_title( $this->wp_object->ID ) )
|
||||||
->set_timezone( $object->get_locale )
|
->set_timezone( $object->get_locale )
|
||||||
->set_is_online( false )
|
->set_is_online( false )
|
||||||
->set_in_language( $this->get_locale() )
|
->set_in_language( $this->get_locale() )
|
||||||
|
|
Loading…
Reference in a new issue