Skip to content

Commit

Permalink
add vendor Prefix "Pluginkollektiv\" to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
stklcode committed Apr 1, 2023
1 parent 0423164 commit 0965089
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 74 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
},
"autoload": {
"psr-4": {
"Statify\\": "inc/"
"Pluginkollektiv\\Statify\\": "inc/"
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion inc/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.9
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use WP_REST_Response;
use WP_REST_Server;
Expand Down
2 changes: 1 addition & 1 deletion inc/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.4.0
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.4.0
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.1
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Deactivate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.4.0
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.4.0
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 0.1
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.7
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed directly..
defined( 'ABSPATH' ) || exit;
Expand Down
34 changes: 17 additions & 17 deletions inc/Statify.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 0.1.0
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -65,31 +65,31 @@ public static function init() {
);

// Cron.
add_action( 'statify_cleanup', array( 'Statify\Cron', 'cleanup_data' ) );
add_action( 'statify_cleanup', array( 'Pluginkollektiv\\Statify\Cron', 'cleanup_data' ) );

if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { // XMLRPC.
add_filter( 'xmlrpc_methods', array( 'Statify\XMLRPC', 'xmlrpc_methods' ) );
add_filter( 'xmlrpc_methods', array( 'Pluginkollektiv\\Statify\XMLRPC', 'xmlrpc_methods' ) );
} elseif ( is_admin() ) { // Backend.
add_action( 'wp_initialize_site', array( 'Statify\Install', 'init_site' ) );
add_action( 'wp_uninitialize_site', array( 'Statify\Uninstall', 'init_site' ) );
add_action( 'wp_dashboard_setup', array( 'Statify\Dashboard', 'init' ) );
add_filter( 'plugin_row_meta', array( 'Statify\Backend', 'add_meta_link' ), 10, 2 );
add_filter( 'plugin_action_links_' . STATIFY_BASE, array( 'Statify\Backend', 'add_action_link' ) );
add_action( 'admin_init', array( 'Statify\Settings', 'register_settings' ) );
add_action( 'admin_menu', array( 'Statify\Settings', 'add_admin_menu' ) );
add_action( 'update_option_statify', array( 'Statify\Settings', 'action_update_options' ), 10, 2 );
add_action( 'wp_initialize_site', array( 'Pluginkollektiv\\Statify\Install', 'init_site' ) );
add_action( 'wp_uninitialize_site', array( 'Pluginkollektiv\\Statify\Uninstall', 'init_site' ) );
add_action( 'wp_dashboard_setup', array( 'Pluginkollektiv\\Statify\Dashboard', 'init' ) );
add_filter( 'plugin_row_meta', array( 'Pluginkollektiv\\Statify\Backend', 'add_meta_link' ), 10, 2 );
add_filter( 'plugin_action_links_' . STATIFY_BASE, array( 'Pluginkollektiv\\Statify\Backend', 'add_action_link' ) );
add_action( 'admin_init', array( 'Pluginkollektiv\\Statify\Settings', 'register_settings' ) );
add_action( 'admin_menu', array( 'Pluginkollektiv\\Statify\Settings', 'add_admin_menu' ) );
add_action( 'update_option_statify', array( 'Pluginkollektiv\\Statify\Settings', 'action_update_options' ), 10, 2 );
} else { // Frontend.
add_action( 'template_redirect', array( 'Statify\Frontend', 'track_visit' ) );
add_filter( 'query_vars', array( 'Statify\Frontend', 'query_vars' ) );
add_action( 'wp_footer', array( 'Statify\Frontend', 'wp_footer' ) );
add_action( 'template_redirect', array( 'Pluginkollektiv\\Statify\Frontend', 'track_visit' ) );
add_filter( 'query_vars', array( 'Pluginkollektiv\\Statify\Frontend', 'query_vars' ) );
add_action( 'wp_footer', array( 'Pluginkollektiv\\Statify\Frontend', 'wp_footer' ) );
if ( function_exists( 'amp_is_request' ) || function_exists( 'is_amp_endpoint' ) ) {
// Automattic AMP plugin present.
add_filter( 'amp_analytics_entries', array( 'Statify\Frontend', 'amp_analytics_entries' ) );
add_filter( 'amp_post_template_analytics', array( 'Statify\Frontend', 'amp_post_template_analytics' ) );
add_filter( 'amp_analytics_entries', array( 'Pluginkollektiv\\Statify\Frontend', 'amp_analytics_entries' ) );
add_filter( 'amp_post_template_analytics', array( 'Pluginkollektiv\\Statify\Frontend', 'amp_post_template_analytics' ) );
}
// Initialize REST API.
if ( self::is_javascript_tracking_enabled() ) {
add_filter( 'rest_api_init', array( 'Statify\Api', 'init' ) );
add_filter( 'rest_api_init', array( 'Pluginkollektiv\\Statify\Api', 'init' ) );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion inc/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 0.6
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 0.1
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
2 changes: 1 addition & 1 deletion inc/XMLRPC.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @since 1.1
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
defined( 'ABSPATH' ) || exit;
Expand Down
36 changes: 6 additions & 30 deletions statify.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://pluginkollektiv.org/
* Plugin URI: https://statify.pluginkollektiv.org/
* License: GPLv3 or later
* Version: 1.9.0
* Version: 2.0.0
*
* @package WordPress
*/
Expand All @@ -20,38 +20,14 @@
define( 'STATIFY_FILE', __FILE__ );
define( 'STATIFY_DIR', dirname( __FILE__ ) );
define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
define( 'STATIFY_VERSION', '1.9.0' );
define( 'STATIFY_VERSION', '2.0.0' );


/* Hooks */
add_action(
'plugins_loaded',
array(
'Statify\Statify',
'init',
)
);
register_activation_hook(
STATIFY_FILE,
array(
'Statify\Install',
'init',
)
);
register_deactivation_hook(
STATIFY_FILE,
array(
'Statify\Deactivate',
'init',
)
);
register_uninstall_hook(
STATIFY_FILE,
array(
'Statify\Uninstall',
'init',
)
);
add_action( 'plugins_loaded', array( 'Pluginkollektiv\Statify\Statify', 'init' ) );
register_activation_hook( STATIFY_FILE, array( 'Pluginkollektiv\Statify\Install', 'init' ) );
register_deactivation_hook( STATIFY_FILE, array( 'Pluginkollektiv\\Statify\Deactivate', 'init' ) );
register_uninstall_hook( STATIFY_FILE, array( 'Pluginkollektiv\\Statify\Uninstall', 'init' ) );

/* Composer Autoload */
require __DIR__ . '/vendor/autoload.php';
2 changes: 1 addition & 1 deletion tests/test-api-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use DateTime;
use WP_REST_Request;
Expand Down
6 changes: 3 additions & 3 deletions tests/test-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use DateTime;
use WP_UnitTestCase;
Expand Down Expand Up @@ -37,15 +37,15 @@ public function test_cronjob() {
// Initialize normal cycle, configure storage period of 3 days.
$this->init_statify_widget( 3 );
$this->assertNotFalse(
has_action( 'statify_cleanup', array( 'Statify\Cron', 'cleanup_data' ) ),
has_action( 'statify_cleanup', array( 'Pluginkollektiv\Statify\Cron', 'cleanup_data' ) ),
'Statify cleanup cron job should be registered in normal cycle (always)'
);

// Initialize cron cycle.
define( 'DOING_CRON', true );
Statify::init();
$this->assertNotFalse(
has_action( 'statify_cleanup', array( 'Statify\Cron', 'cleanup_data' ) ),
has_action( 'statify_cleanup', array( 'Pluginkollektiv\Statify\Cron', 'cleanup_data' ) ),
'Statify cleanup cron job was not registered'
);

Expand Down
6 changes: 4 additions & 2 deletions tests/test-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use DateTime;
use WP_UnitTestCase;
Expand All @@ -28,7 +28,9 @@ public function set_up() {
// "Install" Statify, i.e. create tables and options.
Install::init();

if ( ! function_exists( 'Statify\wp_add_dashboard_widget' ) ) {
/* This function is typically defined in the root namespace. However, the hierarchy prefers this overridden
instance here, so it will be used for testing purposes. */
if ( ! function_exists( 'Pluginkollektiv\Statify\wp_add_dashboard_widget' ) ) {
global $widget_capture;
$widget_capture = array();

Expand Down
6 changes: 3 additions & 3 deletions tests/test-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use WP_UnitTestCase;

Expand All @@ -23,7 +23,7 @@ public function test_wp_footer() {
// Disable JS tracking.
$this->init_statify_tracking( Statify::TRACKING_METHOD_DEFAULT );
$this->assertNotFalse(
has_action( 'wp_footer', array( 'Statify\Frontend', 'wp_footer' ) ),
has_action( 'wp_footer', array( 'Pluginkollektiv\Statify\Frontend', 'wp_footer' ) ),
'Statify footer action not registered'
);

Expand Down Expand Up @@ -58,7 +58,7 @@ public function test_query_vars() {
$this->assertNotFalse(
has_action(
'query_vars',
array( 'Statify\Frontend', 'query_vars' )
array( 'Pluginkollektiv\Statify\Frontend', 'query_vars' )
),
'Statify query_vars action not registered'
);
Expand Down
2 changes: 1 addition & 1 deletion tests/test-statify.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use WP_UnitTestCase;

Expand Down
4 changes: 2 additions & 2 deletions tests/test-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

use DateTime;
use WP_UnitTestCase;
Expand Down Expand Up @@ -40,7 +40,7 @@ public function test_default_tracking() {
$this->assertNotFalse(
has_action(
'template_redirect',
array( 'Statify\Frontend', 'track_visit' )
array( 'Pluginkollektiv\Statify\Frontend', 'track_visit' )
),
'Statify tracking action not registered'
);
Expand Down
2 changes: 1 addition & 1 deletion tests/trait-statify-test-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Statify
*/

namespace Statify;
namespace Pluginkollektiv\Statify;

/**
* Trait Statify_Test_Support.
Expand Down
4 changes: 3 additions & 1 deletion views/widget-back.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* @package Statify
*/

namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
class_exists( 'Statify' ) || exit; ?>
class_exists( 'Pluginkollektiv\Statify\Statify' ) || exit; ?>

<?php if ( current_user_can( 'manage_options' ) ) : ?>
<p class="meta-links settings-link">
Expand Down
4 changes: 3 additions & 1 deletion views/widget-front.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* @package Statify
*/

namespace Pluginkollektiv\Statify;

// Quit if accessed outside WP context.
class_exists( 'Statify' ) || exit;
class_exists( 'Pluginkollektiv\Statify\Statify' ) || exit;

$limit = (int) Statify::$_options['limit'];
$show_totals = (int) Statify::$_options['show_totals'];
Expand Down

0 comments on commit 0965089

Please sign in to comment.