Plugin Directory

Changeset 2339181


Ignore:
Timestamp:
07/11/2020 11:30:07 PM (6 years ago)
Author:
opensums
Message:

Release 1.1.0

Location:
signal-flags
Files:
16 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • signal-flags/tags/1.1.0/readme.txt

    r2337867 r2339181  
    11=== Signal Flags ===
     2Contributors: opensums
    23Tags: flags, signal flags, code flag, sailing
    34Requires at least: 4.7
    45Tested up to: 5.4.2
    5 Stable tag: 1.0.0
     6Stable tag: 1.1.0
    67Requires PHP: 7.2
    78License: MIT
    8 License URI: https://opensource.org/licenses/MIT
     9License URI: https://github.com/signal-flags/signal-flags-wp-plugin/blob/master/LICENSE
    910
    10 Display flags from the International Code of Signals (ICS), the Racing Rules of
    11 Sailing (RRS) and other nautical flags on your website.
     11Display flags from the International Code of Signals (ICS), the Racing Rules of Sailing (RRS) and other nautical flags and pennants on your website.
    1212
    1313== Description ==
    1414
    15 To insert an image of the flag for Letter A in a post or page, use the shortcode
    16 `[signal-flag a]`. You can use the following flags with the corresponding codes:
    17 - Alphabet flags A-Z (codes `a`-`z`)
    18 - Numeral pennants 0-9 (codes `n0` - `n9`)
    19 - Answering pennant (AP) (code `ap`)
    20 - 1st, 2nd and 3rd substitute (codes `s1`-`s3`)
    21 - Various flags defined in the Racing Rules of Sailing (codes `black`,
    22   `blackwhite`, `blue`, `green`, `greenwhite`, `red`, `yellow`)
     15= Usage =
     16To insert an image of the flag for Letter A in a post or page, use the shortcode `[signal-flag a]`. You can use the following flags with the corresponding codes:
     17* Alphabet flags A-Z (codes `a`-`z`)
     18* Numeral pennants 0-9 (codes `n0` - `n9`)
     19* Answering pennant (AP) (code `ap`)
     20* 1st, 2nd and 3rd substitute (codes `s1`-`s3`)
     21* Various flags defined in the Racing Rules of Sailing (codes `black`, `blackwhite`, `blue`, `green`, `greenwhite`, `red`, `yellow`)
    2322
    24 Images are embedded in the page using the SVG vector format (much quicker than
    25 loading a separate image file) and eight sets of flag images are included with
    26 the following options:
    27 - with or without outlines for ease of use on white backgrounds (including when
    28   printed)
    29 - 4x3 and square shapes for letter flags
    30 - in 'natural' or 'primary' colours.
     23There are different sets of flags selectable from the admin settings page.
     24
     25= About the flag images =
     26Images are embedded in the page using the SVG vector format (much quicker than loading a separate image file) and eight sets of flag images are included with the following options:
     27* with or without outlines for ease of use on white backgrounds (including when printed)
     28* rectangular (4:3 aspect ratio) and square shapes for letter flags
     29* in 'natural' or 'primary' colours.
    3130
    3231== Frequently Asked Questions ==
     
    3433= Why don't these flags look like the ones we use at our club? =
    3534
    36 The International Maritime Organisation (IMO) publishes standard designs, but
    37 there are many variations in the shapes of flags in use around the world.
    38 This plugin provides letter flags in square and 4:3 aspect ratios, but all the
    39 pennants are 2:1 and the triangle flags 4:3.
     35There are many variations in the shapes and designs of flags in use around the world. This plugin provides letter flags in square and 4:3 aspect ratios, but all the pennants are 2:1 and the triangle flags 4:3. Designs are a compromise based on experience mainly of flags commonly used in dinghy and yacht racing in the United Kingdom, and those supplied for use on yachts in the UK and Europe.
    4036
    4137= Can I change the colours? =
    4238
    4339This plugin provides flags in two different colour schemes:
    44 'natural' which aim to look like real flags
    45 'primary' which uses primary colours as often used for these flags.
     40* `natural` which aim to look like real flags
     41* `primary` which uses primary colours.
    4642
    47 We are working on an option to customise the colours.
     43We are looking at options for creating custom colour schemes in the plugin, and are also working on a tool to create custom flag files and upload them for use in the plugin.
     44
     45= Can I change the shapes? =
     46
     47This plugin provides two different shapes for letter flags:
     48* `rect` (rectangular) which is normally used in the United Kingdom and elsewhere and is provided here in a 4:3 aspect ratio
     49* `square` which are normally used in the US
     50
     51We are working on a tool to create custom flag files and upload them for use in the plugin.
     52
     53= Can I change the thickness or colour of the outline? =
     54
     55The plugin does not support this. We are working on a tool to create custom flag files and upload them for use in the plugin.
     56
     57= Can I change the designs e.g. the size of the circle on numeral pennants 1 and 2? =
     58
     59Not at the moment, but we are working on a tool to create custom flag files and upload them for use in the plugin.
     60
     61If you think a design is simply _wrong_ then look at the [support forum](https://wordpress.org/support/plugin/signal-flags/) to see if this has already been discussed or start a new topic.
     62
     63== Development ==
     64
     65Development for the Signal Flags plugin is hosted on [GitHub](https://github.com/signal-flags/signal-flags-wp-plugin).
    4866
    4967== Screenshots ==
    5068
    51 1. Signal Flags admin settings.
    52 2. A page showing some flags in use.
     691. A post showing the [signal-flag] shortcode in use.
     702. Signal Flags plugin settings.
    5371
    5472== Changelog ==
    5573
    56 = 1.0.0 =
    57 * First release
     74= 1.1.0 _11 July 2020_ =
     75
     76This is the first release of the Signal Flags plugin.
  • signal-flags/tags/1.1.0/signal-flags.php

    r2337867 r2339181  
    1212 * Plugin Name:       Signal Flags
    1313 * Description:       Display signal flags (ICS) and other nautical flags on your website.
    14  * Version:           1.0
     14 * Version:           1.1.0
    1515 * Requires at least: 4.7
    1616 * Requires PHP:      7.2
  • signal-flags/tags/1.1.0/src/Admin.php

    r2337867 r2339181  
    2929            'sectionTemplate' => 'admin/settings-page-sections',
    3030            'menuParent' => 'settings',
     31            'pageTitle' => 'Signal Flags'
    3132        ]);
    3233
     
    3738        foreach ($flagSetFiles as $file) {
    3839            $flags = include($file);
    39             $flagSets[basename($file, '.php')] = $flags['meta']['description'];
     40            $flagSets[basename($file, '.php')] = $flags['meta']['description']['short'];
    4041        }
    4142
     
    4647        }
    4748        $currentFlagsHtml .= '</div>';
     49        $description = str_replace("\n\n", "</p>\n<p>", $this->plugin->getSignalFlags()->getMeta()['description']['full']);
     50        $currentFlagsHtml .= "<p>$description</p>";
    4851
    4952        $this->adminPage->addSections([
     
    5154            // helper to the right
    5255            // supplemental underneath
    53             [
    54                 'id' => 'intro',
    55                 'title' => __('Quick start', 'signal-flags'),
    56             ],
    5756            [
    5857                // This is prefixed and used as the key in the wp_options table.
     
    7675                ],
    7776            ],
    78             [
    79                 // The default settings options group for this section.
    80                 // 'group' => 'defaults',
    81                 // Prefixed and used as the section element's id.
    82                 'id' => 'save-settings',
    83             ],
    84             [
    85                 // The default settings options group for this section.
    86                 // 'group' => 'defaults',
    87                 // Prefixed and used as the section element's id.
    88                 'id' => 'about',
    89                 'title' => __('About Signal Flags', 'signal-flags'),
    90             ],
    9177        ]);
    9278    }
  • signal-flags/tags/1.1.0/src/Plugin.php

    r2337867 r2339181  
    2020
    2121    /** @var string Current version. */
    22     protected $version = '1.0.0';
     22    protected $version = '1.1.0';
    2323
    2424    /** @var string Class for install/uninstall. */
     
    4747        if (!$this->signalFlags) {
    4848            $user_settings = get_option('signal_flags_user_settings', []);
    49             $this->signalFlags = new SignalFlags([
    50                 'flagsFile' => $user_settings['default-flag-set'] ?? 'signal-flags-00',
    51             ]);
     49            try {
     50                $this->signalFlags = new SignalFlags([
     51                    'flagsFile' => $user_settings['default-flag-set'] ?? 'signal-flags-00',
     52                ]);
     53            } catch (\Throwable $e) {
     54                // Couldn't load the requested flagset so load the default one.
     55                $this->signalFlags = new SignalFlags();
     56            }
    5257        }
    5358        return $this->signalFlags;
     
    6267            'height' => $atts['height'] ?? null,
    6368            'margin' => $atts['margin'] ?? null,
    64             'display' => $atts['display'] ?? 'inline',
     69            'display' => $atts['display'] ?? null,
    6570        ];
    6671        try {
     
    7782            'height' => $atts['height'] ?? null,
    7883            'margin' => $atts['margin'] ?? null,
    79             'display' => $atts['display'] ?? 'inline',
     84            'display' => $atts['display'] ?? null,
    8085        ];
    8186        $flags = '';
  • signal-flags/tags/1.1.0/templates/admin/settings-page-sections.tpl.php

    r2337867 r2339181  
    1313
    1414<?php if ($id === 'intro'): ?>
    15 <?php
    16 $sc1 = '[signal-flag a]';
    17 $sc2 = '[signal-flag a height=30]';
    18 $sc3 = '[signal-flag s1 width=40]';
    19 $sc4 = '[signal-flag n1 height=20 margin=4]';
    20 $sc5 = '[signal-flag ap width=50 margin="0 50px"]';
    21 $sc6 = '[signal-flags height=40 margin="10px 2px"]a n1 ap s1 z black[/signal-flags]';
    22 $sc7 = '[signal-flags width=60 margin="10px 2px"]a n1 ap s1 z black[/signal-flags]';
    23 ?>
    24 <div style="margin-bottom: 3em;">
    25 Use the shortcode <code><?php echo($sc1) ?></code> to display an A flag in a post or page.
    26 You can modify the display with options: try
    27 <code><?php echo($sc2) ?></code>
    28 <?php echo(do_shortcode($sc2)) ?>, <code><?php echo($sc3) ?></code>
    29 <?php echo(do_shortcode($sc3)) ?>, <code><?php echo($sc4) ?></code>
    30 <?php echo(do_shortcode($sc4)) ?>, <code><?php echo($sc5) ?></code>
    31 <?php echo(do_shortcode($sc5)) ?>
    32 </div>
    33 
    34 <div style="margin-bottom: 3em;">
    35 <p>Use the <code>[signal-flags]&hellip;[/signal-flags]</code> shortcode to display more than one flag:</p>
    36 <div><code><?php echo($sc6) ?></code></div>
    37 <div><?php echo(do_shortcode($sc6)) ?></div>
    38 <div><code><?php echo($sc7) ?></code></div>
    39 <div><?php echo(do_shortcode($sc7)) ?></div>
    40 </div>
    41 
    4215
    4316<?php elseif ($id === 'default-flags'): ?>
    4417
    4518<?php elseif ($id === 'save-settings'): ?>
    46 <?php submit_button('Save Settings'); ?>
    4719
    4820<?php elseif ($id === 'about'): ?>
    49 This is <?php echo $plugin['name'] ?> version
    50 <?php echo $plugin['version'] ?>.
    5121
    5222<?php else: ?>
  • signal-flags/tags/1.1.0/templates/admin/settings-page.tpl.php

    r2337867 r2339181  
    1010 */
    1111
     12$span = '<span style="font-family: Consolas, Monaco, monospace; background: rgba(0,0,0,0.07); padding: 0 4px;">';
     13$sc1 = '[signal-flag a]';
     14$sc2 = '[signal-flag a height=inline]';
     15$sc3 = '[signal-flag a height=inline-l]';
     16$sc4 = '[signal-flag a height=inline-s]';
     17$sc5 = '[signal-flag ap height=inline width=50 margin="0 50px"]';
     18$sc6 = '[signal-flags height=40 margin="0 4px"]a z n0 n9 ap s1 s3 greenwhite[/signal-flags]';
     19$sc7 = '[signal-flags width=40 margin="0 4px"]a b c d e f g[/signal-flags]';
     20$sc8 = '[signal-flags width=40 margin="0 4px"]n1 n2 n3 ap s1 s2 s3[/signal-flags]';
     21
    1222?>
     23
    1324<div class="wrap">
    1425
     
    1627
    1728<h1><?php echo get_admin_page_title() ?></h1>
     29
     30<h2>Getting started</h2>
     31
     32<p>
     33Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a
     34post or page (or anywhere you can use shortcodes), but beware the flag will
     35expand to fit the available width so use with care!
     36</p>
    1837
    1938<form action="options.php" method="post">
     
    2544// output save settings button - moved up into sections.
    2645// submit_button('Save Settings');
    27 
    2846?>
     47<?php submit_button('Save settings'); ?>
    2948</form>
    3049
     50<h2>Instructions</h2>
     51
     52<p>
     53Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a
     54post or page (or anywhere you can use shortcodes), but beware the flag will
     55expand to fit the available width so use with care!
     56</p>
     57
     58<p>
     59For use in text like this you can use the
     60<?php echo($span) ?>height=inline</span>
     61option <?php echo(do_shortcode($sc2)) ?>. You can adjust the size using
     62<?php echo($span) ?>inline-l</span> <?php echo(do_shortcode($sc3)) ?> or
     63<?php echo($span) ?>inline-s</span> <?php echo(do_shortcode($sc4)) ?>.
     64</p>
     65
     66<p>Use the <?php echo($span) ?>[signal-flags]&hellip;[/signal-flags]</span>
     67shortcode to display more than one flag, you can also use the
     68<?php echo($span) ?>margin</span> option to create some space:<br>
     69<?php echo($span.$sc6) ?></span><br>
     70<?php echo(do_shortcode($sc6)) ?>
     71</p>
     72
     73<p style="vertical-align: middle;">If you want flags and pennants to line up vertically you can use the
     74<?php echo($span) ?>width</span> option instead of
     75<?php echo($span) ?>height</span>:<br>
     76<?php echo($span.$sc7) ?></span><br>
     77<?php echo($span.$sc8) ?></span><br>
     78<?php echo(do_shortcode($sc7)) ?><br>
     79<?php echo(do_shortcode($sc8)) ?>
     80</p>
     81
     82<h2>About the Signal Flags plugin</h2>
     83
     84This is <?php echo $plugin['name'] ?> version
     85<?php echo $plugin['version'] ?>.
     86
    3187</div>
  • signal-flags/tags/1.1.0/vendor/opensums/signal-flags/src/SignalFlags.php

    r2337867 r2339181  
    1010
    1111    protected static $defaults = [
    12         'flagsFile' => 'signal-flags-00',
     12        'flagsFile' => 'flags-0',
    1313    ];
    1414
     
    5151
    5252    public function getFlagSetFiles() {
    53         return glob(__DIR__.'/../flags/signal-flags-*');
     53        return glob(__DIR__.'/../flags/*');
     54    }
     55
     56    public function getMeta() {
     57        return $this->flags['meta'];
    5458    }
    5559
     
    6064            switch ($option) {
    6165                case 'height':
    62                     $styles[] = is_numeric($value) ? "height: {$value}px" : "height: {$value}";
     66                    if (is_numeric($value)) {
     67                        $styles[] = "height: {$value}px";
     68                    } elseif ($value === 'inline') {
     69                        $styles[] = 'display: inline';
     70                        $styles[] = 'vertical-align: text-bottom';
     71                        $styles[] = 'height: 1.2em';
     72                    } elseif ($value === 'inline-l') {
     73                        $styles[] = 'display: inline';
     74                        $styles[] = 'vertical-align: text-bottom';
     75                        $styles[] = 'height: 1.5em';
     76                    } elseif ($value === 'inline-s') {
     77                        $styles[] = 'display: inline';
     78                        $styles[] = 'vertical-align: text-bottom';
     79                        $styles[] = 'height: 1em';
     80                    } else {
     81                        $styles[] = "height: {$value}";
     82                    }
     83                    break;
     84                case 'display':
     85                    $styles[] = "display: {$value}";
    6386                    break;
    6487                case 'width':
  • signal-flags/trunk/readme.txt

    r2337867 r2339181  
    11=== Signal Flags ===
     2Contributors: opensums
    23Tags: flags, signal flags, code flag, sailing
    34Requires at least: 4.7
    45Tested up to: 5.4.2
    5 Stable tag: 1.0.0
     6Stable tag: 1.1.0
    67Requires PHP: 7.2
    78License: MIT
    8 License URI: https://opensource.org/licenses/MIT
     9License URI: https://github.com/signal-flags/signal-flags-wp-plugin/blob/master/LICENSE
    910
    10 Display flags from the International Code of Signals (ICS), the Racing Rules of
    11 Sailing (RRS) and other nautical flags on your website.
     11Display flags from the International Code of Signals (ICS), the Racing Rules of Sailing (RRS) and other nautical flags and pennants on your website.
    1212
    1313== Description ==
    1414
    15 To insert an image of the flag for Letter A in a post or page, use the shortcode
    16 `[signal-flag a]`. You can use the following flags with the corresponding codes:
    17 - Alphabet flags A-Z (codes `a`-`z`)
    18 - Numeral pennants 0-9 (codes `n0` - `n9`)
    19 - Answering pennant (AP) (code `ap`)
    20 - 1st, 2nd and 3rd substitute (codes `s1`-`s3`)
    21 - Various flags defined in the Racing Rules of Sailing (codes `black`,
    22   `blackwhite`, `blue`, `green`, `greenwhite`, `red`, `yellow`)
     15= Usage =
     16To insert an image of the flag for Letter A in a post or page, use the shortcode `[signal-flag a]`. You can use the following flags with the corresponding codes:
     17* Alphabet flags A-Z (codes `a`-`z`)
     18* Numeral pennants 0-9 (codes `n0` - `n9`)
     19* Answering pennant (AP) (code `ap`)
     20* 1st, 2nd and 3rd substitute (codes `s1`-`s3`)
     21* Various flags defined in the Racing Rules of Sailing (codes `black`, `blackwhite`, `blue`, `green`, `greenwhite`, `red`, `yellow`)
    2322
    24 Images are embedded in the page using the SVG vector format (much quicker than
    25 loading a separate image file) and eight sets of flag images are included with
    26 the following options:
    27 - with or without outlines for ease of use on white backgrounds (including when
    28   printed)
    29 - 4x3 and square shapes for letter flags
    30 - in 'natural' or 'primary' colours.
     23There are different sets of flags selectable from the admin settings page.
     24
     25= About the flag images =
     26Images are embedded in the page using the SVG vector format (much quicker than loading a separate image file) and eight sets of flag images are included with the following options:
     27* with or without outlines for ease of use on white backgrounds (including when printed)
     28* rectangular (4:3 aspect ratio) and square shapes for letter flags
     29* in 'natural' or 'primary' colours.
    3130
    3231== Frequently Asked Questions ==
     
    3433= Why don't these flags look like the ones we use at our club? =
    3534
    36 The International Maritime Organisation (IMO) publishes standard designs, but
    37 there are many variations in the shapes of flags in use around the world.
    38 This plugin provides letter flags in square and 4:3 aspect ratios, but all the
    39 pennants are 2:1 and the triangle flags 4:3.
     35There are many variations in the shapes and designs of flags in use around the world. This plugin provides letter flags in square and 4:3 aspect ratios, but all the pennants are 2:1 and the triangle flags 4:3. Designs are a compromise based on experience mainly of flags commonly used in dinghy and yacht racing in the United Kingdom, and those supplied for use on yachts in the UK and Europe.
    4036
    4137= Can I change the colours? =
    4238
    4339This plugin provides flags in two different colour schemes:
    44 'natural' which aim to look like real flags
    45 'primary' which uses primary colours as often used for these flags.
     40* `natural` which aim to look like real flags
     41* `primary` which uses primary colours.
    4642
    47 We are working on an option to customise the colours.
     43We are looking at options for creating custom colour schemes in the plugin, and are also working on a tool to create custom flag files and upload them for use in the plugin.
     44
     45= Can I change the shapes? =
     46
     47This plugin provides two different shapes for letter flags:
     48* `rect` (rectangular) which is normally used in the United Kingdom and elsewhere and is provided here in a 4:3 aspect ratio
     49* `square` which are normally used in the US
     50
     51We are working on a tool to create custom flag files and upload them for use in the plugin.
     52
     53= Can I change the thickness or colour of the outline? =
     54
     55The plugin does not support this. We are working on a tool to create custom flag files and upload them for use in the plugin.
     56
     57= Can I change the designs e.g. the size of the circle on numeral pennants 1 and 2? =
     58
     59Not at the moment, but we are working on a tool to create custom flag files and upload them for use in the plugin.
     60
     61If you think a design is simply _wrong_ then look at the [support forum](https://wordpress.org/support/plugin/signal-flags/) to see if this has already been discussed or start a new topic.
     62
     63== Development ==
     64
     65Development for the Signal Flags plugin is hosted on [GitHub](https://github.com/signal-flags/signal-flags-wp-plugin).
    4866
    4967== Screenshots ==
    5068
    51 1. Signal Flags admin settings.
    52 2. A page showing some flags in use.
     691. A post showing the [signal-flag] shortcode in use.
     702. Signal Flags plugin settings.
    5371
    5472== Changelog ==
    5573
    56 = 1.0.0 =
    57 * First release
     74= 1.1.0 _11 July 2020_ =
     75
     76This is the first release of the Signal Flags plugin.
  • signal-flags/trunk/signal-flags.php

    r2337867 r2339181  
    1212 * Plugin Name:       Signal Flags
    1313 * Description:       Display signal flags (ICS) and other nautical flags on your website.
    14  * Version:           1.0
     14 * Version:           1.1.0
    1515 * Requires at least: 4.7
    1616 * Requires PHP:      7.2
  • signal-flags/trunk/src/Admin.php

    r2337867 r2339181  
    2929            'sectionTemplate' => 'admin/settings-page-sections',
    3030            'menuParent' => 'settings',
     31            'pageTitle' => 'Signal Flags'
    3132        ]);
    3233
     
    3738        foreach ($flagSetFiles as $file) {
    3839            $flags = include($file);
    39             $flagSets[basename($file, '.php')] = $flags['meta']['description'];
     40            $flagSets[basename($file, '.php')] = $flags['meta']['description']['short'];
    4041        }
    4142
     
    4647        }
    4748        $currentFlagsHtml .= '</div>';
     49        $description = str_replace("\n\n", "</p>\n<p>", $this->plugin->getSignalFlags()->getMeta()['description']['full']);
     50        $currentFlagsHtml .= "<p>$description</p>";
    4851
    4952        $this->adminPage->addSections([
     
    5154            // helper to the right
    5255            // supplemental underneath
    53             [
    54                 'id' => 'intro',
    55                 'title' => __('Quick start', 'signal-flags'),
    56             ],
    5756            [
    5857                // This is prefixed and used as the key in the wp_options table.
     
    7675                ],
    7776            ],
    78             [
    79                 // The default settings options group for this section.
    80                 // 'group' => 'defaults',
    81                 // Prefixed and used as the section element's id.
    82                 'id' => 'save-settings',
    83             ],
    84             [
    85                 // The default settings options group for this section.
    86                 // 'group' => 'defaults',
    87                 // Prefixed and used as the section element's id.
    88                 'id' => 'about',
    89                 'title' => __('About Signal Flags', 'signal-flags'),
    90             ],
    9177        ]);
    9278    }
  • signal-flags/trunk/src/Plugin.php

    r2337867 r2339181  
    2020
    2121    /** @var string Current version. */
    22     protected $version = '1.0.0';
     22    protected $version = '1.1.0';
    2323
    2424    /** @var string Class for install/uninstall. */
     
    4747        if (!$this->signalFlags) {
    4848            $user_settings = get_option('signal_flags_user_settings', []);
    49             $this->signalFlags = new SignalFlags([
    50                 'flagsFile' => $user_settings['default-flag-set'] ?? 'signal-flags-00',
    51             ]);
     49            try {
     50                $this->signalFlags = new SignalFlags([
     51                    'flagsFile' => $user_settings['default-flag-set'] ?? 'signal-flags-00',
     52                ]);
     53            } catch (\Throwable $e) {
     54                // Couldn't load the requested flagset so load the default one.
     55                $this->signalFlags = new SignalFlags();
     56            }
    5257        }
    5358        return $this->signalFlags;
     
    6267            'height' => $atts['height'] ?? null,
    6368            'margin' => $atts['margin'] ?? null,
    64             'display' => $atts['display'] ?? 'inline',
     69            'display' => $atts['display'] ?? null,
    6570        ];
    6671        try {
     
    7782            'height' => $atts['height'] ?? null,
    7883            'margin' => $atts['margin'] ?? null,
    79             'display' => $atts['display'] ?? 'inline',
     84            'display' => $atts['display'] ?? null,
    8085        ];
    8186        $flags = '';
  • signal-flags/trunk/templates/admin/settings-page-sections.tpl.php

    r2337867 r2339181  
    1313
    1414<?php if ($id === 'intro'): ?>
    15 <?php
    16 $sc1 = '[signal-flag a]';
    17 $sc2 = '[signal-flag a height=30]';
    18 $sc3 = '[signal-flag s1 width=40]';
    19 $sc4 = '[signal-flag n1 height=20 margin=4]';
    20 $sc5 = '[signal-flag ap width=50 margin="0 50px"]';
    21 $sc6 = '[signal-flags height=40 margin="10px 2px"]a n1 ap s1 z black[/signal-flags]';
    22 $sc7 = '[signal-flags width=60 margin="10px 2px"]a n1 ap s1 z black[/signal-flags]';
    23 ?>
    24 <div style="margin-bottom: 3em;">
    25 Use the shortcode <code><?php echo($sc1) ?></code> to display an A flag in a post or page.
    26 You can modify the display with options: try
    27 <code><?php echo($sc2) ?></code>
    28 <?php echo(do_shortcode($sc2)) ?>, <code><?php echo($sc3) ?></code>
    29 <?php echo(do_shortcode($sc3)) ?>, <code><?php echo($sc4) ?></code>
    30 <?php echo(do_shortcode($sc4)) ?>, <code><?php echo($sc5) ?></code>
    31 <?php echo(do_shortcode($sc5)) ?>
    32 </div>
    33 
    34 <div style="margin-bottom: 3em;">
    35 <p>Use the <code>[signal-flags]&hellip;[/signal-flags]</code> shortcode to display more than one flag:</p>
    36 <div><code><?php echo($sc6) ?></code></div>
    37 <div><?php echo(do_shortcode($sc6)) ?></div>
    38 <div><code><?php echo($sc7) ?></code></div>
    39 <div><?php echo(do_shortcode($sc7)) ?></div>
    40 </div>
    41 
    4215
    4316<?php elseif ($id === 'default-flags'): ?>
    4417
    4518<?php elseif ($id === 'save-settings'): ?>
    46 <?php submit_button('Save Settings'); ?>
    4719
    4820<?php elseif ($id === 'about'): ?>
    49 This is <?php echo $plugin['name'] ?> version
    50 <?php echo $plugin['version'] ?>.
    5121
    5222<?php else: ?>
  • signal-flags/trunk/templates/admin/settings-page.tpl.php

    r2337867 r2339181  
    1010 */
    1111
     12$span = '<span style="font-family: Consolas, Monaco, monospace; background: rgba(0,0,0,0.07); padding: 0 4px;">';
     13$sc1 = '[signal-flag a]';
     14$sc2 = '[signal-flag a height=inline]';
     15$sc3 = '[signal-flag a height=inline-l]';
     16$sc4 = '[signal-flag a height=inline-s]';
     17$sc5 = '[signal-flag ap height=inline width=50 margin="0 50px"]';
     18$sc6 = '[signal-flags height=40 margin="0 4px"]a z n0 n9 ap s1 s3 greenwhite[/signal-flags]';
     19$sc7 = '[signal-flags width=40 margin="0 4px"]a b c d e f g[/signal-flags]';
     20$sc8 = '[signal-flags width=40 margin="0 4px"]n1 n2 n3 ap s1 s2 s3[/signal-flags]';
     21
    1222?>
     23
    1324<div class="wrap">
    1425
     
    1627
    1728<h1><?php echo get_admin_page_title() ?></h1>
     29
     30<h2>Getting started</h2>
     31
     32<p>
     33Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a
     34post or page (or anywhere you can use shortcodes), but beware the flag will
     35expand to fit the available width so use with care!
     36</p>
    1837
    1938<form action="options.php" method="post">
     
    2544// output save settings button - moved up into sections.
    2645// submit_button('Save Settings');
    27 
    2846?>
     47<?php submit_button('Save settings'); ?>
    2948</form>
    3049
     50<h2>Instructions</h2>
     51
     52<p>
     53Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a
     54post or page (or anywhere you can use shortcodes), but beware the flag will
     55expand to fit the available width so use with care!
     56</p>
     57
     58<p>
     59For use in text like this you can use the
     60<?php echo($span) ?>height=inline</span>
     61option <?php echo(do_shortcode($sc2)) ?>. You can adjust the size using
     62<?php echo($span) ?>inline-l</span> <?php echo(do_shortcode($sc3)) ?> or
     63<?php echo($span) ?>inline-s</span> <?php echo(do_shortcode($sc4)) ?>.
     64</p>
     65
     66<p>Use the <?php echo($span) ?>[signal-flags]&hellip;[/signal-flags]</span>
     67shortcode to display more than one flag, you can also use the
     68<?php echo($span) ?>margin</span> option to create some space:<br>
     69<?php echo($span.$sc6) ?></span><br>
     70<?php echo(do_shortcode($sc6)) ?>
     71</p>
     72
     73<p style="vertical-align: middle;">If you want flags and pennants to line up vertically you can use the
     74<?php echo($span) ?>width</span> option instead of
     75<?php echo($span) ?>height</span>:<br>
     76<?php echo($span.$sc7) ?></span><br>
     77<?php echo($span.$sc8) ?></span><br>
     78<?php echo(do_shortcode($sc7)) ?><br>
     79<?php echo(do_shortcode($sc8)) ?>
     80</p>
     81
     82<h2>About the Signal Flags plugin</h2>
     83
     84This is <?php echo $plugin['name'] ?> version
     85<?php echo $plugin['version'] ?>.
     86
    3187</div>
  • signal-flags/trunk/vendor/opensums/signal-flags/src/SignalFlags.php

    r2337867 r2339181  
    1010
    1111    protected static $defaults = [
    12         'flagsFile' => 'signal-flags-00',
     12        'flagsFile' => 'flags-0',
    1313    ];
    1414
     
    5151
    5252    public function getFlagSetFiles() {
    53         return glob(__DIR__.'/../flags/signal-flags-*');
     53        return glob(__DIR__.'/../flags/*');
     54    }
     55
     56    public function getMeta() {
     57        return $this->flags['meta'];
    5458    }
    5559
     
    6064            switch ($option) {
    6165                case 'height':
    62                     $styles[] = is_numeric($value) ? "height: {$value}px" : "height: {$value}";
     66                    if (is_numeric($value)) {
     67                        $styles[] = "height: {$value}px";
     68                    } elseif ($value === 'inline') {
     69                        $styles[] = 'display: inline';
     70                        $styles[] = 'vertical-align: text-bottom';
     71                        $styles[] = 'height: 1.2em';
     72                    } elseif ($value === 'inline-l') {
     73                        $styles[] = 'display: inline';
     74                        $styles[] = 'vertical-align: text-bottom';
     75                        $styles[] = 'height: 1.5em';
     76                    } elseif ($value === 'inline-s') {
     77                        $styles[] = 'display: inline';
     78                        $styles[] = 'vertical-align: text-bottom';
     79                        $styles[] = 'height: 1em';
     80                    } else {
     81                        $styles[] = "height: {$value}";
     82                    }
     83                    break;
     84                case 'display':
     85                    $styles[] = "display: {$value}";
    6386                    break;
    6487                case 'width':
Note: See TracChangeset for help on using the changeset viewer.