* @license GPL-2.0+ * @link http://webgilde.com * @copyright 2014 Thomas Maier, webgilde GmbH * * Class containing information about the content ad type * this should also work as an example for other ad types * * see also includes/ad-type-abstract.php for basic object * */ class Advanced_Ads_Ad_Type_Content extends Advanced_Ads_Ad_Type_Abstract{ /** * ID - internal type of the ad type * * must be static so set your own ad type ID here * use slug like format, only lower case, underscores and hyphens * * @since 1.0.0 */ public $ID = 'content'; /** * set basic attributes * * @since 1.0.0 */ public function __construct() { $this->title = __( 'Rich Content', 'advanced-ads' ); $this->description = __( 'The full content editor from WordPress with all features like shortcodes, image upload or styling, but also simple text/html mode for scripts and code.', 'advanced-ads' ); $this->parameters = array( 'content' => '' ); } /** * output for the ad parameters metabox * * this will be loaded using ajax when changing the ad type radio buttons * echo the output right away here * name parameters must be in the "advanced_ads" array * * @param obj $ad ad object * @since 1.0.0 */ public function render_parameters($ad){ // load tinymc content exitor $content = (isset($ad->content)) ? $ad->content : ''; /** * build the tinymc editor * @link http://codex.wordpress.org/Function_Reference/wp_editor * * don’t build it when ajax is used; display message and buttons instead */ if ( defined( 'DOING_AJAX' ) ){ ?> 'advanced_ad[content]', 'textarea_rows' => 10, 'drag_drop_upload' => true ); wp_editor( $content, 'advanced-ad-parameters-content', $args ); } ?>
content; if ( isset( $GLOBALS['wp_embed'] ) ) { // temporarily replace the global $post variable with the current ad (post) $old_post = $GLOBALS['post']; $GLOBALS['post'] = $ad->id; // get the [embed] shortcode to run before wpautop() $output = $GLOBALS['wp_embed']->run_shortcode( $output ); // attempts to embed all URLs in a post $output = $GLOBALS['wp_embed']->autoembed( $output ); $GLOBALS['post'] = $old_post; } $output = wptexturize( $output ); $output = convert_smilies( $output ); $output = convert_chars( $output ); $output = wpautop( $output ); $output = shortcode_unautop( $output ); $output = $this->do_shortcode( $output, $ad ); // make included images responsive, since WordPress 4.4 if( ! defined( 'ADVADS_DISABLE_RESPONSIVE_IMAGES' ) && function_exists( 'wp_make_content_images_responsive' ) ){ $output = wp_make_content_images_responsive( $output ); } return $output; } }