adsense-ad-parameters.php
86 lines
| 1 | <?php |
| 2 | if ( ! defined( 'WPINC' ) ) { |
| 3 | die(); |
| 4 | } |
| 5 | $is_responsive = ('responsive' == $unit_type) ? true : false; |
| 6 | $is_link_responsive_unit = ('link-responsive' == $unit_type) ? true : false; |
| 7 | $is_matched_content = ('matched-content' == $unit_type) ? true : false; |
| 8 | $use_manual_css = ('manual' == $unit_resize) ? true : false; |
| 9 | if ( $is_responsive || $is_link_responsive_unit || $is_matched_content ) { |
| 10 | echo '<style type="text/css"> #advanced-ads-ad-parameters-size {display: none;} </style>'; |
| 11 | } |
| 12 | |
| 13 | $use_paste_code = true; |
| 14 | $use_paste_code = apply_filters( 'advanced-ads-gadsense-use-pastecode', $use_paste_code ); |
| 15 | |
| 16 | $db = Advanced_Ads_AdSense_Data::get_instance(); |
| 17 | $sizing_array = $db->get_responsive_sizing(); |
| 18 | |
| 19 | ?> |
| 20 | <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>" /> |
| 21 | <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>" /> |
| 22 | <?php if ( $use_paste_code ) : ?> |
| 23 | <div class="advads-adsense-code" <?php if( !empty( $unit_code ) ): echo 'style="display: none;"'; endif; ?>> |
| 24 | <p class="description"><?php _e( 'Copy the ad code from your AdSense account, paste it into the area below and click on <em>Get details</em>.', 'advanced-ads' ); ?></p> |
| 25 | <textarea rows="10" cols="40" class="advads-adsense-content"></textarea> |
| 26 | <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button> |
| 27 | <div id="pastecode-msg"></div> |
| 28 | </div> |
| 29 | <p class="advads-adsense-show-code" <?php if( empty( $unit_code ) ) : echo 'style="display: none;"'; endif; ?>> |
| 30 | <a href="#"><?php _e( 'Insert new AdSense code', 'advanced-ads' ); ?></a> |
| 31 | </p> |
| 32 | <?php endif; ?> |
| 33 | <p id="adsense-ad-param-error"></p> |
| 34 | <?php ob_start(); ?> |
| 35 | <label class="label"><?php _e( 'Ad Slot ID', 'advanced-ads' ); ?></label> |
| 36 | <div> |
| 37 | <input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>" /> |
| 38 | <input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="" /> |
| 39 | <?php if( $pub_id ) : ?> |
| 40 | <?php printf(__( 'Publisher ID: %s', 'advanced-ads' ), $pub_id ); ?> |
| 41 | <?php endif; ?> |
| 42 | </div> |
| 43 | <hr/> |
| 44 | <?php |
| 45 | $unit_code_markup = ob_get_clean(); |
| 46 | echo apply_filters( 'advanced-ads-gadsense-unit-code-markup', $unit_code_markup, $unit_code ); |
| 47 | if( $pub_id_errors ) : ?> |
| 48 | <p> |
| 49 | <span class="advads-error-message"> |
| 50 | <?php echo $pub_id_errors; ?> |
| 51 | </span> |
| 52 | <?php printf(__( 'Please <a href="%s" target="_blank">change it here</a>.', 'advanced-ads' ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' )); ?> |
| 53 | </p> |
| 54 | <?php endif; ?> |
| 55 | <label class="label" id="unit-type-block"><?php _e( 'Type', 'advanced-ads' ); ?></label> |
| 56 | <div> |
| 57 | <select name="unit-type" id="unit-type"> |
| 58 | <option value="normal" <?php selected( $unit_type, 'normal' ); ?>><?php _e( 'Normal', 'advanced-ads' ); ?></option> |
| 59 | <option value="responsive" <?php selected( $unit_type, 'responsive' ); ?>><?php _e( 'Responsive', 'advanced-ads' ); ?></option> |
| 60 | <option value="matched-content" <?php selected( $unit_type, 'matched-content' ); ?>><?php _e( 'Responsive (Matched Content)', 'advanced-ads' ); ?></option> |
| 61 | <option value="link" <?php selected( $unit_type, 'link' ); ?>><?php _e( 'Link ads', 'advanced-ads' ); ?></option> |
| 62 | <option value="link-responsive" <?php selected( $unit_type, 'link-responsive' ); ?>><?php _e( 'Link ads (Responsive)', 'advanced-ads' ); ?></option> |
| 63 | <option value="in-article" <?php selected( $unit_type, 'in-article' ); ?>><?php _e( 'InArticle', 'advanced-ads' ); ?></option> |
| 64 | <option value="in-feed" <?php selected( $unit_type, 'in-feed' ); ?>><?php _e( 'InFeed', 'advanced-ads' ); ?></option> |
| 65 | </select> |
| 66 | <a href="<?php echo ADVADS_URL . 'manual/adsense-ads/#adsense-ad-types'; ?>" target="_blank"><?php _e( 'manual', 'advanced-ads' ); ?></a> |
| 67 | </div> |
| 68 | <hr/> |
| 69 | <label class="label" <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?> id="resize-label"><?php _e( 'Resizing', 'advanced-ads' ); ?></label> |
| 70 | <div <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) { echo 'style="display: none;"'; } ?>> |
| 71 | <select name="ad-resize-type" id="ad-resize-type"> |
| 72 | <?php foreach ( $sizing_array as $key => $desc ) : ?> |
| 73 | <option value="<?php echo $key; ?>" <?php selected( $key, $unit_resize ); ?>><?php echo $desc; ?></option> |
| 74 | <?php endforeach; ?> |
| 75 | </select> |
| 76 | </div> |
| 77 | <label class="label advads-adsense-layout" <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?> id="advads-adsense-layout"><?php _e( 'Layout', 'advanced-ads' ); ?></label> |
| 78 | <div <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?>> |
| 79 | <input name="ad-layout" id="ad-layout" value="<?php echo isset( $layout ) ? $layout : ''; ?>"/> |
| 80 | </div> |
| 81 | <label class="label advads-adsense-layout-key" <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?> id="advads-adsense-layout-key"><?php _e( 'Layout-Key', 'advanced-ads' ); ?></label> |
| 82 | <div <?php if ( 'in-feed' !== $unit_type ) { echo 'style="display: none;"'; } ?>> |
| 83 | <input name="ad-layout-key" id="ad-layout-key" value="<?php echo isset( $layout_key ) ? $layout_key : ''; ?>"/> |
| 84 | </div> |
| 85 | <hr/> |
| 86 | <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content, $ad ); |