Changeset 2339181
- Timestamp:
- 07/11/2020 11:30:07 PM (6 years ago)
- Location:
- signal-flags
- Files:
-
- 16 deleted
- 14 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from signal-flags/trunk)
-
tags/1.1.0/readme.txt (modified) (2 diffs)
-
tags/1.1.0/signal-flags.php (modified) (1 diff)
-
tags/1.1.0/src/Admin.php (modified) (5 diffs)
-
tags/1.1.0/src/Plugin.php (modified) (4 diffs)
-
tags/1.1.0/templates/admin/settings-page-sections.tpl.php (modified) (1 diff)
-
tags/1.1.0/templates/admin/settings-page.tpl.php (modified) (3 diffs)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-00.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-01.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-02.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-03.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-04.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-05.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-06.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/flags/signal-flags-07.php (deleted)
-
tags/1.1.0/vendor/opensums/signal-flags/src/SignalFlags.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/signal-flags.php (modified) (1 diff)
-
trunk/src/Admin.php (modified) (5 diffs)
-
trunk/src/Plugin.php (modified) (4 diffs)
-
trunk/templates/admin/settings-page-sections.tpl.php (modified) (1 diff)
-
trunk/templates/admin/settings-page.tpl.php (modified) (3 diffs)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-00.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-01.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-02.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-03.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-04.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-05.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-06.php (deleted)
-
trunk/vendor/opensums/signal-flags/flags/signal-flags-07.php (deleted)
-
trunk/vendor/opensums/signal-flags/src/SignalFlags.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
signal-flags/tags/1.1.0/readme.txt
r2337867 r2339181 1 1 === Signal Flags === 2 Contributors: opensums 2 3 Tags: flags, signal flags, code flag, sailing 3 4 Requires at least: 4.7 4 5 Tested up to: 5.4.2 5 Stable tag: 1. 0.06 Stable tag: 1.1.0 6 7 Requires PHP: 7.2 7 8 License: MIT 8 License URI: https:// opensource.org/licenses/MIT9 License URI: https://github.com/signal-flags/signal-flags-wp-plugin/blob/master/LICENSE 9 10 10 Display flags from the International Code of Signals (ICS), the Racing Rules of 11 Sailing (RRS) and other nautical flags on your website. 11 Display flags from the International Code of Signals (ICS), the Racing Rules of Sailing (RRS) and other nautical flags and pennants on your website. 12 12 13 13 == Description == 14 14 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 = 16 To 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`) 23 22 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 - 4x3and square shapes for letter flags30 -in 'natural' or 'primary' colours.23 There are different sets of flags selectable from the admin settings page. 24 25 = About the flag images = 26 Images 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. 31 30 32 31 == Frequently Asked Questions == … … 34 33 = Why don't these flags look like the ones we use at our club? = 35 34 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. 35 There 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. 40 36 41 37 = Can I change the colours? = 42 38 43 39 This plugin provides flags in two different colour schemes: 44 'natural'which aim to look like real flags45 '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. 46 42 47 We are working on an option to customise the colours. 43 We 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 47 This 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 51 We 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 55 The 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 59 Not at the moment, but we are working on a tool to create custom flag files and upload them for use in the plugin. 60 61 If 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 65 Development for the Signal Flags plugin is hosted on [GitHub](https://github.com/signal-flags/signal-flags-wp-plugin). 48 66 49 67 == Screenshots == 50 68 51 1. Signal Flags admin settings.52 2. A page showing some flags in use.69 1. A post showing the [signal-flag] shortcode in use. 70 2. Signal Flags plugin settings. 53 71 54 72 == Changelog == 55 73 56 = 1.0.0 = 57 * First release 74 = 1.1.0 _11 July 2020_ = 75 76 This is the first release of the Signal Flags plugin. -
signal-flags/tags/1.1.0/signal-flags.php
r2337867 r2339181 12 12 * Plugin Name: Signal Flags 13 13 * Description: Display signal flags (ICS) and other nautical flags on your website. 14 * Version: 1. 014 * Version: 1.1.0 15 15 * Requires at least: 4.7 16 16 * Requires PHP: 7.2 -
signal-flags/tags/1.1.0/src/Admin.php
r2337867 r2339181 29 29 'sectionTemplate' => 'admin/settings-page-sections', 30 30 'menuParent' => 'settings', 31 'pageTitle' => 'Signal Flags' 31 32 ]); 32 33 … … 37 38 foreach ($flagSetFiles as $file) { 38 39 $flags = include($file); 39 $flagSets[basename($file, '.php')] = $flags['meta']['description'] ;40 $flagSets[basename($file, '.php')] = $flags['meta']['description']['short']; 40 41 } 41 42 … … 46 47 } 47 48 $currentFlagsHtml .= '</div>'; 49 $description = str_replace("\n\n", "</p>\n<p>", $this->plugin->getSignalFlags()->getMeta()['description']['full']); 50 $currentFlagsHtml .= "<p>$description</p>"; 48 51 49 52 $this->adminPage->addSections([ … … 51 54 // helper to the right 52 55 // supplemental underneath 53 [54 'id' => 'intro',55 'title' => __('Quick start', 'signal-flags'),56 ],57 56 [ 58 57 // This is prefixed and used as the key in the wp_options table. … … 76 75 ], 77 76 ], 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 ],91 77 ]); 92 78 } -
signal-flags/tags/1.1.0/src/Plugin.php
r2337867 r2339181 20 20 21 21 /** @var string Current version. */ 22 protected $version = '1. 0.0';22 protected $version = '1.1.0'; 23 23 24 24 /** @var string Class for install/uninstall. */ … … 47 47 if (!$this->signalFlags) { 48 48 $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 } 52 57 } 53 58 return $this->signalFlags; … … 62 67 'height' => $atts['height'] ?? null, 63 68 'margin' => $atts['margin'] ?? null, 64 'display' => $atts['display'] ?? 'inline',69 'display' => $atts['display'] ?? null, 65 70 ]; 66 71 try { … … 77 82 'height' => $atts['height'] ?? null, 78 83 'margin' => $atts['margin'] ?? null, 79 'display' => $atts['display'] ?? 'inline',84 'display' => $atts['display'] ?? null, 80 85 ]; 81 86 $flags = ''; -
signal-flags/tags/1.1.0/templates/admin/settings-page-sections.tpl.php
r2337867 r2339181 13 13 14 14 <?php if ($id === 'intro'): ?> 15 <?php16 $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: try27 <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]…[/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 42 15 43 16 <?php elseif ($id === 'default-flags'): ?> 44 17 45 18 <?php elseif ($id === 'save-settings'): ?> 46 <?php submit_button('Save Settings'); ?>47 19 48 20 <?php elseif ($id === 'about'): ?> 49 This is <?php echo $plugin['name'] ?> version50 <?php echo $plugin['version'] ?>.51 21 52 22 <?php else: ?> -
signal-flags/tags/1.1.0/templates/admin/settings-page.tpl.php
r2337867 r2339181 10 10 */ 11 11 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 12 22 ?> 23 13 24 <div class="wrap"> 14 25 … … 16 27 17 28 <h1><?php echo get_admin_page_title() ?></h1> 29 30 <h2>Getting started</h2> 31 32 <p> 33 Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a 34 post or page (or anywhere you can use shortcodes), but beware the flag will 35 expand to fit the available width so use with care! 36 </p> 18 37 19 38 <form action="options.php" method="post"> … … 25 44 // output save settings button - moved up into sections. 26 45 // submit_button('Save Settings'); 27 28 46 ?> 47 <?php submit_button('Save settings'); ?> 29 48 </form> 30 49 50 <h2>Instructions</h2> 51 52 <p> 53 Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a 54 post or page (or anywhere you can use shortcodes), but beware the flag will 55 expand to fit the available width so use with care! 56 </p> 57 58 <p> 59 For use in text like this you can use the 60 <?php echo($span) ?>height=inline</span> 61 option <?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]…[/signal-flags]</span> 67 shortcode 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 84 This is <?php echo $plugin['name'] ?> version 85 <?php echo $plugin['version'] ?>. 86 31 87 </div> -
signal-flags/tags/1.1.0/vendor/opensums/signal-flags/src/SignalFlags.php
r2337867 r2339181 10 10 11 11 protected static $defaults = [ 12 'flagsFile' => ' signal-flags-00',12 'flagsFile' => 'flags-0', 13 13 ]; 14 14 … … 51 51 52 52 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']; 54 58 } 55 59 … … 60 64 switch ($option) { 61 65 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}"; 63 86 break; 64 87 case 'width': -
signal-flags/trunk/readme.txt
r2337867 r2339181 1 1 === Signal Flags === 2 Contributors: opensums 2 3 Tags: flags, signal flags, code flag, sailing 3 4 Requires at least: 4.7 4 5 Tested up to: 5.4.2 5 Stable tag: 1. 0.06 Stable tag: 1.1.0 6 7 Requires PHP: 7.2 7 8 License: MIT 8 License URI: https:// opensource.org/licenses/MIT9 License URI: https://github.com/signal-flags/signal-flags-wp-plugin/blob/master/LICENSE 9 10 10 Display flags from the International Code of Signals (ICS), the Racing Rules of 11 Sailing (RRS) and other nautical flags on your website. 11 Display flags from the International Code of Signals (ICS), the Racing Rules of Sailing (RRS) and other nautical flags and pennants on your website. 12 12 13 13 == Description == 14 14 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 = 16 To 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`) 23 22 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 - 4x3and square shapes for letter flags30 -in 'natural' or 'primary' colours.23 There are different sets of flags selectable from the admin settings page. 24 25 = About the flag images = 26 Images 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. 31 30 32 31 == Frequently Asked Questions == … … 34 33 = Why don't these flags look like the ones we use at our club? = 35 34 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. 35 There 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. 40 36 41 37 = Can I change the colours? = 42 38 43 39 This plugin provides flags in two different colour schemes: 44 'natural'which aim to look like real flags45 '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. 46 42 47 We are working on an option to customise the colours. 43 We 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 47 This 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 51 We 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 55 The 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 59 Not at the moment, but we are working on a tool to create custom flag files and upload them for use in the plugin. 60 61 If 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 65 Development for the Signal Flags plugin is hosted on [GitHub](https://github.com/signal-flags/signal-flags-wp-plugin). 48 66 49 67 == Screenshots == 50 68 51 1. Signal Flags admin settings.52 2. A page showing some flags in use.69 1. A post showing the [signal-flag] shortcode in use. 70 2. Signal Flags plugin settings. 53 71 54 72 == Changelog == 55 73 56 = 1.0.0 = 57 * First release 74 = 1.1.0 _11 July 2020_ = 75 76 This is the first release of the Signal Flags plugin. -
signal-flags/trunk/signal-flags.php
r2337867 r2339181 12 12 * Plugin Name: Signal Flags 13 13 * Description: Display signal flags (ICS) and other nautical flags on your website. 14 * Version: 1. 014 * Version: 1.1.0 15 15 * Requires at least: 4.7 16 16 * Requires PHP: 7.2 -
signal-flags/trunk/src/Admin.php
r2337867 r2339181 29 29 'sectionTemplate' => 'admin/settings-page-sections', 30 30 'menuParent' => 'settings', 31 'pageTitle' => 'Signal Flags' 31 32 ]); 32 33 … … 37 38 foreach ($flagSetFiles as $file) { 38 39 $flags = include($file); 39 $flagSets[basename($file, '.php')] = $flags['meta']['description'] ;40 $flagSets[basename($file, '.php')] = $flags['meta']['description']['short']; 40 41 } 41 42 … … 46 47 } 47 48 $currentFlagsHtml .= '</div>'; 49 $description = str_replace("\n\n", "</p>\n<p>", $this->plugin->getSignalFlags()->getMeta()['description']['full']); 50 $currentFlagsHtml .= "<p>$description</p>"; 48 51 49 52 $this->adminPage->addSections([ … … 51 54 // helper to the right 52 55 // supplemental underneath 53 [54 'id' => 'intro',55 'title' => __('Quick start', 'signal-flags'),56 ],57 56 [ 58 57 // This is prefixed and used as the key in the wp_options table. … … 76 75 ], 77 76 ], 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 ],91 77 ]); 92 78 } -
signal-flags/trunk/src/Plugin.php
r2337867 r2339181 20 20 21 21 /** @var string Current version. */ 22 protected $version = '1. 0.0';22 protected $version = '1.1.0'; 23 23 24 24 /** @var string Class for install/uninstall. */ … … 47 47 if (!$this->signalFlags) { 48 48 $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 } 52 57 } 53 58 return $this->signalFlags; … … 62 67 'height' => $atts['height'] ?? null, 63 68 'margin' => $atts['margin'] ?? null, 64 'display' => $atts['display'] ?? 'inline',69 'display' => $atts['display'] ?? null, 65 70 ]; 66 71 try { … … 77 82 'height' => $atts['height'] ?? null, 78 83 'margin' => $atts['margin'] ?? null, 79 'display' => $atts['display'] ?? 'inline',84 'display' => $atts['display'] ?? null, 80 85 ]; 81 86 $flags = ''; -
signal-flags/trunk/templates/admin/settings-page-sections.tpl.php
r2337867 r2339181 13 13 14 14 <?php if ($id === 'intro'): ?> 15 <?php16 $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: try27 <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]…[/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 42 15 43 16 <?php elseif ($id === 'default-flags'): ?> 44 17 45 18 <?php elseif ($id === 'save-settings'): ?> 46 <?php submit_button('Save Settings'); ?>47 19 48 20 <?php elseif ($id === 'about'): ?> 49 This is <?php echo $plugin['name'] ?> version50 <?php echo $plugin['version'] ?>.51 21 52 22 <?php else: ?> -
signal-flags/trunk/templates/admin/settings-page.tpl.php
r2337867 r2339181 10 10 */ 11 11 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 12 22 ?> 23 13 24 <div class="wrap"> 14 25 … … 16 27 17 28 <h1><?php echo get_admin_page_title() ?></h1> 29 30 <h2>Getting started</h2> 31 32 <p> 33 Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a 34 post or page (or anywhere you can use shortcodes), but beware the flag will 35 expand to fit the available width so use with care! 36 </p> 18 37 19 38 <form action="options.php" method="post"> … … 25 44 // output save settings button - moved up into sections. 26 45 // submit_button('Save Settings'); 27 28 46 ?> 47 <?php submit_button('Save settings'); ?> 29 48 </form> 30 49 50 <h2>Instructions</h2> 51 52 <p> 53 Use the shortcode <?php echo($span.$sc1) ?></span> to display an A flag in a 54 post or page (or anywhere you can use shortcodes), but beware the flag will 55 expand to fit the available width so use with care! 56 </p> 57 58 <p> 59 For use in text like this you can use the 60 <?php echo($span) ?>height=inline</span> 61 option <?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]…[/signal-flags]</span> 67 shortcode 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 84 This is <?php echo $plugin['name'] ?> version 85 <?php echo $plugin['version'] ?>. 86 31 87 </div> -
signal-flags/trunk/vendor/opensums/signal-flags/src/SignalFlags.php
r2337867 r2339181 10 10 11 11 protected static $defaults = [ 12 'flagsFile' => ' signal-flags-00',12 'flagsFile' => 'flags-0', 13 13 ]; 14 14 … … 51 51 52 52 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']; 54 58 } 55 59 … … 60 64 switch ($option) { 61 65 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}"; 63 86 break; 64 87 case 'width':
Note: See TracChangeset
for help on using the changeset viewer.