PluginProbe
Wp-Insert / trunk
Wp-Insert vtrunk
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / includes / modules / general / shortcode / module.php

module.php in Wp-Insert trunk, at includes/modules/general/shortcode/module.php

48 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /* Begin UI Functions */
3 add_action( 'wp_insert_plugin_card', 'wp_insert_shortcodeads_plugin_card', 50 );
4 function wp_insert_shortcodeads_plugin_card() {
5 wp_insert_get_plugin_card(
6 'Shortcode Ads',
7 '<p>Ads embedded directly inside post / page content via shortcodes.</p>',
8 'shortcodeads',
9 'Shortcode Ad'
10 );
11 }
12
13 add_action( 'wp_ajax_wp_insert_shortcodeads_get_ad_form', 'wp_insert_get_ad_form' );
14 add_action( 'wp_ajax_wp_insert_shortcodeads_save_ad_data', 'wp_insert_save_ad_data' );
15 add_action( 'wp_ajax_wp_insert_shortcodeads_delete_ad_data', 'wp_insert_delete_ad_data' );
16
17 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_shortcodeads_form_accordion_tabs_shortcode', 10, 3 );
18 function wp_insert_shortcodeads_form_accordion_tabs_shortcode( $control, $identifier, $location ) {
19 echo '<h3>Shortcode</h3>';
20 echo '<div>';
21 $control->set_HTML( '<p class="codeSnippet"><code>[wpinsertshortcodead id="' . $identifier . '"]</code></p>' );
22 $control->create_section( 'Code to add to your post/page content' );
23 wp_insert_echo_html( $control->HTML );
24 $control->clear_controls();
25 echo '</div>';
26 return $control;
27 }
28 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3 );
29 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3 );
30 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3 );
31 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3 );
32 add_filter( 'wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3 );
33 /* End UI Functions */
34
35 /* Begin Shortcode Ad Insertion */
36 add_shortcode( 'wpshortcodead', 'wp_insert_shortcodeads_shortcode' );
37 add_shortcode( 'wpinsertshortcodead', 'wp_insert_shortcodeads_shortcode' );
38 function wp_insert_shortcodeads_shortcode( $atts ) {
39 $atts = shortcode_atts( [ 'id' => '' ], $atts, 'wpinsertshortcodead' );
40 if ( isset( $atts['id'] ) && ( $atts['id'] != '' ) ) {
41 $shortcodeads = get_option( 'wp_insert_shortcodeads' );
42 if ( isset( $shortcodeads[ $atts['id'] ] ) && is_array( $shortcodeads[ $atts['id'] ] ) && wp_insert_get_ad_status( $shortcodeads[ $atts['id'] ] ) ) {
43 return wp_insert_get_ad_unit( $shortcodeads[ $atts['id'] ] );
44 }
45 }
46 }
47 /* End Shortcode Ad Insertion */
48