PluginProbe
Tracking Code Manager / 2.3.0
Tracking Code Manager v2.3.0
2.8.0 2.7.0 trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 All 29 releases
← All changes | includes/core.php +5 -16 trunk2.3.0 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) exit;
2 +//per agganciarsi ogni volta che viene scritto un contenuto
3 3 add_filter( 'wp_head', 'tcmp_head', get_option( 'TCM_HookPriority', TCMP_HOOK_PRIORITY_DEFAULT ) );
4 4 function tcmp_head() {
5 5 global $post, $tcmp;
6 6
7 7 $tcmp->options->setPostShown( null );
8 - if ( $post && isset( $post->ID ) && $post->ID > 0 ) {
8 + if ( $post && isset( $post->ID ) && ( is_page( $post->ID ) || is_single( $post->ID ) ) ) {
9 9 $tcmp->options->setPostShown( $post );
10 10 $tcmp->log->info( 'POST ID=%s IS SHOWN', $post->ID );
11 11 }
12 12
@@ -51,27 +51,16 @@
51 51 add_shortcode( 'tcmp', 'tcmp_shortcode' );
52 52 add_shortcode( 'tcm', 'tcmp_shortcode' );
53 53 function tcmp_shortcode( $atts, $content = '' ) {
54 54 global $tcmp;
55 - // Assign explicitly instead of extract() on external input (see F-13).
56 - $atts = shortcode_atts( array( 'id' => false ), $atts );
57 - $id = $atts['id'];
55 + extract( shortcode_atts( array( 'id' => false ), $atts ) );
58 56
59 - if ( ! $id ) {
57 + if ( ! isset( $id ) || ! $id ) {
60 58 return '';
61 59 }
62 60
63 61 $snippet = $tcmp->manager->get( $id, true );
64 - if ( ! is_array( $snippet ) || ! isset( $snippet['code'] ) ) {
65 - return '';
66 - }
67 -
68 - // Run the snippet through the same output path as write_codes() instead of
69 - // returning it raw, so the shortcode and the normal injection path cannot
70 - // diverge (F-05). Note that this equalises the two paths; it does not make
71 - // the shortcode safe to expose to lower-privileged authors, because the
72 - // whitelist esc_js_code() applies permits <script> by design.
73 - return $tcmp->manager->esc_js_code( $snippet['code'] );
62 + return $snippet['code'];
74 63 }
75 64
76 65 function tcmp_ui_first_time() {
77 66 global $tcmp;