Changeset 2572050
- Timestamp:
- 07/26/2021 05:55:03 AM (5 years ago)
- Location:
- eyeone/trunk
- Files:
-
- 6 edited
-
README.txt (modified) (2 diffs)
-
admin/class-eyeone-admin.php (modified) (11 diffs)
-
admin/css/eyeone-admin.css (modified) (1 diff)
-
admin/js/eyeone-admin.js (modified) (1 diff)
-
admin/partials/eyeone-admin-settings-display.php (modified) (2 diffs)
-
eyeone-plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eyeone/trunk/README.txt
r2554919 r2572050 3 3 Tags: eyeone, eye one, videocalls, videocall, video, call, schedule, schedulling 4 4 Requires at least: 4.6 5 Tested up to: 5. 66 Stable tag: 1. 0.05 Tested up to: 5.8 6 Stable tag: 1.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 77 77 = 1.0.0 = 78 78 * Update settings page 79 80 = 1.1.0 = 81 * Redesign settings page and plugin options, 5.8 WordPress compability check. -
eyeone/trunk/admin/class-eyeone-admin.php
r2554919 r2572050 71 71 if (array_key_exists('eyeone_widget_id', $_POST)) { 72 72 $eyeOneWidgetId = preg_replace('/[^0-9]/', '', $_POST['eyeone_widget_id']); 73 if (preg_match('/[0-9]+/', $eyeOneWidgetId) && $eyeOneWidgetId > 0) {73 if (preg_match('/[0-9]+/', $eyeOneWidgetId) && $eyeOneWidgetId > 0) { 74 74 update_post_meta( 75 75 $postId, … … 89 89 } 90 90 91 function getWidgetList()92 {93 $apikey = get_option('eyeone_api_key');94 if (!is_null($apikey) && preg_match('/[a-zA-Z0-9-]+/', $apikey)) {95 $response = wp_remote_get('https://app.eye.one/api/v2/public/widgets/' . $apikey);96 $body = wp_remote_retrieve_body($response);97 if ($body) {98 $widgets = json_decode($body, true);99 return $widgets;100 }101 }102 return [];103 }104 105 91 function createWidgetSelect($post) 106 92 { 107 93 $selectedWidget = get_post_meta($post->ID, '_eyeone_widget_meta_key', true); 108 ?>94 ?> 109 95 <div class="ey-setting-desc"><?php esc_html_e("Select one of your widgets to show it at this page.", 'eyeone'); ?></div> 110 96 <?php … … 116 102 } 117 103 ?> 118 <div class="ey-setting"> <label for="eyeone_widget_id"><?php esc_html_e(($selectedWidget ? 'Selected widget:' : 'Choose a widget:'), 'eyeone'); ?></label> 104 <div class="ey-setting"> 105 <label for="eyeone_widget_id" 106 class="ey-widget-select-label"><?php esc_html_e(($selectedWidget ? 'Selected widget:' : 'Choose a widget:'), 'eyeone'); ?></label> 119 107 <select name="eyeone_widget_id" id="eyeone_widget_id" class="ey-widget-select"> 120 108 <option value=""><?php esc_html_e("No widget", 'eyeone'); ?></option> … … 123 111 foreach ($widgets as $widget) { 124 112 if ($widget["id"] == $selectedWidget) { 125 echo '<option value="' . esc_attr($widget["id"]) . '" selected>' . esc_attr($widget["name"]) . ' - (type: ' .esc_attr($widget["type"]) . ')</option>';113 echo '<option value="' . esc_attr($widget["id"]) . '" selected>' . esc_attr($widget["name"]) . ' - (type: ' . esc_attr($widget["type"]) . ')</option>'; 126 114 } else { 127 echo '<option value="' . esc_attr($widget["id"]) . '">' . esc_attr($widget["name"]) . ' - (type: ' .esc_attr($widget["type"]) . ')</option>';115 echo '<option value="' . esc_attr($widget["id"]) . '">' . esc_attr($widget["name"]) . ' - (type: ' . esc_attr($widget["type"]) . ')</option>'; 128 116 } 129 117 } … … 132 120 </div> 133 121 134 <?php 122 <?php 123 } 124 125 function getWidgetList() 126 { 127 $apikey = get_option('eyeone_api_key'); 128 if (!is_null($apikey) && preg_match('/[a-zA-Z0-9-]+/', $apikey)) { 129 $response = wp_remote_get('https://app.eye.one/api/v2/public/widgets/' . $apikey); 130 $body = wp_remote_retrieve_body($response); 131 if ($body) { 132 $widgets = json_decode($body, true); 133 return $widgets; 134 } 135 } 136 return []; 135 137 } 136 138 … … 142 144 array($this, 'createWidgetSelect'), 143 145 'post', 144 ' normal',146 'side', 145 147 'high' 146 148 ); … … 151 153 array($this, 'createWidgetSelect'), 152 154 'page', 153 ' normal',155 'side', 154 156 'high' 155 157 ); … … 191 193 'eyeone_general_section', 192 194 array( 193 'type' => 'input',194 'subtype' => 'text',195 'id' => 'eyeone_api_key',196 'name' => 'eyeone_api_key',195 'type' => 'input', 196 'subtype' => 'text', 197 'id' => 'eyeone_api_key', 198 'name' => 'eyeone_api_key', 197 199 'required' => 'true', 198 200 'get_options_list' => '', … … 222 224 foreach ($allTypes as $page) { 223 225 $widgetId = get_post_meta($page->ID, '_eyeone_widget_meta_key', true); 224 $widgetName = $this->getWidgetName($widgetId, $widgets);226 $widgetName = $this->getWidgetName($widgetId, $widgets); 225 227 if ($widgetId) { 226 228 add_settings_field( 227 229 'eyeone_page_widget_status_' . $page->ID, 228 $page->post_title . ($widgetName ? '<br/> (' . $widgetName . ')' : ''),230 $page->post_title . ' <a href="' . get_edit_post_link($page->ID) . '">(#' . $page->ID . ')</a>' . ($widgetName ? '<br/><small> (' . $widgetName . ')' : '</small>'), 229 231 array($this, 'eyeone_render_settings_field'), 230 232 'eyeone_general_settings', 231 233 'eyeone_widgets_section', 232 234 array( 233 'type' => 'input',234 'subtype' => 'list',235 'id' => 'eyeone_page_widget_status_' . $page->ID,236 'name' => 'eyeone_page_widget_status_' . $page->ID,235 'type' => 'input', 236 'subtype' => 'list', 237 'id' => 'eyeone_page_widget_status_' . $page->ID, 238 'name' => 'eyeone_page_widget_status_' . $page->ID, 237 239 'required' => 'true', 238 'disabled' => $widgetName ? false : true,240 'disabled' => $widgetName ? false : true, 239 241 'get_options_list' => '', 240 242 'value_type' => 'normal', … … 248 250 array($this, 'sanitizeEyeOneWidgetStatus') 249 251 ); 250 }; 251 } 252 } 252 } 253 } 254 } 255 253 256 public function getWidgetName($widgetId, $widgets) 254 257 { … … 260 263 return null; 261 264 } 265 262 266 public function eyeone_display_general_info() 263 267 { 264 268 _e('In order to have widgets working properly you need an Eye One API key and an active account.', 'eyeone'); 265 269 } 270 266 271 public function eyeone_display_widgetlist_info() 267 272 { 268 273 _e('Here you can check all pages that have widget setup and you can turn it off here if you want it temporarily disabled.', 'eyeone'); 269 274 } 275 270 276 public function eyeone_render_settings_field($args) 271 277 { -
eyeone/trunk/admin/css/eyeone-admin.css
r2554919 r2572050 1 1 #ey-admin .page-title { 2 background: url("../img/eyeone-logo-black.svg") no-repeat left center;3 background-size: 32px;4 padding-left: 42px;5 line-height: 32px;6 margin-bottom: 20px;2 background: url("../img/eyeone-logo-black.svg") no-repeat left center; 3 background-size: 32px; 4 padding-left: 42px; 5 line-height: 32px; 6 margin-bottom: 20px; 7 7 } 8 8 9 9 .ey-logo { 10 background: url("../img/eyeone-logo-black.svg") no-repeat left center; 11 padding-left: 42px; 12 height: 32px; 13 margin-top: 32px; 14 margin-bottom: 20px; 10 background: url("../img/eyeone-logo-black.svg") no-repeat left center; 11 padding-left: 42px; 12 height: 32px; 13 margin-bottom: 20px; 14 } 15 16 .ey-widget-select-label { 17 display: inline-block; 18 margin-bottom: 8px; 15 19 } 16 20 17 21 .ey-widget-select { 18 margin-left: 16px; 19 vertical-align: baseline; 22 vertical-align: baseline; 23 width: 100%; 24 box-sizing: border-box; 20 25 } 21 26 22 27 .ey-setting { 23 margin-top: 16px;28 margin-top: 16px; 24 29 } 25 30 26 31 .ey-setting-desc { 27 margin-top: 16px;32 margin-top: 16px; 28 33 } 29 34 30 35 .ey-widget-list-element { 31 text-transform: capitalize;36 text-transform: capitalize; 32 37 } 33 38 34 39 .ey-setting { 35 margin-top: 16px;40 margin-top: 16px; 36 41 } 37 42 38 43 .ey-link { 39 text-decoration: none;44 text-decoration: none; 40 45 } 41 46 42 47 .ey-button { 43 background-color: black;44 min-width: 130px;45 height: 46px;46 font-size: 16px;47 font-weight: 500;48 text-align: center;49 border-radius: 6px;50 color: #fff;51 display: flex;52 align-items: center;53 justify-content: center;54 width: 180px;55 margin-right: 16px;56 text-decoration: none;48 background-color: black; 49 min-width: 130px; 50 height: 46px; 51 font-size: 16px; 52 font-weight: 500; 53 text-align: center; 54 border-radius: 6px; 55 color: #fff; 56 display: flex; 57 align-items: center; 58 justify-content: center; 59 width: 180px; 60 margin-right: 16px; 61 text-decoration: none; 57 62 } 58 63 59 64 .ey-buttons { 60 display: flex;61 margin-top: 32px;65 display: flex; 66 margin-top: 12px; 62 67 } 68 69 .ey-metabox .inside { 70 padding-bottom: 20px; 71 padding-left: 20px; 72 } 73 74 .ey-metabox h2 { 75 font-size: 16px !important; 76 font-weight: 600 !important; 77 } 78 79 .ey-metabox ul { 80 margin-bottom: 0; 81 } 82 83 .ey-metabox ul li { 84 border-bottom: solid 1px #DCDCDE; 85 padding: 10px 0; 86 margin: 0; 87 } 88 89 .ey-metabox ul li:last-child { 90 border-bottom: none; 91 } -
eyeone/trunk/admin/js/eyeone-admin.js
r2554919 r2572050 3 3 //Currently nothing to do here. 4 4 })( jQuery ); 5 6 -
eyeone/trunk/admin/partials/eyeone-admin-settings-display.php
r2554919 r2572050 1 1 <div id="ey-admin"> 2 <div class="ey-logo"></div>3 <div><?php esc_html_e("Eye One widget plugin let's your visitors easily schedule an Eye One appointment with you as well as instantly make a videocall request.", 'eyeone'); ?></div>4 <div>5 <div class="ey-buttons">6 <a class="ey-link" href="https://app.eye.one/">7 <div class="ey-button"><?php esc_html_e("Sign in", 'eyeone'); ?></div>8 </a>9 </div>10 <br />11 <h2><?php esc_html_e("You can setup your widget looks in Eye One panel.", 'eyeone'); ?></h2>12 <div><?php esc_html_e("Customize your widget looks and interaction type in your Eye One account's settings.", 'eyeone'); ?></div>13 2 14 </div>15 <br />16 <h2><?php esc_html_e("Below you can find few steps that will help you get your unique API key for Eye One widget.", 'eyeone'); ?></h2>17 <div>18 <ul>19 <li><?php esc_html_e("1. First make sure that you have an active account registered at Eye One.", 'eyeone'); ?></li>20 <li><?php esc_html_e("2. Go to", 'eyeone'); ?> <a href="https://app.eye.one/settings/website-integration"><?php esc_html_e("Eye One Website Integration", 'eyeone'); ?></a></li>21 <li><?php esc_html_e("3. Scroll down to the bottom of the page and click Copy API Key", 'eyeone'); ?></li>22 <li><?php esc_html_e("4. Now your unique API key is copied to your clipboard", 'eyeone'); ?></li>23 <li><?php esc_html_e("5. Paste your API key into API key field below and save changes.", 'eyeone'); ?></li>24 </ul>25 </div>26 <?php27 $widgets = getWidgetList();28 if (count($widgets) > 0) {29 echo '<br /><h2>';30 esc_html_e('Your current active widgets:', 'eyeone');31 echo '</h2>';32 } else {33 echo '<br /><h2>';34 esc_html_e('Your current active widgets:', 'eyeone');35 echo '</h2><div>';36 esc_html_e('If you actually have widgets defined, then make sure that API key is correct.', 'eyeone');37 echo '</div>';38 }39 ?>40 <div>41 <ul>42 <?php43 foreach ($widgets as $widget) {44 echo '<li class="ey-widget-list-element"><strong>' . esc_attr($widget["name"]) . '</strong> (' . esc_attr($widget["type"]) . ')</li>';45 }46 ?>47 </ul>48 </div>49 <br />50 3 51 <?php settings_errors(); ?> 52 <form method="POST" action="options.php"> 53 <?php 54 settings_fields('eyeone_general_settings'); 55 do_settings_sections('eyeone_general_settings'); 56 ?> 57 <?php submit_button(); ?> 58 </form> 4 <div id="welcome-panel" class="welcome-panel"> 5 <div class="welcome-panel-content"> 6 <div class="ey-logo"></div> 7 <p class="about-description" 8 style="margin-bottom: 0;"><?php esc_html_e("Eye One widget plugin let's your visitors easily schedule an Eye One appointment with you as well as instantly make a videocall request.", 'eyeone'); ?></p> 9 <div class="ey-buttons"> 10 <a class="ey-link" href="https://app.eye.one/"> 11 <div class="ey-button"><?php esc_html_e("Sign in", 'eyeone'); ?></div> 12 </a> 13 </div> 14 <br/> 15 <hr/> 16 <div class="welcome-panel-column-container"> 17 <div class="welcome-panel-column" style="width: 50%;"> 18 <h3 style="padding-right: 30px;"><?php esc_html_e("Below you can find few steps that will help you get your unique API key for Eye One widget.", 'eyeone'); ?></h3> 19 <ul> 20 <li><?php esc_html_e("1. First make sure that you have an active account registered at Eye One.", 'eyeone'); ?></li> 21 <li> 22 <?php esc_html_e("2. Go to", 'eyeone'); ?> 23 <a href="https://app.eye.one/settings/website-integration"><?php esc_html_e("Eye One Website Integration", 'eyeone'); ?></a> 24 </li> 25 <li><?php esc_html_e("3. Scroll down to the bottom of the page and click Copy API Key", 'eyeone'); ?></li> 26 <li><?php esc_html_e("4. Now your unique API key is copied to your clipboard", 'eyeone'); ?></li> 27 <li><?php esc_html_e("5. Paste your API key into API key field below and save changes.", 'eyeone'); ?></li> 28 </ul> 29 </div> 30 <div class="welcome-panel-column" style="width: 50%;"> 31 <h3><?php esc_html_e("You can setup your widget looks in Eye One panel.", 'eyeone'); ?></h3> 32 <p><?php esc_html_e("Customize your widget looks and interaction type in your Eye One account's settings.", 'eyeone'); ?></p> 33 </div> 34 35 </div> 36 </div> 37 </div> 38 39 40 <div id="dashboard-widgets" class="metabox-holder ey-metabox"> 41 <div id="postbox-container-1" class="postbox-container" style="width: 100%"> 42 <div id="metabox" class="postbox"> 43 <?php $widgets = getWidgetList(); ?> 44 <div class="inside"> 45 <div class="main"> 46 <h2><?php esc_html_e('Your current active widgets:', 'eyeone'); ?></h2> 47 <?php if (count($widgets) <= 0) { ?> 48 <?php esc_html_e('If you actually have widgets defined, then make sure that API key is correct.', 'eyeone'); ?> 49 <?php } else { ?> 50 <ul> 51 <?php 52 foreach ($widgets as $widget) { 53 echo '<li class="ey-widget-list-element"><strong>' . esc_attr($widget["name"]) . '</strong> (' . esc_attr($widget["type"]) . ')</li>'; 54 } 55 ?> 56 </ul> 57 <?php } ?> 58 </div> 59 </div> 60 </div> 61 </div> 62 </div> 63 64 <br/> 65 <div id="dashboard-widgets" class="metabox-holder ey-metabox"> 66 <div id="postbox-container-1" class="postbox-container" style="width: 100%"> 67 <div id="metabox" class="postbox"> 68 <div class="inside"> 69 <div class="main"> 70 <?php settings_errors(); ?> 71 <form method="POST" action="options.php"> 72 <?php 73 settings_fields('eyeone_general_settings'); 74 do_settings_sections('eyeone_general_settings'); 75 ?> 76 <?php submit_button(); ?> 77 </form> 78 </div> 79 </div> 80 </div> 81 </div> 82 </div> 59 83 </div> 60 84 … … 62 86 function getWidgetName($widgetId, $widgets) 63 87 { 64 foreach ($widgets as $widget) {65 if ($widgetId == $widget["id"]) {66 return esc_attr($widget["name"]);67 }68 }88 foreach ($widgets as $widget) { 89 if ($widgetId == $widget["id"]) { 90 return esc_attr($widget["name"]); 91 } 92 } 69 93 } 94 70 95 function getWidgetList() 71 96 { 72 $apikey = get_option('eyeone_api_key');73 if (!is_null($apikey) && preg_match('/[a-zA-Z0-9-]+', $apikey)) {74 $response = wp_remote_get('https://app.eye.one/api/v2/public/widgets/' . $apikey);75 $body= wp_remote_retrieve_body($response);76 if ($body) {77 $widgets = json_decode($body, true);78 return $widgets;79 }80 }81 return [];97 $apikey = get_option('eyeone_api_key'); 98 if (!is_null($apikey) && preg_match('/[a-zA-Z0-9-]+/', $apikey)) { 99 $response = wp_remote_get('https://app.eye.one/api/v2/public/widgets/' . $apikey); 100 $body = wp_remote_retrieve_body($response); 101 if ($body) { 102 $widgets = json_decode($body, true); 103 return $widgets; 104 } 105 } 106 return []; 82 107 } 108 83 109 ?> -
eyeone/trunk/eyeone-plugin.php
r2554919 r2572050 14 14 * Plugin URI: https://eye.one 15 15 * Description: Add Eye One widget to your website and let your visitors schedule appointment with you or videocall your directly 16 * Version: 1.0.0 16 * Version: 1.1.0 17 * Requires at least: 4.6 18 * Requires PHP: 5.6 17 19 * Author: Eye One 18 20 * License: GPL-2.0+
Note: See TracChangeset
for help on using the changeset viewer.