forgejo_runner #26
5 changed files with 20 additions and 24 deletions
|
@ -35,25 +35,21 @@ Activitypub_Event_Extensions\Autoloader::register();
|
|||
// Initialize the plugin.
|
||||
Activitypub_Event_Extensions\Setup::get_instance();
|
||||
|
||||
// For local development purposes: TODO. Remove everything after here.
|
||||
// BeforeFirstRelease: Remove everything after this after here.
|
||||
|
||||
/**
|
||||
* Add a filter for http_request_host_is_external
|
||||
*
|
||||
* TODO: Remove this for release.
|
||||
*
|
||||
* @todo This filter is temporary code needed to do local testing.
|
||||
* BeforeFirstRelease: Remove this for release.
|
||||
*/
|
||||
add_filter( 'http_request_host_is_external', 'activitypub_event_extensions_custom_http_request_host_is_external', 10, 3 );
|
||||
|
||||
/**
|
||||
* Add a filter for http_request_host_is_external
|
||||
*
|
||||
* TODO: Remove this for release.
|
||||
* BeforeFirstRelease: Remove this for release.
|
||||
*
|
||||
* @param bool $is_external Whether the request is external.
|
||||
*
|
||||
* @todo This filter is temporary code needed to do local testing.
|
||||
*/
|
||||
function activitypub_event_extensions_custom_http_request_host_is_external( $is_external ) {
|
||||
$is_external = true;
|
||||
|
@ -64,14 +60,12 @@ function activitypub_event_extensions_custom_http_request_host_is_external( $is_
|
|||
/**
|
||||
* Don't verify ssl certs for testing.
|
||||
*
|
||||
* TODO: Remove this for release.
|
||||
*
|
||||
* @todo This filter is temporary code needed to do local testing.
|
||||
* BeforeFirstRelease: Remove this for release.
|
||||
*/
|
||||
add_filter( 'https_ssl_verify', 'activitypub_event_extensions_dont_verify_local_dev_https', 10, 3 );
|
||||
|
||||
/**
|
||||
* TODO: remove it.
|
||||
* BeforeFirstRelease: remove it.
|
||||
*/
|
||||
function activitypub_event_extensions_dont_verify_local_dev_https() {
|
||||
return false;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
namespace Activitypub_Event_Extensions\Activitypub\Transformer;
|
||||
|
||||
use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transformer;
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use EM_Event;
|
||||
use Activitypub\Activity\Extended_Object\Event;
|
||||
use Activitypub\Activity\Extended_Object\Place;
|
||||
|
@ -153,7 +155,7 @@ final class Events_Manager extends Event_Transformer {
|
|||
/**
|
||||
* Return the remaining attendee capacity
|
||||
*
|
||||
* @todo decide whether to include pending bookings or not!
|
||||
* @return int
|
||||
*/
|
||||
public function get_remaining_attendee_capacity() {
|
||||
$em_bookings = $this->em_event->get_bookings()->get_bookings();
|
||||
|
@ -166,7 +168,7 @@ final class Events_Manager extends Event_Transformer {
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_participant_count() {
|
||||
public function get_participant_count(): int {
|
||||
$em_bookings = $this->em_event->get_bookings()->get_bookings();
|
||||
return count( $em_bookings->bookings );
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ final class The_Events_Calendar extends Event {
|
|||
* @return string|null tribe category if it exists
|
||||
*/
|
||||
public function get_tribe_category() {
|
||||
// TODO: make it possible that one event can have multiple categories?
|
||||
// Using cat_slugs isn't the best way to do this, don't know if it's a good idea.
|
||||
$categories = tribe_get_event_cat_slugs( $this->wp_object->ID );
|
||||
|
||||
if ( count( $categories ) === 0 ) {
|
||||
|
@ -133,12 +131,10 @@ final class The_Events_Calendar extends Event {
|
|||
protected function get_content() {
|
||||
|
||||
$content = parent::get_content();
|
||||
// TODO: remove link at the end of the content.
|
||||
|
||||
// TODO: add organizer
|
||||
// $this->tribe_event->organizers[0].
|
||||
|
||||
// TODO: do add Cancelled reason in the content (maybe at the end).
|
||||
// /BeforeFirstRelease:
|
||||
// * remove link at the end of the content.
|
||||
// * add organizer.
|
||||
// * do add Cancelled reason in the content.s
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class Setup {
|
|||
*/
|
||||
protected function __construct() {
|
||||
$this->activitypub_plugin_is_active = is_plugin_active( 'activitypub/activitypub.php' );
|
||||
// TODO: decide whether we want to do anything at all when ActivityPub plugin is note active.
|
||||
// BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active.
|
||||
// if ( ! $this->activitypub_plugin_is_active ) {
|
||||
// deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE );
|
||||
// return;
|
||||
|
|
|
@ -46,8 +46,12 @@ final class The_Events_Calendar extends Event_plugin {
|
|||
* @return string The settings page url.
|
||||
*/
|
||||
public static function get_settings_page(): string {
|
||||
// TODO: Tribe\Events\Admin\Settings::settings_page_id.
|
||||
return 'edit.php?post_type=tribe_events&page=tec-events-settings';
|
||||
if ( class_exists( '\Tribe\Events\Admin\Settings' ) ) {
|
||||
$page = \Tribe\Events\Admin\Settings::$settings_page_id;
|
||||
} else {
|
||||
$page = 'tec-events-settings';
|
||||
}
|
||||
return sprintf( 'edit.php?post_type=tribe_events&page=%s', $page );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue