notices
8 years ago
ad-display-metabox.php
8 years ago
ad-group-edit.php
8 years ago
ad-group-list-ads.php
8 years ago
ad-group-list-form-row.php
8 years ago
ad-group-list-header.php
10 years ago
ad-group-list-row.php
10 years ago
ad-group.php
8 years ago
ad-info-after-textarea.php
8 years ago
ad-info-bottom.php
8 years ago
ad-info-top.php
8 years ago
ad-info.php
10 years ago
ad-list-details-column.php
10 years ago
ad-list-filters.php
8 years ago
ad-list-no-ads.php
8 years ago
ad-list-timing-column.php
8 years ago
ad-main-metabox.php
8 years ago
ad-output-metabox.php
8 years ago
ad-parameters-metabox.php
8 years ago
ad-parameters-size.php
8 years ago
ad-submitbox-meta.php
8 years ago
ad-visitor-metabox.php
8 years ago
feedback-disable.php
8 years ago
index.php
12 years ago
overview-addons-line.php
8 years ago
overview-widget.php
8 years ago
overview.php
8 years ago
placement-injection-top.php
8 years ago
placements-ad-label-position.php
8 years ago
placements-ad-label.php
8 years ago
placements-content-index.php
8 years ago
placements-item.php
8 years ago
placements.php
8 years ago
post-ad-settings-metabox.php
8 years ago
setting-license.php
8 years ago
setting-target.php
8 years ago
settings-disable-ads.php
10 years ago
settings.php
8 years ago
support.php
8 years ago
placements.php
207 lines
| 1 | <?php |
| 2 | /** |
| 3 | * the view for the placements page |
| 4 | */ |
| 5 | ?><div class="wrap"> |
| 6 | <?php if ( isset($_GET['message'] ) ) : |
| 7 | if ( $_GET['message'] === 'error' ) : |
| 8 | ?><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><?php |
| 9 | elseif ( $_GET['message'] === 'updated' ) : |
| 10 | ?><div id="message" class="updated"><p><?php _e( 'Placements updated', 'advanced-ads' ); ?></p></div><?php |
| 11 | endif; ?> |
| 12 | <?php endif; ?> |
| 13 | <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
| 14 | <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> |
| 15 | <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> |
| 16 | <?php if ( isset($placements) && is_array( $placements ) && count( $placements ) ) : |
| 17 | do_action( 'advanced-ads-placements-list-before', $placements ); ?> |
| 18 | <h2><?php _e( 'Placements', 'advanced-ads' ); ?></h2> |
| 19 | <form method="POST" action=""> |
| 20 | <table class="widefat advads-placements-table striped"> |
| 21 | <thead> |
| 22 | <tr> |
| 23 | <th><?php _e( 'Type', 'advanced-ads' ); ?></th> |
| 24 | <th><?php _e( 'Name', 'advanced-ads' ); ?></th> |
| 25 | <th><?php _e( 'Options', 'advanced-ads' ); ?></th> |
| 26 | <?php do_action( 'advanced-ads-placements-list-column-header' ); ?> |
| 27 | <th></th> |
| 28 | </tr> |
| 29 | </thead> |
| 30 | <tbody> |
| 31 | <?php // order by slug |
| 32 | ksort( $placements ); |
| 33 | foreach ( $placements as $_placement_slug => $_placement ) : |
| 34 | $type_missing = false; |
| 35 | if( isset( $_placement['type'] ) && ! isset( $placement_types[$_placement['type']] )) { |
| 36 | $missed_type = $_placement['type']; |
| 37 | $_placement['type'] = 'default'; |
| 38 | $type_missing = true; |
| 39 | } |
| 40 | ?><tr id="single-placement-<?php echo $_placement_slug; ?>"> |
| 41 | <td><?php |
| 42 | if( $type_missing ) : // type is not given |
| 43 | ?><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><?php |
| 44 | elseif( isset($_placement['type'] )) : |
| 45 | if( isset( $placement_types[$_placement['type']]['image'] )) : |
| 46 | ?><img src="<?php echo $placement_types[$_placement['type']]['image']; |
| 47 | ?>" title="<?php echo $placement_types[$_placement['type']]['title']; |
| 48 | ?>" alt="<?php echo $placement_types[$_placement['type']]['title']; ?>"/><?php |
| 49 | else : |
| 50 | echo $placement_types[$_placement['type']]['title']; |
| 51 | endif; |
| 52 | else : |
| 53 | __( 'default', 'advanced-ads' ); |
| 54 | endif; |
| 55 | ?></td> |
| 56 | <td><?php echo $_placement['name']; ?><br/> |
| 57 | <?php if( ! isset( $_placement['type'] ) || 'default' === $_placement['type']) : |
| 58 | $_placement['type'] = 'default'; |
| 59 | ?><a class="usage-link"><?php _e( 'show usage', 'advanced-ads' ); ?></a><?php |
| 60 | endif; |
| 61 | ?></td> |
| 62 | <td class="advads-placements-table-options"> |
| 63 | <?php if( ! isset( $_placement['type'] ) || 'default' === $_placement['type']) : ?> |
| 64 | <div class="hidden advads-usage"> |
| 65 | <label><?php _e( 'shortcode', 'advanced-ads' ); ?> |
| 66 | <code><input type="text" onclick="this.select();" value='[the_ad_placement id="<?php echo $_placement_slug; ?>"]'/></code> |
| 67 | </label> |
| 68 | <label><?php _e( 'template (PHP)', 'advanced-ads' ); ?> |
| 69 | <code><input type="text" onclick="this.select();" value="if( function_exists('the_ad_placement') ) { the_ad_placement('<?php echo $_placement_slug; ?>'); }"/></code> |
| 70 | </label> |
| 71 | </div> |
| 72 | <?php endif; ?> |
| 73 | |
| 74 | <?php do_action( 'advanced-ads-placement-options-before', $_placement_slug, $_placement ); ?> |
| 75 | |
| 76 | <?php |
| 77 | ob_start(); |
| 78 | include ADVADS_BASE_PATH . 'admin/views/placements-item.php'; |
| 79 | $item_option_content = ob_get_clean(); |
| 80 | |
| 81 | Advanced_Ads_Admin_Options::render_option( |
| 82 | 'placement-item', |
| 83 | __( 'Item', 'advanced-ads' ), |
| 84 | $item_option_content ); ?> |
| 85 | <?php switch ( $_placement['type'] ) : |
| 86 | case 'post_content' : |
| 87 | |
| 88 | ob_start(); |
| 89 | include ADVADS_BASE_PATH . 'admin/views/placements-content-index.php'; |
| 90 | $option_content = ob_get_clean(); |
| 91 | |
| 92 | Advanced_Ads_Admin_Options::render_option( |
| 93 | 'placement-content-injection-index', |
| 94 | __( 'position', 'advanced-ads' ), |
| 95 | $option_content ); |
| 96 | |
| 97 | if( ! function_exists( 'mb_convert_encoding' ) ) : ?> |
| 98 | <p><span class="advads-error-message"><?php _e( 'Important Notice', 'advanced-ads' ); ?>: </span><?php _e( 'Your server is missing an extension. This might break the content injection.<br/>Ignore this warning if everything works fine or else ask your hosting provider to enable <em>mbstring</em>.', 'advanced-ads' ); ?></p> |
| 99 | <?php endif; |
| 100 | break; |
| 101 | endswitch; |
| 102 | do_action( 'advanced-ads-placement-options-after', $_placement_slug, $_placement ); |
| 103 | ob_start(); |
| 104 | |
| 105 | if ( 'header' !== $_placement['type'] ): |
| 106 | $_label = isset( $_placement['options']['ad_label'] ) ? $_placement['options']['ad_label'] : 'default'; |
| 107 | $_position = ! empty( $_placement['options']['placement_position'] ) ? $_placement['options']['placement_position'] : 'default'; |
| 108 | $_clearfix = ! empty( $_placement['options']['placement_clearfix'] ); |
| 109 | |
| 110 | ob_start(); |
| 111 | include ADVADS_BASE_PATH . 'admin/views/placements-ad-label.php'; |
| 112 | if ( ! empty( $placement_types[ $_placement['type']]['options']['show_position'] ) ) : |
| 113 | include ADVADS_BASE_PATH . 'admin/views/placements-ad-label-position.php'; |
| 114 | endif; |
| 115 | $option_content = ob_get_clean(); |
| 116 | |
| 117 | Advanced_Ads_Admin_Options::render_option( |
| 118 | 'placement-ad-label', |
| 119 | __( 'ad label', 'advanced-ads' ), |
| 120 | $option_content ); |
| 121 | |
| 122 | endif; |
| 123 | |
| 124 | do_action( 'advanced-ads-placement-options-after-advanced', $_placement_slug, $_placement ); |
| 125 | $advanced_options = ob_get_clean(); |
| 126 | if( $advanced_options ) : |
| 127 | ?><a class="advads-toggle-link" onclick="advads_toggle('.advads-placements-advanced-options-<?php |
| 128 | echo $_placement_slug; ?>')"><?php _e( 'show all options', 'advanced-ads' ); ?></a> |
| 129 | <div class="advads-placements-advanced-options-<?php echo $_placement_slug; ?>" style="display: none"><?php |
| 130 | echo $advanced_options; |
| 131 | ?></div><?php |
| 132 | endif; |
| 133 | // information after options |
| 134 | if( isset( $_placement['type'] ) && 'header' === $_placement['type']) : |
| 135 | ?><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><?php |
| 136 | endif; |
| 137 | |
| 138 | ?></td> |
| 139 | <?php do_action( 'advanced-ads-placements-list-column', $_placement_slug, $_placement ); ?> |
| 140 | <td> |
| 141 | <input type="checkbox" id="advads-placements-item-delete-<?php echo $_placement_slug; ?>" name="advads[placements][<?php echo $_placement_slug; ?>][delete]" value="1"/> |
| 142 | <label for="advads-placements-item-delete-<?php echo $_placement_slug; ?>"><?php _ex( 'delete', 'checkbox to remove placement', 'advanced-ads' ); ?></label> |
| 143 | </td> |
| 144 | </tr> |
| 145 | <?php endforeach; ?> |
| 146 | </tbody> |
| 147 | </table> |
| 148 | <div class="tablenav bottom"> |
| 149 | <input type="submit" id="advads-save-placements-button" class="button button-primary" value="<?php _e( 'Save Placements', 'advanced-ads' ); ?>"/> |
| 150 | <?php wp_nonce_field( 'advads-placement', 'advads_placement', true ) ?> |
| 151 | <button type="button" title="<?php _e( 'Create a new placement', 'advanced-ads' ); ?>" class="button-secondary" onclick="advads_toggle('.advads-placements-new-form')"><?php |
| 152 | _e( 'New Placement', 'advanced-ads' ); ?></button> |
| 153 | <?php do_action( 'advanced-ads-placements-list-buttons', $placements ); ?> |
| 154 | </div> |
| 155 | </form> |
| 156 | <?php do_action( 'advanced-ads-placements-list-after', $placements ); |
| 157 | endif; |
| 158 | |
| 159 | ?><form method="POST" action="" onsubmit="return advads_validate_placement_form();" class="advads-placements-new-form"<?php if ( isset($placements) && count( $placements ) ) echo ' style="display: none;"' ; ?>> |
| 160 | <h3>1. <?php _e( 'Choose a placement type', 'advanced-ads' ); ?></h3> |
| 161 | <p class="description"><?php printf(__( 'Placement types define where the ad is going to be displayed. Learn more about the different types from the <a href="%s">manual</a>', 'advanced-ads' ), ADVADS_URL . 'manual/placements/#utm_source=advanced-ads&utm_medium=link&utm_campaign=placements' ); ?></p> |
| 162 | <div class= "advads-new-placement-types advads-buttonset"> |
| 163 | <?php |
| 164 | if ( is_array( $placement_types ) ) { |
| 165 | foreach ( $placement_types as $_key => $_place ) : |
| 166 | if( isset( $_place['image'] )) : |
| 167 | $image = '<img src="' . $_place['image'] . '" alt="' . $_place['title'] . '"/>'; |
| 168 | else : |
| 169 | $image = '<strong>' . $_place['title'] . '</strong><br/><p class="description">' . $_place['description'] . '</p>'; |
| 170 | endif; |
| 171 | ?><div class="advads-placement-type"><label for="advads-placement-type-<?php echo $_key; ?>"><?php echo $image; ?></label> |
| 172 | <input type="radio" id="advads-placement-type-<?php echo $_key; ?>" name="advads[placement][type]" value="<?php echo $_key; ?>"/> |
| 173 | <p class="advads-placement-description"><strong><?php echo $_place['title'] ?></strong><br/><?php echo $_place['description']; ?></p> |
| 174 | </div><?php |
| 175 | endforeach; }; |
| 176 | ?></div> |
| 177 | <div class="clear"></div> |
| 178 | <p class="advads-error-message advads-placement-type-error"><?php _e( 'Please select a placement type.', 'advanced-ads' ); ?></p> |
| 179 | <br/> |
| 180 | <h3>2. <?php _e( 'Choose a Name', 'advanced-ads' ); ?></h3> |
| 181 | <p class="description"><?php _e( 'The name of the placement is only visible to you. Tip: choose a descriptive one, e.g. <em>Below Post Headline</em>.', 'advanced-ads' ); ?></p> |
| 182 | <p><input name="advads[placement][name]" class="advads-new-placement-name" type="text" value="" placeholder="<?php _e( 'Placement Name', 'advanced-ads' ); ?>"/></p> |
| 183 | <p class="advads-error-message advads-placement-name-error"><?php _e( 'Please enter a name for your placement.', 'advanced-ads' ); ?></p> |
| 184 | <h3>3. <?php _e( 'Choose the Ad or Group', 'advanced-ads' ); ?></h3> |
| 185 | <p class="description"><?php _e( 'The ad or group that should be displayed.', 'advanced-ads' ); ?></p> |
| 186 | <p><select name="advads[placement][item]"> |
| 187 | <option value=""><?php _e( '--not selected--', 'advanced-ads' ); ?></option> |
| 188 | <?php if ( isset($items['groups']) ) : ?> |
| 189 | <optgroup label="<?php _e( 'Ad Groups', 'advanced-ads' ); ?>"> |
| 190 | <?php foreach ( $items['groups'] as $_item_id => $_item_title ) : ?> |
| 191 | <option value="<?php echo $_item_id; ?>"><?php echo $_item_title; ?></option> |
| 192 | <?php endforeach; ?> |
| 193 | </optgroup> |
| 194 | <?php endif; ?> |
| 195 | <?php if ( isset($items['ads']) ) : ?> |
| 196 | <optgroup label="<?php _e( 'Ads', 'advanced-ads' ); ?>"> |
| 197 | <?php foreach ( $items['ads'] as $_item_id => $_item_title ) : ?> |
| 198 | <option value="<?php echo $_item_id; ?>"><?php echo $_item_title; ?></option> |
| 199 | <?php endforeach; ?> |
| 200 | </optgroup> |
| 201 | <?php endif; ?> |
| 202 | </select></p> |
| 203 | <?php wp_nonce_field( 'advads-placement', 'advads_placement', true ) ?> |
| 204 | <input type="submit" class="button button-primary" value="<?php _e( 'Save New Placement', 'advanced-ads' ); ?>"/> |
| 205 | </form> |
| 206 | </div> |
| 207 |