Skip to content

Commit

Permalink
Merge pull request #1 from mt-support/initial
Browse files Browse the repository at this point in the history
Initial
  • Loading branch information
andrasguseo authored Jan 20, 2022
2 parents fea3dd7 + bb71f3f commit 9257fd6
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 640 deletions.
69 changes: 0 additions & 69 deletions README.md

This file was deleted.

28 changes: 14 additions & 14 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
/**
* Plugin Name: The Events Calendar Extension: Remove Past Events Plus
* Plugin URI:
* GitHub Plugin URI: https://github.com/mt-support/tec-labs-remove-past-events-plus
* Description:
* Plugin Name: The Events Calendar Extension: Remove Past Events
* Plugin URI: https://theeventscalendar.com/extensions/remove-past-events
* GitHub Plugin URI: https://github.com/mt-support/tec-labs-remove-past-events
* Description: Additional frequencies to remove past events.
* Version: 1.0.0
* Author: The Events Calendar
* Author URI: https://evnt.is/1971
* License: GPL version 3 or any later version
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: __TRIBE_DOMAIN__
* Text Domain: tec-labs-remove-past-events
*
* This plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -29,31 +29,31 @@
*
* @var string Base file that loaded the plugin.
*/
define( 'TRIBE_EXTENSION_REMOVE_PAST_EVENTS_PLUS_FILE', __FILE__ );
define( 'TRIBE_EXTENSION_REMOVE_PAST_EVENTS_FILE', __FILE__ );

/**
* Register and load the service provider for loading the extension.
*
* @since 1.0.0
*/
function tribe_extension_remove_past_events_plus() {
function tribe_extension_remove_past_events() {
// When we don't have autoloader from common we bail.
if ( ! class_exists( 'Tribe__Autoloader' ) ) {
return;
}

// Register the namespace so we can the plugin on the service provider registration.
Tribe__Autoloader::instance()->register_prefix(
'\\Tribe\\Extensions\\Remove_Past_Events_Plus\\',
'\\Tribe\\Extensions\\Remove_Past_Events\\',
__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Tec',
'remove-past-events-plus'
'remove-past-events'
);

// Deactivates the plugin in case of the main class didn't autoload.
if ( ! class_exists( '\Tribe\Extensions\Remove_Past_Events_Plus\Plugin' ) ) {
if ( ! class_exists( '\Tribe\Extensions\Remove_Past_Events\Plugin' ) ) {
tribe_transient_notice(
'remove-past-events-plus',
'<p>' . esc_html__( 'Couldn\'t properly load "The Events Calendar Extension: Remove Past Events Plus" the extension was deactivated.', '__TRIBE_DOMAIN__' ) . '</p>',
'remove-past-events',
'<p>' . esc_html__( 'Couldn\'t properly load "The Events Calendar Extension: Remove Past Events" the extension was deactivated.', 'tec-labs-remove-past-events' ) . '</p>',
[],
// 1 second after that make sure the transient is removed.
1
Expand All @@ -67,8 +67,8 @@ function tribe_extension_remove_past_events_plus() {
return;
}

tribe_register_provider( '\Tribe\Extensions\Remove_Past_Events_Plus\Plugin' );
tribe_register_provider( '\Tribe\Extensions\Remove_Past_Events\Plugin' );
}

// Loads after common is already properly loaded.
add_action( 'tribe_common_loaded', 'tribe_extension_remove_past_events_plus' );
add_action( 'tribe_common_loaded', 'tribe_extension_remove_past_events' );
17 changes: 6 additions & 11 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
=== The Events Calendar Extension: Remove Past Events Plus ===
=== The Events Calendar Extension: Remove Past Events ===
Contributors: theeventscalendar
Donate link: https://evnt.is/29
Tags: events, calendar
Requires at least: 4.9
Tested up to: 5.7
Requires PHP: 5.6
Tested up to: 5.8.3
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL version 3 or any later version
License URI: https://www.gnu.org/licenses/gpl-3.0.html



== Description ==

This is the long description. No limit, and you can use Markdown (as well as in the following sections).

For backwards compatibility, if this section is missing, the full length of the short description will be used, and Markdown parsed.
This extension adds additional frequencies to the 'Move to trash events older than' and 'Permanently delete events older
than' settings, which can be found under `Events > Settings > General tab`.

== Installation ==

Expand All @@ -37,6 +32,6 @@ We're always interested in your feedback and our [Help Desk](https://support.the

== Changelog ==

= [1.0.0] YYYY-MM-DD =
= [1.0.0] 2022-01-20 =

* Initial release
8 changes: 4 additions & 4 deletions src/Tec/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus
* @package Tribe\Extensions\Remove_Past_Events
*/

namespace Tribe\Extensions\Remove_Past_Events_Plus;
namespace Tribe\Extensions\Remove_Past_Events;

/**
* Register Assets.
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus
* @package Tribe\Extensions\Remove_Past_Events
*/
class Assets extends \tad_DI52_ServiceProvider {
/**
Expand All @@ -30,7 +30,7 @@ class Assets extends \tad_DI52_ServiceProvider {
*/
public function register() {
$this->container->singleton( static::class, $this );
$this->container->singleton( 'extension.remove_past_events_plus.assets', $this );
$this->container->singleton( 'extension.remove_past_events.assets', $this );

$plugin = tribe( Plugin::class );

Expand Down
18 changes: 9 additions & 9 deletions src/Tec/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
*
* To remove a filter:
* ```php
* remove_filter( 'some_filter', [ tribe( Tribe\Extensions\Remove_Past_Events_Plus\Hooks::class ), 'some_filtering_method' ] );
* remove_filter( 'some_filter', [ tribe( 'extension.remove_past_events_plus.hooks' ), 'some_filtering_method' ] );
* remove_filter( 'some_filter', [ tribe( Tribe\Extensions\Remove_Past_Events\Hooks::class ), 'some_filtering_method' ] );
* remove_filter( 'some_filter', [ tribe( 'extension.remove_past_events.hooks' ), 'some_filtering_method' ] );
* ```
*
* To remove an action:
* ```php
* remove_action( 'some_action', [ tribe( Tribe\Extensions\Remove_Past_Events_Plus\Hooks::class ), 'some_method' ] );
* remove_action( 'some_action', [ tribe( 'extension.remove_past_events_plus.hooks' ), 'some_method' ] );
* remove_action( 'some_action', [ tribe( Tribe\Extensions\Remove_Past_Events\Hooks::class ), 'some_method' ] );
* remove_action( 'some_action', [ tribe( 'extension.remove_past_events.hooks' ), 'some_method' ] );
* ```
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus;
* @package Tribe\Extensions\Remove_Past_Events;
*/

namespace Tribe\Extensions\Remove_Past_Events_Plus;
namespace Tribe\Extensions\Remove_Past_Events;

use Tribe__Main as Common;

Expand All @@ -28,7 +28,7 @@
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus;
* @package Tribe\Extensions\Remove_Past_Events;
*/
class Hooks extends \tad_DI52_ServiceProvider {

Expand All @@ -39,7 +39,7 @@ class Hooks extends \tad_DI52_ServiceProvider {
*/
public function register() {
$this->container->singleton( static::class, $this );
$this->container->singleton( 'extension.remove_past_events_plus.hooks', $this );
$this->container->singleton( 'extension.remove_past_events.hooks', $this );

$this->add_actions();
$this->add_filters();
Expand Down Expand Up @@ -70,7 +70,7 @@ protected function add_filters() {
*/
public function load_text_domains() {
$mopath = tribe( Plugin::class )->plugin_dir . 'lang/';
$domain = '__TRIBE_DOMAIN__';
$domain = 'tec-labs-remove-past-events';

// This will load `wp-content/languages/plugins` files first.
Common::instance()->load_text_domain( $domain, $mopath );
Expand Down
10 changes: 5 additions & 5 deletions src/Tec/PUE.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus;
* @package Tribe\Extensions\Remove_Past_Events;
*/

namespace Tribe\Extensions\Remove_Past_Events_Plus;
namespace Tribe\Extensions\Remove_Past_Events;

use Tribe__PUE__Checker;

Expand All @@ -16,7 +16,7 @@
*
* @since 1.0.0
*
* @package Tribe\Extensions\Remove_Past_Events_Plus;
* @package Tribe\Extensions\Remove_Past_Events;
*/
class PUE extends \tad_DI52_ServiceProvider {

Expand All @@ -27,7 +27,7 @@ class PUE extends \tad_DI52_ServiceProvider {
*
* @var string
*/
private static $pue_slug = 'extension-remove-past-events-plus';
private static $pue_slug = 'extension-remove-past-events';

/**
* Whether to load PUE or not.
Expand Down Expand Up @@ -63,7 +63,7 @@ class PUE extends \tad_DI52_ServiceProvider {
*/
public function register() {
$this->container->singleton( static::class, $this );
$this->container->singleton( 'extension.remove_past_events_plus.pue', $this );
$this->container->singleton( 'extension.remove_past_events.pue', $this );

// Bail to avoid notice.
if ( ! static:: $is_active ) {
Expand Down
Loading

0 comments on commit 9257fd6

Please sign in to comment.