conditions
6 years ago
notices
6 years ago
ad-conditions-string-operators.php
7 years ago
ad-group-edit.php
7 years ago
ad-group-list-ads.php
7 years ago
ad-group-list-form-row.php
6 years ago
ad-group-list-header.php
7 years ago
ad-group-list-row.php
7 years ago
ad-group.php
6 years ago
ad-info-after-textarea.php
7 years ago
ad-info-bottom.php
6 years ago
ad-info-top.php
7 years ago
ad-info.php
7 years ago
ad-list-details-column.php
7 years ago
ad-list-filters.php
6 years ago
ad-list-no-ads.php
6 years ago
ad-list-shortcode-column.php
7 years ago
ad-list-timing-column.php
7 years ago
ad-main-metabox.php
6 years ago
ad-output-metabox.php
6 years ago
ad-parameters-metabox.php
6 years ago
ad-parameters-size.php
6 years ago
ad-submitbox-meta.php
7 years ago
checks.php
6 years ago
feedback-disable.php
6 years ago
gadsense-dashboard.php
6 years ago
index.php
7 years ago
overview-addons-line.php
7 years ago
overview-notice-row.php
6 years ago
overview-notices.php
6 years ago
overview-widget.php
6 years ago
overview.php
6 years ago
pitch-bundle.php
7 years ago
pitch-pro-tab.php
7 years ago
pitch-tracking.php
7 years ago
placement-form.php
6 years ago
placement-injection-top.php
6 years ago
placements-ad-label-position.php
7 years ago
placements-ad-label.php
7 years ago
placements-content-index.php
7 years ago
placements-item.php
6 years ago
placements.php
6 years ago
post-ad-settings-metabox.php
6 years ago
setting-disable-post-types.php
6 years ago
setting-license.php
6 years ago
setting-target.php
7 years ago
settings-disable-ads.php
6 years ago
settings.php
6 years ago
support-callout.php
6 years ago
support.php
7 years ago
placements.php
223 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The view for the placements page |
| 4 | */ |
| 5 | ?><div class="wrap"> |
| 6 | <?php |
| 7 | if ( isset( $_GET['message'] ) ) : |
| 8 | if ( $_GET['message'] === 'error' ) : |
| 9 | ?> |
| 10 | <div id="message" class="error"><p><?php _e( 'Couldn’t create the new placement. Please check your form field and whether the name is already in use.', 'advanced-ads' ); ?></p></div> |
| 11 | <?php |
| 12 | elseif ( $_GET['message'] === 'updated' ) : |
| 13 | ?> |
| 14 | <div id="message" class="updated"><p><?php _e( 'Placements updated', 'advanced-ads' ); ?></p></div> |
| 15 | <?php |
| 16 | endif; |
| 17 | ?> |
| 18 | <?php endif; ?> |
| 19 | <h1 class="wp-heading-inline"><?php echo esc_html( get_admin_page_title() ); ?></h1> |
| 20 | <a href="#" class="page-title-action" title="<?php _e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');"><?php |
| 21 | _e( 'New Placement', 'advanced-ads' ); |
| 22 | ?></a> |
| 23 | |
| 24 | <hr class="wp-header-end"> |
| 25 | |
| 26 | <p class="description"><?php _e( 'Placements are physically places in your theme and posts. You can use them if you plan to change ads and ad groups on the same place without the need to change your templates.', 'advanced-ads' ); ?></p> |
| 27 | <p class="description"><?php printf( __( 'See also the manual for more information on <a href="%s">placements</a>.', 'advanced-ads' ), ADVADS_URL . 'manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements' ); ?></p> |
| 28 | <?php |
| 29 | |
| 30 | // add placement form. |
| 31 | include_once ADVADS_BASE_PATH . 'admin/views/placement-form.php'; |
| 32 | |
| 33 | if ( isset( $placements ) && is_array( $placements ) && count( $placements ) ) : |
| 34 | do_action( 'advanced-ads-placements-list-before', $placements ); |
| 35 | ?> |
| 36 | <h2><?php _e( 'Placements', 'advanced-ads' ); ?></h2> |
| 37 | <form method="POST" action="" id="advanced-ads-placements-form"> |
| 38 | <table class="widefat advads-placements-table striped"> |
| 39 | <thead> |
| 40 | <tr> |
| 41 | <th><?php _e( 'Type', 'advanced-ads' ); ?></th> |
| 42 | <th><?php _e( 'Name', 'advanced-ads' ); ?></th> |
| 43 | <th><?php _e( 'Options', 'advanced-ads' ); ?></th> |
| 44 | <?php do_action( 'advanced-ads-placements-list-column-header' ); ?> |
| 45 | <th></th> |
| 46 | </tr> |
| 47 | </thead> |
| 48 | <tbody> |
| 49 | <?php |
| 50 | // order by slug |
| 51 | ksort( $placements ); |
| 52 | foreach ( $placements as $_placement_slug => $_placement ) : |
| 53 | $type_missing = false; |
| 54 | if ( isset( $_placement['type'] ) && ! isset( $placement_types[ $_placement['type'] ] ) ) { |
| 55 | $missed_type = $_placement['type']; |
| 56 | $_placement['type'] = 'default'; |
| 57 | $type_missing = true; |
| 58 | } |
| 59 | ?> |
| 60 | <tr id="single-placement-<?php echo $_placement_slug; ?>" class="advanced-ads-placement-row"> |
| 61 | <td> |
| 62 | <?php |
| 63 | if ( $type_missing ) : // type is not given |
| 64 | ?> |
| 65 | <p class="advads-error-message"><?php printf( __( 'Placement type "%s" is missing and was reset to "default".<br/>Please check if the responsible add-on is activated.', 'advanced-ads' ), $missed_type ); ?></p> |
| 66 | <?php |
| 67 | elseif ( isset( $_placement['type'] ) ) : |
| 68 | if ( isset( $placement_types[ $_placement['type'] ]['image'] ) ) : |
| 69 | ?> |
| 70 | <img src=" |
| 71 | <?php |
| 72 | echo $placement_types[ $_placement['type'] ]['image']; |
| 73 | ?> |
| 74 | " title=" |
| 75 | <?php |
| 76 | echo $placement_types[ $_placement['type'] ]['title']; |
| 77 | ?> |
| 78 | " alt="<?php echo $placement_types[ $_placement['type'] ]['title']; ?>"/> |
| 79 | <?php |
| 80 | else : |
| 81 | echo $placement_types[ $_placement['type'] ]['title']; |
| 82 | endif; |
| 83 | else : |
| 84 | __( 'default', 'advanced-ads' ); |
| 85 | endif; |
| 86 | ?> |
| 87 | </td> |
| 88 | <td><?php echo $_placement['name']; ?><br/> |
| 89 | <?php |
| 90 | if ( ! isset( $_placement['type'] ) || 'default' === $_placement['type'] ) : |
| 91 | $_placement['type'] = 'default'; |
| 92 | ?> |
| 93 | <a class="usage-link"><?php _e( 'show usage', 'advanced-ads' ); ?></a> |
| 94 | <?php |
| 95 | endif; |
| 96 | ?> |
| 97 | </td> |
| 98 | <td class="advads-placements-table-options"> |
| 99 | <input type="hidden" class="advads-placement-slug" value="<?php echo $_placement_slug; ?>"/> |
| 100 | <?php if ( ! isset( $_placement['type'] ) || 'default' === $_placement['type'] ) : ?> |
| 101 | <div class="hidden advads-usage"> |
| 102 | <label><?php _e( 'shortcode', 'advanced-ads' ); ?> |
| 103 | <code><input type="text" onclick="this.select();" value='[the_ad_placement id="<?php echo $_placement_slug; ?>"]'/></code> |
| 104 | </label> |
| 105 | <label><?php _e( 'template (PHP)', 'advanced-ads' ); ?> |
| 106 | <code><input type="text" onclick="this.select();" value="if( function_exists('the_ad_placement') ) { the_ad_placement('<?php echo $_placement_slug; ?>'); }"/></code> |
| 107 | </label> |
| 108 | </div> |
| 109 | <?php endif; ?> |
| 110 | |
| 111 | <?php do_action( 'advanced-ads-placement-options-before', $_placement_slug, $_placement ); ?> |
| 112 | |
| 113 | <?php |
| 114 | ob_start(); |
| 115 | include ADVADS_BASE_PATH . 'admin/views/placements-item.php'; |
| 116 | $item_option_content = ob_get_clean(); |
| 117 | |
| 118 | Advanced_Ads_Admin_Options::render_option( |
| 119 | 'placement-item', |
| 120 | __( 'Item', 'advanced-ads' ), |
| 121 | $item_option_content |
| 122 | ); |
| 123 | ?> |
| 124 | <?php |
| 125 | switch ( $_placement['type'] ) : |
| 126 | case 'post_content': |
| 127 | ob_start(); |
| 128 | include ADVADS_BASE_PATH . 'admin/views/placements-content-index.php'; |
| 129 | do_action( 'advanced-ads-placement-post-content-position', $_placement_slug, $_placement ); |
| 130 | $option_content = ob_get_clean(); |
| 131 | |
| 132 | Advanced_Ads_Admin_Options::render_option( |
| 133 | 'placement-content-injection-index', |
| 134 | __( 'position', 'advanced-ads' ), |
| 135 | $option_content |
| 136 | ); |
| 137 | |
| 138 | if ( ! extension_loaded( 'dom' ) ) : |
| 139 | ?> |
| 140 | <p><span class="advads-error-message"><?php _e( 'Important Notice', 'advanced-ads' ); ?>: </span><?php printf( __( 'Missing PHP extensions could cause issues. Please ask your hosting provider to enable them: %s', 'advanced-ads' ), 'dom (php_xml)' ); ?></p> |
| 141 | <?php |
| 142 | endif; |
| 143 | break; |
| 144 | endswitch; |
| 145 | do_action( 'advanced-ads-placement-options-after', $_placement_slug, $_placement ); |
| 146 | ob_start(); |
| 147 | |
| 148 | if ( 'header' !== $_placement['type'] ) : |
| 149 | $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default'; |
| 150 | $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default'; |
| 151 | $_clearfix = ! empty( $_placement['options']['placement_clearfix'] ); |
| 152 | |
| 153 | ob_start(); |
| 154 | include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php'; |
| 155 | if ( ! empty( $placement_types[ $_placement['type'] ]['options']['show_position'] ) ) : |
| 156 | include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php'; |
| 157 | endif; |
| 158 | $option_content = ob_get_clean(); |
| 159 | |
| 160 | Advanced_Ads_Admin_Options::render_option( |
| 161 | 'placement-ad-label', |
| 162 | __( 'ad label', 'advanced-ads' ), |
| 163 | $option_content |
| 164 | ); |
| 165 | |
| 166 | endif; |
| 167 | |
| 168 | do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement ); |
| 169 | $advanced_options = ob_get_clean(); |
| 170 | if ( $advanced_options ) : |
| 171 | ?> |
| 172 | <a class="advads-toggle-link advads-placement-options-link" data-placement="<?php echo $_placement_slug ?>"><?php _e( 'show all options', 'advanced-ads' ); ?></a> |
| 173 | <?php |
| 174 | $hidden = ( isset( $_POST['advads-last-edited-placement'] ) && $_placement_slug == $_POST['advads-last-edited-placement'] ) ? '' : ' hidden'; |
| 175 | ?> |
| 176 | <div class="advads-placements-advanced-options advads-placements-advanced-options- |
| 177 | <?php |
| 178 | echo $_placement_slug; |
| 179 | echo $hidden; |
| 180 | ?> |
| 181 | "> |
| 182 | <?php |
| 183 | echo $advanced_options; |
| 184 | ?> |
| 185 | </div> |
| 186 | <?php |
| 187 | endif; |
| 188 | // information after options |
| 189 | if ( isset( $_placement['type'] ) && 'header' === $_placement['type'] ) : |
| 190 | ?> |
| 191 | <br/><p><?php printf( __( 'Tutorial: <a href="%s" target="_blank">How to place visible ads in the header of your website</a>.', 'advanced-ads' ), ADVADS_URL . 'place-ads-in-website-header/#utm_source=advanced-ads&utm_medium=link&utm_campaign=header-ad-tutorial' ); ?></p> |
| 192 | <?php |
| 193 | endif; |
| 194 | |
| 195 | ?> |
| 196 | </td> |
| 197 | <?php do_action( 'advanced-ads-placements-list-column', $_placement_slug, $_placement ); ?> |
| 198 | <td> |
| 199 | <input type="checkbox" id="advads-placements-item-delete-<?php echo $_placement_slug; ?>" name="advads[placements][<?php echo $_placement_slug; ?>][delete]" value="1"/> |
| 200 | <label for="advads-placements-item-delete-<?php echo $_placement_slug; ?>"><?php _ex( 'delete', 'checkbox to remove placement', 'advanced-ads' ); ?></label> |
| 201 | </td> |
| 202 | </tr> |
| 203 | <?php endforeach; ?> |
| 204 | </tbody> |
| 205 | </table> |
| 206 | <div class="tablenav bottom"> |
| 207 | <input type="submit" id="advads-save-placements-button" class="button button-primary" value="<?php _e( 'Save Placements', 'advanced-ads' ); ?>"/> |
| 208 | <?php wp_nonce_field( 'advads-placement', 'advads_placement', true ); ?> |
| 209 | <button type="button" title="<?php _e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form'); advads_scroll_to_element('#advads-placements-new-form');"> |
| 210 | <?php |
| 211 | _e( 'New Placement', 'advanced-ads' ); |
| 212 | ?> |
| 213 | </button> |
| 214 | <?php do_action( 'advanced-ads-placements-list-buttons', $placements ); ?> |
| 215 | </div> |
| 216 | <input type="hidden" name="advads-last-edited-placement" id="advads-last-edited-placement" value="0"/> |
| 217 | </form> |
| 218 | <?php |
| 219 | do_action( 'advanced-ads-placements-list-after', $placements ); |
| 220 | endif; |
| 221 | |
| 222 | ?></div> |
| 223 |