Plugin Directory

Changeset 1911852


Ignore:
Timestamp:
07/19/2018 08:05:18 PM (8 years ago)
Author:
jondor
Message:

added redirect to latest post function

Location:
phototools/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • phototools/trunk/languages/phototools-nl_NL.po

    r1895338 r1911852  
    55"Project-Id-Version: phototools 1.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/phototools\n"
    7 "POT-Creation-Date: 2018-06-19 21:37+0200\n"
    8 "PO-Revision-Date: 2018-06-19 21:39+0200\n"
     7"POT-Creation-Date: 2018-07-19 22:02+0200\n"
     8"PO-Revision-Date: 2018-07-19 22:03+0200\n"
    99"Last-Translator: Gerhard Hoogterp <admin@funsite.eu>\n"
    1010"Language-Team: \n"
     
    1616"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    1717
    18 #: phototools.php:87
     18#: phototools.php:92
    1919msgid "General info"
    2020msgstr "Algemeen informatie"
    2121
    22 #: phototools.php:88
     22#: phototools.php:93
    2323msgid "Settings"
    2424msgstr "Instellingen"
    2525
    26 #: phototools.php:136 phototools.php:149
     26#: phototools.php:145 phototools.php:158
    2727msgid "Phototools"
    2828msgstr "Fototools"
    2929
    30 #: phototools.php:152
     30#: phototools.php:161
    3131msgid ""
    3232"Phototools is a collection of plugins which add functionality for those who "
     
    3636"Wordpress als fotoblog of gallerij gebruiken."
    3737
    38 #: phototools.php:167
     38#: phototools.php:176
    3939msgid "The following plugins in this series are installed:"
    4040msgstr "De onderstaande plugins van deze serie zijn geïnstalleerd:"
    4141
    42 #: phototools.php:205
     42#: phototools.php:219
    4343msgid "Dashboard"
    4444msgstr "Dashboard"
    4545
    46 #: phototools.php:207
     46#: phototools.php:221
    4747msgid "Replace activity widget:"
    4848msgstr "Vervang activiteiten widget:"
    4949
    50 #: phototools.php:212
     50#: phototools.php:226
    5151msgid "No. publishing soon:"
    5252msgstr "No. \"Binnenkort publiceren\":"
    5353
    54 #: phototools.php:216
     54#: phototools.php:230
    5555msgid "No. published recently:"
    5656msgstr "No.\" Recent gepubliceerd\":"
    5757
    58 #: phototools.php:220
     58#: phototools.php:234
    5959msgid "No. recent comments:"
    6060msgstr "No. \"Recente reacties\":"
    6161
    62 #: phototools.php:225
     62#: phototools.php:239
    6363msgid "Extra's"
    6464msgstr "Extras"
    6565
    66 #: phototools.php:226
     66#: phototools.php:240
    6767msgid "Enable use of shortcodes in widgets"
    6868msgstr "Maak het gebruik van shortcodes in widgets mogelijk"
    6969
    70 #: phototools.php:231
     70#: phototools.php:245
    7171msgid "Enable use of the photogroup taxonomy"
    7272msgstr "Maak gebruik van de fotogroep taxonomy"
    7373
    74 #: phototools.php:236
     74#: phototools.php:250
    7575msgid "Enable fuzzy dates"
    7676msgstr "Gebruik \"fuzzy\" datums"
    7777
    78 #: phototools.php:241
     78#: phototools.php:255
    7979msgid "Add rich data to posts with a featured image"
    8080msgstr "Voeg \"rich data\" toe aan posts met een uitgelichte foto"
    8181
    82 #: phototools.php:320
     82#: phototools.php:260
     83#, fuzzy
     84msgid "use the \"redirect to the latest post\""
     85msgstr "gebruik de \"redirect naar de laatste post\""
     86
     87#: phototools.php:265
     88msgid "Redirect string"
     89msgstr "Redirect string"
     90
     91#: phototools.php:356
    8392msgid "now"
    8493msgstr "nu"
    8594
    86 #: phototools.php:324
     95#: phototools.php:360
    8796msgid "just"
    8897msgstr "net"
    8998
    90 #: phototools.php:325
     99#: phototools.php:361
    91100msgid "1 minute ago"
    92101msgstr "1 minuut geleden"
    93102
    94 #: phototools.php:326
     103#: phototools.php:362
    95104msgid " minutes ago"
    96105msgstr " minuten geleden"
    97106
    98 #: phototools.php:327
     107#: phototools.php:363
    99108msgid " hours ago"
    100109msgstr " uren geleden"
    101110
    102 #: phototools.php:328
     111#: phototools.php:364
    103112msgid "1 hour ago"
    104113msgstr "1 uur geleden"
    105114
    106 #: phototools.php:331
     115#: phototools.php:367
    107116msgid "yesterday"
    108117msgstr "gisteren"
    109118
    110 #: phototools.php:332
     119#: phototools.php:368
    111120msgid "the day before yesterday"
    112121msgstr "eergister"
    113122
    114 #: phototools.php:333
     123#: phototools.php:369
    115124#, php-format
    116125msgid "%s days ago"
    117126msgstr "%s dagen geleden"
    118127
    119 #: phototools.php:334
     128#: phototools.php:370
    120129#, php-format
    121130msgid "%s weeks ago"
    122131msgstr "%s weken geleden"
    123132
    124 #: phototools.php:340
     133#: phototools.php:376
    125134msgid "in a moment"
    126135msgstr "zometeen"
    127136
    128 #: phototools.php:341
     137#: phototools.php:377
    129138msgid "in a minute"
    130139msgstr "over een minuut"
    131140
    132 #: phototools.php:342
     141#: phototools.php:378
    133142#, php-format
    134143msgid "in %s minutes"
    135144msgstr "over %s minuten"
    136145
    137 #: phototools.php:343
     146#: phototools.php:379
    138147msgid "in an hour"
    139148msgstr "over een uur"
    140149
    141 #: phototools.php:344
     150#: phototools.php:380
    142151#, php-format
    143152msgid "in %s hours"
    144153msgstr "over %s uren"
    145154
    146 #: phototools.php:346
     155#: phototools.php:382
    147156msgid "tomorrow"
    148157msgstr "morgen"
    149158
    150 #: phototools.php:347
     159#: phototools.php:383
    151160msgid "the day after tomorrow"
    152161msgstr "Overmorgen"
    153162
    154 #: phototools.php:348
     163#: phototools.php:384
    155164#, php-format
    156165msgid "in %s days"
    157166msgstr "over %s dagen"
    158167
    159 #: phototools.php:349
     168#: phototools.php:385
    160169#, php-format
    161170msgid "in %s weeks"
    162171msgstr "over %s weken"
    163172
    164 #: phototools.php:359
     173#: phototools.php:395
    165174msgid "Publishing Soon"
    166175msgstr "Binnenkort publiceren"
    167176
    168 #: phototools.php:366
     177#: phototools.php:402
    169178msgid "Published Recent"
    170179msgstr "Recent gepubliceerd"
    171180
    172 #: phototools.php:374
     181#: phototools.php:410
    173182msgid "Recent Comments"
    174183msgstr "Recente reacties"
    175184
    176 #: phototools.php:394
     185#: phototools.php:430
    177186msgid "edit post"
    178187msgstr "bewerkt"
    179188
    180 #: phototools.php:395
     189#: phototools.php:431
    181190msgid "view post"
    182191msgstr "bekijk"
    183192
    184 #: phototools.php:440
     193#: phototools.php:476
    185194msgid "Approve"
    186195msgstr "Toelaten"
    187196
    188 #: phototools.php:441
     197#: phototools.php:477
    189198msgid "Unapprove"
    190199msgstr "Weigeren"
    191200
    192 #: phototools.php:442
     201#: phototools.php:478
    193202msgid "Edit"
    194203msgstr "Bewerken"
    195204
    196 #: phototools.php:443
     205#: phototools.php:479
    197206msgid "Reply"
    198207msgstr "Reageer"
    199208
    200 #: phototools.php:448
     209#: phototools.php:484
    201210msgid "Delete Permanently"
    202211msgstr "Verwijder"
    203212
    204 #: phototools.php:454
     213#: phototools.php:490
    205214msgid "View"
    206215msgstr "Bekijk"
    207216
    208 #: phototools.php:559
     217#: phototools.php:627
    209218msgid "Search groups"
    210219msgstr "Doorzoekn groepen"
    211220
    212 #: phototools.php:560
     221#: phototools.php:628
    213222msgid "Popular groups"
    214223msgstr "Populaire groepen"
    215224
    216 #: phototools.php:561
     225#: phototools.php:629
    217226msgid "All groups"
    218227msgstr "Alle groepen"
    219228
    220 #: phototools.php:564
     229#: phototools.php:632
    221230msgid "Edit photogroup"
    222231msgstr "Bewerk fotogroep"
    223232
    224 #: phototools.php:565
     233#: phototools.php:633
    225234msgid "Update photogroup"
    226235msgstr "Wijzig fotogroep"
    227236
    228 #: phototools.php:566
     237#: phototools.php:634
    229238msgid "Add new photogroup"
    230239msgstr "Voeg nieuwe fotogroep toe"
    231240
    232 #: phototools.php:567
     241#: phototools.php:635
    233242msgid "New photogroup"
    234243msgstr "Nieuwe fotogroep"
    235244
    236 #: phototools.php:568
     245#: phototools.php:636
    237246msgid "Separate groups with commas"
    238247msgstr "Scheid groepen met komma's"
    239248
    240 #: phototools.php:569
     249#: phototools.php:637
    241250msgid "Add or remove Photogroups"
    242251msgstr "Verwijder of voeg fotogroepen toe"
    243252
    244 #: phototools.php:570
     253#: phototools.php:638
    245254msgid "Choose from the most used photogroups"
    246255msgstr "Kies uit de meest gebruikte fotogroepen"
    247256
    248 #: phototools.php:571
     257#: phototools.php:639
    249258msgid "No groups found."
    250259msgstr "Geen fotogroepen gevonden."
    251260
    252 #: phototools.php:572
     261#: phototools.php:640
    253262msgid "Photogroups"
    254263msgstr "Fototools"
    255264
    256 #: phototools.php:584
     265#: phototools.php:652
    257266msgid "Group photos together"
    258267msgstr "Groepeer fotos"
  • phototools/trunk/languages/phototools.pot

    r1895338 r1911852  
    66"Project-Id-Version: phototools 1.0\n"
    77"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/phototools\n"
    8 "POT-Creation-Date: 2018-06-19 21:37+0200\n"
     8"POT-Creation-Date: 2018-07-19 22:02+0200\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=UTF-8\n"
     
    2020"X-Poedit-SearchPath-0: phototools.php\n"
    2121
    22 #: phototools.php:87
     22#: phototools.php:92
    2323msgid "General info"
    2424msgstr ""
    2525
    26 #: phototools.php:88
     26#: phototools.php:93
    2727msgid "Settings"
    2828msgstr ""
    2929
    30 #: phototools.php:136 phototools.php:149
     30#: phototools.php:145 phototools.php:158
    3131msgid "Phototools"
    3232msgstr ""
    3333
    34 #: phototools.php:152
     34#: phototools.php:161
    3535msgid ""
    3636"Phototools is a collection of plugins which add functionality for those who "
     
    3838msgstr ""
    3939
    40 #: phototools.php:167
     40#: phototools.php:176
    4141msgid "The following plugins in this series are installed:"
    4242msgstr ""
    4343
    44 #: phototools.php:205
     44#: phototools.php:219
    4545msgid "Dashboard"
    4646msgstr ""
    4747
    48 #: phototools.php:207
     48#: phototools.php:221
    4949msgid "Replace activity widget:"
    5050msgstr ""
    5151
    52 #: phototools.php:212
     52#: phototools.php:226
    5353msgid "No. publishing soon:"
    5454msgstr ""
    5555
    56 #: phototools.php:216
     56#: phototools.php:230
    5757msgid "No. published recently:"
    5858msgstr ""
    5959
    60 #: phototools.php:220
     60#: phototools.php:234
    6161msgid "No. recent comments:"
    6262msgstr ""
    6363
    64 #: phototools.php:225
     64#: phototools.php:239
    6565msgid "Extra's"
    6666msgstr ""
    6767
    68 #: phototools.php:226
     68#: phototools.php:240
    6969msgid "Enable use of shortcodes in widgets"
    7070msgstr ""
    7171
    72 #: phototools.php:231
     72#: phototools.php:245
    7373msgid "Enable use of the photogroup taxonomy"
    7474msgstr ""
    7575
    76 #: phototools.php:236
     76#: phototools.php:250
    7777msgid "Enable fuzzy dates"
    7878msgstr ""
    7979
    80 #: phototools.php:241
     80#: phototools.php:255
    8181msgid "Add rich data to posts with a featured image"
    8282msgstr ""
    8383
    84 #: phototools.php:320
     84#: phototools.php:260
     85msgid "use the \"redirect to the latest post\""
     86msgstr ""
     87
     88#: phototools.php:265
     89msgid "Redirect string"
     90msgstr ""
     91
     92#: phototools.php:356
    8593msgid "now"
    8694msgstr ""
    8795
    88 #: phototools.php:324
     96#: phototools.php:360
    8997msgid "just"
    9098msgstr ""
    9199
    92 #: phototools.php:325
     100#: phototools.php:361
    93101msgid "1 minute ago"
    94102msgstr ""
    95103
    96 #: phototools.php:326
     104#: phototools.php:362
    97105msgid " minutes ago"
    98106msgstr ""
    99107
    100 #: phototools.php:327
     108#: phototools.php:363
    101109msgid " hours ago"
    102110msgstr ""
    103111
    104 #: phototools.php:328
     112#: phototools.php:364
    105113msgid "1 hour ago"
    106114msgstr ""
    107115
    108 #: phototools.php:331
     116#: phototools.php:367
    109117msgid "yesterday"
    110118msgstr ""
    111119
    112 #: phototools.php:332
     120#: phototools.php:368
    113121msgid "the day before yesterday"
    114122msgstr ""
    115123
    116 #: phototools.php:333
     124#: phototools.php:369
    117125#, php-format
    118126msgid "%s days ago"
    119127msgstr ""
    120128
    121 #: phototools.php:334
     129#: phototools.php:370
    122130#, php-format
    123131msgid "%s weeks ago"
    124132msgstr ""
    125133
    126 #: phototools.php:340
     134#: phototools.php:376
    127135msgid "in a moment"
    128136msgstr ""
    129137
    130 #: phototools.php:341
     138#: phototools.php:377
    131139msgid "in a minute"
    132140msgstr ""
    133141
    134 #: phototools.php:342
     142#: phototools.php:378
    135143#, php-format
    136144msgid "in %s minutes"
    137145msgstr ""
    138146
    139 #: phototools.php:343
     147#: phototools.php:379
    140148msgid "in an hour"
    141149msgstr ""
    142150
    143 #: phototools.php:344
     151#: phototools.php:380
    144152#, php-format
    145153msgid "in %s hours"
    146154msgstr ""
    147155
    148 #: phototools.php:346
     156#: phototools.php:382
    149157msgid "tomorrow"
    150158msgstr ""
    151159
    152 #: phototools.php:347
     160#: phototools.php:383
    153161msgid "the day after tomorrow"
    154162msgstr ""
    155163
    156 #: phototools.php:348
     164#: phototools.php:384
    157165#, php-format
    158166msgid "in %s days"
    159167msgstr ""
    160168
    161 #: phototools.php:349
     169#: phototools.php:385
    162170#, php-format
    163171msgid "in %s weeks"
    164172msgstr ""
    165173
    166 #: phototools.php:359
     174#: phototools.php:395
    167175msgid "Publishing Soon"
    168176msgstr ""
    169177
    170 #: phototools.php:366
     178#: phototools.php:402
    171179msgid "Published Recent"
    172180msgstr ""
    173181
    174 #: phototools.php:374
     182#: phototools.php:410
    175183msgid "Recent Comments"
    176184msgstr ""
    177185
    178 #: phototools.php:394
     186#: phototools.php:430
    179187msgid "edit post"
    180188msgstr ""
    181189
    182 #: phototools.php:395
     190#: phototools.php:431
    183191msgid "view post"
    184192msgstr ""
    185193
    186 #: phototools.php:440
     194#: phototools.php:476
    187195msgid "Approve"
    188196msgstr ""
    189197
    190 #: phototools.php:441
     198#: phototools.php:477
    191199msgid "Unapprove"
    192200msgstr ""
    193201
    194 #: phototools.php:442
     202#: phototools.php:478
    195203msgid "Edit"
    196204msgstr ""
    197205
    198 #: phototools.php:443
     206#: phototools.php:479
    199207msgid "Reply"
    200208msgstr ""
    201209
    202 #: phototools.php:448
     210#: phototools.php:484
    203211msgid "Delete Permanently"
    204212msgstr ""
    205213
    206 #: phototools.php:454
     214#: phototools.php:490
    207215msgid "View"
    208216msgstr ""
    209217
    210 #: phototools.php:559
     218#: phototools.php:627
    211219msgid "Search groups"
    212220msgstr ""
    213221
    214 #: phototools.php:560
     222#: phototools.php:628
    215223msgid "Popular groups"
    216224msgstr ""
    217225
    218 #: phototools.php:561
     226#: phototools.php:629
    219227msgid "All groups"
    220228msgstr ""
    221229
    222 #: phototools.php:564
     230#: phototools.php:632
    223231msgid "Edit photogroup"
    224232msgstr ""
    225233
    226 #: phototools.php:565
     234#: phototools.php:633
    227235msgid "Update photogroup"
    228236msgstr ""
    229237
    230 #: phototools.php:566
     238#: phototools.php:634
    231239msgid "Add new photogroup"
    232240msgstr ""
    233241
    234 #: phototools.php:567
     242#: phototools.php:635
    235243msgid "New photogroup"
    236244msgstr ""
    237245
    238 #: phototools.php:568
     246#: phototools.php:636
    239247msgid "Separate groups with commas"
    240248msgstr ""
    241249
    242 #: phototools.php:569
     250#: phototools.php:637
    243251msgid "Add or remove Photogroups"
    244252msgstr ""
    245253
    246 #: phototools.php:570
     254#: phototools.php:638
    247255msgid "Choose from the most used photogroups"
    248256msgstr ""
    249257
    250 #: phototools.php:571
     258#: phototools.php:639
    251259msgid "No groups found."
    252260msgstr ""
    253261
    254 #: phototools.php:572
     262#: phototools.php:640
    255263msgid "Photogroups"
    256264msgstr ""
    257265
    258 #: phototools.php:584
     266#: phototools.php:652
    259267msgid "Group photos together"
    260268msgstr ""
  • phototools/trunk/phototools.php

    r1895338 r1911852  
    22/**
    33 * @package phototools
    4  * @version 1.2
     4 * @version 1.3
    55 */
    66/*
     
    99Description: Dashboard widgets for photosites
    1010Author: Gerhard Hoogterp
    11 Version: 1.2
     11Version: 1.3
    1212Author URI: https://gerhardhoogterp.nl/
    1313*/
     
    7474            add_action('wp_head', array($this,'rich_photographyinfo'));
    7575        endif;
     76       
     77        if ($phototools_options['redirectToLatestPost']):
     78                    add_action('template_redirect', array($this,'redirect_to_latest_post'));
     79                endif;                   
     80       
    7681       
    7782    }
     
    116121            $phototools_options['publishedRecently'] = 2;
    117122            $phototools_options['recentComments'] = 5;
     123            $phototools_options['redirectToLatestPost'] = true;
     124            $phototools_options['redirectString'] = 'latest';
     125           
    118126
    119127            update_option('phototools_options', $phototools_options);
    120128        endif;
     129   
    121130    }
    122131
     
    194203        if (!array_key_exists('enableFuzzyDates',$options))           $options['enableFuzzyDates']=true;
    195204        */
     205       
     206                if (isset($options['redirectToLatestPost']) && empty($options['redirectString'])) {
     207                    $options['redirectString']='latest';
     208                }
     209               
    196210        return $options;
    197211    }
     
    243257            'phototools_addRichData_CB'
    244258        ) , 'phototools', 'phototools_bonus_settings', ['label_for' => 'addRichData']);
    245        
     259
     260        add_settings_field('redirectToLatestPost', __('use the "redirect to the latest post"', self::FS_TEXTDOMAIN) , array(
     261            $this,
     262            'phototools_redirectToLatestPost_CB'
     263        ) , 'phototools', 'phototools_bonus_settings', ['label_for' => 'redirectToLatestPost']);
     264   
     265                add_settings_field('redirectString', __('Redirect string', self::FS_TEXTDOMAIN) , array(
     266            $this,
     267            'phototools_redirectString'
     268        ) , 'phototools', 'phototools_bonus_settings', ['label_for' => 'redirectString']);
     269   
     270   
    246271    }
    247272
     
    284309        print '<input type="checkbox" id="addRichData" name="phototools_options[addRichData]" ' . ($phototools_options['addRichData'] ? 'checked' : '') . ' >';
    285310    }
     311   
     312    public function phototools_redirectToLatestPost_CB() {
     313        $phototools_options = get_option('phototools_options');
     314        print '<input type="checkbox" id="redirectToLatestPost" name="phototools_options[redirectToLatestPost]" ' . ($phototools_options['redirectToLatestPost'] ? 'checked' : '') . ' >';
     315    }
     316   
     317    public function phototools_redirectString() {
     318        $phototools_options = get_option('phototools_options');
     319        print '<input id="redirectString" name="phototools_options[redirectString]" value="' . $phototools_options['redirectString'] . '">';
     320    }
     321   
    286322   
    287323    /* ****************************************************************************
     
    539575    }
    540576
     577        function getLatestPost() {
     578        $args = array(
     579            'post_type' => 'post',
     580            'posts_per_page' => 1 ,
     581            'orderby' => 'date',
     582            'order' => 'desc',
     583            'no_found_rows' => true, // Get 5 poss and bail. Make our query more effiecient
     584            'suppress_filters' => true, // We don't want any filters to alter this query
     585            'date_query' => array(
     586                array(
     587                    'before' => $this->current_time( 'mysql' ) ,
     588                    'inclusive' => false, // Don't include the current post in the query
     589                )
     590            )
     591        );
     592        $post = current(query_posts($args));
     593        return get_permalink($post->ID);
     594    }
     595   
     596        function redirect_to_latest_post() {
     597            $phototools_options = get_option('phototools_options');
     598            if (!empty($phototools_options['redirectString'])) {
     599           
     600                if ( 0 === stripos( $_SERVER['REQUEST_URI'], '/'.$phototools_options['redirectString'] ) ) {
     601                    $latestPost = $this->getLatestPost();
     602                    wp_redirect( $latestPost);
     603                    exit;
     604                }
     605            }
     606        }
     607   
     608   
    541609    function recentComments() {
    542610        $phototools_options = get_option('phototools_options');
  • phototools/trunk/readme.txt

    r1895338 r1911852  
    33Tags: phototools, dashboard
    44Requires at least: 3.0.1
    5 Tested up to: 4.9.5
     5Tested up to: 4.9.7
    66Requires PHP: 5.6
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88Donate link: https://gerhardhoogterp.nl/plugins/&utm_source=readme&utm_campaign=phototools
    99License: GPLv2 or later
     
    2525* Fuzzy dates on/off. Makes the postdates in the activity widgets more "humanlike".
    2626* Rich photo info (https://www.schemaapp.com/tools/jsonld-schema-generator/Photograph/)
    27 
     27* <domain>/latests option to redirect to the latest posts on your blog. For example: https://gerhardhoogterp.nl/latest will show your the latest photo I posted.
    2828
    2929== Installation ==
     
    5959  The mouseover always has the exact date and time.
    6060* added rich photoinfo to the page.
    61  
     61
     62= 1.3 =
     63
     64* added "latest" option. you can turn it on/off in the settings and define your "latest" string which will be used in the url.
     65
     66
    6267== Upgrade Notice ==
    6368
Note: See TracChangeset for help on using the changeset viewer.