Plugin Directory

Changeset 2831563


Ignore:
Timestamp:
12/10/2022 03:31:53 PM (3 years ago)
Author:
shewa
Message:

New version 1.1.0 released

Location:
easy-poll/trunk
Files:
9 added
21 edited

Legend:

Unmodified
Added
Removed
  • easy-poll/trunk/assets/bundles/backend-style.min.css

    r2776193 r2831563  
    55  width: 100%;
    66}
     7.ep-wrapper input[type=datetime-local] {
     8  width: 220px;
     9}
    710.ep-wrapper a {
    811  text-decoration: none;
     
    102105}
    103106
    104 .ep-col-2 {
     107.ep-col-12 {
    105108  flex-basis: 96%;
    106109}
     
    300303  padding: 5px 8px;
    301304  margin: 0 3px;
     305}
     306
     307.ep-badge {
     308  background-color: #0d6efd;
     309  color: #fff;
     310  padding: 5px;
     311  border-radius: 5px;
     312  font-size: 10px;
     313  letter-spacing: 1px;
     314}
     315.ep-badge.ep-badge-primary {
     316  background-color: #0d6efd;
     317  color: #fff;
     318  padding: 5px;
     319  border-radius: 5px;
     320  font-size: 10px;
     321  letter-spacing: 1px;
     322}
     323.ep-badge.ep-badge-success {
     324  background-color: #198754;
     325  color: #fff;
     326  padding: 5px;
     327  border-radius: 5px;
     328  font-size: 10px;
     329  letter-spacing: 1px;
     330}
     331.ep-badge.ep-badge-warning {
     332  background-color: #ffc107;
     333  color: #fff;
     334  padding: 5px;
     335  border-radius: 5px;
     336  font-size: 10px;
     337  letter-spacing: 1px;
     338}
     339.ep-badge.ep-badge-danger {
     340  background-color: #d63384;
     341  color: #fff;
     342  padding: 5px;
     343  border-radius: 5px;
     344  font-size: 10px;
     345  letter-spacing: 1px;
    302346}
    303347
  • easy-poll/trunk/assets/bundles/frontend-style.min.css

    r2776193 r2831563  
    55  width: 100%;
    66}
     7.ep-wrapper input[type=datetime-local] {
     8  width: 220px;
     9}
    710.ep-wrapper a {
    811  text-decoration: none;
     
    102105}
    103106
    104 .ep-col-2 {
     107.ep-col-12 {
    105108  flex-basis: 96%;
    106109}
     
    302305}
    303306
     307.ep-badge {
     308  background-color: #0d6efd;
     309  color: #fff;
     310  padding: 5px;
     311  border-radius: 5px;
     312  font-size: 10px;
     313  letter-spacing: 1px;
     314}
     315.ep-badge.ep-badge-primary {
     316  background-color: #0d6efd;
     317  color: #fff;
     318  padding: 5px;
     319  border-radius: 5px;
     320  font-size: 10px;
     321  letter-spacing: 1px;
     322}
     323.ep-badge.ep-badge-success {
     324  background-color: #198754;
     325  color: #fff;
     326  padding: 5px;
     327  border-radius: 5px;
     328  font-size: 10px;
     329  letter-spacing: 1px;
     330}
     331.ep-badge.ep-badge-warning {
     332  background-color: #ffc107;
     333  color: #fff;
     334  padding: 5px;
     335  border-radius: 5px;
     336  font-size: 10px;
     337  letter-spacing: 1px;
     338}
     339.ep-badge.ep-badge-danger {
     340  background-color: #d63384;
     341  color: #fff;
     342  padding: 5px;
     343  border-radius: 5px;
     344  font-size: 10px;
     345  letter-spacing: 1px;
     346}
     347
    304348.ep-poll-wrapper {
    305349  padding: 20px 0 20px;
  • easy-poll/trunk/assets/bundles/frontend.min.js

    r2776193 r2831563  
    22/*!************************************!*\
    33  !*** ./assets/scripts/frontend.js ***!
    4   \************************************/(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utilities_ajax_request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utilities/ajax-request */ \"./assets/scripts/utilities/ajax-request.js\");\n\n/**\n * Contains frontend scripts\n * \n * @since v1.0.0\n */\n\n\nconst {__} = wp.i18n;\n\nwindow.addEventListener('DOMContentLoaded', function() {\n    // Handle user's poll submission\n    const pollForm = document.getElementById('ep-poll-form');\n    const pollWrapper = document.querySelector('.ep-poll-wrapper');\n    pollForm.onsubmit = async (e) => {\n        e.preventDefault();\n        let warningMsg = __('Do you want to submit it? This cannot be reverted!', 'easy-poll');\n        if (confirm(warningMsg)) {\n            const submitBtn = pollForm.querySelector('.ep-btn');\n            const formData = new FormData(pollForm);\n            formData.set('action', 'ep_poll_submit');\n            const response = await (0,_utilities_ajax_request__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(formData, true, submitBtn);\n            let width = `${epData.poll_template_width}%`;\n            if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {\n                width = '92%';\n            }\n            if (response.success) {\n                if (pollWrapper) {\n                    pollWrapper.innerHTML = `\n                        <div class=\"ep-alert ep-alert-success\" style=\"width: ${width}; margin: auto;\">\n                            <p>\n                                ${epData.success_msg}\n                            </p>\n                        </div>\n                    `;\n                }\n            } else {\n                alert( __( 'Something went wrong, please try again.', 'easy-poll') )\n            }\n        }\n    }\n});\n\n//# sourceURL=webpack://easy-poll/./assets/scripts/frontend.js?")},"./assets/scripts/utilities/ajax-request.js":
     4  \************************************/(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utilities_ajax_request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utilities/ajax-request */ \"./assets/scripts/utilities/ajax-request.js\");\n\n/**\n * Contains frontend scripts\n * \n * @since v1.0.0\n */\n\n\nconst {__} = wp.i18n;\n\nwindow.addEventListener('DOMContentLoaded', function() {\n    // Handle user's poll submission\n    const pollForm = document.getElementById('ep-poll-form');\n    const pollWrapper = document.querySelector('.ep-poll-wrapper');\n    if ( !pollForm) {\n        return;\n    }\n    pollForm.onsubmit = async (e) => {\n        e.preventDefault();\n        let warningMsg = __('Do you want to submit it? This cannot be reverted!', 'easy-poll');\n        if (confirm(warningMsg)) {\n            const submitBtn = pollForm.querySelector('.ep-btn');\n            const formData = new FormData(pollForm);\n            formData.set('action', 'ep_poll_submit');\n            const response = await (0,_utilities_ajax_request__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(formData, true, submitBtn);\n            let width = `${epData.poll_template_width}%`;\n            if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {\n                width = '92%';\n            }\n            if (response.success) {\n                if (pollWrapper) {\n                    pollWrapper.innerHTML = `\n                        <div class=\"ep-alert ep-alert-success\" style=\"width: ${width}; margin: auto;\">\n                            <p>\n                                ${epData.success_msg}\n                            </p>\n                        </div>\n                    `;\n                }\n            } else {\n                alert( __( 'Something went wrong, please try again.', 'easy-poll') )\n            }\n        }\n    }\n});\n\n//# sourceURL=webpack://easy-poll/./assets/scripts/frontend.js?")},"./assets/scripts/utilities/ajax-request.js":
    55/*!**************************************************!*\
    66  !*** ./assets/scripts/utilities/ajax-request.js ***!
    7   \**************************************************/(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ ajaxRequest)\n/* harmony export */ });\n/**\n * Ajax request for global use\n *\n * @param {*} formData | form data for post request\n * @returns json response on success or false\n */\n const { __ } = wp.i18n; \n async function ajaxRequest(formData, jsonResponse = true, target = false) {\n\n    let loadingMessage = __('Loading', 'easy-poll');\n    let prevHtml = '';\n\n    if (target) {\n        prevHtml = target.innerHTML;\n        // Disabled target button.\n        target.setAttribute('disabled', true);\n        // Show loading message.\n        target.innerHTML = loadingMessage;\n    }\n\n    const post = await fetch(epData.url, {\n        method: 'POST',\n        body: formData,\n    });\n\n    if (target) {\n        // Reset button to the prev state.\n        target.innerHTML = prevHtml;\n        target.removeAttribute('disabled');\n    }\n    if (post.ok) {\n        if (jsonResponse) {\n            return await post.json();\n        } else {\n            return await post.text();\n        }\n    } else {\n        return false;\n    }\n}\n\n//# sourceURL=webpack://easy-poll/./assets/scripts/utilities/ajax-request.js?")}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./assets/scripts/frontend.js")})();
     7  \**************************************************/(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* binding */ ajaxRequest)\n/* harmony export */ });\n/**\n * Ajax request for global use\n *\n * @param {*} formData | form data for post request\n * @returns json response on success or false\n */\n const { __ } = wp.i18n; \n async function ajaxRequest(formData, jsonResponse = true, target = false) {\n\n    let loadingMessage = __('Loading', 'easy-poll');\n    let prevHtml = '';\n\n    if (target) {\n        prevHtml = target.innerHTML;\n        // Disabled target button.\n        target.setAttribute('disabled', true);\n        // Show loading message.\n        target.innerHTML = loadingMessage;\n    }\n\n    const post = await fetch(epData.url, {\n        method: 'POST',\n        body: formData,\n    });\n\n    if (target) {\n        // Reset button to the prev state.\n        target.innerHTML = prevHtml;\n        target.removeAttribute('disabled');\n    }\n    if (post.ok) {\n        if (jsonResponse) {\n            return await post.json();\n        } else {\n            return await post.text();\n        }\n    } else {\n        return false;\n    }\n}\n\n//# sourceURL=webpack://easy-poll/./assets/scripts/utilities/ajax-request.js?")}},__webpack_module_cache__={};function __webpack_require__(e){var n=__webpack_module_cache__[e];if(void 0!==n)return n.exports;var t=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](t,t.exports,__webpack_require__),t.exports}__webpack_require__.d=(e,n)=>{for(var t in n)__webpack_require__.o(n,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./assets/scripts/frontend.js")})();
  • easy-poll/trunk/easy-poll.php

    r2776489 r2831563  
    88 * Text Domain:     easy-poll
    99 * Domain Path:     /languages
    10  * Version:         1.0.1
     10 * Version:         1.1.0
    1111 *
    1212 * @package         EasyPoll
     
    1919use EasyPoll\Database\EasyPollFields;
    2020use EasyPoll\Database\EasyPollOptions;
     21use EasyPoll\ErrorHandler\Init as ErrorHandlerInit;
    2122use EasyPoll\FormBuilder\FormClient;
    2223use EasyPoll\Metabox\MetaboxInit;
     
    9596            array_push( self::$plugin_data, $plugin_data );
    9697
    97             self::$plugin_data['plugin_url']   = trailingslashit( plugin_dir_url( __FILE__ ) );
    98             self::$plugin_data['plugin_path']  = trailingslashit( plugin_dir_path( __FILE__ ) );
     98            self::$plugin_data['plugin_url']   = plugin_dir_url( __FILE__ );
     99            self::$plugin_data['plugin_path']  = plugin_dir_path( __FILE__ );
    99100            self::$plugin_data['base_name']    = plugin_basename( __FILE__ );
    100101            self::$plugin_data['templates']    = trailingslashit( plugin_dir_path( __FILE__ ) . 'templates' );
     
    145146            // Save default settings options.
    146147            Options::save_default_settings();
     148
     149            flush_rewrite_rules();
    147150        }
    148151
     
    180183            new ShortCodes();
    181184            new Report();
     185            new ErrorHandlerInit();
    182186        }
    183187    }
  • easy-poll/trunk/includes/Admin/Menu/MainMenu.php

    r2776193 r2831563  
    141141        // Available sub-menu.
    142142        $submenus = array(
     143            'Report',
    143144            'Settings',
    144             'Report',
    145145        );
    146146        $submenus = apply_filters( 'tp_submenus', $submenus );
  • easy-poll/trunk/includes/CustomPosts/EasyPollPost.php

    r2776193 r2831563  
    1111
    1212namespace EasyPoll\CustomPosts;
     13
     14use EasyPoll\Settings\Options;
    1315
    1416if ( ! defined( 'ABSPATH' ) ) {
     
    4749     */
    4850    public static function post_args(): array {
     51        $poll_slug = Options::get_option( 'ep-poll-slug', 'easy-poll' );
    4952        return array(
    5053            'label'           => __( 'Poll', 'easy-poll' ),
     
    7275            'capability_type' => 'post',
    7376            'supports'        => array( 'title', 'editor', 'author', 'thumbnail' ),
     77            'rewrite'         => array(
     78                'slug'       => $poll_slug,
     79                'with_front' => true,
     80            ),
    7481        );
    7582    }
  • easy-poll/trunk/includes/CustomPosts/FilterEasyPollColumns.php

    r2776193 r2831563  
    1111
    1212use EasyPoll\FormBuilder\Feedback;
     13use EasyPoll\PollHandler\PollHandler;
     14use EasyPoll\Utilities\Utilities;
    1315
    1416if ( ! defined( 'ABSPATH' ) ) {
     
    5456        $modify_columns['title']            = __( 'Title', 'easy-poll' );
    5557        $modify_columns['short_code']       = __( 'Short code', 'easy-poll' );
     58        $modify_columns['poll_status']      = __( 'Poll Status', 'easy-poll' );
     59        $modify_columns['expire_datetime']  = __( 'Expire at', 'easy-poll' );
    5660        $modify_columns['total_submission'] = __( 'Total Submission', 'easy-poll' );
    5761        $modify_columns['author']           = __( 'Author', 'easy-poll' );
     
    8387            }
    8488            if ( 'total_submission' === $column_name ) {
    85                 $total = Feedback::total_submission( $post_id );
     89                $total          = Feedback::total_submission( $post_id );
    8690                $submission_url = admin_url( 'admin.php?page=ep-report&poll-id=' . $post_id );
    8791                if ( $total ) {
     
    9397                }
    9498            }
     99
     100            /**
     101             * Show poll status
     102             *
     103             * @since 1.1.0
     104             */
     105            if ( 'poll_status' === $column_name ) {
     106                $poll_datetime = PostCallBack::get_poll_datetime( $post_id );
     107
     108                $utc_start_time = $poll_datetime->start_datetime ? Utilities::get_gmt_date_from_timezone_date( $poll_datetime->start_datetime, $poll_datetime->timezone ) : false;
     109
     110                $utc_expire_time = $poll_datetime->expire_datetime ? Utilities::get_gmt_date_from_timezone_date( $poll_datetime->expire_datetime, $poll_datetime->timezone ) : false;
     111
     112                $poll_status  = PollHandler::check_poll_status( $utc_start_time, $utc_expire_time );
     113                $poll_status  = str_replace( 'poll-', '', $poll_status );
     114                $status_class = ( 'upcoming' === $poll_status ? 'primary' : ( 'expired' === $poll_status ? 'danger' : 'success' ) );
     115                ?>
     116                <span class="ep-badge ep-badge-<?php echo esc_attr( $status_class ); ?>">
     117                    <?php echo esc_html( strtoupper( $poll_status ) ); ?>
     118                </span>
     119                <?php
     120            }
     121
     122            if ( 'expire_datetime' === $column_name ) {
     123                $poll_datetime   = PostCallBack::get_poll_datetime( $post_id );
     124                $expire_datetime = '' === $poll_datetime->expire_datetime ? __( 'No Expiry', 'easy-poll' ) : Utilities::get_translated_date( $poll_datetime->expire_datetime );
     125                echo esc_html( $expire_datetime );
     126            }
    95127        }
    96128    }
  • easy-poll/trunk/includes/CustomPosts/InitCustomPosts.php

    r2776193 r2831563  
    2626    public function __construct() {
    2727        add_action( 'init', __CLASS__ . '::init' );
     28
     29        /**
     30         * Register post callback class
     31         *
     32         * @since 1.1.0
     33         */
     34        self::register_callback_class();
    2835    }
    2936
     
    5057        new FilterEasyPollColumns();
    5158    }
     59
     60    /**
     61     * Register post callback class
     62     *
     63     * @since 1.1.0
     64     *
     65     * @return void
     66     */
     67    private static function register_callback_class() {
     68        new PostCallBack();
     69    }
    5270}
  • easy-poll/trunk/includes/PollHandler/PollHandler.php

    r2776193 r2831563  
    110110        return $save ? wp_send_json_success() : wp_send_json_error();
    111111    }
     112
     113    /**
     114     * Check poll status by the start & expire datetime
     115     *
     116     * @since 1.1.0
     117     *
     118     * @param mixed $start_datetime false|string(y-m-d H:i:s).
     119     * @param mixed $expire_datetime false|string(y-m-d H:i:s).
     120     *
     121     * @return string poll status poll-active|poll-expired|poll-upcoming
     122     */
     123    public static function check_poll_status( $start_datetime, $expire_datetime ): string {
     124        if ( '' === $start_datetime ) {
     125            $start_datetime = false;
     126        }
     127        if ( '' === $expire_datetime ) {
     128            $expire_datetime = false;
     129        }
     130        $poll_status = 'poll-active';
     131        // If poll start time not set then start right away.
     132        if ( false !== $start_datetime ) {
     133            // Check if poll expire date. False means expire date not set.
     134            if ( false !== $expire_datetime && ( time() >= strtotime( $expire_datetime ) ) ) {
     135                $poll_status = 'poll-expired';
     136            } elseif ( time() < strtotime( $start_datetime ) ) {
     137                $poll_status = 'poll-upcoming';
     138            }
     139        } else {
     140            // If poll start datetime set.
     141            if ( time() < strtotime( $start_datetime ) ) {
     142                $poll_status = 'poll-upcoming';
     143            } else {
     144                // Expire time not set.
     145                if ( false === $expire_datetime ) {
     146                    $poll_status = 'poll-active';
     147                } elseif ( time() >= strtotime( $expire_datetime ) ) {
     148                    $poll_status = 'poll-expired';
     149                } elseif ( time() >= strtotime( $start_datetime ) && time() < strtotime( $expire_datetime ) ) {
     150
     151                    $poll_status = 'poll-active';
     152                }
     153            }
     154        }
     155        return $poll_status;
     156    }
    112157}
  • easy-poll/trunk/includes/Settings/Options.php

    r2776489 r2831563  
    2727     */
    2828    const OPTION_KEY = 'ep-settings';
    29     const REQUIRE_PERMALINK_UPDATE = 'ep-permalink-update-require';
    3029
    3130    /**
     
    5049            array(
    5150                array(
     51                    'label'       => __( 'Poll Slug', 'easy-poll' ),
     52                    'field_type'  => 'input',
     53                    'option_name' => 'ep-poll-slug',
     54                    'description' => __( 'Customize default poll slug, refresh <strong>permalink</strong> after update the slug', 'easy-poll' ),
     55                    'default'     => __( 'easy-poll', 'easy-poll' ),
     56                ),
     57                array(
    5258                    'label'       => __( 'Container Width' ),
    5359                    'field_type'  => 'radio',
     
    7076                    'field_type'  => 'number',
    7177                    'option_name' => 'ep-max-width',
    72                     'description' => __( 'Set max-width in percentage for the large screen devices', 'easy-poll' ),
     78                    'description' => __( 'Set <strong>max-width</strong> in percentage for the large screen devices', 'easy-poll' ),
    7379                    'default'     => 60,
    7480                ),
     
    130136                        ),
    131137                    ),
    132                     'description' => __( 'If allowed, any (logged-in/guest) users will be able to see & submit the poll.', 'easy-poll' ),
     138                    'description' => __( 'If allowed, any <strong>(logged-in/guest)</strong> users will be able to see & submit the poll.', 'easy-poll' ),
    133139                    'default'     => __( 'no', 'easy-poll' ),
     140                ),
     141                array(
     142                    'label'       => __( 'Upcoming Poll', 'easy-poll' ),
     143                    'field_type'  => 'textarea',
     144                    'option_name' => 'ep-upcoming-poll-message',
     145                    'description' => __( 'Write a message that will be visible if the user accesses an upcoming poll.\n Keep <strong>{time}</strong> placeholder if you want to show the start time.', 'easy-poll' ),
     146                    'default'     => __( 'The Poll will be started at {time}', 'easy-poll' ),
     147                ),
     148                array(
     149                    'label'       => __( 'Expire Poll', 'easy-poll' ),
     150                    'field_type'  => 'textarea',
     151                    'option_name' => 'ep-expired-poll-message',
     152                    'description' => __( 'Write a message that will be visible if the user accesses an expired poll.\n Keep <strong>{time}</strong> placeholder if you want to show the expired time.', 'easy-poll' ),
     153                    'default'     => __( 'The Poll has expired at {time}', 'easy-poll' ),
    134154                ),
    135155            ),
     
    155175        update_option( self::OPTION_KEY, $combined_options );
    156176        do_action( 'easy_poll_after_default_settings_save', $combined_options );
    157 
    158         /**
    159          * On plugin activate set option that permalink
    160          * update is required to prevent 404 error
    161          *
    162          * @since v1.0.1
    163          */
    164         update_option( self::REQUIRE_PERMALINK_UPDATE, 1 );
    165177    }
    166178
  • easy-poll/trunk/includes/Settings/Settings.php

    r2776489 r2831563  
    2626    public function __construct() {
    2727        new Options();
    28         new RewriteRules();
    2928    }
    3029}
  • easy-poll/trunk/includes/Utilities/Utilities.php

    r2776193 r2831563  
    1111
    1212use EasyPoll;
     13use phpDocumentor\Reflection\Types\Callable_;
    1314
    1415if ( ! defined( 'ABSPATH' ) ) {
     
    136137        return $data;
    137138    }
     139
     140    /**
     141     * Get global timezone
     142     *
     143     * @since 1.0.2
     144     *
     145     * @return array
     146     */
     147    public static function timezone_lists() {
     148        return array(
     149            'Pacific/Midway'                 => '(GMT-11:00) Midway Island, Samoa ',
     150            'Pacific/Pago_Pago'              => '(GMT-11:00) Pago Pago ',
     151            'Pacific/Honolulu'               => '(GMT-10:00) Hawaii ',
     152            'America/Anchorage'              => '(GMT-8:00) Alaska ',
     153            'America/Vancouver'              => '(GMT-7:00) Vancouver ',
     154            'America/Los_Angeles'            => '(GMT-7:00) Pacific Time (US and Canada) ',
     155            'America/Tijuana'                => '(GMT-7:00) Tijuana ',
     156            'America/Phoenix'                => '(GMT-7:00) Arizona ',
     157            'America/Edmonton'               => '(GMT-6:00) Edmonton ',
     158            'America/Denver'                 => '(GMT-6:00) Mountain Time (US and Canada) ',
     159            'America/Mazatlan'               => '(GMT-6:00) Mazatlan ',
     160            'America/Regina'                 => '(GMT-6:00) Saskatchewan ',
     161            'America/Guatemala'              => '(GMT-6:00) Guatemala ',
     162            'America/El_Salvador'            => '(GMT-6:00) El Salvador ',
     163            'America/Managua'                => '(GMT-6:00) Managua ',
     164            'America/Costa_Rica'             => '(GMT-6:00) Costa Rica ',
     165            'America/Tegucigalpa'            => '(GMT-6:00) Tegucigalpa ',
     166            'America/Winnipeg'               => '(GMT-5:00) Winnipeg ',
     167            'America/Chicago'                => '(GMT-5:00) Central Time (US and Canada) ',
     168            'America/Mexico_City'            => '(GMT-5:00) Mexico City ',
     169            'America/Panama'                 => '(GMT-5:00) Panama ',
     170            'America/Bogota'                 => '(GMT-5:00) Bogota ',
     171            'America/Lima'                   => '(GMT-5:00) Lima ',
     172            'America/Caracas'                => '(GMT-4:30) Caracas ',
     173            'America/Montreal'               => '(GMT-4:00) Montreal ',
     174            'America/New_York'               => '(GMT-4:00) Eastern Time (US and Canada) ',
     175            'America/Indianapolis'           => '(GMT-4:00) Indiana (East) ',
     176            'America/Puerto_Rico'            => '(GMT-4:00) Puerto Rico ',
     177            'America/Santiago'               => '(GMT-4:00) Santiago ',
     178            'America/Halifax'                => '(GMT-3:00) Halifax ',
     179            'America/Montevideo'             => '(GMT-3:00) Montevideo ',
     180            'America/Araguaina'              => '(GMT-3:00) Brasilia ',
     181            'America/Argentina/Buenos_Aires' => '(GMT-3:00) Buenos Aires, Georgetown ',
     182            'America/Sao_Paulo'              => '(GMT-3:00) Sao Paulo ',
     183            'Canada/Atlantic'                => '(GMT-3:00) Atlantic Time (Canada) ',
     184            'America/St_Johns'               => '(GMT-2:30) Newfoundland and Labrador ',
     185            'America/Godthab'                => '(GMT-2:00) Greenland ',
     186            'Atlantic/Cape_Verde'            => '(GMT-1:00) Cape Verde Islands ',
     187            'Atlantic/Azores'                => '(GMT+0:00) Azores ',
     188            'UTC'                            => '(GMT+0:00) Universal Time UTC ',
     189            'Etc/Greenwich'                  => '(GMT+0:00) Greenwich Mean Time ',
     190            'Atlantic/Reykjavik'             => '(GMT+0:00) Reykjavik ',
     191            'Africa/Nouakchott'              => '(GMT+0:00) Nouakchott ',
     192            'Europe/Dublin'                  => '(GMT+1:00) Dublin ',
     193            'Europe/London'                  => '(GMT+1:00) London ',
     194            'Europe/Lisbon'                  => '(GMT+1:00) Lisbon ',
     195            'Africa/Casablanca'              => '(GMT+1:00) Casablanca ',
     196            'Africa/Bangui'                  => '(GMT+1:00) West Central Africa ',
     197            'Africa/Algiers'                 => '(GMT+1:00) Algiers ',
     198            'Africa/Tunis'                   => '(GMT+1:00) Tunis ',
     199            'Europe/Belgrade'                => '(GMT+2:00) Belgrade, Bratislava, Ljubljana ',
     200            'CET'                            => '(GMT+2:00) Sarajevo, Skopje, Zagreb ',
     201            'Europe/Oslo'                    => '(GMT+2:00) Oslo ',
     202            'Europe/Copenhagen'              => '(GMT+2:00) Copenhagen ',
     203            'Europe/Brussels'                => '(GMT+2:00) Brussels ',
     204            'Europe/Berlin'                  => '(GMT+2:00) Amsterdam, Berlin, Rome, Stockholm, Vienna ',
     205            'Europe/Amsterdam'               => '(GMT+2:00) Amsterdam ',
     206            'Europe/Rome'                    => '(GMT+2:00) Rome ',
     207            'Europe/Stockholm'               => '(GMT+2:00) Stockholm ',
     208            'Europe/Vienna'                  => '(GMT+2:00) Vienna ',
     209            'Europe/Luxembourg'              => '(GMT+2:00) Luxembourg ',
     210            'Europe/Paris'                   => '(GMT+2:00) Paris ',
     211            'Europe/Zurich'                  => '(GMT+2:00) Zurich ',
     212            'Europe/Madrid'                  => '(GMT+2:00) Madrid ',
     213            'Africa/Harare'                  => '(GMT+2:00) Harare, Pretoria ',
     214            'Europe/Warsaw'                  => '(GMT+2:00) Warsaw ',
     215            'Europe/Prague'                  => '(GMT+2:00) Prague Bratislava ',
     216            'Europe/Budapest'                => '(GMT+2:00) Budapest ',
     217            'Africa/Tripoli'                 => '(GMT+2:00) Tripoli ',
     218            'Africa/Cairo'                   => '(GMT+2:00) Cairo ',
     219            'Africa/Johannesburg'            => '(GMT+2:00) Johannesburg ',
     220            'Europe/Helsinki'                => '(GMT+3:00) Helsinki ',
     221            'Africa/Nairobi'                 => '(GMT+3:00) Nairobi ',
     222            'Europe/Sofia'                   => '(GMT+3:00) Sofia ',
     223            'Europe/Istanbul'                => '(GMT+3:00) Istanbul ',
     224            'Europe/Athens'                  => '(GMT+3:00) Athens ',
     225            'Europe/Bucharest'               => '(GMT+3:00) Bucharest ',
     226            'Asia/Nicosia'                   => '(GMT+3:00) Nicosia ',
     227            'Asia/Beirut'                    => '(GMT+3:00) Beirut ',
     228            'Asia/Damascus'                  => '(GMT+3:00) Damascus ',
     229            'Asia/Jerusalem'                 => '(GMT+3:00) Jerusalem ',
     230            'Asia/Amman'                     => '(GMT+3:00) Amman ',
     231            'Europe/Moscow'                  => '(GMT+3:00) Moscow ',
     232            'Asia/Baghdad'                   => '(GMT+3:00) Baghdad ',
     233            'Asia/Kuwait'                    => '(GMT+3:00) Kuwait ',
     234            'Asia/Riyadh'                    => '(GMT+3:00) Riyadh ',
     235            'Asia/Bahrain'                   => '(GMT+3:00) Bahrain ',
     236            'Asia/Qatar'                     => '(GMT+3:00) Qatar ',
     237            'Asia/Aden'                      => '(GMT+3:00) Aden ',
     238            'Africa/Khartoum'                => '(GMT+3:00) Khartoum ',
     239            'Africa/Djibouti'                => '(GMT+3:00) Djibouti ',
     240            'Africa/Mogadishu'               => '(GMT+3:00) Mogadishu ',
     241            'Europe/Kiev'                    => '(GMT+3:00) Kiev ',
     242            'Asia/Dubai'                     => '(GMT+4:00) Dubai ',
     243            'Asia/Muscat'                    => '(GMT+4:00) Muscat ',
     244            'Asia/Tehran'                    => '(GMT+4:30) Tehran ',
     245            'Asia/Kabul'                     => '(GMT+4:30) Kabul ',
     246            'Asia/Baku'                      => '(GMT+5:00) Baku, Tbilisi, Yerevan ',
     247            'Asia/Yekaterinburg'             => '(GMT+5:00) Yekaterinburg ',
     248            'Asia/Tashkent'                  => '(GMT+5:00) Tashkent ',
     249            'Asia/Karachi'                   => '(GMT+5:00) Islamabad, Karachi ',
     250            'Asia/Calcutta'                  => '(GMT+5:30) India ',
     251            'Asia/Kolkata'                   => '(GMT+5:30) Mumbai, Kolkata, New Delhi ',
     252            'Asia/Kathmandu'                 => '(GMT+5:45) Kathmandu ',
     253            'Asia/Novosibirsk'               => '(GMT+6:00) Novosibirsk ',
     254            'Asia/Almaty'                    => '(GMT+6:00) Almaty ',
     255            'Asia/Dacca'                     => '(GMT+6:00) Dacca ',
     256            'Asia/Dhaka'                     => '(GMT+6:00) Astana, Dhaka ',
     257            'Asia/Krasnoyarsk'               => '(GMT+7:00) Krasnoyarsk ',
     258            'Asia/Bangkok'                   => '(GMT+7:00) Bangkok ',
     259            'Asia/Saigon'                    => '(GMT+7:00) Vietnam ',
     260            'Asia/Jakarta'                   => '(GMT+7:00) Jakarta ',
     261            'Asia/Irkutsk'                   => '(GMT+8:00) Irkutsk, Ulaanbaatar ',
     262            'Asia/Shanghai'                  => '(GMT+8:00) Beijing, Shanghai ',
     263            'Asia/Hong_Kong'                 => '(GMT+8:00) Hong Kong ',
     264            'Asia/Taipei'                    => '(GMT+8:00) Taipei ',
     265            'Asia/Kuala_Lumpur'              => '(GMT+8:00) Kuala Lumpur ',
     266            'Asia/Singapore'                 => '(GMT+8:00) Singapore ',
     267            'Australia/Perth'                => '(GMT+8:00) Perth ',
     268            'Asia/Yakutsk'                   => '(GMT+9:00) Yakutsk ',
     269            'Asia/Seoul'                     => '(GMT+9:00) Seoul ',
     270            'Asia/Tokyo'                     => '(GMT+9:00) Osaka, Sapporo, Tokyo ',
     271            'Australia/Darwin'               => '(GMT+9:30) Darwin ',
     272            'Australia/Adelaide'             => '(GMT+9:30) Adelaide ',
     273            'Asia/Vladivostok'               => '(GMT+10:00) Vladivostok ',
     274            'Pacific/Port_Moresby'           => '(GMT+10:00) Guam, Port Moresby ',
     275            'Australia/Brisbane'             => '(GMT+10:00) Brisbane ',
     276            'Australia/Sydney'               => '(GMT+10:00) Canberra, Melbourne, Sydney ',
     277            'Australia/Hobart'               => '(GMT+10:00) Hobart ',
     278            'Asia/Magadan'                   => '(GMT+10:00) Magadan ',
     279            'SST'                            => '(GMT+11:00) Solomon Islands ',
     280            'Pacific/Noumea'                 => '(GMT+11:00) New Caledonia ',
     281            'Asia/Kamchatka'                 => '(GMT+12:00) Kamchatka ',
     282            'Pacific/Fiji'                   => '(GMT+12:00) Fiji Islands, Marshall Islands ',
     283            'Pacific/Auckland'               => '(GMT+12:00) Auckland, Wellington',
     284        );
     285    }
     286
     287    /**
     288     * Get UTC time from any specific timezone date
     289     *
     290     * @since 1.1.0
     291     *
     292     * @param string $datetime  string date time.
     293     * @param string $timezone  timezone.
     294     * @param string $format    optional date format to get formatted date.
     295     *
     296     * @return string date time.
     297     */
     298    public static function get_gmt_date_from_timezone_date( $datetime, $timezone, $format = '' ) {
     299        if ( '' === $format ) {
     300            $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
     301        }
     302        $datetime = date_create( $datetime, new \DateTimeZone( $timezone ) );
     303        if ( false === $datetime ) {
     304            return gmdate( $format, 0 );
     305        }
     306        return $datetime->setTimezone( new \DateTimeZone( 'UTC' ) )->format( $format );
     307    }
     308
     309    /**
     310     * Undocumented function
     311     *
     312     * @since 1.1.0
     313     *
     314     * @param string $date date time.
     315     * @param string $format date format for return date. If not set
     316     * WordPress default datetime format will be used.
     317     *
     318     * @return string
     319     */
     320    public static function get_translated_date( string $date, $format = '' ) {
     321        if ( ! $date ) {
     322            return '';
     323        }
     324        if ( '' === $format ) {
     325            $format = get_option( 'date_format ' ) . ' ' . get_option( 'time_format' );
     326        }
     327        return date_i18n( $format, strtotime( $date ) );
     328    }
     329
     330    /**
     331     * Sanitize array, single or multi dimensional array
     332     * Explicitly setup how should a value sanitize by the
     333     * sanitize function.
     334     *
     335     * @see available sanitize func
     336     * https://developer.wordpress.org/themes/theme-security/data-sanitization-escaping/
     337     *
     338     * @param array $input array to sanitize.
     339     * @param array $sanitize_mapping single dimensional map key value
     340     * pair to set up sanitization process. Key name should by inside
     341     * input array and the value will be callable func.
     342     * For ex: [key1 => sanitize_email, key2 => wp_kses_post ]
     343     *
     344     * If key not passed then default sanitize_text_field will be used.
     345     *
     346     * @return array
     347     */
     348    public static function sanitize_array( array $input, array $sanitize_mapping = array() ):array {
     349        $array = array();
     350
     351        if ( is_array( $input ) && count( $input ) ) {
     352            foreach ( $input as $key => $value ) {
     353                if ( is_array( $value ) ) {
     354                    $array[ $key ] = self::sanitize_array( $value );
     355                } else {
     356                    $key = sanitize_text_field( $key );
     357
     358                    // If mapping exists then use callback.
     359                    if ( isset( $sanitize_mapping[ $key ] ) ) {
     360                        $callback = $sanitize_mapping[ $key ];
     361                        $value    = call_user_func( $callback, wp_unslash( $value ) );
     362                    } else {
     363                        $value = sanitize_text_field( wp_unslash( $value ) );
     364                    }
     365                    $array[ $key ] = $value;
     366                }
     367            }
     368        }
     369        return is_array( $array ) && count( $array ) ? $array : array();
     370    }
     371
     372    /**
     373     * Sanitize post value through callable function
     374     *
     375     * @param string   $key required $_POST key.
     376     * @param callable $callback callable WP sanitize/esc func.
     377     * @param string   $default will be returned if key not set.
     378     *
     379     * @return string
     380     */
     381    public static function sanitize_post_field( string $key, callable $callback = null, $default = '' ) {
     382        if ( is_null( $callback ) ) {
     383            $callback = 'sanitize_text_field';
     384        }
     385        //phpcs:ignore
     386        if ( isset( $_POST[ $key ] ) ) {
     387            return call_user_func( $callback, wp_unslash( $_POST[ $key ] ) ); //phpcs:ignore
     388        }
     389        return $default;
     390    }
     391
     392    /**
     393     * Get allowed tags for using with wp_kses
     394     *
     395     * @since 1.1.0
     396     *
     397     * @param array $tags allowed tags.
     398     *
     399     * @return array
     400     */
     401    public static function allowed_tags( array $tags = array() ):array {
     402        $default      = array(
     403            'strong' => true,
     404            'b'      => true,
     405            'italic' => true,
     406            'a'      => array(
     407                'href'  => true,
     408                'class' => true,
     409                'id'    => true,
     410            ),
     411            'p'      => array(
     412                'class' => true,
     413                'id'    => true,
     414            ),
     415            'span'   => array(
     416                'class' => true,
     417            ),
     418        );
     419        $allowed_tags = wp_parse_args( $tags, $default );
     420        return $allowed_tags;
     421    }
    138422}
  • easy-poll/trunk/languages/easy-poll.pot

    r2776489 r2831563  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Easy Poll 1.0.1\n"
     5"Project-Id-Version: Easy Poll 1.1.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-poll\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-08-27T13:12:23+00:00\n"
     12"POT-Creation-Date: 2022-12-10T15:23:53+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.5.0\n"
     14"X-Generator: WP-CLI 2.7.1\n"
    1515"X-Domain: easy-poll\n"
    1616
     
    4747#: includes/Admin/Menu/SubMenu/Polls.php:29
    4848#: includes/Admin/Menu/SubMenu/Polls.php:40
    49 #: includes/CustomPosts/EasyPollPost.php:61
     49#: includes/CustomPosts/EasyPollPost.php:64
     50#: tests/PHPUnit/EasyPollPostTest.php:64
    5051msgid "Polls"
    5152msgstr ""
     
    6162msgstr ""
    6263
    63 #: includes/CustomPosts/EasyPollPost.php:50
     64#: includes/CustomPosts/EasyPollPost.php:53
     65#: tests/PHPUnit/EasyPollPostTest.php:53
    6466msgid "Poll"
    6567msgstr ""
    6668
    67 #: includes/CustomPosts/EasyPollPost.php:52
     69#: includes/CustomPosts/EasyPollPost.php:55
     70#: tests/PHPUnit/EasyPollPostTest.php:55
    6871msgctxt "post type general name"
    6972msgid "Polls"
    7073msgstr ""
    7174
    72 #: includes/CustomPosts/EasyPollPost.php:53
     75#: includes/CustomPosts/EasyPollPost.php:56
     76#: tests/PHPUnit/EasyPollPostTest.php:56
    7377msgctxt "post type singular name"
    7478msgid "Poll"
    7579msgstr ""
    7680
    77 #: includes/CustomPosts/EasyPollPost.php:54
     81#: includes/CustomPosts/EasyPollPost.php:57
     82#: tests/PHPUnit/EasyPollPostTest.php:57
    7883msgctxt "admin menu"
    7984msgid "Polls"
    8085msgstr ""
    8186
    82 #: includes/CustomPosts/EasyPollPost.php:55
     87#: includes/CustomPosts/EasyPollPost.php:58
     88#: tests/PHPUnit/EasyPollPostTest.php:58
    8389msgctxt "add new on admin bar"
    8490msgid "Poll"
    8591msgstr ""
    8692
    87 #: includes/CustomPosts/EasyPollPost.php:56
     93#: includes/CustomPosts/EasyPollPost.php:59
     94#: tests/PHPUnit/EasyPollPostTest.php:59
    8895msgctxt "tutor Poll add"
    8996msgid "Add New"
    9097msgstr ""
    9198
    92 #: includes/CustomPosts/EasyPollPost.php:57
     99#: includes/CustomPosts/EasyPollPost.php:60
     100#: tests/PHPUnit/EasyPollPostTest.php:60
    93101msgid "Add New Poll"
    94102msgstr ""
    95103
    96 #: includes/CustomPosts/EasyPollPost.php:58
     104#: includes/CustomPosts/EasyPollPost.php:61
     105#: tests/PHPUnit/EasyPollPostTest.php:61
    97106msgid "New Poll"
    98107msgstr ""
    99108
    100 #: includes/CustomPosts/EasyPollPost.php:59
     109#: includes/CustomPosts/EasyPollPost.php:62
     110#: tests/PHPUnit/EasyPollPostTest.php:62
    101111msgid "Edit Poll"
    102112msgstr ""
    103113
    104 #: includes/CustomPosts/EasyPollPost.php:60
     114#: includes/CustomPosts/EasyPollPost.php:63
     115#: tests/PHPUnit/EasyPollPostTest.php:63
    105116msgid "View Poll"
    106117msgstr ""
    107118
    108 #: includes/CustomPosts/EasyPollPost.php:62
     119#: includes/CustomPosts/EasyPollPost.php:65
     120#: tests/PHPUnit/EasyPollPostTest.php:65
    109121msgid "Search Polls"
    110122msgstr ""
    111123
    112 #: includes/CustomPosts/EasyPollPost.php:63
     124#: includes/CustomPosts/EasyPollPost.php:66
     125#: tests/PHPUnit/EasyPollPostTest.php:66
    113126msgid "Parent Polls:"
    114127msgstr ""
    115128
    116 #: includes/CustomPosts/EasyPollPost.php:64
     129#: includes/CustomPosts/EasyPollPost.php:67
     130#: tests/PHPUnit/EasyPollPostTest.php:67
    117131msgid "No Polls found."
    118132msgstr ""
    119133
    120 #: includes/CustomPosts/EasyPollPost.php:65
     134#: includes/CustomPosts/EasyPollPost.php:68
     135#: tests/PHPUnit/EasyPollPostTest.php:68
    121136msgid "No Polls found in Trash."
    122137msgstr ""
    123138
    124 #: includes/CustomPosts/EasyPollPost.php:67
     139#: includes/CustomPosts/EasyPollPost.php:70
     140#: tests/PHPUnit/EasyPollPostTest.php:70
    125141msgid "Easy poll custom post type"
    126142msgstr ""
    127143
    128 #: includes/CustomPosts/FilterEasyPollColumns.php:54
     144#: includes/CustomPosts/FilterEasyPollColumns.php:56
    129145msgid "Title"
    130146msgstr ""
    131147
    132 #: includes/CustomPosts/FilterEasyPollColumns.php:55
     148#: includes/CustomPosts/FilterEasyPollColumns.php:57
    133149msgid "Short code"
    134150msgstr ""
    135151
    136 #: includes/CustomPosts/FilterEasyPollColumns.php:56
     152#: includes/CustomPosts/FilterEasyPollColumns.php:58
     153msgid "Poll Status"
     154msgstr ""
     155
     156#: includes/CustomPosts/FilterEasyPollColumns.php:59
     157msgid "Expire at"
     158msgstr ""
     159
     160#: includes/CustomPosts/FilterEasyPollColumns.php:60
    137161msgid "Total Submission"
    138162msgstr ""
    139163
    140 #: includes/CustomPosts/FilterEasyPollColumns.php:57
     164#: includes/CustomPosts/FilterEasyPollColumns.php:61
    141165msgid "Author"
    142166msgstr ""
    143167
    144 #: includes/CustomPosts/FilterEasyPollColumns.php:58
     168#: includes/CustomPosts/FilterEasyPollColumns.php:62
    145169msgid "Date"
     170msgstr ""
     171
     172#: includes/CustomPosts/FilterEasyPollColumns.php:124
     173msgid "No Expiry"
    146174msgstr ""
    147175
     
    206234msgstr ""
    207235
    208 #: includes/Settings/Options.php:58
     236#: includes/Settings/Options.php:51
     237msgid "Poll Slug"
     238msgstr ""
     239
     240#: includes/Settings/Options.php:54
     241msgid "Customize default poll slug, refresh <strong>permalink</strong> after update the slug"
     242msgstr ""
     243
     244#: includes/Settings/Options.php:55
     245msgid "easy-poll"
     246msgstr ""
     247
     248#: includes/Settings/Options.php:64
     249#: includes/Settings/Options.php:131
     250msgid "Yes"
     251msgstr ""
     252
     253#: includes/Settings/Options.php:68
     254#: includes/Settings/Options.php:135
     255msgid "No"
     256msgstr ""
     257
     258#: includes/Settings/Options.php:71
     259msgid "Adjust the front-end poll template width"
     260msgstr ""
     261
     262#: includes/Settings/Options.php:75
     263msgid "Max Width"
     264msgstr ""
     265
     266#: includes/Settings/Options.php:78
     267msgid "Set <strong>max-width</strong> in percentage for the large screen devices"
     268msgstr ""
     269
     270#: includes/Settings/Options.php:82
     271msgid "Thumbnail Size"
     272msgstr ""
     273
     274#: includes/Settings/Options.php:88
     275msgid "Thumbnail"
     276msgstr ""
     277
     278#: includes/Settings/Options.php:92
     279msgid "Medium"
     280msgstr ""
     281
     282#: includes/Settings/Options.php:96
     283msgid "Medium Large"
     284msgstr ""
     285
     286#: includes/Settings/Options.php:100
     287msgid "Large"
     288msgstr ""
     289
     290#: includes/Settings/Options.php:104
     291msgid "Full"
     292msgstr ""
     293
     294#: includes/Settings/Options.php:107
     295msgid "Poll thumbnail size"
     296msgstr ""
     297
     298#: includes/Settings/Options.php:111
     299msgid "Select Multiple Hint"
     300msgstr ""
     301
     302#: includes/Settings/Options.php:114
     303msgid "Show a message so that users can understand that they can select multiple"
     304msgstr ""
     305
     306#: includes/Settings/Options.php:115
     307msgid "Select multiple if required"
     308msgstr ""
     309
     310#: includes/Settings/Options.php:118
     311msgid "Success Message"
     312msgstr ""
     313
     314#: includes/Settings/Options.php:121
     315msgid "Show a message after successful poll submission"
     316msgstr ""
     317
     318#: includes/Settings/Options.php:122
     319msgid "Thank you for submitting poll"
     320msgstr ""
     321
    209322#: includes/Settings/Options.php:125
    210 msgid "Yes"
    211 msgstr ""
    212 
    213 #: includes/Settings/Options.php:62
    214 #: includes/Settings/Options.php:129
    215 msgid "No"
    216 msgstr ""
    217 
    218 #: includes/Settings/Options.php:65
    219 msgid "Adjust the front-end poll template width"
    220 msgstr ""
    221 
    222 #: includes/Settings/Options.php:69
    223 msgid "Max Width"
    224 msgstr ""
    225 
    226 #: includes/Settings/Options.php:72
    227 msgid "Set max-width in percentage for the large screen devices"
    228 msgstr ""
    229 
    230 #: includes/Settings/Options.php:76
    231 msgid "Thumbnail Size"
    232 msgstr ""
    233 
    234 #: includes/Settings/Options.php:82
    235 msgid "Thumbnail"
    236 msgstr ""
    237 
    238 #: includes/Settings/Options.php:86
    239 msgid "Medium"
    240 msgstr ""
    241 
    242 #: includes/Settings/Options.php:90
    243 msgid "Medium Large"
    244 msgstr ""
    245 
    246 #: includes/Settings/Options.php:94
    247 msgid "Large"
    248 msgstr ""
    249 
    250 #: includes/Settings/Options.php:98
    251 msgid "Full"
    252 msgstr ""
    253 
    254 #: includes/Settings/Options.php:101
    255 msgid "Poll thumbnail size"
    256 msgstr ""
    257 
    258 #: includes/Settings/Options.php:105
    259 msgid "Select Multiple Hint"
    260 msgstr ""
    261 
    262 #: includes/Settings/Options.php:108
    263 msgid "Show a message so that users can understand that they can select multiple"
    264 msgstr ""
    265 
    266 #: includes/Settings/Options.php:109
    267 msgid "Select multiple if required"
    268 msgstr ""
    269 
    270 #: includes/Settings/Options.php:112
    271 msgid "Success Message"
    272 msgstr ""
    273 
    274 #: includes/Settings/Options.php:115
    275 msgid "Show a message after successful poll submission"
    276 msgstr ""
    277 
    278 #: includes/Settings/Options.php:116
    279 msgid "Thank you for submitting poll"
    280 msgstr ""
    281 
    282 #: includes/Settings/Options.php:119
    283323msgid "Guest Submit"
    284324msgstr ""
    285325
    286 #: includes/Settings/Options.php:132
    287 msgid "If allowed, any (logged-in/guest) users will be able to see & submit the poll."
    288 msgstr ""
    289 
    290 #: includes/Settings/Options.php:133
     326#: includes/Settings/Options.php:138
     327msgid "If allowed, any <strong>(logged-in/guest)</strong> users will be able to see & submit the poll."
     328msgstr ""
     329
     330#: includes/Settings/Options.php:139
    291331msgid "no"
     332msgstr ""
     333
     334#: includes/Settings/Options.php:142
     335msgid "Upcoming Poll"
     336msgstr ""
     337
     338#: includes/Settings/Options.php:145
     339msgid "Write a message that will be visible if the user accesses an upcoming poll.\\n Keep <strong>{time}</strong> placeholder if you want to show the start time."
     340msgstr ""
     341
     342#: includes/Settings/Options.php:146
     343msgid "The Poll will be started at {time}"
     344msgstr ""
     345
     346#: includes/Settings/Options.php:149
     347msgid "Expire Poll"
     348msgstr ""
     349
     350#: includes/Settings/Options.php:152
     351msgid "Write a message that will be visible if the user accesses an expired poll.\\n Keep <strong>{time}</strong> placeholder if you want to show the expired time."
     352msgstr ""
     353
     354#: includes/Settings/Options.php:153
     355msgid "The Poll has expired at {time}"
    292356msgstr ""
    293357
     
    304368msgstr ""
    305369
    306 #: templates/easy-poll.php:45
     370#: templates/easy-poll.php:54
    307371#: templates/poll-form.php:42
    308372msgid "Permission Denied"
    309373msgstr ""
    310374
    311 #: templates/easy-poll.php:46
     375#: templates/easy-poll.php:55
    312376#: templates/poll-form.php:43
    313377msgid "Guest are not allowed for participating the Poll. Please log-in to participate."
    314378msgstr ""
    315379
    316 #: templates/easy-poll.php:63
     380#: templates/easy-poll.php:72
    317381#: templates/poll-form.php:60
    318382msgid "Poll Already Submitted"
    319383msgstr ""
    320384
    321 #: templates/easy-poll.php:64
     385#: templates/easy-poll.php:73
    322386#: templates/poll-form.php:61
    323387msgid "The Poll you are trying access is already submitted"
    324388msgstr ""
    325389
     390#: templates/easy-poll.php:96
     391msgid " file not found"
     392msgstr ""
     393
    326394#: templates/poll-form.php:16
    327395msgid "Invalid poll id"
     
    334402#: templates/poll-form.php:156
    335403msgid "Questions not available"
     404msgstr ""
     405
     406#: templates/poll-parts/poll-expired.php:23
     407msgid "Poll has been Expired"
     408msgstr ""
     409
     410#: templates/poll-parts/poll-upcoming.php:23
     411msgid "Poll has not been Started Yet"
     412msgstr ""
     413
     414#: views/components/validation-error.php:18
     415msgid "Validation Error"
    336416msgstr ""
    337417
     
    350430msgstr ""
    351431
    352 #: views/metabox/poll-builder.php:19
     432#: views/metabox/poll-builder.php:31
     433msgid "Start Date Time"
     434msgstr ""
     435
     436#: views/metabox/poll-builder.php:37
     437msgid "Expiration Date Time"
     438msgstr ""
     439
     440#: views/metabox/poll-builder.php:43
     441msgid "Timezone"
     442msgstr ""
     443
     444#: views/metabox/poll-builder.php:58
    353445msgid "Add Question, Single/Multiple Choice"
    354446msgstr ""
    355447
    356 #: views/metabox/poll-builder.php:23
     448#: views/metabox/poll-builder.php:62
    357449msgid "Add Question, Input/Textarea"
    358450msgstr ""
    359451
    360 #: views/metabox/poll-builder.php:32
     452#: views/metabox/poll-builder.php:71
    361453msgid "Poll Questions"
    362454msgstr ""
    363455
    364 #: views/metabox/poll-builder.php:43
     456#: views/metabox/poll-builder.php:82
    365457msgid "Do you want to delete this question?"
    366458msgstr ""
    367459
    368 #: views/metabox/poll-builder.php:43
     460#: views/metabox/poll-builder.php:82
    369461msgid "Warning: Questions & their feedback will be deleted permanently!"
    370462msgstr ""
    371463
    372 #: views/metabox/poll-builder.php:55
     464#: views/metabox/poll-builder.php:94
    373465#: assets/scripts/backend/poll-builder.js:54
    374466#: assets/scripts/backend/poll-builder.js:109
     
    427519msgstr ""
    428520
    429 #: views/settings/settings.php:78
     521#: views/settings/settings.php:91
    430522msgid "Save Changes"
    431523msgstr ""
     
    444536msgstr ""
    445537
    446 #: assets/scripts/frontend.js:17
     538#: assets/scripts/frontend.js:20
    447539msgid "Do you want to submit it? This cannot be reverted!"
    448540msgstr ""
    449541
    450 #: assets/scripts/frontend.js:38
     542#: assets/scripts/frontend.js:41
    451543msgid "Something went wrong, please try again."
    452544msgstr ""
  • easy-poll/trunk/readme.txt

    r2776489 r2831563  
    44Tags: Poll, survey, feedback, contact, form
    55Requires at least: 5.3
    6 Tested up to: 6.0.1
     6Tested up to: 6.1
    77Requires PHP: 7.0
    8 Stable tag: 1.0.1
     8Stable tag: 1.1.0
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    4343=== Frequently Asked Questions ===
    4444
    45 = On the front-end Poll showing 404 not found =
     45= Can I create multiple choice poll?
    4646
    47 Answer: Make your website permalink is set to post name. If not so, set it & update permalink.
     47Answer: Yes. Four type of poll can be created these are:
     48Single Choice
     49Multiple Choice
     50Input type ( for tiny text )
     51Textarea type ( for large text )
    4852
    4953= How to see submissions list =
     
    5458
    5559Answer: Yes
     60
     61= Can I create a schedule poll?
     62
     63Answer: Yes, you can set poll start & expiration date with any specific timezone
     64
     65= On the front-end Poll showing 404 not found =
     66
     67Answer: Make your website permalink is set to post name. If not so, set it & update permalink.
    5668
    5769=== Screenshots ===
     
    6981* Plugin released
    7082
    71 = 1.0.1  Aug 27, 2022 =
    72 Fix: 404 not found issue on the front end
     83= 1.1.0 - 10 December, 2022 =
     84New: Now poll could be created for any specific timezone with start & expire time
     85New: Poll status & expire column added on the poll list page
     86New: easy-poll default slug update option added on the settings page
     87New: Textarea field added to add message that will be visible if user visit before poll start and after expire
     88Fix: Javascript error showing on the console
    7389
    7490=== Upgrade Notice ===
    75 After activate the plugin reset the permalink from WordPress settings. It will prevent 404 not found poll on the frontend.
  • easy-poll/trunk/templates/easy-poll.php

    r2776193 r2831563  
    1010 */
    1111
     12use EasyPoll\CustomPosts\PostCallBack;
    1213use EasyPoll\PollHandler\PollHandler;
    1314use EasyPoll\Settings\Options;
     
    3233$allow_guest       = Options::get_option( 'ep-allow-guest', 'no' );
    3334$already_submitted = Feedback::is_user_already_submitted( $poll_id );
     35
     36$poll_datetime = PostCallBack::get_poll_datetime( $poll_id );
     37
     38$utc_start_time = $poll_datetime->start_datetime ? Utilities::get_gmt_date_from_timezone_date( $poll_datetime->start_datetime, $poll_datetime->timezone ) : false;
     39
     40$utc_expire_time = $poll_datetime->expire_datetime ? Utilities::get_gmt_date_from_timezone_date( $poll_datetime->expire_datetime, $poll_datetime->timezone ) : false;
     41
     42$plugin_data = EasyPoll::plugin_data();
    3443?>
    3544
     
    7180    return;
    7281}
     82
     83$poll_template_part = PollHandler::check_poll_status( $utc_start_time, $utc_expire_time );
     84$poll_template_part = $plugin_data['templates'] . "poll-parts/{$poll_template_part}.php";
     85if ( file_exists( $poll_template_part ) ) {
     86    Utilities::load_file_from_custom_path(
     87        $poll_template_part,
     88        array(
     89            'poll-id'         => $poll_id,
     90            'thumbnail-size'  => $thumbnail_size,
     91            'start_datetime'  => Utilities::get_translated_date( $poll_datetime->start_datetime ),
     92            'expire_datetime' => Utilities::get_translated_date( $poll_datetime->expire_datetime ),
     93        )
     94    );
     95} else {
     96    echo esc_html( $poll_template_part ) . esc_html__( ' file not found', 'easy-poll' );
     97}
    7398?>
    74     <h2>
    75         <?php echo esc_html( get_the_title( $poll_id ) ); ?>
    76     </h2>
    7799
    78     <?php if ( '' !== get_the_post_thumbnail( $poll_id ) ) : ?>
    79         <?php echo get_the_post_thumbnail( $poll_id, $thumbnail_size ); ?>
    80     <?php endif; ?>
    81 
    82     <?php if ( '' !== get_the_content( $poll_id ) ) : ?>
    83         <div class="ep-poll-contents">
    84             <?php echo wp_kses_post( get_the_content( $poll_id ) ); ?>
    85         </div>
    86     <?php endif; ?>
    87 
    88     <!-- render poll  -->
    89     <?php PollHandler::render_poll( get_the_ID() ); ?>
    90     <!-- render poll  -->
    91100</div>
    92101
  • easy-poll/trunk/vendor/autoload.php

    r2776193 r2831563  
    44
    55if (PHP_VERSION_ID < 50600) {
    6     echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
    7     exit(1);
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
     15        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
    821}
    922
  • easy-poll/trunk/vendor/composer/autoload_psr4.php

    r2776193 r2831563  
    77
    88return array(
    9     'EasyPoll\\Tests\\' => array($baseDir . '/tests'),
    109    'EasyPoll\\' => array($baseDir . '/includes'),
    1110);
  • easy-poll/trunk/vendor/composer/autoload_static.php

    r2776193 r2831563  
    1010        'E' =>
    1111        array (
    12             'EasyPoll\\Tests\\' => 15,
    1312            'EasyPoll\\' => 9,
    1413        ),
     
    1615
    1716    public static $prefixDirsPsr4 = array (
    18         'EasyPoll\\Tests\\' =>
    19         array (
    20             0 => __DIR__ . '/../..' . '/tests',
    21         ),
    2217        'EasyPoll\\' =>
    2318        array (
  • easy-poll/trunk/vendor/composer/installed.php

    r2776193 r2831563  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '4c21c6b148fa56b005e28e051dfa947f92a788f7',
     6        'reference' => 'c9ae0801888dc881d6721129f325fd087f995a98',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
    99        'aliases' => array(),
    10         'dev' => true,
     10        'dev' => false,
    1111    ),
    1212    'versions' => array(
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '4c21c6b148fa56b005e28e051dfa947f92a788f7',
     16            'reference' => 'c9ae0801888dc881d6721129f325fd087f995a98',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
    1919            'aliases' => array(),
    2020            'dev_requirement' => false,
    21         ),
    22         'phpcompatibility/php-compatibility' => array(
    23             'pretty_version' => '9.3.5',
    24             'version' => '9.3.5.0',
    25             'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
    26             'type' => 'phpcodesniffer-standard',
    27             'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
    28             'aliases' => array(),
    29             'dev_requirement' => true,
    30         ),
    31         'phpcompatibility/phpcompatibility-paragonie' => array(
    32             'pretty_version' => '1.3.1',
    33             'version' => '1.3.1.0',
    34             'reference' => 'ddabec839cc003651f2ce695c938686d1086cf43',
    35             'type' => 'phpcodesniffer-standard',
    36             'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
    37             'aliases' => array(),
    38             'dev_requirement' => true,
    39         ),
    40         'phpcompatibility/phpcompatibility-wp' => array(
    41             'pretty_version' => '2.1.3',
    42             'version' => '2.1.3.0',
    43             'reference' => 'd55de55f88697b9cdb94bccf04f14eb3b11cf308',
    44             'type' => 'phpcodesniffer-standard',
    45             'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
    46             'aliases' => array(),
    47             'dev_requirement' => true,
    4821        ),
    4922        'squizlabs/php_codesniffer' => array(
  • easy-poll/trunk/views/metabox/poll-builder.php

    r2776193 r2831563  
    77 */
    88
     9use EasyPoll\CustomPosts\PostCallBack;
    910use EasyPoll\FormBuilder\FormField;
    1011use EasyPoll\Utilities\Utilities;
    1112
    12 $fields = FormField::get_poll_fields_with_option( get_the_ID() );
     13$fields      = FormField::get_poll_fields_with_option( get_the_ID() );
     14$timezones   = Utilities::timezone_lists();
     15$datetime    = PostCallBack::get_poll_datetime( get_the_ID() );
     16$plugin_data = EasyPoll::plugin_data();
    1317?>
    1418<?php do_action( 'ep_before_poll_builder_meta_box', get_the_ID() ); ?>
    1519<div class="ep-meta-box-wrapper ep-wrapper">
    16     <div class="ep-d-flex ep-gap-10">
     20
     21    <!-- show validation error -->
     22    <?php
     23        $error_template = $plugin_data['views'] . 'components/validation-error.php';
     24        Utilities::load_file_from_custom_path( $error_template );
     25    ?>
     26    <!-- show validation error end -->
     27
     28    <div class="ep-expire-date-wrapper ep-d-flex ep-align-center ep-gap-10 ep-mt-10">
     29        <div class="ep-start-datetime ep-d-flex ep-flex-column">
     30            <label for="ep-start-datetime" class="ep-col-1">
     31                <?php esc_html_e( 'Start Date Time', 'easy-poll' ); ?>
     32            </label>
     33            <input type="datetime-local" name="ep-start-datetime" class="ep-mt-10" id="ep-start-datetime" value="<?php echo esc_attr( $datetime->start_datetime ); ?>"/>
     34        </div>
     35        <div class="ep-end-datetime ep-d-flex ep-flex-column">
     36            <label for="ep-expire-datetime" class="ep-col-1">
     37                <?php esc_html_e( 'Expiration Date Time', 'easy-poll' ); ?>
     38            </label>
     39            <input type="datetime-local" name="ep-expire-datetime" class="ep-mt-10" id="ep-expire-datetime" value="<?php echo esc_attr( $datetime->expire_datetime ); ?>"/>
     40        </div>
     41        <div class="ep-date-timezone ep-d-flex ep-flex-column">
     42            <label for="ep-date-timezone" class="ep-col-1">
     43                <?php esc_html_e( 'Timezone', 'easy-poll' ); ?>
     44            </label>
     45            <select name="ep-date-timezone" class="ep-mt-10" id="ep-date-timezone" style="max-width: 250px;">
     46                <?php foreach ( $timezones as $key => $timezone ) : ?>
     47                    <option value="<?php echo esc_html( $key ); ?>" <?php selected( $datetime->timezone, $key ); ?>>
     48                        <?php echo esc_html( $timezone ); ?>
     49                    </option>
     50                <?php endforeach; ?>
     51            </select>
     52        </div>
     53    </div>
     54
     55    <div class="ep-d-flex ep-gap-10 ep-mt-20">
    1756        <button type="button" class="ep-btn ep-btn-sm ep-mt-10 ep-modal-opener" data-target="#ep-single-multiple-choice-modal">
    1857            <i class="dashicons dashicons-insert"></i>
     
    2665
    2766    <!-- field listing -->
    28     <div class="ep-poll-fields-wrapper">
     67    <div class="ep-poll-fields-wrapper ep-pt-10">
    2968        <?php if ( is_array( $fields ) && count( $fields ) ) : ?>
    3069            <?php $i = 0; ?>
    31             <h4>
     70            <h3>
    3271                <?php esc_html_e( 'Poll Questions', 'easy-poll' ); ?>
    33             </h4>
     72            </h3>
    3473            <?php foreach ( $fields as $value ) : ?>
    3574                <?php
  • easy-poll/trunk/views/settings/settings.php

    r2776193 r2831563  
    1818
    1919if ( ! $settings ) {
    20     die( esc_html_e( 'Invalid settings, try re-install the plugin', 'easy-poll') );
     20    die( esc_html_e( 'Invalid settings, try re-install the plugin', 'easy-poll' ) );
    2121}
    2222?>
     
    6666                        <?php endif; ?>
    6767
    68                         <p class="description">
    69                             <?php echo esc_html( $option['description'] ); ?>
    70                         </p>
    71                        
     68                        <div class="description">
     69                            <?php
     70                            $desc_lines = explode( '\n', $option['description'] );
     71                            foreach ( $desc_lines as $desc ) {
     72                                ?>
     73                                    <p class="description">
     74                                    <?php
     75                                    echo wp_kses(
     76                                        $desc,
     77                                        Utilities::allowed_tags()
     78                                    );
     79                                    ?>
     80                                    </p>
     81                                    <?php
     82                            }
     83                            ?>
     84                        </div>
    7285                    </td>
    7386                </tr>
Note: See TracChangeset for help on using the changeset viewer.