Plugin Directory

Changeset 1754310


Ignore:
Timestamp:
10/28/2017 09:41:26 AM (8 years ago)
Author:
maximevalette
Message:

tagging new version

Location:
ical-feeds
Files:
4 edited
6 copied

Legend:

Unmodified
Added
Removed
  • ical-feeds/tags/1.5/ical-feeds.php

    r1734807 r1754310  
    66Author: Maxime VALETTE
    77Author URI: http://maxime.sh
    8 Version: 1.4.2
     8Version: 1.5
    99*/
    1010
     
    3939    if (!isset($options['icalfeeds_senable'])) $options['icalfeeds_senable'] = 0;
    4040    if (!isset($options['icalfeeds_limit'])) $options['icalfeeds_limit'] = 50;
     41    if (!isset($options['icalfeeds_future'])) $options['icalfeeds_future'] = 0;
    4142
    4243    $updated = false;
     
    6869        } else {
    6970            $icalfeeds_limit = 50;
     71        }
     72       
     73        if (isset($_POST['icalfeeds_future'])) {
     74            $icalfeeds_future = $_POST['icalfeeds_future'];
     75        } else {
     76            $icalfeeds_future = 0;
    7077        }
    7178
     
    7481        $options['icalfeeds_senable'] = $icalfeeds_senable;
    7582        $options['icalfeeds_limit']   = $icalfeeds_limit;
     83        $options['icalfeeds_future']  = $icalfeeds_future;
    7684
    7785        update_option('icalfeeds', $options);
     
    112120    echo '<p><input id="icalfeeds_senable" name="icalfeeds_senable" type="checkbox" value="1"';
    113121    if ($options['icalfeeds_senable'] == 1) echo ' checked';
    114     echo '/> <label for="icalfeeds_senable">'.__('Enable a secret parameter to view future posts.', ICALFEEDS_TEXTDOMAIN).'</label></p>';
     122    echo '/> <label for="icalfeeds_senable">'.__('Enable a secret parameter to view ALL future posts.', ICALFEEDS_TEXTDOMAIN).'</label></p>';
    115123
    116124    echo '<h3><label for="icalfeeds_secret">'.__('Secret parameter value:', ICALFEEDS_TEXTDOMAIN).'</label></h3>';
     
    123131    echo '<p><input type="number" id="icalfeeds_limit" name="icalfeeds_limit" value="'.$options['icalfeeds_limit'].'" style="width: 50px; text-align: center;" /> '.__('blog posts', ICALFEEDS_TEXTDOMAIN).'</p>';
    124132
     133    echo '<h3><label for="icalfeeds_future">'.__('Number of future posts:', ICALFEEDS_TEXTDOMAIN).'</label></h3>';
     134    echo '<p><input type="number" id="icalfeeds_future" name="icalfeeds_future" value="'.$options['icalfeeds_future'].'" style="width: 50px; text-align: center;" /> '.__('future posts', ICALFEEDS_TEXTDOMAIN).'</p>';
    125135   
    126136    echo '<p class="submit" style="text-align: left">';
     
    240250    global $wpdb;
    241251
     252    //Set defaults if no values exist
    242253    $options = get_option('icalfeeds');
    243254    if (!isset($options['icalfeeds_minutes'])) $options['icalfeeds_minutes'] = 60;
    244255    if (!isset($options['icalfeeds_limit'])) $options['icalfeeds_limit'] = 50;
    245 
    246 
     256    if (!isset($options['icalfeeds_future'])) $options['icalfeeds_future'] = 0;
     257
     258
     259    //Get Post Type
    247260    $post_type = 'post';
    248261    if (isset($_GET['posttype'])) {
     
    250263    }
    251264
    252     $post_date_field = 'pubDate';
     265    //Set how many future posts to display
     266    $post_status = array( 'publish', 'future' );
     267    if ($_REQUEST['ical'] == $options['icalfeeds_secret']) {
     268   
     269        $future = date('Ymd', strtotime('+3650 day')); //10 years out
     270       
     271    } else {
     272       
     273        $future = date('Ymd', strtotime('+'.$options['icalfeeds_future'].' day'));
     274       
     275    }
     276   
     277    // Is a custom meta_key field being used for date
    253278    if (isset($_GET['datefield'])) {
     279   
    254280        $post_date_field = $_GET['datefield'];
    255     }
    256 
     281        $post_order_by = array( 'meta_key' => $_GET['datefield'], 'meta_value'   => $future, 'meta_compare' => '<=', 'orderby' => 'meta_value' );
     282       
     283    } else {
     284   
     285        $post_date_field = 'pubDate';
     286        $post_order_by = array( 'before' => $future,'orderby' => 'post_date' );
     287   
     288    }
     289   
     290    //Custom End Date field
    257291    if (isset($_GET['enddatefield'])) {
    258292        $post_end_date_field = $_GET['enddatefield'];
     
    261295    }
    262296
     297    // Get category IDs
    263298    if (isset($_GET['category'])) {
    264299
     
    279314    }
    280315
     316    // Set limit on posts retrieved
    281317    $limit = $options['icalfeeds_limit'];
    282 
    283318    if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
    284319        $limit = $_GET['limit'];
     
    286321
    287322
    288     if ($_REQUEST['ical'] == $options['icalfeeds_secret']) {
    289 
    290         $postCond = "post_status = 'publish' OR post_status = 'future'";
    291 
    292     } else {
    293         $futureEarlyAccessDate = date('Y-m-d', strtotime('+3 day'));
    294 
    295         $postCond = "post_status = 'publish' OR post_status = 'future' AND post_date <= '${futureEarlyAccessDate}'";
    296 
    297     }
    298 
    299     // Get posts
    300 
     323    // Construct query arguement
    301324    if (isset($_GET['category'])) {
    302325
    303         $posts = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_content, UNIX_TIMESTAMP($wpdb->posts.post_date) AS post_date, $wpdb->posts.post_title FROM $wpdb->posts
    304             LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)
    305             LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    306             WHERE (".$postCond.") AND $wpdb->posts.post_type = '$post_type' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id IN (".implode(',', $categoryIds).")
    307             ORDER BY post_date DESC LIMIT $limit");
    308 
     326        $args = array(
     327            'post_type'         => $post_type,
     328            'post_status'       => $post_status,
     329            'posts_per_page'    => $limit,
     330            'cat' => implode(',', $categoryIds),
     331            'order'             => 'DESC',
     332        ) + $post_order_by;
     333       
     334       
    309335    } else {
    310336
    311         $posts = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_content, UNIX_TIMESTAMP($wpdb->posts.post_date) AS post_date, $wpdb->posts.post_title
    312             FROM $wpdb->posts
    313             WHERE (".$postCond.") AND $wpdb->posts.post_type = '$post_type'
    314             ORDER BY post_date DESC LIMIT $limit");
    315 
    316     }
    317 
     337        $args = array(
     338            'post_type'         => $post_type,
     339            'post_status'       => $post_status,
     340            'posts_per_page'    => $limit,
     341            'order'             => 'DESC',
     342        ) + $post_order_by;
     343
     344    }
     345
     346    // Get posts
     347    $posts = new WP_Query( $args );
     348   
    318349    $events = null;
    319350
    320     foreach ($posts as $post) {
     351    while ( $posts->have_posts() ) {
     352        $posts->the_post();
    321353
    322354        if ($post_date_field !== 'pubDate') {
    323             $start_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_date_field, true ) ) );
    324             $end_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_date_field, true ) ) + ($options['icalfeeds_minutes'] * 60));
     355           
     356            $start_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     357            $end_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) + ($options['icalfeeds_minutes'] * 60));
     358            $modified_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     359           
    325360        } else {
    326             $start_time = date( 'Ymd\THis', get_post_time( 'U', true, $post->ID ) );
    327             $end_time = date( 'Ymd\THis', get_post_time( 'U', true, $post->ID ) + ($options['icalfeeds_minutes'] * 60));
     361
     362            $start_time = date( 'Ymd\THis', get_post_time( 'U', true, get_the_ID() ) );
     363            $end_time = date( 'Ymd\THis', get_post_time( 'U', true, get_the_ID() ) + ($options['icalfeeds_minutes'] * 60));
     364            $modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, get_the_ID() ) );
     365           
    328366        }
    329367
    330         $modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, $post->ID ) );
    331         $summary = strip_tags($post->post_title);
    332         $permalink = get_permalink($post->ID);
     368        //$modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, $post->ID ) );
     369        $summary = strip_tags( html_entity_decode( get_the_title() ) );
     370        $permalink = get_permalink(get_the_ID());
    333371        $timezone = get_option('timezone_string');
    334         $guid = get_the_guid($post->ID);
    335 
    336         if (null !== $post_end_date_field) {
    337             $end_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_end_date_field, true ) ));
     372        $guid = get_the_guid(get_the_ID());
     373       
     374        if (null !== $post_end_date_field) {
     375            $end_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_end_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
    338376        }
    339377
  • ical-feeds/tags/1.5/languages/icalfeeds-fr_FR.po

    r951761 r1754310  
    22msgstr ""
    33"Project-Id-Version: iCal Feeds Plugin\n"
    4 "POT-Creation-Date: 2014-07-20 10:16+0100\n"
    5 "PO-Revision-Date: 2014-07-20 10:18+0100\n"
     4"POT-Creation-Date: 2017-10-28 11:33+0100\n"
     5"PO-Revision-Date: 2017-10-28 11:36+0100\n"
    66"Last-Translator: Maxime VALETTE <[email protected]>\n"
    77"Language-Team: Maxime VALETTE <[email protected]>\n"
     
    2525msgstr "Flux iCal"
    2626
    27 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:80
     27#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:96
    2828msgid "Configuration updated."
    2929msgstr "Configuration mise à jour."
    3030
    31 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:90
     31#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:106
    3232msgid "You have to define your current timezone (specify a city) in"
    3333msgstr "Vous devez définir votre fuseau horaire (en spécifiant une ville) dans"
    3434
    35 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:91
     35#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:107
    3636msgid "Settings > General"
    3737msgstr "Réglages > Général"
    3838
    39 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:96
     39#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:112
    4040msgid "iCal Feeds Configuration"
    4141msgstr "Configuration de iCal Feeds"
    4242
    43 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:102
     43#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:118
    4444msgid "Advanced Options"
    4545msgstr "Options avancées"
    4646
    47 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:106
    48 msgid "Enable a secret parameter to view future posts."
    49 msgstr "Activer un paramètre secret pour voir les billets programmés."
     47#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:122
     48msgid "Enable a secret parameter to view ALL future posts."
     49msgstr "Activer un paramètre secret pour voir tous les billets programmés."
    5050
    51 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:108
     51#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:124
    5252msgid "Secret parameter value:"
    5353msgstr "Valeur du paramètre secret :"
    5454
    55 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:111
     55#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:127
    5656msgid "Time interval per post:"
    5757msgstr "Intervalle de temps par article :"
    5858
    59 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:112
     59#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:128
    6060msgid "minutes"
    6161msgstr "minutes"
    6262
    63 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:116
     63#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:130
     64msgid "Number of blog posts:"
     65msgstr "Nombre de billets :"
     66
     67#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:131
     68msgid "blog posts"
     69msgstr "billets"
     70
     71#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:133
     72msgid "Number of future posts:"
     73msgstr "Nombre de billets dans le futur :"
     74
     75#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:134
     76msgid "future posts"
     77msgstr "billets futurs"
     78
     79#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:138
    6480msgid "Save"
    6581msgstr "Sauver"
    6682
    67 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:118
     83#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:140
    6884msgid "Main iCal feeds"
    6985msgstr "Flux iCal principaux"
    7086
    71 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:120
     87#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:142
    7288msgid "You can use the below addresses to add in your iCal software:"
    7389msgstr ""
     
    7591"logiciel iCal :"
    7692
    77 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:124
     93#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:146
    7894msgid "Public iCal feed"
    7995msgstr "Flux iCal public"
    8096
    81 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:127
     97#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:149
    8298msgid "Private iCal feed"
    8399msgstr "Flux iCal privé"
    84100
    85 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:132
     101#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:154
    86102msgid "Categories iCal feeds"
    87103msgstr "Flux iCal des catégories"
    88104
    89 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:140
     105#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:162
     106#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:199
    90107msgid "Public iCal feed for"
    91108msgstr "Flux iCal public pour"
    92109
    93 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:146
     110#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:168
    94111msgid "Multiple categories iCal feeds"
    95112msgstr "Flux iCal de plusieurs catégories"
    96113
    97 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:148
     114#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:170
    98115msgid ""
    99116"You can add multiple categories in only one URL. Just check the categories "
     
    103120"catégories que vous souhaitez ci-dessous :"
    104121
    105 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:160
     122#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:182
    106123msgid "URL:"
    107124msgstr "URL :"
    108125
    109 #~ msgid "iCal Posts"
    110 #~ msgstr "iCal Posts"
     126#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:193
     127msgid "Post Type iCal feeds"
     128msgstr "Flux iCal pour le type de billet"
     129
     130#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:207
     131msgid "Custom Date iCal feed"
     132msgstr "Flux iCal pour la date personnalisée"
     133
     134#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:209
     135msgid ""
     136"You can use a custom date field instead of the default publish date. The "
     137"Meta Key must exist in the Post Meta table."
     138msgstr ""
     139"Vous pouvez utiliser un champ de date personnalisé à la place de la date de "
     140"publication par défaut. La clé meta doit exister dans la table Post Meta."
     141
     142#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:213
     143msgid "You can also use a custom end date field width enddatefield."
     144msgstr ""
     145"Vous pouvez également utiliser un champ de date de fin personnalisé avec "
     146"enddatefield."
  • ical-feeds/tags/1.5/readme.txt

    r1750579 r1754310  
    55Requires at least: 3.0
    66Tested up to: 4.7.2
    7 Stable tag: 1.4.2
     7Stable tag: 1.5
    88
    99Generate a customizable iCal feed of your present and future blog posts.
     
    2222
    2323== Changelog ==
     24
     25= 1.5 =
     26
     27* New number of Future Posts setting
     28* Replaced get_results with Wp_Query
     29* Better implementation of the custom date field to filter results returned
     30* Timezone support for the custom date field
     31* Reorganized code & Added comments
     32
     33Thanks to @contemplate (http://contemplatedesign.com) for this new version!
    2434
    2535= 1.4.2 =
  • ical-feeds/trunk/ical-feeds.php

    r1734807 r1754310  
    66Author: Maxime VALETTE
    77Author URI: http://maxime.sh
    8 Version: 1.4.2
     8Version: 1.5
    99*/
    1010
     
    3939    if (!isset($options['icalfeeds_senable'])) $options['icalfeeds_senable'] = 0;
    4040    if (!isset($options['icalfeeds_limit'])) $options['icalfeeds_limit'] = 50;
     41    if (!isset($options['icalfeeds_future'])) $options['icalfeeds_future'] = 0;
    4142
    4243    $updated = false;
     
    6869        } else {
    6970            $icalfeeds_limit = 50;
     71        }
     72       
     73        if (isset($_POST['icalfeeds_future'])) {
     74            $icalfeeds_future = $_POST['icalfeeds_future'];
     75        } else {
     76            $icalfeeds_future = 0;
    7077        }
    7178
     
    7481        $options['icalfeeds_senable'] = $icalfeeds_senable;
    7582        $options['icalfeeds_limit']   = $icalfeeds_limit;
     83        $options['icalfeeds_future']  = $icalfeeds_future;
    7684
    7785        update_option('icalfeeds', $options);
     
    112120    echo '<p><input id="icalfeeds_senable" name="icalfeeds_senable" type="checkbox" value="1"';
    113121    if ($options['icalfeeds_senable'] == 1) echo ' checked';
    114     echo '/> <label for="icalfeeds_senable">'.__('Enable a secret parameter to view future posts.', ICALFEEDS_TEXTDOMAIN).'</label></p>';
     122    echo '/> <label for="icalfeeds_senable">'.__('Enable a secret parameter to view ALL future posts.', ICALFEEDS_TEXTDOMAIN).'</label></p>';
    115123
    116124    echo '<h3><label for="icalfeeds_secret">'.__('Secret parameter value:', ICALFEEDS_TEXTDOMAIN).'</label></h3>';
     
    123131    echo '<p><input type="number" id="icalfeeds_limit" name="icalfeeds_limit" value="'.$options['icalfeeds_limit'].'" style="width: 50px; text-align: center;" /> '.__('blog posts', ICALFEEDS_TEXTDOMAIN).'</p>';
    124132
     133    echo '<h3><label for="icalfeeds_future">'.__('Number of future posts:', ICALFEEDS_TEXTDOMAIN).'</label></h3>';
     134    echo '<p><input type="number" id="icalfeeds_future" name="icalfeeds_future" value="'.$options['icalfeeds_future'].'" style="width: 50px; text-align: center;" /> '.__('future posts', ICALFEEDS_TEXTDOMAIN).'</p>';
    125135   
    126136    echo '<p class="submit" style="text-align: left">';
     
    240250    global $wpdb;
    241251
     252    //Set defaults if no values exist
    242253    $options = get_option('icalfeeds');
    243254    if (!isset($options['icalfeeds_minutes'])) $options['icalfeeds_minutes'] = 60;
    244255    if (!isset($options['icalfeeds_limit'])) $options['icalfeeds_limit'] = 50;
    245 
    246 
     256    if (!isset($options['icalfeeds_future'])) $options['icalfeeds_future'] = 0;
     257
     258
     259    //Get Post Type
    247260    $post_type = 'post';
    248261    if (isset($_GET['posttype'])) {
     
    250263    }
    251264
    252     $post_date_field = 'pubDate';
     265    //Set how many future posts to display
     266    $post_status = array( 'publish', 'future' );
     267    if ($_REQUEST['ical'] == $options['icalfeeds_secret']) {
     268   
     269        $future = date('Ymd', strtotime('+3650 day')); //10 years out
     270       
     271    } else {
     272       
     273        $future = date('Ymd', strtotime('+'.$options['icalfeeds_future'].' day'));
     274       
     275    }
     276   
     277    // Is a custom meta_key field being used for date
    253278    if (isset($_GET['datefield'])) {
     279   
    254280        $post_date_field = $_GET['datefield'];
    255     }
    256 
     281        $post_order_by = array( 'meta_key' => $_GET['datefield'], 'meta_value'   => $future, 'meta_compare' => '<=', 'orderby' => 'meta_value' );
     282       
     283    } else {
     284   
     285        $post_date_field = 'pubDate';
     286        $post_order_by = array( 'before' => $future,'orderby' => 'post_date' );
     287   
     288    }
     289   
     290    //Custom End Date field
    257291    if (isset($_GET['enddatefield'])) {
    258292        $post_end_date_field = $_GET['enddatefield'];
     
    261295    }
    262296
     297    // Get category IDs
    263298    if (isset($_GET['category'])) {
    264299
     
    279314    }
    280315
     316    // Set limit on posts retrieved
    281317    $limit = $options['icalfeeds_limit'];
    282 
    283318    if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
    284319        $limit = $_GET['limit'];
     
    286321
    287322
    288     if ($_REQUEST['ical'] == $options['icalfeeds_secret']) {
    289 
    290         $postCond = "post_status = 'publish' OR post_status = 'future'";
    291 
    292     } else {
    293         $futureEarlyAccessDate = date('Y-m-d', strtotime('+3 day'));
    294 
    295         $postCond = "post_status = 'publish' OR post_status = 'future' AND post_date <= '${futureEarlyAccessDate}'";
    296 
    297     }
    298 
    299     // Get posts
    300 
     323    // Construct query arguement
    301324    if (isset($_GET['category'])) {
    302325
    303         $posts = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_content, UNIX_TIMESTAMP($wpdb->posts.post_date) AS post_date, $wpdb->posts.post_title FROM $wpdb->posts
    304             LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)
    305             LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    306             WHERE (".$postCond.") AND $wpdb->posts.post_type = '$post_type' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id IN (".implode(',', $categoryIds).")
    307             ORDER BY post_date DESC LIMIT $limit");
    308 
     326        $args = array(
     327            'post_type'         => $post_type,
     328            'post_status'       => $post_status,
     329            'posts_per_page'    => $limit,
     330            'cat' => implode(',', $categoryIds),
     331            'order'             => 'DESC',
     332        ) + $post_order_by;
     333       
     334       
    309335    } else {
    310336
    311         $posts = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_content, UNIX_TIMESTAMP($wpdb->posts.post_date) AS post_date, $wpdb->posts.post_title
    312             FROM $wpdb->posts
    313             WHERE (".$postCond.") AND $wpdb->posts.post_type = '$post_type'
    314             ORDER BY post_date DESC LIMIT $limit");
    315 
    316     }
    317 
     337        $args = array(
     338            'post_type'         => $post_type,
     339            'post_status'       => $post_status,
     340            'posts_per_page'    => $limit,
     341            'order'             => 'DESC',
     342        ) + $post_order_by;
     343
     344    }
     345
     346    // Get posts
     347    $posts = new WP_Query( $args );
     348   
    318349    $events = null;
    319350
    320     foreach ($posts as $post) {
     351    while ( $posts->have_posts() ) {
     352        $posts->the_post();
    321353
    322354        if ($post_date_field !== 'pubDate') {
    323             $start_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_date_field, true ) ) );
    324             $end_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_date_field, true ) ) + ($options['icalfeeds_minutes'] * 60));
     355           
     356            $start_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     357            $end_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) + ($options['icalfeeds_minutes'] * 60));
     358            $modified_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     359           
    325360        } else {
    326             $start_time = date( 'Ymd\THis', get_post_time( 'U', true, $post->ID ) );
    327             $end_time = date( 'Ymd\THis', get_post_time( 'U', true, $post->ID ) + ($options['icalfeeds_minutes'] * 60));
     361
     362            $start_time = date( 'Ymd\THis', get_post_time( 'U', true, get_the_ID() ) );
     363            $end_time = date( 'Ymd\THis', get_post_time( 'U', true, get_the_ID() ) + ($options['icalfeeds_minutes'] * 60));
     364            $modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, get_the_ID() ) );
     365           
    328366        }
    329367
    330         $modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, $post->ID ) );
    331         $summary = strip_tags($post->post_title);
    332         $permalink = get_permalink($post->ID);
     368        //$modified_time = date( 'Ymd\THis', get_post_modified_time( 'U', true, $post->ID ) );
     369        $summary = strip_tags( html_entity_decode( get_the_title() ) );
     370        $permalink = get_permalink(get_the_ID());
    333371        $timezone = get_option('timezone_string');
    334         $guid = get_the_guid($post->ID);
    335 
    336         if (null !== $post_end_date_field) {
    337             $end_time = date( 'Ymd\THis', strtotime( get_post_meta( $post->ID, $post_end_date_field, true ) ));
     372        $guid = get_the_guid(get_the_ID());
     373       
     374        if (null !== $post_end_date_field) {
     375            $end_time = date( 'Ymd\THis', strtotime( get_post_meta( get_the_ID(), $post_end_date_field, true ) ) - ( get_option( 'gmt_offset' ) * 3600 ) );
    338376        }
    339377
  • ical-feeds/trunk/languages/icalfeeds-fr_FR.po

    r951761 r1754310  
    22msgstr ""
    33"Project-Id-Version: iCal Feeds Plugin\n"
    4 "POT-Creation-Date: 2014-07-20 10:16+0100\n"
    5 "PO-Revision-Date: 2014-07-20 10:18+0100\n"
     4"POT-Creation-Date: 2017-10-28 11:33+0100\n"
     5"PO-Revision-Date: 2017-10-28 11:36+0100\n"
    66"Last-Translator: Maxime VALETTE <[email protected]>\n"
    77"Language-Team: Maxime VALETTE <[email protected]>\n"
     
    2525msgstr "Flux iCal"
    2626
    27 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:80
     27#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:96
    2828msgid "Configuration updated."
    2929msgstr "Configuration mise à jour."
    3030
    31 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:90
     31#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:106
    3232msgid "You have to define your current timezone (specify a city) in"
    3333msgstr "Vous devez définir votre fuseau horaire (en spécifiant une ville) dans"
    3434
    35 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:91
     35#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:107
    3636msgid "Settings > General"
    3737msgstr "Réglages > Général"
    3838
    39 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:96
     39#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:112
    4040msgid "iCal Feeds Configuration"
    4141msgstr "Configuration de iCal Feeds"
    4242
    43 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:102
     43#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:118
    4444msgid "Advanced Options"
    4545msgstr "Options avancées"
    4646
    47 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:106
    48 msgid "Enable a secret parameter to view future posts."
    49 msgstr "Activer un paramètre secret pour voir les billets programmés."
     47#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:122
     48msgid "Enable a secret parameter to view ALL future posts."
     49msgstr "Activer un paramètre secret pour voir tous les billets programmés."
    5050
    51 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:108
     51#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:124
    5252msgid "Secret parameter value:"
    5353msgstr "Valeur du paramètre secret :"
    5454
    55 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:111
     55#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:127
    5656msgid "Time interval per post:"
    5757msgstr "Intervalle de temps par article :"
    5858
    59 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:112
     59#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:128
    6060msgid "minutes"
    6161msgstr "minutes"
    6262
    63 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:116
     63#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:130
     64msgid "Number of blog posts:"
     65msgstr "Nombre de billets :"
     66
     67#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:131
     68msgid "blog posts"
     69msgstr "billets"
     70
     71#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:133
     72msgid "Number of future posts:"
     73msgstr "Nombre de billets dans le futur :"
     74
     75#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:134
     76msgid "future posts"
     77msgstr "billets futurs"
     78
     79#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:138
    6480msgid "Save"
    6581msgstr "Sauver"
    6682
    67 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:118
     83#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:140
    6884msgid "Main iCal feeds"
    6985msgstr "Flux iCal principaux"
    7086
    71 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:120
     87#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:142
    7288msgid "You can use the below addresses to add in your iCal software:"
    7389msgstr ""
     
    7591"logiciel iCal :"
    7692
    77 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:124
     93#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:146
    7894msgid "Public iCal feed"
    7995msgstr "Flux iCal public"
    8096
    81 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:127
     97#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:149
    8298msgid "Private iCal feed"
    8399msgstr "Flux iCal privé"
    84100
    85 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:132
     101#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:154
    86102msgid "Categories iCal feeds"
    87103msgstr "Flux iCal des catégories"
    88104
    89 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:140
     105#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:162
     106#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:199
    90107msgid "Public iCal feed for"
    91108msgstr "Flux iCal public pour"
    92109
    93 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:146
     110#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:168
    94111msgid "Multiple categories iCal feeds"
    95112msgstr "Flux iCal de plusieurs catégories"
    96113
    97 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:148
     114#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:170
    98115msgid ""
    99116"You can add multiple categories in only one URL. Just check the categories "
     
    103120"catégories que vous souhaitez ci-dessous :"
    104121
    105 #: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:160
     122#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:182
    106123msgid "URL:"
    107124msgstr "URL :"
    108125
    109 #~ msgid "iCal Posts"
    110 #~ msgstr "iCal Posts"
     126#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:193
     127msgid "Post Type iCal feeds"
     128msgstr "Flux iCal pour le type de billet"
     129
     130#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:207
     131msgid "Custom Date iCal feed"
     132msgstr "Flux iCal pour la date personnalisée"
     133
     134#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:209
     135msgid ""
     136"You can use a custom date field instead of the default publish date. The "
     137"Meta Key must exist in the Post Meta table."
     138msgstr ""
     139"Vous pouvez utiliser un champ de date personnalisé à la place de la date de "
     140"publication par défaut. La clé meta doit exister dans la table Post Meta."
     141
     142#: /Users/maxime/Sites/wordpress/wp-content/plugins/ical-feeds/ical-feeds.php:213
     143msgid "You can also use a custom end date field width enddatefield."
     144msgstr ""
     145"Vous pouvez également utiliser un champ de date de fin personnalisé avec "
     146"enddatefield."
  • ical-feeds/trunk/readme.txt

    r1750579 r1754310  
    55Requires at least: 3.0
    66Tested up to: 4.7.2
    7 Stable tag: 1.4.2
     7Stable tag: 1.5
    88
    99Generate a customizable iCal feed of your present and future blog posts.
     
    2222
    2323== Changelog ==
     24
     25= 1.5 =
     26
     27* New number of Future Posts setting
     28* Replaced get_results with Wp_Query
     29* Better implementation of the custom date field to filter results returned
     30* Timezone support for the custom date field
     31* Reorganized code & Added comments
     32
     33Thanks to @contemplate (http://contemplatedesign.com) for this new version!
    2434
    2535= 1.4.2 =
Note: See TracChangeset for help on using the changeset viewer.