ad-list
5 months ago
conditions
5 months ago
notices
1 year ago
upgrades
1 year ago
ad-conditions-string-operators.php
3 months ago
checks.php
3 months ago
index.php
7 years ago
modal.php
3 months ago
overview-addons-line.php
5 months ago
overview-notice-row.php
1 year ago
overview-widget.php
1 year ago
placement-form.php
1 year ago
placement-injection-top.php
1 year ago
placement-types.php
3 years ago
placements-ad-label.php
1 year ago
placements-inline-css.php
1 year ago
placements-item.php
1 year ago
post-list-filter-dropdown.php
5 months ago
support-callout.php
1 year ago
placements-item.php
71 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Render item option for placements. |
| 4 | * |
| 5 | * @var array $items Array of available items. |
| 6 | * @var string $slug slug of the current placement. |
| 7 | * @var array $placement information of the current placement. |
| 8 | * @var string $placement_item_type type of the item currently selected for the placement |
| 9 | * @var int $placement_item_id ID of the item currently selected for the placement |
| 10 | * @package AdvancedAds |
| 11 | */ |
| 12 | |
| 13 | ?> |
| 14 | <select id="advads-placements-item-<?php echo esc_attr( $slug ); ?>" name="advads[placements][<?php echo esc_attr( $slug ); ?>][item]"> |
| 15 | <option value=""><?php esc_html_e( '--not selected--', 'advanced-ads' ); ?></option> |
| 16 | |
| 17 | <?php foreach ( $items as $item_group ) : ?> |
| 18 | <optgroup label="<?php echo esc_attr( $item_group['label'] ); ?>"> |
| 19 | <?php foreach ( $item_group['items'] as $item_id => $item ) : ?> |
| 20 | <option value="<?php echo esc_attr( $item_id ); ?>" <?php selected( $item['selected'] ); ?> <?php disabled( $item['disabled'] ); ?>> |
| 21 | <?php echo esc_html( $item['name'] ); ?> |
| 22 | </option> |
| 23 | <?php endforeach; ?> |
| 24 | </optgroup> |
| 25 | <?php endforeach; ?> |
| 26 | </select> |
| 27 | |
| 28 | <?php |
| 29 | // link to item. |
| 30 | if ( $placement_item_type ) : |
| 31 | $link_to_item = false; |
| 32 | switch ( $placement_item_type ) : |
| 33 | case 'ad': |
| 34 | /** |
| 35 | * Deliver the translated version of an ad if set up with WPML. |
| 36 | * |
| 37 | * @source https://wpml.org/wpml-hook/wpml_object_id/ |
| 38 | */ |
| 39 | $placement_item_id = apply_filters( 'wpml_object_id', $placement_item_id, 'advanced_ads' ); |
| 40 | $link_to_item = get_edit_post_link( $placement_item_id ); |
| 41 | break; |
| 42 | case 'group': |
| 43 | $link_to_item = admin_url( 'admin.php?page=advanced-ads-groups#modal-group-edit-' . $placement_item_id ); |
| 44 | break; |
| 45 | endswitch; |
| 46 | if ( $link_to_item ) { |
| 47 | ?> |
| 48 | <a href="<?php echo esc_url( $link_to_item ); ?>"><span class="dashicons dashicons-external"></span></span></a> |
| 49 | <?php |
| 50 | } elseif ( 'ad' === $placement_item_type && defined( 'ICL_LANGUAGE_NAME' ) ) { |
| 51 | // translation missing notice. |
| 52 | ?> |
| 53 | <p> |
| 54 | <?php |
| 55 | printf( |
| 56 | /* translators: %s is the name of a language in English. */ |
| 57 | esc_html__( 'The ad is not translated into %s', 'advanced-ads' ), |
| 58 | esc_html( ICL_LANGUAGE_NAME ) |
| 59 | ); |
| 60 | ?> |
| 61 | </p> |
| 62 | <?php |
| 63 | } |
| 64 | endif; |
| 65 | // show a button when no ads exist, yet. |
| 66 | if ( empty( $items ) ) : |
| 67 | ?> |
| 68 | <a class="button" href="<?php echo esc_url( admin_url( 'post-new.php?post_type=advanced_ads' ) ); ?>"><?php esc_html_e( 'Create your first ad', 'advanced-ads' ); ?></a> |
| 69 | <?php |
| 70 | endif; |
| 71 |