Changeset 2831563
- Timestamp:
- 12/10/2022 03:31:53 PM (3 years ago)
- Location:
- easy-poll/trunk
- Files:
-
- 9 added
- 21 edited
-
assets/bundles/backend-style.min.css (modified) (3 diffs)
-
assets/bundles/frontend-style.min.css (modified) (3 diffs)
-
assets/bundles/frontend.min.js (modified) (1 diff)
-
easy-poll.php (modified) (5 diffs)
-
includes/Admin/Menu/MainMenu.php (modified) (1 diff)
-
includes/CustomPosts/EasyPollPost.php (modified) (3 diffs)
-
includes/CustomPosts/FilterEasyPollColumns.php (modified) (4 diffs)
-
includes/CustomPosts/InitCustomPosts.php (modified) (2 diffs)
-
includes/CustomPosts/PostCallBack.php (added)
-
includes/ErrorHandler (added)
-
includes/ErrorHandler/ErrorHandler.php (added)
-
includes/ErrorHandler/Init.php (added)
-
includes/PollHandler/PollHandler.php (modified) (1 diff)
-
includes/Settings/Options.php (modified) (5 diffs)
-
includes/Settings/Settings.php (modified) (1 diff)
-
includes/Utilities/Utilities.php (modified) (2 diffs)
-
languages/easy-poll.pot (modified) (10 diffs)
-
readme.txt (modified) (4 diffs)
-
templates/easy-poll.php (modified) (3 diffs)
-
templates/poll-parts (added)
-
templates/poll-parts/poll-active.php (added)
-
templates/poll-parts/poll-expired.php (added)
-
templates/poll-parts/poll-upcoming.php (added)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
-
views/components/validation-error.php (added)
-
views/metabox/poll-builder.php (modified) (2 diffs)
-
views/settings/settings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-poll/trunk/assets/bundles/backend-style.min.css
r2776193 r2831563 5 5 width: 100%; 6 6 } 7 .ep-wrapper input[type=datetime-local] { 8 width: 220px; 9 } 7 10 .ep-wrapper a { 8 11 text-decoration: none; … … 102 105 } 103 106 104 .ep-col- 2 {107 .ep-col-12 { 105 108 flex-basis: 96%; 106 109 } … … 300 303 padding: 5px 8px; 301 304 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; 302 346 } 303 347 -
easy-poll/trunk/assets/bundles/frontend-style.min.css
r2776193 r2831563 5 5 width: 100%; 6 6 } 7 .ep-wrapper input[type=datetime-local] { 8 width: 220px; 9 } 7 10 .ep-wrapper a { 8 11 text-decoration: none; … … 102 105 } 103 106 104 .ep-col- 2 {107 .ep-col-12 { 105 108 flex-basis: 96%; 106 109 } … … 302 305 } 303 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; 346 } 347 304 348 .ep-poll-wrapper { 305 349 padding: 20px 0 20px; -
easy-poll/trunk/assets/bundles/frontend.min.js
r2776193 r2831563 2 2 /*!************************************!*\ 3 3 !*** ./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": 5 5 /*!**************************************************!*\ 6 6 !*** ./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 8 8 * Text Domain: easy-poll 9 9 * Domain Path: /languages 10 * Version: 1. 0.110 * Version: 1.1.0 11 11 * 12 12 * @package EasyPoll … … 19 19 use EasyPoll\Database\EasyPollFields; 20 20 use EasyPoll\Database\EasyPollOptions; 21 use EasyPoll\ErrorHandler\Init as ErrorHandlerInit; 21 22 use EasyPoll\FormBuilder\FormClient; 22 23 use EasyPoll\Metabox\MetaboxInit; … … 95 96 array_push( self::$plugin_data, $plugin_data ); 96 97 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__ ); 99 100 self::$plugin_data['base_name'] = plugin_basename( __FILE__ ); 100 101 self::$plugin_data['templates'] = trailingslashit( plugin_dir_path( __FILE__ ) . 'templates' ); … … 145 146 // Save default settings options. 146 147 Options::save_default_settings(); 148 149 flush_rewrite_rules(); 147 150 } 148 151 … … 180 183 new ShortCodes(); 181 184 new Report(); 185 new ErrorHandlerInit(); 182 186 } 183 187 } -
easy-poll/trunk/includes/Admin/Menu/MainMenu.php
r2776193 r2831563 141 141 // Available sub-menu. 142 142 $submenus = array( 143 'Report', 143 144 'Settings', 144 'Report',145 145 ); 146 146 $submenus = apply_filters( 'tp_submenus', $submenus ); -
easy-poll/trunk/includes/CustomPosts/EasyPollPost.php
r2776193 r2831563 11 11 12 12 namespace EasyPoll\CustomPosts; 13 14 use EasyPoll\Settings\Options; 13 15 14 16 if ( ! defined( 'ABSPATH' ) ) { … … 47 49 */ 48 50 public static function post_args(): array { 51 $poll_slug = Options::get_option( 'ep-poll-slug', 'easy-poll' ); 49 52 return array( 50 53 'label' => __( 'Poll', 'easy-poll' ), … … 72 75 'capability_type' => 'post', 73 76 'supports' => array( 'title', 'editor', 'author', 'thumbnail' ), 77 'rewrite' => array( 78 'slug' => $poll_slug, 79 'with_front' => true, 80 ), 74 81 ); 75 82 } -
easy-poll/trunk/includes/CustomPosts/FilterEasyPollColumns.php
r2776193 r2831563 11 11 12 12 use EasyPoll\FormBuilder\Feedback; 13 use EasyPoll\PollHandler\PollHandler; 14 use EasyPoll\Utilities\Utilities; 13 15 14 16 if ( ! defined( 'ABSPATH' ) ) { … … 54 56 $modify_columns['title'] = __( 'Title', 'easy-poll' ); 55 57 $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' ); 56 60 $modify_columns['total_submission'] = __( 'Total Submission', 'easy-poll' ); 57 61 $modify_columns['author'] = __( 'Author', 'easy-poll' ); … … 83 87 } 84 88 if ( 'total_submission' === $column_name ) { 85 $total = Feedback::total_submission( $post_id );89 $total = Feedback::total_submission( $post_id ); 86 90 $submission_url = admin_url( 'admin.php?page=ep-report&poll-id=' . $post_id ); 87 91 if ( $total ) { … … 93 97 } 94 98 } 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 } 95 127 } 96 128 } -
easy-poll/trunk/includes/CustomPosts/InitCustomPosts.php
r2776193 r2831563 26 26 public function __construct() { 27 27 add_action( 'init', __CLASS__ . '::init' ); 28 29 /** 30 * Register post callback class 31 * 32 * @since 1.1.0 33 */ 34 self::register_callback_class(); 28 35 } 29 36 … … 50 57 new FilterEasyPollColumns(); 51 58 } 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 } 52 70 } -
easy-poll/trunk/includes/PollHandler/PollHandler.php
r2776193 r2831563 110 110 return $save ? wp_send_json_success() : wp_send_json_error(); 111 111 } 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 } 112 157 } -
easy-poll/trunk/includes/Settings/Options.php
r2776489 r2831563 27 27 */ 28 28 const OPTION_KEY = 'ep-settings'; 29 const REQUIRE_PERMALINK_UPDATE = 'ep-permalink-update-require';30 29 31 30 /** … … 50 49 array( 51 50 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( 52 58 'label' => __( 'Container Width' ), 53 59 'field_type' => 'radio', … … 70 76 'field_type' => 'number', 71 77 'option_name' => 'ep-max-width', 72 'description' => __( 'Set max-widthin percentage for the large screen devices', 'easy-poll' ),78 'description' => __( 'Set <strong>max-width</strong> in percentage for the large screen devices', 'easy-poll' ), 73 79 'default' => 60, 74 80 ), … … 130 136 ), 131 137 ), 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' ), 133 139 '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' ), 134 154 ), 135 155 ), … … 155 175 update_option( self::OPTION_KEY, $combined_options ); 156 176 do_action( 'easy_poll_after_default_settings_save', $combined_options ); 157 158 /**159 * On plugin activate set option that permalink160 * update is required to prevent 404 error161 *162 * @since v1.0.1163 */164 update_option( self::REQUIRE_PERMALINK_UPDATE, 1 );165 177 } 166 178 -
easy-poll/trunk/includes/Settings/Settings.php
r2776489 r2831563 26 26 public function __construct() { 27 27 new Options(); 28 new RewriteRules();29 28 } 30 29 } -
easy-poll/trunk/includes/Utilities/Utilities.php
r2776193 r2831563 11 11 12 12 use EasyPoll; 13 use phpDocumentor\Reflection\Types\Callable_; 13 14 14 15 if ( ! defined( 'ABSPATH' ) ) { … … 136 137 return $data; 137 138 } 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 } 138 422 } -
easy-poll/trunk/languages/easy-poll.pot
r2776489 r2831563 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Easy Poll 1. 0.1\n"5 "Project-Id-Version: Easy Poll 1.1.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/easy-poll\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "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" 13 13 "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" 15 15 "X-Domain: easy-poll\n" 16 16 … … 47 47 #: includes/Admin/Menu/SubMenu/Polls.php:29 48 48 #: 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 50 51 msgid "Polls" 51 52 msgstr "" … … 61 62 msgstr "" 62 63 63 #: includes/CustomPosts/EasyPollPost.php:50 64 #: includes/CustomPosts/EasyPollPost.php:53 65 #: tests/PHPUnit/EasyPollPostTest.php:53 64 66 msgid "Poll" 65 67 msgstr "" 66 68 67 #: includes/CustomPosts/EasyPollPost.php:52 69 #: includes/CustomPosts/EasyPollPost.php:55 70 #: tests/PHPUnit/EasyPollPostTest.php:55 68 71 msgctxt "post type general name" 69 72 msgid "Polls" 70 73 msgstr "" 71 74 72 #: includes/CustomPosts/EasyPollPost.php:53 75 #: includes/CustomPosts/EasyPollPost.php:56 76 #: tests/PHPUnit/EasyPollPostTest.php:56 73 77 msgctxt "post type singular name" 74 78 msgid "Poll" 75 79 msgstr "" 76 80 77 #: includes/CustomPosts/EasyPollPost.php:54 81 #: includes/CustomPosts/EasyPollPost.php:57 82 #: tests/PHPUnit/EasyPollPostTest.php:57 78 83 msgctxt "admin menu" 79 84 msgid "Polls" 80 85 msgstr "" 81 86 82 #: includes/CustomPosts/EasyPollPost.php:55 87 #: includes/CustomPosts/EasyPollPost.php:58 88 #: tests/PHPUnit/EasyPollPostTest.php:58 83 89 msgctxt "add new on admin bar" 84 90 msgid "Poll" 85 91 msgstr "" 86 92 87 #: includes/CustomPosts/EasyPollPost.php:56 93 #: includes/CustomPosts/EasyPollPost.php:59 94 #: tests/PHPUnit/EasyPollPostTest.php:59 88 95 msgctxt "tutor Poll add" 89 96 msgid "Add New" 90 97 msgstr "" 91 98 92 #: includes/CustomPosts/EasyPollPost.php:57 99 #: includes/CustomPosts/EasyPollPost.php:60 100 #: tests/PHPUnit/EasyPollPostTest.php:60 93 101 msgid "Add New Poll" 94 102 msgstr "" 95 103 96 #: includes/CustomPosts/EasyPollPost.php:58 104 #: includes/CustomPosts/EasyPollPost.php:61 105 #: tests/PHPUnit/EasyPollPostTest.php:61 97 106 msgid "New Poll" 98 107 msgstr "" 99 108 100 #: includes/CustomPosts/EasyPollPost.php:59 109 #: includes/CustomPosts/EasyPollPost.php:62 110 #: tests/PHPUnit/EasyPollPostTest.php:62 101 111 msgid "Edit Poll" 102 112 msgstr "" 103 113 104 #: includes/CustomPosts/EasyPollPost.php:60 114 #: includes/CustomPosts/EasyPollPost.php:63 115 #: tests/PHPUnit/EasyPollPostTest.php:63 105 116 msgid "View Poll" 106 117 msgstr "" 107 118 108 #: includes/CustomPosts/EasyPollPost.php:62 119 #: includes/CustomPosts/EasyPollPost.php:65 120 #: tests/PHPUnit/EasyPollPostTest.php:65 109 121 msgid "Search Polls" 110 122 msgstr "" 111 123 112 #: includes/CustomPosts/EasyPollPost.php:63 124 #: includes/CustomPosts/EasyPollPost.php:66 125 #: tests/PHPUnit/EasyPollPostTest.php:66 113 126 msgid "Parent Polls:" 114 127 msgstr "" 115 128 116 #: includes/CustomPosts/EasyPollPost.php:64 129 #: includes/CustomPosts/EasyPollPost.php:67 130 #: tests/PHPUnit/EasyPollPostTest.php:67 117 131 msgid "No Polls found." 118 132 msgstr "" 119 133 120 #: includes/CustomPosts/EasyPollPost.php:65 134 #: includes/CustomPosts/EasyPollPost.php:68 135 #: tests/PHPUnit/EasyPollPostTest.php:68 121 136 msgid "No Polls found in Trash." 122 137 msgstr "" 123 138 124 #: includes/CustomPosts/EasyPollPost.php:67 139 #: includes/CustomPosts/EasyPollPost.php:70 140 #: tests/PHPUnit/EasyPollPostTest.php:70 125 141 msgid "Easy poll custom post type" 126 142 msgstr "" 127 143 128 #: includes/CustomPosts/FilterEasyPollColumns.php:5 4144 #: includes/CustomPosts/FilterEasyPollColumns.php:56 129 145 msgid "Title" 130 146 msgstr "" 131 147 132 #: includes/CustomPosts/FilterEasyPollColumns.php:5 5148 #: includes/CustomPosts/FilterEasyPollColumns.php:57 133 149 msgid "Short code" 134 150 msgstr "" 135 151 136 #: includes/CustomPosts/FilterEasyPollColumns.php:56 152 #: includes/CustomPosts/FilterEasyPollColumns.php:58 153 msgid "Poll Status" 154 msgstr "" 155 156 #: includes/CustomPosts/FilterEasyPollColumns.php:59 157 msgid "Expire at" 158 msgstr "" 159 160 #: includes/CustomPosts/FilterEasyPollColumns.php:60 137 161 msgid "Total Submission" 138 162 msgstr "" 139 163 140 #: includes/CustomPosts/FilterEasyPollColumns.php: 57164 #: includes/CustomPosts/FilterEasyPollColumns.php:61 141 165 msgid "Author" 142 166 msgstr "" 143 167 144 #: includes/CustomPosts/FilterEasyPollColumns.php: 58168 #: includes/CustomPosts/FilterEasyPollColumns.php:62 145 169 msgid "Date" 170 msgstr "" 171 172 #: includes/CustomPosts/FilterEasyPollColumns.php:124 173 msgid "No Expiry" 146 174 msgstr "" 147 175 … … 206 234 msgstr "" 207 235 208 #: includes/Settings/Options.php:58 236 #: includes/Settings/Options.php:51 237 msgid "Poll Slug" 238 msgstr "" 239 240 #: includes/Settings/Options.php:54 241 msgid "Customize default poll slug, refresh <strong>permalink</strong> after update the slug" 242 msgstr "" 243 244 #: includes/Settings/Options.php:55 245 msgid "easy-poll" 246 msgstr "" 247 248 #: includes/Settings/Options.php:64 249 #: includes/Settings/Options.php:131 250 msgid "Yes" 251 msgstr "" 252 253 #: includes/Settings/Options.php:68 254 #: includes/Settings/Options.php:135 255 msgid "No" 256 msgstr "" 257 258 #: includes/Settings/Options.php:71 259 msgid "Adjust the front-end poll template width" 260 msgstr "" 261 262 #: includes/Settings/Options.php:75 263 msgid "Max Width" 264 msgstr "" 265 266 #: includes/Settings/Options.php:78 267 msgid "Set <strong>max-width</strong> in percentage for the large screen devices" 268 msgstr "" 269 270 #: includes/Settings/Options.php:82 271 msgid "Thumbnail Size" 272 msgstr "" 273 274 #: includes/Settings/Options.php:88 275 msgid "Thumbnail" 276 msgstr "" 277 278 #: includes/Settings/Options.php:92 279 msgid "Medium" 280 msgstr "" 281 282 #: includes/Settings/Options.php:96 283 msgid "Medium Large" 284 msgstr "" 285 286 #: includes/Settings/Options.php:100 287 msgid "Large" 288 msgstr "" 289 290 #: includes/Settings/Options.php:104 291 msgid "Full" 292 msgstr "" 293 294 #: includes/Settings/Options.php:107 295 msgid "Poll thumbnail size" 296 msgstr "" 297 298 #: includes/Settings/Options.php:111 299 msgid "Select Multiple Hint" 300 msgstr "" 301 302 #: includes/Settings/Options.php:114 303 msgid "Show a message so that users can understand that they can select multiple" 304 msgstr "" 305 306 #: includes/Settings/Options.php:115 307 msgid "Select multiple if required" 308 msgstr "" 309 310 #: includes/Settings/Options.php:118 311 msgid "Success Message" 312 msgstr "" 313 314 #: includes/Settings/Options.php:121 315 msgid "Show a message after successful poll submission" 316 msgstr "" 317 318 #: includes/Settings/Options.php:122 319 msgid "Thank you for submitting poll" 320 msgstr "" 321 209 322 #: includes/Settings/Options.php:125 210 msgid "Yes"211 msgstr ""212 213 #: includes/Settings/Options.php:62214 #: includes/Settings/Options.php:129215 msgid "No"216 msgstr ""217 218 #: includes/Settings/Options.php:65219 msgid "Adjust the front-end poll template width"220 msgstr ""221 222 #: includes/Settings/Options.php:69223 msgid "Max Width"224 msgstr ""225 226 #: includes/Settings/Options.php:72227 msgid "Set max-width in percentage for the large screen devices"228 msgstr ""229 230 #: includes/Settings/Options.php:76231 msgid "Thumbnail Size"232 msgstr ""233 234 #: includes/Settings/Options.php:82235 msgid "Thumbnail"236 msgstr ""237 238 #: includes/Settings/Options.php:86239 msgid "Medium"240 msgstr ""241 242 #: includes/Settings/Options.php:90243 msgid "Medium Large"244 msgstr ""245 246 #: includes/Settings/Options.php:94247 msgid "Large"248 msgstr ""249 250 #: includes/Settings/Options.php:98251 msgid "Full"252 msgstr ""253 254 #: includes/Settings/Options.php:101255 msgid "Poll thumbnail size"256 msgstr ""257 258 #: includes/Settings/Options.php:105259 msgid "Select Multiple Hint"260 msgstr ""261 262 #: includes/Settings/Options.php:108263 msgid "Show a message so that users can understand that they can select multiple"264 msgstr ""265 266 #: includes/Settings/Options.php:109267 msgid "Select multiple if required"268 msgstr ""269 270 #: includes/Settings/Options.php:112271 msgid "Success Message"272 msgstr ""273 274 #: includes/Settings/Options.php:115275 msgid "Show a message after successful poll submission"276 msgstr ""277 278 #: includes/Settings/Options.php:116279 msgid "Thank you for submitting poll"280 msgstr ""281 282 #: includes/Settings/Options.php:119283 323 msgid "Guest Submit" 284 324 msgstr "" 285 325 286 #: includes/Settings/Options.php:13 2287 msgid "If allowed, any (logged-in/guest)users will be able to see & submit the poll."288 msgstr "" 289 290 #: includes/Settings/Options.php:13 3326 #: includes/Settings/Options.php:138 327 msgid "If allowed, any <strong>(logged-in/guest)</strong> users will be able to see & submit the poll." 328 msgstr "" 329 330 #: includes/Settings/Options.php:139 291 331 msgid "no" 332 msgstr "" 333 334 #: includes/Settings/Options.php:142 335 msgid "Upcoming Poll" 336 msgstr "" 337 338 #: includes/Settings/Options.php:145 339 msgid "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." 340 msgstr "" 341 342 #: includes/Settings/Options.php:146 343 msgid "The Poll will be started at {time}" 344 msgstr "" 345 346 #: includes/Settings/Options.php:149 347 msgid "Expire Poll" 348 msgstr "" 349 350 #: includes/Settings/Options.php:152 351 msgid "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." 352 msgstr "" 353 354 #: includes/Settings/Options.php:153 355 msgid "The Poll has expired at {time}" 292 356 msgstr "" 293 357 … … 304 368 msgstr "" 305 369 306 #: templates/easy-poll.php: 45370 #: templates/easy-poll.php:54 307 371 #: templates/poll-form.php:42 308 372 msgid "Permission Denied" 309 373 msgstr "" 310 374 311 #: templates/easy-poll.php: 46375 #: templates/easy-poll.php:55 312 376 #: templates/poll-form.php:43 313 377 msgid "Guest are not allowed for participating the Poll. Please log-in to participate." 314 378 msgstr "" 315 379 316 #: templates/easy-poll.php: 63380 #: templates/easy-poll.php:72 317 381 #: templates/poll-form.php:60 318 382 msgid "Poll Already Submitted" 319 383 msgstr "" 320 384 321 #: templates/easy-poll.php: 64385 #: templates/easy-poll.php:73 322 386 #: templates/poll-form.php:61 323 387 msgid "The Poll you are trying access is already submitted" 324 388 msgstr "" 325 389 390 #: templates/easy-poll.php:96 391 msgid " file not found" 392 msgstr "" 393 326 394 #: templates/poll-form.php:16 327 395 msgid "Invalid poll id" … … 334 402 #: templates/poll-form.php:156 335 403 msgid "Questions not available" 404 msgstr "" 405 406 #: templates/poll-parts/poll-expired.php:23 407 msgid "Poll has been Expired" 408 msgstr "" 409 410 #: templates/poll-parts/poll-upcoming.php:23 411 msgid "Poll has not been Started Yet" 412 msgstr "" 413 414 #: views/components/validation-error.php:18 415 msgid "Validation Error" 336 416 msgstr "" 337 417 … … 350 430 msgstr "" 351 431 352 #: views/metabox/poll-builder.php:19 432 #: views/metabox/poll-builder.php:31 433 msgid "Start Date Time" 434 msgstr "" 435 436 #: views/metabox/poll-builder.php:37 437 msgid "Expiration Date Time" 438 msgstr "" 439 440 #: views/metabox/poll-builder.php:43 441 msgid "Timezone" 442 msgstr "" 443 444 #: views/metabox/poll-builder.php:58 353 445 msgid "Add Question, Single/Multiple Choice" 354 446 msgstr "" 355 447 356 #: views/metabox/poll-builder.php: 23448 #: views/metabox/poll-builder.php:62 357 449 msgid "Add Question, Input/Textarea" 358 450 msgstr "" 359 451 360 #: views/metabox/poll-builder.php: 32452 #: views/metabox/poll-builder.php:71 361 453 msgid "Poll Questions" 362 454 msgstr "" 363 455 364 #: views/metabox/poll-builder.php: 43456 #: views/metabox/poll-builder.php:82 365 457 msgid "Do you want to delete this question?" 366 458 msgstr "" 367 459 368 #: views/metabox/poll-builder.php: 43460 #: views/metabox/poll-builder.php:82 369 461 msgid "Warning: Questions & their feedback will be deleted permanently!" 370 462 msgstr "" 371 463 372 #: views/metabox/poll-builder.php: 55464 #: views/metabox/poll-builder.php:94 373 465 #: assets/scripts/backend/poll-builder.js:54 374 466 #: assets/scripts/backend/poll-builder.js:109 … … 427 519 msgstr "" 428 520 429 #: views/settings/settings.php: 78521 #: views/settings/settings.php:91 430 522 msgid "Save Changes" 431 523 msgstr "" … … 444 536 msgstr "" 445 537 446 #: assets/scripts/frontend.js: 17538 #: assets/scripts/frontend.js:20 447 539 msgid "Do you want to submit it? This cannot be reverted!" 448 540 msgstr "" 449 541 450 #: assets/scripts/frontend.js: 38542 #: assets/scripts/frontend.js:41 451 543 msgid "Something went wrong, please try again." 452 544 msgstr "" -
easy-poll/trunk/readme.txt
r2776489 r2831563 4 4 Tags: Poll, survey, feedback, contact, form 5 5 Requires at least: 5.3 6 Tested up to: 6. 0.16 Tested up to: 6.1 7 7 Requires PHP: 7.0 8 Stable tag: 1. 0.18 Stable tag: 1.1.0 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 43 43 === Frequently Asked Questions === 44 44 45 = On the front-end Poll showing 404 not found =45 = Can I create multiple choice poll? 46 46 47 Answer: Make your website permalink is set to post name. If not so, set it & update permalink. 47 Answer: Yes. Four type of poll can be created these are: 48 Single Choice 49 Multiple Choice 50 Input type ( for tiny text ) 51 Textarea type ( for large text ) 48 52 49 53 = How to see submissions list = … … 54 58 55 59 Answer: Yes 60 61 = Can I create a schedule poll? 62 63 Answer: Yes, you can set poll start & expiration date with any specific timezone 64 65 = On the front-end Poll showing 404 not found = 66 67 Answer: Make your website permalink is set to post name. If not so, set it & update permalink. 56 68 57 69 === Screenshots === … … 69 81 * Plugin released 70 82 71 = 1.0.1 Aug 27, 2022 = 72 Fix: 404 not found issue on the front end 83 = 1.1.0 - 10 December, 2022 = 84 New: Now poll could be created for any specific timezone with start & expire time 85 New: Poll status & expire column added on the poll list page 86 New: easy-poll default slug update option added on the settings page 87 New: Textarea field added to add message that will be visible if user visit before poll start and after expire 88 Fix: Javascript error showing on the console 73 89 74 90 === 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 10 10 */ 11 11 12 use EasyPoll\CustomPosts\PostCallBack; 12 13 use EasyPoll\PollHandler\PollHandler; 13 14 use EasyPoll\Settings\Options; … … 32 33 $allow_guest = Options::get_option( 'ep-allow-guest', 'no' ); 33 34 $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(); 34 43 ?> 35 44 … … 71 80 return; 72 81 } 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"; 85 if ( 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 } 73 98 ?> 74 <h2>75 <?php echo esc_html( get_the_title( $poll_id ) ); ?>76 </h2>77 99 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 -->91 100 </div> 92 101 -
easy-poll/trunk/vendor/autoload.php
r2776193 r2831563 4 4 5 5 if (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 ); 8 21 } 9 22 -
easy-poll/trunk/vendor/composer/autoload_psr4.php
r2776193 r2831563 7 7 8 8 return array( 9 'EasyPoll\\Tests\\' => array($baseDir . '/tests'),10 9 'EasyPoll\\' => array($baseDir . '/includes'), 11 10 ); -
easy-poll/trunk/vendor/composer/autoload_static.php
r2776193 r2831563 10 10 'E' => 11 11 array ( 12 'EasyPoll\\Tests\\' => 15,13 12 'EasyPoll\\' => 9, 14 13 ), … … 16 15 17 16 public static $prefixDirsPsr4 = array ( 18 'EasyPoll\\Tests\\' =>19 array (20 0 => __DIR__ . '/../..' . '/tests',21 ),22 17 'EasyPoll\\' => 23 18 array ( -
easy-poll/trunk/vendor/composer/installed.php
r2776193 r2831563 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 4c21c6b148fa56b005e28e051dfa947f92a788f7',6 'reference' => 'c9ae0801888dc881d6721129f325fd087f995a98', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', 9 9 'aliases' => array(), 10 'dev' => true,10 'dev' => false, 11 11 ), 12 12 'versions' => array( … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 4c21c6b148fa56b005e28e051dfa947f92a788f7',16 'reference' => 'c9ae0801888dc881d6721129f325fd087f995a98', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', 19 19 'aliases' => array(), 20 20 '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,48 21 ), 49 22 'squizlabs/php_codesniffer' => array( -
easy-poll/trunk/views/metabox/poll-builder.php
r2776193 r2831563 7 7 */ 8 8 9 use EasyPoll\CustomPosts\PostCallBack; 9 10 use EasyPoll\FormBuilder\FormField; 10 11 use EasyPoll\Utilities\Utilities; 11 12 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(); 13 17 ?> 14 18 <?php do_action( 'ep_before_poll_builder_meta_box', get_the_ID() ); ?> 15 19 <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"> 17 56 <button type="button" class="ep-btn ep-btn-sm ep-mt-10 ep-modal-opener" data-target="#ep-single-multiple-choice-modal"> 18 57 <i class="dashicons dashicons-insert"></i> … … 26 65 27 66 <!-- field listing --> 28 <div class="ep-poll-fields-wrapper ">67 <div class="ep-poll-fields-wrapper ep-pt-10"> 29 68 <?php if ( is_array( $fields ) && count( $fields ) ) : ?> 30 69 <?php $i = 0; ?> 31 <h 4>70 <h3> 32 71 <?php esc_html_e( 'Poll Questions', 'easy-poll' ); ?> 33 </h 4>72 </h3> 34 73 <?php foreach ( $fields as $value ) : ?> 35 74 <?php -
easy-poll/trunk/views/settings/settings.php
r2776193 r2831563 18 18 19 19 if ( ! $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' ) ); 21 21 } 22 22 ?> … … 66 66 <?php endif; ?> 67 67 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> 72 85 </td> 73 86 </tr>
Note: See TracChangeset
for help on using the changeset viewer.