class-affiliates-graph-renderer-wordpress.php
1.25 KB
<?php
if ( !defined( 'ABSPATH' ) ) { exit; } class Affiliates_Graph_Renderer_WordPress extends Affiliates_Graph_Renderer { const IXAP183 = 'affiliate-nonce'; const IXAP184 = 'affiliate-nonce-1'; const IXAP185 = 'affiliate-nonce-2'; const IXAP186 = 'affiliate-nonce-filters'; static function init() { add_action( 'wp_enqueue_scripts', array( __CLASS__, 'wp_enqueue_scripts' ) ); add_filter( 'the_posts', array( __CLASS__, 'the_posts' ) ); add_shortcode( 'affiliates_affiliate_graph', array( __CLASS__, 'graph' ) ); } public static function wp_enqueue_scripts() { global $IXAP390; if ( isset( $IXAP390 ) ) { wp_enqueue_script( 'jquery' ); } } public static function the_posts( $posts ) { global $IXAP390; if ( !isset( $IXAP390 ) ) { if ( !wp_script_is( 'jquery' ) ) { foreach( $posts as $post ) { $IXAP391 = strpos( $post->post_content, '[affiliates_affiliate_graph' ) !== false; if ( $IXAP391 ) { $IXAP390 = true; break; } } } } return $posts; } static function graph( $IXAP223, $IXAP167 = null ) { wp_enqueue_style( 'affiliates-pro' ); wp_enqueue_script( 'excanvas' ); wp_enqueue_script( 'flot' ); wp_enqueue_script( 'flot-resize' ); $IXAP105 = shortcode_atts( self::$IXAP100, $IXAP223 ); return self::render_graph( $IXAP105 ); } } Affiliates_Graph_Renderer_WordPress::init();