-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57e5f8d
Showing
19 changed files
with
1,095 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
=== Plugin Name === | ||
Contributors: (this should be a list of wordpress.org userid's) | ||
Donate link: http://example.com/ | ||
Tags: comments, spam | ||
Requires at least: 3.0.1 | ||
Tested up to: 3.4 | ||
Stable tag: 4.3 | ||
License: GPLv2 or later | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
Here is a short description of the plugin. This should be no more than 150 characters. No markup here. | ||
|
||
== 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. | ||
|
||
A few notes about the sections above: | ||
|
||
* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames | ||
* "Tags" is a comma separated list of tags that apply to the plugin | ||
* "Requires at least" is the lowest version that the plugin will work on | ||
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on | ||
higher versions... this is just the highest one you've verified. | ||
* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for | ||
stable. | ||
|
||
Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so | ||
if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used | ||
for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt` | ||
is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in | ||
your in-development version, without having that information incorrectly disclosed about the current stable version | ||
that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. | ||
|
||
If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where | ||
you put the stable version, in order to eliminate any doubt. | ||
|
||
== Installation == | ||
|
||
This section describes how to install the plugin and get it working. | ||
|
||
e.g. | ||
|
||
1. Upload `google-tag-manager-server-side.php` to the `/wp-content/plugins/` directory | ||
1. Activate the plugin through the 'Plugins' menu in WordPress | ||
1. Place `<?php do_action('google_tag_manager_server_side_hook'); ?>` in your templates | ||
|
||
== Frequently Asked Questions == | ||
|
||
= A question that someone might have = | ||
|
||
An answer to that question. | ||
|
||
= What about foo bar? = | ||
|
||
Answer to foo bar dilemma. | ||
|
||
== Screenshots == | ||
|
||
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from | ||
the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets | ||
directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` | ||
(or jpg, jpeg, gif). | ||
2. This is the second screen shot | ||
|
||
== Changelog == | ||
|
||
= 1.0 = | ||
* A change since the previous version. | ||
* Another change. | ||
|
||
= 0.5 = | ||
* List versions from most recent at top to oldest at bottom. | ||
|
||
== Upgrade Notice == | ||
|
||
= 1.0 = | ||
Upgrade notices describe the reason a user should upgrade. No more than 300 characters. | ||
|
||
= 0.5 = | ||
This version fixes a security related bug. Upgrade immediately. | ||
|
||
== Arbitrary section == | ||
|
||
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated | ||
plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or | ||
"installation." Arbitrary sections will be shown below the built-in sections outlined above. | ||
|
||
== A brief Markdown Example == | ||
|
||
Ordered list: | ||
|
||
1. Some feature | ||
1. Another feature | ||
1. Something else about the plugin | ||
|
||
Unordered list: | ||
|
||
* something | ||
* something else | ||
* third thing | ||
|
||
Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. | ||
Titles are optional, naturally. | ||
|
||
[markdown syntax]: http://daringfireball.net/projects/markdown/syntax | ||
"Markdown is what the parser uses to process much of the readme file" | ||
|
||
Markdown uses email style notation for blockquotes and I've been told: | ||
> Asterisks for *emphasis*. Double it up for **strong**. | ||
|
||
`<?php code(); // goes in backticks ?>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/** | ||
* The admin-specific functionality of the plugin. | ||
* | ||
* @package Google_Tag_Manager_Server_Side | ||
* @subpackage Google_Tag_Manager_Server_Side/admin | ||
*/ | ||
class Google_Tag_Manager_Server_Side_Admin { | ||
|
||
/** | ||
* The ID of this plugin. | ||
* | ||
* @since 1.0.0 | ||
* @access private | ||
* @var string $google_tag_manager_server_side The ID of this plugin. | ||
*/ | ||
private $google_tag_manager_server_side; | ||
|
||
/** | ||
* The version of this plugin. | ||
* | ||
* @since 1.0.0 | ||
* @access private | ||
* @var string $version The current version of this plugin. | ||
*/ | ||
private $version; | ||
|
||
/** | ||
* Initialize the class and set its properties. | ||
* | ||
* @since 1.0.0 | ||
* @param string $google_tag_manager_server_side The name of this plugin. | ||
* @param string $version The version of this plugin. | ||
*/ | ||
public function __construct( $google_tag_manager_server_side, $version ) { | ||
|
||
$this->google_tag_manager_server_side = $google_tag_manager_server_side; | ||
$this->version = $version; | ||
|
||
} | ||
|
||
/** | ||
* Register the stylesheets for the admin area. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function enqueue_styles() { | ||
|
||
wp_enqueue_style( $this->google_tag_manager_server_side, plugin_dir_url( __FILE__ ) . 'css/google-tag-manager-server-side-admin.css', array(), $this->version, 'all' ); | ||
|
||
} | ||
|
||
/** | ||
* Register the JavaScript for the admin area. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public function enqueue_scripts() { | ||
|
||
wp_enqueue_script( $this->google_tag_manager_server_side, plugin_dir_url( __FILE__ ) . 'js/google-tag-manager-server-side-admin.js', array( 'jquery' ), $this->version, false ); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* All of the CSS for your admin-specific functionality should be | ||
* included in this file. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php // Silence is golden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(function( $ ) { | ||
'use strict'; | ||
|
||
/** | ||
* All of the code for your admin-facing JavaScript source | ||
* should reside in this file. | ||
* | ||
* Note: It has been assumed you will write jQuery code here, so the | ||
* $ function reference has been prepared for usage within the scope | ||
* of this function. | ||
* | ||
* This enables you to define handlers, for when the DOM is ready: | ||
* | ||
* $(function() { | ||
* | ||
* }); | ||
* | ||
* When the window is loaded: | ||
* | ||
* $( window ).load(function() { | ||
* | ||
* }); | ||
* | ||
* ...and/or other possibilities. | ||
* | ||
* Ideally, it is not considered best practise to attach more than a | ||
* single DOM-ready or window-load handler for a particular page. | ||
* Although scripts in the WordPress core, Plugins and Themes may be | ||
* practising this, we should strive to set a better example in our own work. | ||
*/ | ||
|
||
})( jQuery ); |
16 changes: 16 additions & 0 deletions
16
admin/partials/google-tag-manager-server-side-admin-display.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/** | ||
* Provide a admin area view for the plugin | ||
* | ||
* This file is used to markup the admin-facing aspects of the plugin. | ||
* | ||
* @link http://example.com | ||
* @since 1.0.0 | ||
* | ||
* @package Google_Tag_Manager_Server_Side | ||
* @subpackage Google_Tag_Manager_Server_Side/admin/partials | ||
*/ | ||
?> | ||
|
||
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
/** | ||
* @link https://gtm-server.com | ||
* @since 1.0.0 | ||
* @package Google_Tag_Manager_Server_Side | ||
* | ||
* @wordpress-plugin | ||
* Plugin Name: Google Tag Manager Server-Side for WordPress | ||
* Plugin URI: https://wordpress.org/plugins/google-tag-manager-server-side/ | ||
* Description: Allows wordpress send events to Google Tag Manager Server-Side | ||
* Version: 1.0.0 | ||
* Author: GTM Server | ||
* Author URI: https://gtm-server.com | ||
* License: GPL-2.0+ | ||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | ||
* Text Domain: google-tag-manager-server-side | ||
* Domain Path: /languages | ||
*/ | ||
|
||
// If this file is called directly, abort. | ||
if ( ! defined( 'WPINC' ) ) { | ||
die; | ||
} | ||
|
||
/** | ||
* Currently plugin version. | ||
*/ | ||
define( 'GOOGLE_TAG_MANAGER_SERVER_SIDE_VERSION', '1.0.0' ); | ||
|
||
/** | ||
* The code that runs during plugin activation. | ||
* This action is documented in includes/class-google-tag-manager-server-side-activator.php | ||
*/ | ||
function activate_google_tag_manager_server_side() { | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-google-tag-manager-server-side-activator.php'; | ||
Google_Tag_Manager_Server_Side_Activator::activate(); | ||
} | ||
|
||
/** | ||
* The code that runs during plugin deactivation. | ||
* This action is documented in includes/class-google-tag-manager-server-side-deactivator.php | ||
*/ | ||
function deactivate_google_tag_manager_server_side() { | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-google-tag-manager-server-side-deactivator.php'; | ||
Google_Tag_Manager_Server_Side_Deactivator::deactivate(); | ||
} | ||
|
||
register_activation_hook( __FILE__, 'activate_google_tag_manager_server_side' ); | ||
register_deactivation_hook( __FILE__, 'deactivate_google_tag_manager_server_side' ); | ||
|
||
/** | ||
* The core plugin class that is used to define internationalization, | ||
* admin-specific hooks, and public-facing site hooks. | ||
*/ | ||
require plugin_dir_path( __FILE__ ) . 'includes/class-google-tag-manager-server-side.php'; | ||
|
||
/** | ||
* Begins execution of the plugin. | ||
* | ||
* Since everything within the plugin is registered via hooks, | ||
* then kicking off the plugin from this point in the file does | ||
* not affect the page life cycle. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
function run_google_tag_manager_server_side() { | ||
|
||
$plugin = new Google_Tag_Manager_Server_Side(); | ||
$plugin->run(); | ||
|
||
} | ||
run_google_tag_manager_server_side(); |
25 changes: 25 additions & 0 deletions
25
includes/class-google-tag-manager-server-side-activator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* Fired during plugin activation. | ||
* | ||
* This class defines all code necessary to run during the plugin's activation. | ||
* | ||
* @since 1.0.0 | ||
* @package Google_Tag_Manager_Server_Side | ||
* @subpackage Google_Tag_Manager_Server_Side/includes | ||
*/ | ||
class Google_Tag_Manager_Server_Side_Activator { | ||
|
||
/** | ||
* Short Description. (use period) | ||
* | ||
* Long Description. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public static function activate() { | ||
|
||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
includes/class-google-tag-manager-server-side-deactivator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* Fired during plugin deactivation. | ||
* | ||
* This class defines all code necessary to run during the plugin's deactivation. | ||
* | ||
* @since 1.0.0 | ||
* @package Google_Tag_Manager_Server_Side | ||
* @subpackage Google_Tag_Manager_Server_Side/includes | ||
*/ | ||
class Google_Tag_Manager_Server_Side_Deactivator { | ||
|
||
/** | ||
* Short Description. (use period) | ||
* | ||
* Long Description. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public static function deactivate() { | ||
if (!current_user_can('activate_plugins')) { | ||
return; | ||
} | ||
} | ||
} |
Oops, something went wrong.