| 2 | | <?php // newlines wrecks the punctuation. ?> |
| 3 | | <?php |
| 4 | | use_helper('I18N'); |
| 5 | | $clauses = array(); |
| 6 | | if (aMediaTools::getAttribute('aspect-width') && aMediaTools::getAttribute('aspect-height')) |
| 7 | | { |
| 8 | | $clauses[] = __('A %w%x%h% aspect ratio', array('%w%' => aMediaTools::getAttribute('aspect-width'), '%h%' => aMediaTools::getAttribute('aspect-height')), 'apostrophe'); |
| 9 | | } |
| 10 | | if (aMediaTools::getAttribute('minimum-width')) |
| 11 | | { |
| 12 | | $clauses[] = __('A minimum width of %mw% pixels', array('%mw%' => aMediaTools::getAttribute('minimum-width')), 'apostrophe'); |
| 13 | | } |
| 14 | | if (aMediaTools::getAttribute('minimum-height')) |
| 15 | | { |
| 16 | | $clauses[] = __('A minimum height of %mh% pixels', array('%mh%' => aMediaTools::getAttribute('minimum-height')), 'apostrophe'); |
| 17 | | } |
| 18 | | if (aMediaTools::getAttribute('width')) |
| 19 | | { |
| 20 | | $clauses[] = __('A width of exactly %w% pixels', array('%w%' => aMediaTools::getAttribute('width')), 'apostrophe'); |
| 21 | | } |
| 22 | | if (aMediaTools::getAttribute('height')) |
| 23 | | { |
| 24 | | $clauses[] = __('A height of exactly %h% pixels', array('%h%' => aMediaTools::getAttribute('height')), 'apostrophe'); |
| 25 | | } |
| 26 | | if (aMediaTools::getAttribute('type')) |
| 27 | | { |
| 28 | | // Internationalize the plural so that can be correct too |
| 29 | | $type = __(aMediaTools::getAttribute('type') . "s", null, 'apostrophe'); |
| 30 | | } |
| 31 | | else |
| 32 | | { |
| 33 | | $type = __("items", null, 'apostrophe'); |
| 34 | | } |
| 35 | | if (count($clauses)) |
| 36 | | { |
| 37 | | // Markup change: for I18N it's better to use a list here rather than |
| 38 | | // trying to create a sentence with commas and 'and' |
| 39 | | echo('<h3 class="a-constraints-description">' . __("Displaying only %t% with:", array('%t%' => $type), 'apostrophe') . '</h3>'); |
| 40 | | echo('<ul class="a-constraints">'); |
| 41 | | foreach ($clauses as $clause) |
| | 2 | <?php // newlines wrecks the punctuation. (OK, we're building a ul list now...) ?> |
| | 3 | <?php use_helper('I18N') ?> |
| | 4 | <?php // Images support cropping, which makes some of the constraints unnecessary to display ?> |
| | 5 | <?php // With other media types we must find an item that satisfies all of them. ?> |
| | 6 | <?php if (aMediaTools::getAttribute('type') === 'image'): ?> |
| | 7 | <?php // We went with something simpler when cropping is present ?> |
| | 8 | <?php if ($limitSizes): ?> |
| | 9 | <h4 class="a-help"><?php echo __('Some images in your media library may not be large enough to be selected. Only images that can be used are displayed below.', null, 'apostrophe') ?></h4> |
| | 10 | <?php endif ?> |
| | 11 | <?php else: ?> |
| | 12 | <?php // No cropping, their only hope is to get proper details from us on what is allowed ?> |
| | 13 | <?php |
| | 14 | $clauses = array(); |
| | 15 | if (aMediaTools::getAttribute('aspect-width') && aMediaTools::getAttribute('aspect-height')) |
| 45 | | echo('</ul>'); |
| 46 | | } |
| | 19 | if (aMediaTools::getAttribute('minimum-width')) |
| | 20 | { |
| | 21 | $clauses[] = __('A minimum width of %mw% pixels', array('%mw%' => aMediaTools::getAttribute('minimum-width')), 'apostrophe'); |
| | 22 | } |
| | 23 | if (aMediaTools::getAttribute('minimum-height')) |
| | 24 | { |
| | 25 | $clauses[] = __('A minimum height of %mh% pixels', array('%mh%' => aMediaTools::getAttribute('minimum-height')), 'apostrophe'); |
| | 26 | } |
| | 27 | if (aMediaTools::getAttribute('width')) |
| | 28 | { |
| | 29 | $clauses[] = __('A width of exactly %w% pixels', array('%w%' => aMediaTools::getAttribute('width')), 'apostrophe'); |
| | 30 | } |
| | 31 | if (aMediaTools::getAttribute('height')) |
| | 32 | { |
| | 33 | $clauses[] = __('A height of exactly %h% pixels', array('%h%' => aMediaTools::getAttribute('height')), 'apostrophe'); |
| | 34 | } |
| | 35 | if (aMediaTools::getAttribute('type')) |
| | 36 | { |
| | 37 | // Internationalize the plural so that can be correct too |
| | 38 | $type = __(aMediaTools::getAttribute('type') . "s", null, 'apostrophe'); |
| | 39 | } |
| | 40 | else |
| | 41 | { |
| | 42 | $type = __("items", null, 'apostrophe'); |
| | 43 | } |
| | 44 | if (count($clauses)) |
| | 45 | { |
| | 46 | // Markup change: for I18N it's better to use a list here rather than |
| | 47 | // trying to create a sentence with commas and 'and' |
| | 48 | echo('<h4 class="a-constraints-description">' . __("Displaying only %t% with:", array('%t%' => $type), 'apostrophe') . '</h4>'); |
| | 49 | echo('<ul class="a-constraints">'); |
| | 50 | foreach ($clauses as $clause) |
| | 51 | { |
| | 52 | echo('<li>' . $clause . '</li>'); |
| | 53 | } |
| | 54 | echo('</ul>'); |
| | 55 | } |
| | 56 | ?> |
| | 57 | <?php endif ?> |