| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/repository/wp-content/plugins/jetpack/modules/shortcodes/ |
Upload File : |
<?php
/**
* Embed WordAds 'ad' in post
*
*/
class Jetpack_WordAds_Shortcode {
private $scripts_and_style_included = false;
function __construct() {
add_action( 'init', array( $this, 'action_init' ) );
}
/**
* Register our shortcode and enqueue necessary files.
*/
function action_init() {
global $wordads;
if ( empty( $wordads ) ) {
return null;
}
add_shortcode( 'wordads', array( $this, 'wordads_shortcode' ) );
}
/**
* Our [wordads] shortcode.
* Prints a WordAds Ad.
*
* @param array $atts Array of shortcode attributes.
* @param string $content Post content.
*
* @return string HTML for WordAds shortcode.
*/
static function wordads_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts( array(), $atts, 'wordads');
return self::wordads_shortcode_html( $atts, $content );
}
/**
* The shortcode output
*
* @param array $atts Array of shortcode attributes.
* @param string $content Post content.
*
* @return string HTML output
*/
static function wordads_shortcode_html( $atts, $content = '' ) {
global $wordads;
if ( empty( $wordads ) ) {
return '<div>' . __( 'The WordAds module is not active', 'jetpack' ) . '</div>';
}
$html = '<div class="jetpack-wordad" itemscope itemtype="https://schema.org/WPAdBlock">';
$html .= '</div>';
$html = $wordads->insert_inline_ad( $html );
return $html;
}
}
new Jetpack_WordAds_Shortcode();