Skip to content

Commit

Permalink
Feature/mesurement protocol (#62)
Browse files Browse the repository at this point in the history
closes #61

<!-- This is an auto-generated comment: release notes by OSS CodeRabbit
-->
### Summary by CodeRabbit

- New Feature: Added GA4 Measurement Protocol support, enabling users to
send post requests directly to the GA4 Measurement Protocol.
- Refactor: Improved code readability and consistency by adjusting
function parameter spacing and renaming variables for clarity.
- Style: Updated PHP linting rules to enforce standard array syntax and
disallow short ternary operators.
- Refactor: Simplified directory handling in `base_dir` method and
improved efficiency of `popular_posts` method.
- New Feature: Introduced a new setting field 'ga4-api-secret' for
enhanced configuration.
- Bug Fix: Ensured type safety in `PlaceHolders.php` by checking if the
queried object is an instance of `WP_Term` before accessing its taxonomy
property.
- Chore: Corrected a typo in a comment in `ScriptRenderer.php` for
better clarity.
<!-- end of auto-generated comment: release notes by OSS CodeRabbit -->
  • Loading branch information
fumikito authored Jul 19, 2024
2 parents 879806d + cfbe818 commit bb4fa4f
Show file tree
Hide file tree
Showing 17 changed files with 305 additions and 217 deletions.
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
},
"require-dev": {
"phpunit/phpunit": ">=5.7",
"squizlabs/php_codesniffer": "^3.0",
"wp-coding-standards/wpcs": "^2.0",
"wp-coding-standards/wpcs": "^3.0",
"yoast/phpunit-polyfills": "^1.0 || ^2.0",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"config": {
Expand Down
6 changes: 3 additions & 3 deletions ga-communicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
}

// Initialize plugin.
add_action( 'plugins_loaded', function() {
add_action( 'plugins_loaded', function () {
// Add i18n
load_plugin_textdomain( 'ga-communicator', false, basename( __DIR__ ) . '/languages' );
// Load composer.
if ( file_exists( __DIR__ . '/vendor-prefixed/vendor/scoper-autoload.php' ) ) {
require_once __DIR__ . '/vendor-prefixed/vendor/scoper-autoload.php';
// Needs original autoloader.
spl_autoload_register( function( $class_name ) {
spl_autoload_register( function ( $class_name ) {
$class_name = ltrim( $class_name, '\\' );
$prefix = 'Kunoichi\\GaCommunicator';
if ( 0 !== strpos( $class_name, $prefix ) ) {
Expand All @@ -54,7 +54,7 @@
} );

// Register Widgets.
add_action( 'widgets_init', function() {
add_action( 'widgets_init', function () {
register_widget( \Kunoichi\GaCommunicator\Widgets\PopularPosts::class );
} );

Expand Down
Binary file modified languages/ga-communicator-ja.mo
Binary file not shown.
Loading

0 comments on commit bb4fa4f

Please sign in to comment.