Plugin Directory

Changeset 1773384


Ignore:
Timestamp:
11/22/2017 06:20:19 PM (8 years ago)
Author:
squareoffs
Message:

Allow creation of SquareOff with no end date.

Location:
squareoffs/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • squareoffs/trunk/js/datepicker.js

    r1759645 r1773384  
    1717
    1818    var formatReadableDate = function( date ) {
    19         return $.datepicker.formatDate( 'd M yy', date );
     19        if ( typeof( date ) !== "undefined" && date !== "" ) {
     20            return $.datepicker.formatDate( 'd M yy', date );
     21        } else {
     22            return "";
     23        }
    2024    };
    2125
     
    2428        var $dateField = $el.find( '.squareoffs-date-input' );
    2529        var $timeField = $el.find( '.squareoffs-time-input' );
    26         var date       = new Date( $dateField.attr( 'data-date-iso' ));
     30        var dateIso    = $dateField.attr( 'data-date-iso' );
     31        var date       = "";
     32
     33        if ( typeof( dateIso ) !== "undefined" && dateIso !== "" ) {
     34            date = new Date( dateIso );
     35        }
    2736
    2837        var $visibleField = $( '<input />', {
  • squareoffs/trunk/js/media-button.js

    r1759645 r1773384  
    7272        isReady: function() {
    7373            var ready         = true;
    74             var requiredProps = [ 'question', 'side_1_title', 'side_2_title', 'category_uuid', 'end_date' ];
     74            var requiredProps = [ 'question', 'side_1_title', 'side_2_title', 'category_uuid' ];
    7575
    7676            _.each( requiredProps, function( prop ) {
     
    547547            var date = this.$el.find( '[name="end_date[date]"]' ).val();
    548548            var time = this.$el.find( '[name="end_date[time]"]' ).val();
    549 
    550             try {
    551                 args.end_date = new Date( date + ' ' + time ).toISOString();
    552             } catch ( error ) {
    553                 var _date = new Date();
    554                 _date.setFullYear( new Date().getFullYear() + 1 );
    555                 args.end_date = _date.toISOString();
     549            if ( typeof( date ) !== "undefined" && date !== "" ) {
     550                try {
     551                    args.end_date = new Date( date + ' ' + time ).toISOString();
     552                } catch ( error ) {
     553                    var _date = new Date();
     554                    _date.setFullYear( new Date().getFullYear() + 1 );
     555                    args.end_date = _date.toISOString();
     556                }
    556557            }
    557558
  • squareoffs/trunk/js/templates/modal-insert-content-new.php

    r1759645 r1773384  
    102102            <fieldset>
    103103                <legend class="screen-reader-text"><?php esc_html_e( 'End date SquareOff' , 'squareoffs' ); ?></legend>
    104                 <?php squareoffs_render_date_field( 'end_date', new DateTime( '+1 year' ), 'squareoffs-new-end-date-{{ data.cid }}' ); ?>
     104                <?php squareoffs_render_date_field( 'end_date', null, 'squareoffs-new-end-date-{{ data.cid }}' ); ?>
    105105            </fieldset>
    106106        </div>
  • squareoffs/trunk/php/admin/admin.php

    r1759645 r1773384  
    219219    }
    220220    $class   = 'notice notice-error is-dismissible';
    221     $message = __( 'Please connect to your SquareOffs account, or <a href="https://www.squareoffs.com/registration/new/" target="_blank">create a new account</a> on squareoffs.com.', 'squareoffs' );
     221    $message = __( 'Please connect to your SquareOffs account, or <a href="https://www.squareoffs.com/registration/new/?platform=wordpress" target="_blank">create a new account</a> on squareoffs.com.', 'squareoffs' );
    222222    $dismiss = __( 'Dismiss this warning', 'squareoffs' );
    223223
     
    228228                'a' => array(
    229229                    'href' => array(),
     230                    'target' => array(),
    230231                    'title' => array(),
    231232                ),
  • squareoffs/trunk/php/admin/squareoffs.php

    r1759645 r1773384  
    290290        $date->setTimezone( new DateTimeZone( 'UTC' ) );
    291291    } else {
    292         $date = new DateTime( '+1 year' );
     292        $date = null;
    293293    }
    294294
     
    304304 * @return void
    305305 */
    306 function squareoffs_render_date_field( $name, $date, $id = null ) {
     306function squareoffs_render_date_field( $name, $date = null, $id = null ) {
    307307
    308308    $id = ! empty( $id ) ? $id : 'squareoffs-datepicker-' . uniqid();
     
    320320        esc_attr( $id . '-date' ),
    321321        esc_attr( $name . '[date]' ),
    322         esc_attr( $date->format( 'Y-m-d' ) ),
    323         esc_attr( $date->format( 'c' ) )
     322        esc_attr( empty( $date ) ? "" : $date->format( 'Y-m-d' ) ),
     323        esc_attr( empty( $date ) ? "" : $date->format( 'c' ) )
    324324    );
    325325
     
    334334        esc_attr( $id . '-time' ),
    335335        esc_attr( $name . '[time]' ),
    336         esc_attr( $date->format( 'g:i A' ) )
     336        esc_attr( empty( $date ) ? "" : $date->format( 'g:i A' ) )
    337337    );
    338338
  • squareoffs/trunk/php/class-squareoffs-internal-api.php

    r1759645 r1773384  
    9898                        'required' => true,
    9999                    ),
    100                     'end_date'         => array(
    101                         'required' => true,
    102                     ),
     100                    'end_date'         => array(),
    103101                    'tag_list'         => array(),
    104102                ),
  • squareoffs/trunk/php/sanitization.php

    r1759645 r1773384  
    211211        'side_2_photo'     => '',
    212212        'side_2_photo_url' => '',
    213         'end_date'         => '',
     213        'end_date'         => null,
    214214        'category_uuid'    => '',
    215215        'tag_list'         => '',
    216216        'cover_photo'      => '',
    217217        'cover_photo_url'  => '',
    218         'end_date'         => null,
    219218    );
    220219
     
    238237
    239238    // Convert date.
    240     if ( $data['end_date'] ) {
     239    if ( ! empty( $data['end_date'] ) && ! empty( $data['end_date']['date'] ) ) {
    241240        $data['end_date'] = squareoffs_convert_date( $data['end_date'] );
    242241        unset( $date );
     242    } else {
     243        unset( $data['end_date'] );
    243244    }
    244245
  • squareoffs/trunk/plugin.php

    r1759645 r1773384  
    88 * Text Domain:     squareoffs
    99 * Domain Path:     /languages
    10  * Version:         1.0.0
     10 * Version:         1.1.0
    1111 *
    1212 * @package         Squareoffs
    1313 */
    1414
    15 define( 'SQUAREOFFS_PLUGIN_VERSION', '1.0.0' );
     15define( 'SQUAREOFFS_PLUGIN_VERSION', '1.1.0' );
    1616defined( 'SQUAREOFFS_PLUGIN_PATH' ) || define( 'SQUAREOFFS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    1717defined( 'SQUAREOFFS_PLUGIN_URL' ) || define( 'SQUAREOFFS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
  • squareoffs/trunk/readme.txt

    r1759645 r1773384  
    11=== SquareOffs ===
    22Contributors: squareoffs, humanmade
    3 Donate link: 
     3Donate link:
    44Tags: squareoff, debate, poll, vote, comment, engagement, forum, opinion, compare, review, discuss, survey
    55Requires at least: 4.6
    6 Tested up to: 4.8
     6Tested up to: 4.9
    77Requires PHP: 5.4
    8 Stable tag: 1.0.0
     8Stable tag: 1.1.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414== Description ==
    15 This easy-to-use plugin allows you to embed SquareOffs® directly into your content without ever leaving Wordpress. 
     15This easy-to-use plugin allows you to embed SquareOffs® directly into your content without ever leaving Wordpress.
    1616
    17 SquareOffs microdebates™ allow digital publishers of all sizes to engage readers, increase traffic, gain insight, and generate new revenue. They are more than just another poll. SquareOffs allow you to engage your readers in an interactive conversational debate where they not only choose a side, but can also explain “why” they made their choice. Readers love it because they can make their voice heard, invite others to join the conversation, vote up top reasons supporting their side, and easily access relevant comments within the innovative dual comment stream. Readers are kept on your site rather than social networks, allowing you to own the conversation. 
     17SquareOffs microdebates™ allow digital publishers of all sizes to engage readers, increase traffic, gain insight, and generate new revenue. They are more than just another poll. SquareOffs allow you to engage your readers in an interactive conversational debate where they not only choose a side, but can also explain “why” they made their choice. Readers love it because they can make their voice heard, invite others to join the conversation, vote up top reasons supporting their side, and easily access relevant comments within the innovative dual comment stream. Readers are kept on your site rather than social networks, allowing you to own the conversation.
    1818
    1919>SquareOffs placed in an article receive 41% more comments than standard commenting systems.
     
    2828* Graphical representation of the shortcode in the Visual editor allows users to easily coordinate the layout of a post or page.
    2929* Increase site traffic when voters share on social media, pulling new readers back to your site.
    30 * Create simple, bite-sized content with which readers can easily engage. 
    31 * Easily link your SquareOffs account to the Wordpress plugin during installation. 
     30* Create simple, bite-sized content with which readers can easily engage.
     31* Easily link your SquareOffs account to the Wordpress plugin during installation.
    3232* Configure display settings, colors, font, social sharing, and more.
    3333
     
    5555
    5656If you already have a SquareOffs account, simply click on "SquareOffs" in the left navigation.
    57 Enter your SquareOffs login information (email and password). 
     57Enter your SquareOffs login information (email and password).
    5858
    5959New Account
     
    7373== Frequently Asked Questions ==
    7474= What is a SquareOff? =
    75 A SquareOff is a piece of content publishers use to engage their audience and allow their readers to share their opinions. Each SquareOff contains a question and two sides. Readers vote for their side, and then comment WHY they voted for that side. 
     75A SquareOff is a piece of content publishers use to engage their audience and allow their readers to share their opinions. Each SquareOff contains a question and two sides. Readers vote for their side, and then comment WHY they voted for that side.
    7676
    7777= Who can use SquareOffs? =
    78 SquareOffs is great for digital publishers. From boutique bloggers to high traffic news websites, SquareOffs works with any topic, on any website. SquareOffs is also great for brands and agencies to use as a tool in their toolkit to increase brand engagement and loyalty. 
     78SquareOffs is great for digital publishers. From boutique bloggers to high traffic news websites, SquareOffs works with any topic, on any website. SquareOffs is also great for brands and agencies to use as a tool in their toolkit to increase brand engagement and loyalty.
    7979
    8080= Where do SquareOffs live? =
     
    8282
    8383= Where should publishers place SquareOffs on a website? =
    84 This depends on your website, and how your readers interact on your page. Small SquareOffs work great embedded in-line within articles or right on your homepage. Polls Pages are a great to create a new landing page on your site that had not previously existed. 
     84This depends on your website, and how your readers interact on your page. Small SquareOffs work great embedded in-line within articles or right on your homepage. Polls Pages are a great to create a new landing page on your site that had not previously existed.
    8585
    8686= Why use SquareOffs? =
    87 SquareOffs is designed for digital publishers to create user-generated debate on any topic, on any website. From small bloggers to high traffic news sites, SquareOffs is a simple tool to increase engagement, revenue, traffic, and insight. 
     87SquareOffs is designed for digital publishers to create user-generated debate on any topic, on any website. From small bloggers to high traffic news sites, SquareOffs is a simple tool to increase engagement, revenue, traffic, and insight.
    8888
    8989Further support:
     
    104104== Changelog ==
    105105
     106= 1.1.0 =
     107* Tested with WordPress 4.9s
     108* Allow creation of SquareOff with no end date.
     109
    106110= 1.0.0 =
    107111* Initial release.
     
    114118== Upgrade Notice ==
    115119
    116 This is our initial release. Please notify us with any feedback at [email protected].
     120= 1.1.0 =
     121* Tested with WordPress 4.9
Note: See TracChangeset for help on using the changeset viewer.