Changeset 2777307
- Timestamp:
- 08/29/2022 04:43:42 PM (4 years ago)
- Location:
- kinguin/trunk
- Files:
-
- 1 added
- 31 edited
-
README.txt (modified) (2 diffs)
-
assets/css/kinguin-admin-import.css (modified) (1 diff)
-
assets/js/kinguin-products-import.js (modified) (6 diffs)
-
kinguin.php (modified) (2 diffs)
-
lang/kinguin-pl_PL.mo (modified) (previous)
-
lang/kinguin-pl_PL.po (modified) (8 diffs)
-
src/Plugin/Admin/Configuration.php (modified) (4 diffs)
-
src/Plugin/Admin/CurrencyExchange.php (modified) (2 diffs)
-
src/Plugin/Admin/Exceptions/FrankfurterUnsupportedCurrencyException.php (added)
-
src/Plugin/Admin/Import.php (modified) (5 diffs)
-
src/Plugin/Admin/MainAdmin.php (modified) (4 diffs)
-
src/Plugin/Admin/Product/Attributes.php (modified) (1 diff)
-
src/Plugin/Admin/Product/DataTabs.php (modified) (4 diffs)
-
src/Plugin/Admin/Product/InsertUpdate.php (modified) (7 diffs)
-
src/Plugin/Admin/SettingsPage.php (modified) (4 diffs)
-
src/Plugin/Admin/templates/import_template.php (modified) (1 diff)
-
src/Plugin/Common/ProductMargin.php (modified) (1 diff)
-
src/Plugin/Common/ProductWebHook.php (modified) (1 diff)
-
src/Plugin/Frontend/MainFrontend.php (modified) (2 diffs)
-
src/Plugin/Plugin.php (modified) (1 diff)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (5 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
-
vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php (modified) (2 diffs)
-
vendor_prefixed/wpdesk/wp-plugin-flow/composer.json (modified) (2 diffs)
-
vendor_prefixed/wpdesk/wp-plugin-flow/src/plugin-init-php52-free.php (modified) (2 diffs)
-
vendor_prefixed/wpdesk/wp-plugin-flow/src/plugin-init-php52.php (modified) (3 diffs)
-
vendor_prefixed/wpdesk/wp-wpdesk-helper/composer.json (modified) (2 diffs)
-
vendor_prefixed/wpdesk/wp-wpdesk-helper/src/PrefixedHelperAsLibrary.php (modified) (1 diff)
-
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php (modified) (3 diffs)
-
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kinguin/trunk/README.txt
r2745667 r2777307 4 4 Tags: digital downloads, EDD, video games, marketplace, eStore, games distributing, gaming 5 5 Requires at least: 5.0 6 Tested up to: 6.0 7 Stable tag: 1.0. 46 Tested up to: 6.0.1 7 Stable tag: 1.0.5 8 8 Requires PHP: 7.0 9 9 License: GPLv2 … … 53 53 == Changelog == 54 54 55 = 1.0.5 = 56 * Divide products to categories during import. 57 * Some small fixs and improvements. 58 55 59 = 1.0.4 = 56 60 * New filtering options allow you to import only products that meet your criteria. 57 61 * New sales options for flexible pricing. 58 62 * Fixed problem with infinite import via webhook. 59 60 63 61 64 = 1.0.3 = -
kinguin/trunk/assets/css/kinguin-admin-import.css
r2745667 r2777307 137 137 } 138 138 139 .import-setup > pre { 140 width:200px; 141 margin-left:20px; 139 140 /* ======== */ 141 142 143 .progress-db { 144 padding: 2px; 145 background: #f3f3f3; 146 border-radius: 4px; 147 /*box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px rgba(255, 255, 255, 0.08);*/ 148 height: 26px; 142 149 } 143 150 144 .import-setup > div > span {145 display: block;146 margin-left:20px;151 @keyframes progressAnimation { 152 0% { width: 5%; background-color: #cccccc;} 153 100% { width: 85%; background-color: #9bcd99; } 147 154 } 148 155 149 .import-setup > pre > span { 150 margin-left:20px; 151 display: inline-block; 156 .progress-bar-kinguin { 157 height: 26px; 158 border-radius: 4px; 159 background-image: 160 linear-gradient(to right, 161 #7daa87, #9bcd99, #cccccc, 162 #7daa87, #9bcd99, #cccccc); 163 transition: 1s linear; 164 transition-property: width, background-color; 152 165 } 153 166 154 #kinguin-import-setup { 155 padding-bottom: 20px; 167 .progress-infinite .progress-bar-kinguin { 168 width: 0%; 169 max-width: 100%; 170 background-image: 171 linear-gradient(to right, #7daa87, #9bcd99, #cccccc, #cccccc); 172 animation: colorAnimation 3s infinite; 156 173 } 157 174 158 #kinguin-import-setup > span > b { 159 marging-bottom: 10px; 175 @keyframes colorAnimation { 176 0% { 177 background-image: 178 linear-gradient(to right, #4cd964, #9bcd99, #cccccc, #cccccc); 179 } 180 20% { 181 background-image: 182 linear-gradient(to right, #cccccc, #7daa87, #9bcd99, #cccccc); 183 } 184 40% { 185 background-image: 186 linear-gradient(to right, #7daa87, #9bcd99, #cccccc, #cccccc); 187 } 188 60% { 189 background-image: 190 linear-gradient(to right, #9bcd99, #7daa87, #cccccc, #cccccc); 191 } 192 100% { 193 background-image: 194 linear-gradient(to right, #7daa87, #cccccc, #9bcd99, #cccccc); 195 } 160 196 } 161 162 .kinguin-test-hidden-result {163 margin-top: 20px;164 }165 166 .kinguin-test-hidden-result > span {167 display: block;168 }169 170 .kinguin-test-filter-preset {171 font-size: 1.5em;172 margin-top: 20px;173 margin-bottom: 50px;174 }175 176 .kinguin-test-filter-preset > span {177 display: block;178 } -
kinguin/trunk/assets/js/kinguin-products-import.js
r2745667 r2777307 9 9 this.totalPages = parseInt( kinguin.total ); 10 10 this.progress = 0; 11 this.progressDB = 0; 12 this.limit = 0; 11 13 this.progressCacheProductsUpdate = false; 12 14 this.progressImportProductsUpdate = false; 13 15 this.cachedFiles = kinguin.cachedFiles; 14 16 this.importIsRunning = false; 17 this.notice = kinguin.notice; 15 18 } 16 19 … … 92 95 let statusContainer = parent.setupContainer.querySelector( '.status_cache' ); 93 96 97 parent.limit = response.data.limit; 94 98 parent.totalPages = response.data.of; // Set total pages to import from Kinguin. 95 99 parent.cachedFiles.push( response.data.file ); // Add file to array of existing files. … … 127 131 statusContainer.classList.add( 'success' ); 128 132 statusContainer.innerHTML = 'Done'; 133 parent.ProcessStart(); 129 134 } 130 135 } … … 156 161 }, 157 162 error: function( xhr, textStatus, errorThrown ) { 163 158 164 parent.importIsRunning = false; 165 parent.setupContainer.querySelector( '.kinguin-dynamic-text' ).style.display = "none"; 159 166 160 167 if (textStatus === 'timeout') { … … 168 175 return; 169 176 } 177 178 if (textStatus === 'error') { 179 parent.setupContainer.querySelector( '.import-setup__process' ).classList.add( 'error' ); 180 parent.setupContainer.querySelector( '.progress' ).innerHTML = 'An error has occurred'; 181 return; 182 } 170 183 } 171 184 }).done( function( response ) { 172 173 185 let progressContainer = parent.setupContainer.querySelector( '.progress' ); 186 let progressCount = parent.setupContainer.querySelector( '.status_cache' ); 174 187 175 188 if( parent.totalPages === 0 ) { 189 // nothing found 190 parent.setupContainer.querySelector( '.kinguin-dynamic-text' ).style.display = "none"; 176 191 let empty_response = document.createElement('div'); 177 192 empty_response.classList.add( 'kinguin-empty-response' ); 178 193 empty_response.innerHTML = '<b style="color:red; font-size:1.1em">Nothing found</b>'; 179 194 progressContainer.innerHTML = ''; 195 progressCount.innerHTML = ''; 180 196 progressContainer.appendChild(empty_response); 181 197 } 182 198 183 199 if ( response.success === true ) { 200 184 201 let statusContainer = parent.setupContainer.querySelector( '.status_import' ); 185 186 // Update progress position once, only at the beginning. 187 if ( parseInt( response.data.page ) > 1 && parent.progressImportProductsUpdate == false ) { 188 parent.progress = parent.progress + parseInt( response.data.page ); 202 let pg = parent.setupContainer.querySelector( '.progress-bar-kinguin' ); 203 let koeff = 100 / parent.totalPages; 204 let interrupt_step = 0; 205 206 if ( parseInt( response.data.page ) > 0 && parent.progressImportProductsUpdate == false ) { 207 // after break 189 208 parent.progressImportProductsUpdate = true; 209 parent.progressDB++; 210 let interrupt_step = parseInt( parent.progressDB ) * koeff * response.data.page; 211 let step = parseInt( parent.progressDB ) * koeff * response.data.page + '%'; 212 pg.style.width = step; 213 190 214 } else { 191 // Progress update. 192 parent.progress++; 193 } 194 parent.setProgressBar(); 195 parent.cachedFiles.shift(); 215 216 if ( parseInt( response.data.page ) > 1 && parent.progressImportProductsUpdate == false ) { 217 parent.progress = parent.progress + parseInt( response.data.page ); 218 parent.progressDB++; 219 let step = parseInt( parent.progressDB ) * koeff + '%'; 220 pg.style.width = step; 221 222 } else { 223 parent.progressDB++; 224 let step = koeff * response.data.page; 225 let progress_step = step + '%'; 226 pg.style.width = progress_step; 227 } 228 } 229 // if filter setting where changed and page is not reload - avoid incorrect progress bars 230 if( parent.totalPages > 0 && ( response.data.page > parent.totalPages ) ) { 231 let progressBar = parent.setupContainer.querySelector( '.progress-db' ); 232 progressBar.innerHTML = '<b style="color:red; font-size:1.1em">' + 233 parent.notice + 234 '</b>'; 235 return; 236 237 } else { 238 // show not qty of products but qty of proccessed cached files 239 statusContainer.innerHTML = 'Proccessing file ' + response.data.page + ' of ' + parent.totalPages; 240 241 } 242 243 if( response.data.page < 5 ) { 244 parent.ProcessStart(); 245 } 246 247 parent.cachedFiles.shift(); 196 248 parent.importProducts(); 197 249 … … 215 267 let importProgress = this.setupContainer.querySelector( '#import-progress' ); 216 268 if( null !== importProgress && importProgress !== undefined ) { 217 importProgress.max = parseInt( this.totalPages ) * 2;269 importProgress.max = parseInt( this.totalPages ); 218 270 importProgress.value = parseInt( this.progress ); 219 271 } 220 272 } 273 274 275 ProcessStart() { 276 277 let parent = this; 278 let dynamic_text = parent.setupContainer.querySelector( '.kinguin-dynamic-text' ); 279 let statusContainer = parent.setupContainer.querySelector( '.status_import' ); 280 281 var Processes = [ 282 { Percent: 1, ProgressText: 'Please take a little patience' }, 283 { Percent: 4, ProgressText: 'Please take a little patience.' }, 284 { Percent: 6, ProgressText: 'Please take a little patience..' }, 285 { Percent: 8, ProgressText: 'Please take a little patience...' }, 286 { Percent: 10, ProgressText: 'Please take a little patience...' }, 287 { Percent: 10, ProgressText: 'Please take a little patience' }, 288 { Percent: 12, ProgressText: 'Please take a little patience.' }, 289 { Percent: 14, ProgressText: 'Please take a little patience..' }, 290 { Percent: 18, ProgressText: 'Please take a little patience...' }, 291 { Percent: 20, ProgressText: 'Please take a little patience' }, 292 { Percent: 24, ProgressText: 'Please take a little patience.' }, 293 { Percent: 26, ProgressText: 'Please take a little patience..' }, 294 { Percent: 28, ProgressText: 'Please take a little patience...' }, 295 { Percent: 30, ProgressText: 'Please take a little patience' }, 296 { Percent: 31, ProgressText: 'Please take a little patience.' }, 297 { Percent: 32, ProgressText: 'Please take a little patience..' }, 298 { Percent: 33, ProgressText: 'Please take a little patience...' }, 299 { Percent: 34, ProgressText: 'We\'re proccessing files' }, 300 { Percent: 36, ProgressText: 'We\'re proccessing files.' }, 301 { Percent: 38, ProgressText: 'We\'re proccessing files..' }, 302 { Percent: 40, ProgressText: 'We\'re proccessing files...' }, 303 { Percent: 42, ProgressText: 'We\'re proccessing files' }, 304 { Percent: 44, ProgressText: 'We\'re proccessing files.' }, 305 { Percent: 46, ProgressText: 'We\'re proccessing files..' }, 306 { Percent: 48, ProgressText: 'We\'re proccessing files...' }, 307 { Percent: 50, ProgressText: 'We\'re proccessing files' }, 308 { Percent: 52, ProgressText: 'We\'re proccessing files.' }, 309 { Percent: 54, ProgressText: 'We\'re proccessing files..' }, 310 { Percent: 56, ProgressText: 'We\'re proccessing files...' }, 311 { Percent: 58, ProgressText: 'We\'re proccessing files' }, 312 { Percent: 60, ProgressText: 'We\'re proccessing files.' }, 313 { Percent: 62, ProgressText: 'We\'re proccessing files..' }, 314 { Percent: 64, ProgressText: 'We\'re proccessing files...' }, 315 { Percent: 66, ProgressText: 'We\'re proccessing files' }, 316 { Percent: 70, ProgressText: 'We\'re proccessing files.' }, 317 { Percent: 74, ProgressText: 'We\'re proccessing files..' }, 318 { Percent: 78, ProgressText: 'We\'re proccessing files...' }, 319 { Percent: 80, ProgressText: 'We\'re proccessing files' }, 320 { Percent: 82, ProgressText: 'We\'re proccessing files.' }, 321 { Percent: 86, ProgressText: 'We\'re proccessing files..' }, 322 { Percent: 90, ProgressText: 'We\'re proccessing files...' }, 323 { Percent: 94, ProgressText: 'We\'re proccessing files' }, 324 { Percent: 96, ProgressText: 'We\'re proccessing files.' }, 325 { Percent: 98, ProgressText: 'We\'re proccessing files..' }, 326 { Percent: 100, ProgressText: 'We\'re proccessing files...' } 327 ]; 328 var Current = 0; 329 330 statusContainer.addEventListener("DOMSubtreeModified", function () { 331 // To cancel an interval, pass the timer to clearInterval() 332 clearInterval(IntervalProgress); 333 }); 334 335 var IntervalProgress = setInterval(function() { 336 dynamic_text.innerHTML = Processes[Current].ProgressText; 337 Current++; 338 if (Current >= Processes.length) { 339 clearInterval(IntervalProgress); 340 } 341 }, 1000); 342 } 221 343 } 222 344 -
kinguin/trunk/kinguin.php
r2745667 r2777307 4 4 Description: Import over 70,000 digital products to your online store, including video games, software, gift cards and in-game content. 5 5 Product: Kinguin 6 Version: 1.0. 46 Version: 1.0.5 7 7 Author: iLabs.dev 8 8 Author URI: https://ilabs.dev/ … … 34 34 35 35 /* THESE TWO VARIABLES CAN BE CHANGED AUTOMATICALLY */ 36 $plugin_version = '1.0. 4';36 $plugin_version = '1.0.5'; 37 37 38 $plugin_name = 'Kinguin'; 39 $plugin_class_name = '\WPDesk\ILKinguin\Plugin'; 40 $plugin_text_domain = 'kinguin'; 41 $product_id = 'kinguin'; 42 $plugin_file = __FILE__; 43 $kinguin_plugin_dir = dirname( __FILE__ ); 38 $plugin_name = 'Kinguin'; 39 $plugin_class_name = '\WPDesk\ILKinguin\Plugin'; 40 $plugin_text_domain = 'kinguin'; 41 $product_id = 'kinguin'; 42 $plugin_file = __FILE__; 43 $plugin_dir = dirname( __FILE__ ); 44 $kinguin_plugin_dir = dirname( __FILE__ ); 44 45 45 46 $requirements = [ -
kinguin/trunk/lang/kinguin-pl_PL.po
r2712632 r2777307 3 3 "Project-Id-Version: Kinguin 1.0\n" 4 4 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/kinguin\n" 5 "POT-Creation-Date: 2021-11-29T10:36:12+00:00\n" 6 "PO-Revision-Date: 2022-04-19 13:11+0300\n" 7 "Last-Translator: \n" 8 "Language-Team: \n" 9 "Language: pl_PL\n" 5 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 6 "Language-Team: LANGUAGE <LL@li.org>\n" 10 7 "MIME-Version: 1.0\n" 11 8 "Content-Type: text/plain; charset=UTF-8\n" 12 9 "Content-Transfer-Encoding: 8bit\n" 13 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 14 "X-Generator: Poedit 3.0.1\n" 10 "POT-Creation-Date: 2021-11-29T10:36:12+00:00\n" 11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 "Language: pl_PL\n" 13 "X-Generator: WP-CLI 2.4.0\n" 15 14 "X-Domain: kinguin\n" 16 15 "X-Poedit-Basepath: ../src\n" 17 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;\"\n" 16 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" 17 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"\n" 18 "X-Poedit-SearchPath-0: .\n" 18 19 "X-Poedit-SourceCharset: UTF-8\n" 19 "X-Poedit-SearchPath-0: .\n"20 20 "X-Poedit-SearchPathExcluded-0: *.js\n" 21 21 … … 127 127 msgstr "" 128 128 129 #: src/Plugin/Admin/Import.php:193 src/Plugin/Admin/Import.php:249 129 #: src/Plugin/Admin/Import.php:193 130 #: src/Plugin/Admin/Import.php:249 130 131 msgid "Access denied." 131 132 msgstr "" 132 133 133 #: src/Plugin/Admin/MainAdmin.php:98 src/Plugin/Admin/MainAdmin.php:99 134 #: src/Plugin/Admin/MainAdmin.php:98 135 #: src/Plugin/Admin/MainAdmin.php:99 134 136 msgid "Import products" 135 137 msgstr "" 136 138 137 #: src/Plugin/Admin/MainAdmin.php:108 src/Plugin/Admin/MainAdmin.php:109 138 #: Page/SettingsPage.php:52 Page/SettingsPage.php:53 139 #: src/Plugin/Admin/MainAdmin.php:108 140 #: src/Plugin/Admin/MainAdmin.php:109 141 #: Page/SettingsPage.php:52 142 #: Page/SettingsPage.php:53 139 143 msgid "Settings" 140 144 msgstr "Ustawienia" … … 258 262 msgstr "" 259 263 260 #: src/Plugin/Admin/SettingsPage.php:112 src/Plugin/Admin/SettingsPage.php:143 264 #: src/Plugin/Admin/SettingsPage.php:112 265 #: src/Plugin/Admin/SettingsPage.php:143 261 266 msgid "Webhook Url" 262 267 msgstr "" … … 266 271 msgstr "" 267 272 268 #: src/Plugin/Admin/SettingsPage.php:121 src/Plugin/Admin/SettingsPage.php:152 273 #: src/Plugin/Admin/SettingsPage.php:121 274 #: src/Plugin/Admin/SettingsPage.php:152 269 275 msgid "Secret" 270 276 msgstr "" … … 415 421 msgstr "" 416 422 423 #: src/Plugin/Admin/Import.php:101 424 msgid "Filter settings have been changed - please update this page (or close / re-open)" 425 msgstr "" 426 417 427 #: Basic_Requirement_Checker.php:202 418 428 #, php-format … … 488 498 msgstr "WP Desk Debug Log" 489 499 490 #: Integration/LogsIntegration.php:62 Integration/TrackerIntegration.php:80 500 #: Integration/LogsIntegration.php:62 501 #: Integration/TrackerIntegration.php:80 491 502 msgid "Enable" 492 503 msgstr "Włącz" … … 515 526 msgstr "Żadne wrażliwe dane nie będą zbierane, %sprzeczytaj więcej%s." 516 527 517 #: Page/LibraryDebugPage.php:34 Page/LibraryDebugPage.php:35 528 #: Page/LibraryDebugPage.php:34 529 #: Page/LibraryDebugPage.php:35 518 530 msgid "Library report" 519 531 msgstr "Raport bibliotek" … … 725 737 msgstr "Pobierz klucze API <a href=\"%s\" target=\"_blank\">tutaj</a>. Możesz aktywować i dezaktywować klucze API <strong>dowolną ilość razy na różnych domenach</strong>, pod warunkiem, że subskrypcja jest aktywna." 726 738 727 #: Page/LicensePage.php:45 Page/LicensePage.php:46 739 #: Page/LicensePage.php:45 740 #: Page/LicensePage.php:46 728 741 msgid "Subscriptions" 729 742 msgstr "Subskrypcje" -
kinguin/trunk/src/Plugin/Admin/Configuration.php
r2745667 r2777307 142 142 */ 143 143 public function get_currency_rate( string $currency ) : float { 144 return ( new CurrencyExchange() )->get_currency_rate( $currency ); 144 try{ 145 return ( new CurrencyExchange() )->get_currency_rate( $currency ); 146 } catch ( \Exception $e ) { 147 error_log( $e->getMessage() ); 148 } 145 149 } 146 150 … … 392 396 393 397 /** 394 * Get regions.398 * Get genres. 395 399 * 396 400 * @return array … … 433 437 '34' => 'XBOX LIVE Gold Card', 434 438 '35' => 'XBOX LIVE Points', 439 '36' => 'Adult Games', 435 440 ); 436 441 } … … 466 471 } 467 472 473 474 /** 475 * Get PC platforms. 476 * 477 * @return array 478 */ 479 public function get_pc_platforms() : array { 480 return array( 481 'EA Origin' => 'ea-origin', 482 'Steam' => 'steam', 483 'Battle.net' => 'battle-net', 484 'NCSoft' => 'ncsoft', 485 'Uplay' => 'uplay', 486 'GOG COM' => 'gog-com', 487 'Epic Games' => 'epic-games', 488 'Bethesda' => 'bethesda', 489 'Rockstar Games' => 'rockstar-games', 490 'Mog Station' => 'mog-station', 491 ); 492 } 493 494 495 /** 496 * Get default categories to create during insert new products. 497 * 498 * @return array 499 */ 500 public function get_default_categories() : array { 501 return array( 502 'XBOX 360' => 'xbox-360-platform', 503 'XBOX ONE' => 'xbox-one', 504 'XBOX Series X|S' => 'xbox-series-xs', 505 'PlayStation 3' => 'playstation-3-platform', 506 'PlayStation 4' => 'playstation-4-platform', 507 'PlayStation 5' => 'playstation-5-platform', 508 'PlayStation Vita' => 'vita-playstation', 509 'Android' => 'android', 510 'Nintendo' => 'nintendo', 511 'Prepaid' => 'prepaid', 512 'Software' => 'software', 513 'PC' => 'pc-platform', 514 'Others' => 'others-platforms' 515 ); 516 } 517 518 /** 519 * Helper function to get correct names of some categories for frontend. 520 * 521 * @return array 522 */ 523 public function rename_genre_for_category() : array { 524 return array( 525 'Co-op' => 'Cooperation', 526 'Fighting' => 'Fight', 527 'Hidden Object' => 'Hidden items', 528 'Puzzle' => 'Logic', 529 'Story rich' => 'Narrative', 530 'Third-Person Shooter' => 'TPS', 531 'Music / Soundtrack' => 'Soundtrack', 532 'Life Simulation' => 'Life', 533 'Dating Simulator' => 'Dating', 534 ); 535 } 536 537 /** 538 * Helper function to get slugs for categories based on genres 539 * 540 * @return array 541 */ 542 public function get_genre_slug() : array { 543 return array( 544 'Action' => 'action', 545 'Adventure' => 'adventure', 546 'Anime' => 'anime', 547 'Casual' => 'casual', 548 'Co-op' => 'cooperation', 549 'Dating Simulator' => 'dating', 550 'Fighting' => 'fighting', 551 'FPS' => 'fps', 552 'Hack and Slash' => 'hack-and-slash', 553 'Hidden Object' => 'hidden-items', 554 'Horror' => 'horror', 555 'Indie' => 'indie', 556 'Open World' => 'open-world', 557 'Platformer' => 'platformer', 558 'Point & click' => 'point-and-click', 559 'PSN Card' => 'psn-card', 560 'Puzzle' => 'logic', 561 'Racing' => 'racing', 562 'RPG' => 'rpg', 563 'Simulation' => 'simulation', 564 'Life Simulation' => 'life-simulation', 565 'Software' => 'subcat-software', 566 'Sport' => 'sport', 567 'Story rich' => 'narrative', 568 'Strategy' => 'strategy', 569 'Survival' => 'survival', 570 'XBOX LIVE Gold Card' => 'xbox-live-gold-card', 571 'Third-Person Shooter' => 'tps', 572 'MMO' => 'mmo', 573 'Music / Soundtrack' => 'soundtrack', 574 'Visual Novel' => 'visual-novel', 575 'VR Games' => 'vr-games', 576 'Subscription' => 'subscription', 577 'Adult Games' => 'adult-games', 578 'Online Courses' => 'online-courses', 579 ); 580 } 581 468 582 } -
kinguin/trunk/src/Plugin/Admin/CurrencyExchange.php
r2712632 r2777307 11 11 use WPDesk\ILKinguin\Admin\Exceptions\FrankfurterStatusCodeException; 12 12 use WPDesk\ILKinguin\Admin\Exceptions\FrankfurterNoConnectionException; 13 use WPDesk\ILKinguin\Admin\Exceptions\FrankfurterUnsupportedCurrencyException; 13 14 14 15 class CurrencyExchange { … … 90 91 $current_rate = $this->get( $currency ); 91 92 $this->save_rates( $current_rate ); 93 if ( isset( $current_rate['rates'][ $currency ] ) ) { 94 return (float) $current_rate['rates'][ $currency ]; 95 } else { 96 throw new FrankfurterUnsupportedCurrencyException(); 97 } 92 98 } 93 99 } catch ( \Exception $e ) { -
kinguin/trunk/src/Plugin/Admin/Import.php
r2745667 r2777307 85 85 $this->plugin_info->get_plugin_url() . '/assets/js/kinguin-products-import.js', 86 86 array(), 87 $this->plugin_info->get_version(),87 bin2hex( random_bytes( 16 ) ), //$this->plugin_info->get_version(), 88 88 true 89 89 ); … … 99 99 'cacheDir' => $this->get_cache_dir(), 100 100 'cachedFiles' => $this->get_cached_files(), 101 'notice' => __('Filter settings have been changed - please update this page (or close / re-open)', 'kinguin'), 101 102 ) 102 103 ); … … 288 289 $filter_param = $this->get_filter_preset(); 289 290 $products = $import_products->get( $this->get_api_url() . '/v1/products?page=' . $page . '&limit=' . $this->limit . $filter_param); 291 290 292 if ( property_exists( $products, 'results' ) ) { 291 293 $file = $this->get_cache_dir() . 'kinguin-' . $page . '.json'; … … 298 300 'file' => 'kinguin-' . $page . '.json', 299 301 'of' => ceil( $products->item_count / $this->limit ), 300 'total' => $products->item_count 302 'total' => $products->item_count, 303 'limit' => $this->limit 301 304 ); 302 305 } else { … … 335 338 $import = new InsertUpdate(); 336 339 $import->set_currency_rate(); 340 337 341 foreach ($products as $key => $product) { 338 342 $import->manage($product, 1); -
kinguin/trunk/src/Plugin/Admin/MainAdmin.php
r2745667 r2777307 16 16 17 17 class MainAdmin { 18 use Configuration; 18 19 19 20 /** … … 69 70 70 71 72 71 73 /** 72 74 * Integrate with WordPress admin actions and filters. … … 76 78 public function hooks() { 77 79 add_action( 'admin_menu', array( $this, 'admin_menu_items' ) ); 80 add_action( 'before_delete_post', array( $this, 'kinguin_delete_thumbnail') ); 78 81 } 79 80 82 81 83 … … 123 125 } 124 126 127 128 /** 129 * Remove product image if deleting products to save disk quota 130 */ 131 public function kinguin_delete_thumbnail( $pid ) { 132 133 if( 'product' == get_post_type( $pid ) ) { 134 $product = new \WC_product( $pid ); 135 $product_id = $product->get_id(); 136 $sku_label = explode('-', $product->get_sku())[0]; 137 138 if ( $product_id && $sku_label === 'kinguin' ) { 139 $product_thumbnail = get_post_thumbnail_id( $product_id ); 140 wp_delete_attachment($product_thumbnail, true); 141 } 142 } 143 144 } 145 125 146 } -
kinguin/trunk/src/Plugin/Admin/Product/Attributes.php
r2745667 r2777307 40 40 add_action( 'admin_init', array( $this, 'platform_attribute' ) ); 41 41 add_action( 'admin_init', array( $this, 'languages_attribute' ) ); 42 }42 } 43 43 44 44 45 /** 45 46 /** 46 47 * Register developers product attribute taxonomy 47 48 */ -
kinguin/trunk/src/Plugin/Admin/Product/DataTabs.php
r2745667 r2777307 49 49 50 50 add_action( 'woocommerce_product_options_pricing', array( $this, 'kinguin_price_before_margin'), 10, 0 ); 51 add_filter( 'gettext', array( $this, 'kinguin_change_backend_product_regular_price'), 100, 3 );51 add_filter( 'gettext', array( $this, 'kinguin_change_backend_product_regular_price'), 100, 3 ); 52 52 } 53 53 … … 166 166 */ 167 167 public function save_product_data_tab_inputs( $post_id ) { 168 update_post_meta( $post_id, '_kinguinPrice', sanitize_text_field( $_POST['_kinguinPrice'] ) ); 169 update_post_meta( $post_id, '_steam', sanitize_text_field( $_POST['_steam'] ) ); 170 update_post_meta( $post_id, '_ageRating', sanitize_text_field( $_POST['_ageRating'] ) ); 171 update_post_meta( $post_id, '_regionId', sanitize_text_field( $_POST['_regionId'] ) ); 172 update_post_meta( $post_id, '_activationDetails', sanitize_textarea_field( $_POST['_activationDetails'] ) ); 168 if( isset( $_POST['_kinguinPrice'] ) ) { 169 update_post_meta( $post_id, '_kinguinPrice', sanitize_text_field($_POST['_kinguinPrice'] ) ); 170 } 171 if( isset( $_POST['_steam'] ) ) { 172 update_post_meta( $post_id, '_steam', sanitize_text_field( $_POST['_steam'] ) ); 173 } 174 if( isset( $_POST['_ageRating'] ) ) { 175 update_post_meta( $post_id, '_ageRating', sanitize_text_field( $_POST['_ageRating'] ) ); 176 } 177 if( isset( $_POST['_regionId'] ) ) { 178 update_post_meta( $post_id, '_regionId', sanitize_text_field( $_POST['_regionId'] ) ); 179 } 180 if( isset( $_POST['_activationDetails'] ) ) { 181 update_post_meta( $post_id, '_activationDetails', sanitize_textarea_field( $_POST['_activationDetails'] ) ); 182 } 173 183 } 174 184 … … 218 228 public function kinguin_price_before_margin() { 219 229 global $post; 220 $product = wc_get_product( $post->ID ); 221 woocommerce_wp_text_input( array( 222 'custom_attributes' => array('readonly' => 'readonly'), 223 'id' => 'wholesaler_price', 224 'placeholder' => $product->get_price(), 225 'class' => 'wc_input_price short', 226 'label' => __( 'Price after margin', 'kinguin' ) . ' (' . get_woocommerce_currency_symbol() . ')', 227 ) ); 230 if ( metadata_exists( 'post', $post->ID, '_kinguinId' ) ) { 231 $product = wc_get_product($post->ID); 232 woocommerce_wp_text_input(array( 233 'custom_attributes' => array('readonly' => 'readonly'), 234 'id' => 'wholesaler_price', 235 'placeholder' => $product->get_price(), 236 'class' => 'wc_input_price short', 237 'label' => __('Price after margin', 'kinguin') . ' (' . get_woocommerce_currency_symbol() . ')', 238 )); 239 } 228 240 } 229 241 … … 233 245 */ 234 246 public function kinguin_change_backend_product_regular_price( $translated_text, $text, $domain ) { 235 global $pagenow, $post_type; 236 237 if ( is_admin() && in_array( $pagenow, ['post.php', 'post-new.php'] ) 238 && 'product' === $post_type && 'Regular price' === $text && 'woocommerce' === $domain ) 239 { 240 $translated_text = __( 'Kinguin price', 'kinguin' ); 241 } 247 global $pagenow, $post_type, $post; 248 249 if (is_admin() && in_array($pagenow, ['post.php', 'post-new.php']) 250 && 'product' === $post_type && 'Regular price' === $text && 'woocommerce' === $domain) { 251 if ( metadata_exists( 'post', $post->ID, '_kinguinId' ) ) { 252 $translated_text = __('Kinguin price', 'kinguin'); 253 } 254 } 255 242 256 return $translated_text; 243 257 } -
kinguin/trunk/src/Plugin/Admin/Product/InsertUpdate.php
r2745667 r2777307 53 53 public function manage( array $product, bool $manual_import = null ) { 54 54 $post_id = $this->get_post_id( $product['productId'] ); 55 55 56 if ( $post_id ) { 56 57 return $this->update( $post_id, $product ); … … 107 108 */ 108 109 public function prepare_post( array $product , bool $is_new_item = null) { 110 111 //write_log($product); 109 112 110 113 $post = array( … … 200 203 * 201 204 * @param array $product Kinguin single product from API response. 205 * @return int|string post ID 202 206 */ 203 207 public function insert( array $product ) { 204 208 $post_id = wp_insert_post( $this->prepare_post( $product, 1 ) ); 205 209 if ( ! is_wp_error( $post_id ) ) { 210 // assign main category 211 $kinguin_main_category_id = $this->get_kinguin_main_category( $product ); 212 $res = wp_set_object_terms( $post_id, (int) $kinguin_main_category_id, 'product_cat', false ); 213 214 // assign subcategories 215 if ( ! is_wp_error( $res ) ) { 216 $this->kinguin_set_subcategory( $product, (int) $kinguin_main_category_id, $post_id ); 217 } 218 206 219 return $post_id; 207 220 } … … 209 222 210 223 211 public function check_filter_conditions( array $product) {224 public function check_filter_conditions( array $product ) { 212 225 $filter = get_option( 'kinguin_settings_import' ); 213 226 214 if( !empty($filter['kinguinId'])) {215 $arr_ids = explode(',', $filter['kinguinId'] );216 if( !empty($arr_ids)) {217 foreach ($arr_ids as $id) {218 if(!empty( $id)) {219 if( $id != $product['kinguinId']) {227 if( !empty( $filter['kinguinId'] ) ) { 228 $arr_ids = explode(',', $filter['kinguinId'] ); 229 if( !empty( $arr_ids ) ) { 230 foreach( $arr_ids as $id) { 231 if(!empty( $id ) ) { 232 if( $id != $product['kinguinId'] ) { 220 233 return false; 221 234 } … … 287 300 * @param int $post_id product ID. 288 301 * @param array $product Kinguin single product from API response. 302 * @return int|string post ID 289 303 */ 290 304 public function update( int $post_id, array $product ) { … … 416 430 * Get product tags ids 417 431 * 418 * @param string[] $names Array of terms to look for and ins tert.432 * @param string[] $names Array of terms to look for and insert. 419 433 * @param string $taxonomy Taxonomy name. 420 434 * … … 454 468 } 455 469 470 471 /** 472 * Get ID of main category for Kinguin product 473 * 474 * @param array $product Kinguin single product from API response. 475 * @return int Product Category ID. 476 */ 477 public function get_kinguin_main_category( array $product ) { 478 479 // map main category based on platform 480 $mapped_main_category = $this->define_main_category( $product ); 481 482 $id = term_exists( $mapped_main_category['slug'], 'product_cat' ); 483 if( $id == NULL ) 484 { 485 $id = wp_insert_term( 486 $mapped_main_category['term'], 487 'product_cat', 488 array( 489 'description'=> $mapped_main_category['term'], 490 'slug' => $mapped_main_category['slug'] 491 ) 492 ); 493 if ( ! is_wp_error( $id ) ) { 494 return $id['term_id']; 495 } 496 497 } else { 498 return $id['term_id']; 499 } 500 501 } 502 503 504 /** 505 * Map main category for product based on platform, tag 506 * 507 * @param array $product Kinguin single product from API response. 508 * @return array Product Category slug and Category name. 509 */ 510 public function define_main_category( $product ) 511 { 512 if ( in_array( 'prepaid', $product['tags'] ) ) { 513 return array( 'term' => 'Prepaid', 'slug' => 'prepaid' ); 514 515 } else if ( in_array('software', $product['tags'] ) ) { 516 return array( 'term' => 'Software', 'slug' => 'software' ); 517 518 } else if ( array_key_exists( $product['platform'], $this->get_default_categories() ) ) { 519 $slug = $this->get_default_categories()[$product['platform']]; 520 return array( 'term' => $product['platform'], 'slug' => $slug ); 521 522 } else if ( array_key_exists( $product['platform'], $this->get_pc_platforms() ) ) { 523 return array( 'term' => 'PC', 'slug' => 'pc-platform' ); 524 525 } else { 526 // it will be 'Others' category 527 return array( 'term' => 'Others', 'slug' => 'others-platforms' ); 528 } 529 } 530 531 532 /** 533 * Assign sub-categories 2 and 3 level 534 * 535 * @param array $product Kinguin single product from API response. 536 * @param int parent category ID. 537 * @param int|string post ID 538 * @return void 539 */ 540 public function kinguin_set_subcategory( $product, $parent_cat_id, $post_id ) { 541 542 // PC categories proccessing 543 if ( array_key_exists( $product['platform'], $this->get_pc_platforms() ) 544 && !in_array( 'prepaid', $product['tags'] ) 545 && !in_array( 'software', $product['tags'] ) 546 ) { 547 548 $id = term_exists( $product['platform'], 'product_cat', $parent_cat_id ); 549 if( $id == NULL ) 550 { 551 552 $slug = $this->get_pc_platforms()[$product['platform']]; 553 554 $id = wp_insert_term( 555 $product['platform'], 556 'product_cat', 557 array( 558 'description'=> $product['platform'], 559 'slug' => $slug, 560 'parent'=> $parent_cat_id 561 ) 562 ); 563 } 564 $res = wp_set_object_terms( $post_id, (int) $id['term_id'], 'product_cat',true ); 565 566 if( ! empty( $product['genres'] ) && ! is_wp_error( $res ) ) { 567 foreach( $product['genres'] as $key => $genre ) { 568 569 // WordPress does not allow child categories/terms to have same name even tough they have a different parent 570 $slug = strtolower( $product['platform'] ) . '-' . $this->get_genre_slug()[$genre]; 571 572 $sub_id = term_exists( $slug, 'product_cat', (int) $id['term_id'] ); 573 if( $sub_id == NULL ) 574 { 575 $genre = $this->fix_genre_cat_name( $genre ); 576 577 $sub_id = wp_insert_term( 578 $genre, 579 'product_cat', 580 array( 581 'description'=> $genre, 582 'slug' => $slug, 583 'parent'=> (int) $id['term_id'] 584 ) 585 ); 586 } 587 wp_set_object_terms( $post_id, (int) $sub_id['term_id'], 'product_cat',true ); 588 } 589 } 590 591 } else if ( array_key_exists( $product['platform'], $this->get_default_categories() ) 592 && !in_array( 'prepaid', $product['tags'] ) 593 && !in_array( 'software', $product['tags'] ) 594 ) { 595 // assign genre-subcategories for main categories except PC 596 if( ! empty( $product['genres'] ) ) { 597 foreach( $product['genres'] as $key => $genre ) { 598 // WordPress does not allow child categories/terms to have same name even tough they have a different parent 599 $slug = strtolower( $product['platform'] ) . '-' . $this->get_genre_slug()[$genre]; 600 $id = term_exists( $slug, 'product_cat', $parent_cat_id ); 601 if( $id == NULL ) 602 { 603 $genre = $this->fix_genre_cat_name( $genre ); 604 605 $id = wp_insert_term( 606 $genre, 607 'product_cat', 608 array( 609 'description'=> $genre, 610 'slug' => $slug, 611 'parent'=> $parent_cat_id 612 ) 613 ); 614 } 615 wp_set_object_terms( $post_id, (int) $id['term_id'], 'product_cat',true ); 616 } 617 } 618 } 619 620 } 621 622 /** 623 * Return corrected Category name for frontend 624 * 625 * @param string Genre name. 626 * @return string Category name. 627 */ 628 public function fix_genre_cat_name( $genre ) { 629 if( array_key_exists( $genre, $this->rename_genre_for_category() ) ) { 630 return $this->rename_genre_for_category()[$genre]; 631 } 632 return $genre; 633 } 634 635 456 636 } -
kinguin/trunk/src/Plugin/Admin/SettingsPage.php
r2745667 r2777307 49 49 public function hooks() { 50 50 add_action( 'admin_init', array( $this, 'register_plugin_settings' ) ); 51 add_action( 'admin_enqueue_scripts', array( $this, 'settings_scripts' ) ); 51 add_action( 'admin_enqueue_scripts', array( $this, 'kinguin_import_settings' ) ); 52 } 53 54 55 /** 56 * Enqueue styles and script for import filter tab. 57 * 58 * @return void 59 */ 60 public function kinguin_import_settings() { 61 $current_screen = get_current_screen(); 62 if ( is_a( $current_screen, 'WP_Screen' ) && 'import-products_page_kinguin-settings' === $current_screen->id ) { 63 if( isset($_GET['page']) && 'kinguin-settings' === $_GET['page'] 64 ) { 65 wp_enqueue_style('kinguin_import_settings', $this->plugin_info->get_plugin_url() . '/assets/css/kinguin-import-settings.css', array(), $this->plugin_info->get_version(), false); 66 wp_enqueue_script('kinguin_import_settings-js', $this->plugin_info->get_plugin_url() . '/assets/js/kinguin-import-settings.js', array(), $this->plugin_info->get_version(), false); 67 } 52 68 } 53 54 55 public function settings_scripts() {56 wp_enqueue_style( 'kinguin-test', $this->plugin_info->get_plugin_url() . '/assets/css/kinguin-import-settings.css', array(), $this->plugin_info->get_version(), false );57 wp_enqueue_script( 'kinguin-test-js', $this->plugin_info->get_plugin_url() . '/assets/js/kinguin-import-settings.js', array(), $this->plugin_info->get_version(), false );58 59 69 } 60 70 … … 81 91 array( $this, 'validate_api_key' ) 82 92 ); 93 94 add_settings_section( 'kinguin_settings', '', false, 'kinguin_settings' ); 95 83 96 add_settings_field( 84 97 'kinguin_api_key', … … 420 433 public function kinguin_product_margin_callback() { 421 434 422 $options = get_option( 'kinguin_product_margin' ); ?> 423 424 <input type="radio" id="kinguin_product_margin_fix" name="kinguin_product_margin[kinguin_margin_type]" value="1" <?php echo ' ' . checked( 1, $options['kinguin_margin_type'], false )?> /> 425 426 <label for="kinguin_product_margin_fix"> 427 <?php echo esc_html_e('Flat fee', 'kinguin') ?> 428 (<?php echo esc_html( get_woocommerce_currency_symbol() ) ?>) 429 </label> 430 431 <input type="radio" id="kinguin_product_margin_percent" name="kinguin_product_margin[kinguin_margin_type]" value="2" <?php echo ' ' . checked( 2, $options['kinguin_margin_type'], false ) ?> /> 432 433 <label for="kinguin_product_margin_percent"> 434 <?php echo esc_html_e('Percent', 'kinguin') ?> 435 </label> 436 437 438 <?php } 435 $options = get_option( 'kinguin_product_margin' ); 436 437 if( isset( $options['kinguin_margin_type'] ) ) { ?> 438 439 <input type="radio" id="kinguin_product_margin_fix" name="kinguin_product_margin[kinguin_margin_type]" 440 value="1" <?php echo ' ' . checked(1, $options['kinguin_margin_type'], false); ?> /> 441 442 <label for="kinguin_product_margin_fix"> 443 <?php echo esc_html_e('Flat fee', 'kinguin') ?> 444 (<?php echo esc_html(get_woocommerce_currency_symbol()) ?>) 445 </label> 446 447 <input type="radio" id="kinguin_product_margin_percent" name="kinguin_product_margin[kinguin_margin_type]" 448 value="2" <?php echo ' ' . checked(2, $options['kinguin_margin_type'], false); ?> /> 449 450 <label for="kinguin_product_margin_percent"> 451 <?php echo esc_html_e('Percent', 'kinguin') ?> 452 </label> 453 454 <?php } else { ?> 455 456 <input type="radio" id="kinguin_product_margin_fix" name="kinguin_product_margin[kinguin_margin_type]" 457 value="1" checked /> 458 459 <label for="kinguin_product_margin_fix"> 460 <?php echo esc_html_e('Flat fee', 'kinguin') ?> 461 (<?php echo esc_html(get_woocommerce_currency_symbol()) ?>) 462 </label> 463 464 <input type="radio" id="kinguin_product_margin_percent" name="kinguin_product_margin[kinguin_margin_type]" 465 value="2" /> 466 467 <label for="kinguin_product_margin_percent"> 468 <?php echo esc_html_e('Percent', 'kinguin') ?> 469 </label> 470 471 <?php } 472 } 439 473 440 474 … … 910 944 </div> 911 945 912 946 913 947 </div> 914 948 <?php } -
kinguin/trunk/src/Plugin/Admin/templates/import_template.php
r2712632 r2777307 29 29 </header> 30 30 31 <div class="import-setup__begin">32 <div class="message">31 <div class="import-setup__begin"> 32 <div class="message"> 33 33 <?php if ( ! $memory_limit_error ) : ?> 34 35 <p> 36 <?php esc_attr_e( 'Due to huge Kinguin games library (above 32.000) this process is rather long and take easily couple of hours. However its duration is heavily dependent of Your server configuration - it is quicker on servers with greater RAM amount. We recommend to import products during low site traffic like for e.g on the night time. You can always interrupt this process and it will automatically resumes where You left.', 'kinguin' ); ?> 37 </p> 38 <p> 39 <?php esc_attr_e( 'Click - Import Products - to begin with product import.', 'kinguin' ); ?> 40 </p> 34 <p> 35 <?php esc_attr_e( 'Due to huge Kinguin games library (above 32.000) this process is rather long and take easily couple of hours. However its duration is heavily dependent of Your server configuration - it is quicker on servers with greater RAM amount. We recommend to import products during low site traffic like for e.g on the night time. You can always interrupt this process and it will automatically resumes where You left.', 'kinguin' ); ?> 36 </p> 37 <p> 38 <?php esc_attr_e( 'Click - Import Products - to begin with product import.', 'kinguin' ); ?> 39 </p> 41 40 <?php else : ?> 42 41 <?php esc_attr_e( 'Unfortunately the amount of memory limit is set too low to import such huge number products efficiently. Please contact with Your server administrator to increase memory limit to at least 160 MB. Remember that the higher memory limit allow You to get Kinguin products quicker into Your store.', 'kinguin' ); ?> 43 42 <?php endif; ?> 43 </div> 44 </div> 45 46 <div class="import-setup__process"> 47 <dl> 48 <dt> 49 <?php esc_attr_e( 'Create cache directory', 'kinguin' ); ?> 50 </dt> 51 <dd> 52 <span class="status_cache_dir"></span> 53 </dd> 54 <dt> 55 <?php esc_attr_e( 'Importing products sets from Kinguin', 'kinguin' ); ?> 56 </dt> 57 <dd> 58 <span class="status_cache"></span> 59 </dd> 60 </dl> 61 <div class="progress"> 62 <progress id="import-progress" max="0" value="0"></progress> 63 </div> 64 <dl> 65 <dt> 66 <span class="kinguin-dynamic-text"> 67 <?php esc_attr_e( 'Creating products from cached files', 'kinguin' ); ?> 68 </span> 69 </dt> 70 <dd> 71 <span class="status_import"></span> 72 </dd> 73 </dl> 74 <div class="progress-db progress-infinite"> 75 <div class="progress-bar-kinguin"> 76 </div> 44 77 </div> 45 78 </div> 46 47 <div class="import-setup__process">48 <dl>49 <dt>50 <?php esc_attr_e( 'Create cache directory', 'kinguin' ); ?>51 </dt>52 <dd>53 <span class="status_cache_dir"></span>54 </dd>55 <dt>56 <?php esc_attr_e( 'Importing products sets from Kinguin', 'kinguin' ); ?>57 </dt>58 <dd>59 <span class="status_cache"></span>60 </dd>61 <dt>62 <?php esc_attr_e( 'Creating products', 'kinguin' ); ?>63 </dt>64 <dd>65 <span class="status_import"></span>66 </dd>67 </dl>68 <div class="progress">69 <progress id="import-progress" max="0" value="0"></progress>70 </div>71 </div>72 79 73 80 <div class="import-setup__done"> -
kinguin/trunk/src/Plugin/Common/ProductMargin.php
r2745667 r2777307 54 54 } 55 55 } 56 56 57 return $price; 57 58 } -
kinguin/trunk/src/Plugin/Common/ProductWebHook.php
r2745667 r2777307 109 109 $post = new InsertUpdate(); 110 110 $post->set_currency_rate(); 111 112 if ( $post->manage( $product ) ) { 113 return array( 114 'status' => 200, 115 'response' => 'Product updated' 116 ); 117 } else { 118 return array( 119 'status' => 404, 120 'response' => 'Product not found' 121 ); 122 } 123 111 if ( $post->manage( $product ) ) { 112 return array( 113 'status' => 200, 114 'response' => 'Product updated' 115 ); 116 } else { 117 return array( 118 'status' => 404, 119 'response' => 'Product not found' 120 ); 121 } 124 122 } 125 123 -
kinguin/trunk/src/Plugin/Frontend/MainFrontend.php
r2745667 r2777307 52 52 add_action( 'woocommerce_new_order', array( new NewOrder(), 'order' ), 1, 2 ); 53 53 add_action( 'pre_get_posts', array( $this, 'product_filter' ) ); 54 } 54 add_action( 'woocommerce_archive_description', array( $this, 'kinguin_filter_search_results_title' ) ); 55 } 55 56 56 57 … … 88 89 } 89 90 91 92 /** 93 * Show title for filtered results on shop archive page 94 * 95 */ 96 public function kinguin_filter_search_results_title() { 97 if ( ! is_admin() && is_post_type_archive( 'product' ) ) { 98 $attributes = wc_get_attribute_taxonomies(); 99 if ( $attributes ) { 100 $attributes = wp_list_pluck( $attributes, 'attribute_name' ); 101 102 $params = array_filter( 103 $_GET, 104 function( $param ) { 105 return sanitize_text_field( $param ); 106 } 107 ); 108 109 if ( isset( $params ) ) { 110 foreach ( $params as $param => $value ) { 111 if ( in_array($param, $attributes ) ) { 112 echo '<h2>' . __( 'All products that meet the criteria', 'kinguin' ) . ' "' . $param . ' - ' . ucfirst( $value ) . '":</h2>'; 113 } 114 } 115 } 116 } 117 } 118 } 119 90 120 } -
kinguin/trunk/src/Plugin/Plugin.php
r2745667 r2777307 96 96 add_action( 'rest_api_init', array( new OrderWebHook(), 'register_route' ) ); 97 97 add_action( 'rest_api_init', array( new ProductWebHook(), 'register_route' ) ); 98 99 } 98 } 100 99 101 100 -
kinguin/trunk/vendor/autoload.php
r2720754 r2777307 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 4ea417124d576bddbefffedfa0c43822::getLoader();7 return ComposerAutoloaderInitcc4a59561dee07d5b0b9c74b6e9b762e::getLoader(); -
kinguin/trunk/vendor/composer/autoload_real.php
r2720754 r2777307 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 4ea417124d576bddbefffedfa0c438225 class ComposerAutoloaderInitcc4a59561dee07d5b0b9c74b6e9b762e 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 4ea417124d576bddbefffedfa0c43822', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitcc4a59561dee07d5b0b9c74b6e9b762e', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 4ea417124d576bddbefffedfa0c43822', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitcc4a59561dee07d5b0b9c74b6e9b762e', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 4ea417124d576bddbefffedfa0c43822::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; … … 54 54 55 55 if ($useStaticLoader) { 56 $includeFiles = Composer\Autoload\ComposerStaticInit 4ea417124d576bddbefffedfa0c43822::$files;56 $includeFiles = Composer\Autoload\ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e::$files; 57 57 } else { 58 58 $includeFiles = require __DIR__ . '/autoload_files.php'; 59 59 } 60 60 foreach ($includeFiles as $fileIdentifier => $file) { 61 composerRequire 4ea417124d576bddbefffedfa0c43822($fileIdentifier, $file);61 composerRequirecc4a59561dee07d5b0b9c74b6e9b762e($fileIdentifier, $file); 62 62 } 63 63 … … 66 66 } 67 67 68 function composerRequire 4ea417124d576bddbefffedfa0c43822($fileIdentifier, $file)68 function composerRequirecc4a59561dee07d5b0b9c74b6e9b762e($fileIdentifier, $file) 69 69 { 70 70 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
kinguin/trunk/vendor/composer/autoload_static.php
r2745667 r2777307 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 4ea417124d576bddbefffedfa0c438227 class ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e 8 8 { 9 9 public static $files = array ( … … 349 349 { 350 350 return \Closure::bind(function () use ($loader) { 351 $loader->prefixLengthsPsr4 = ComposerStaticInit 4ea417124d576bddbefffedfa0c43822::$prefixLengthsPsr4;352 $loader->prefixDirsPsr4 = ComposerStaticInit 4ea417124d576bddbefffedfa0c43822::$prefixDirsPsr4;353 $loader->classMap = ComposerStaticInit 4ea417124d576bddbefffedfa0c43822::$classMap;351 $loader->prefixLengthsPsr4 = ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e::$prefixLengthsPsr4; 352 $loader->prefixDirsPsr4 = ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e::$prefixDirsPsr4; 353 $loader->classMap = ComposerStaticInitcc4a59561dee07d5b0b9c74b6e9b762e::$classMap; 354 354 355 355 }, null, ClassLoader::class); -
kinguin/trunk/vendor/composer/installed.php
r2745667 r2777307 1 1 <?php return array( 2 2 'root' => array( 3 'pretty_version' => ' 1.0.0+no-version-set',4 'version' => ' 1.0.0.0',3 'pretty_version' => 'dev-master', 4 'version' => 'dev-master', 5 5 'type' => 'library', 6 6 'install_path' => __DIR__ . '/../../', 7 7 'aliases' => array(), 8 'reference' => NULL,8 'reference' => 'cfdfaeb7df61da06d6f75a52c27c6abb3453cd91', 9 9 'name' => 'wpdesk/kinguin', 10 10 'dev' => false, … … 21 21 ), 22 22 'wpdesk/kinguin' => array( 23 'pretty_version' => ' 1.0.0+no-version-set',24 'version' => ' 1.0.0.0',23 'pretty_version' => 'dev-master', 24 'version' => 'dev-master', 25 25 'type' => 'library', 26 26 'install_path' => __DIR__ . '/../../', 27 27 'aliases' => array(), 28 'reference' => NULL,28 'reference' => 'cfdfaeb7df61da06d6f75a52c27c6abb3453cd91', 29 29 'dev_requirement' => false, 30 30 ), -
kinguin/trunk/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php
r2712632 r2777307 45 45 { 46 46 $message = 'Error: ' . \get_class($e) . ' Code: ' . $e->get_error_code() . ' Message: ' . $e->get_error_message(); 47 self::log_message_backtrace($message, \ILKinguinVendor\WPDesk_Logger::ERROR, $backtrace);47 self::log_message_backtrace($message, $backtrace, \ILKinguinVendor\WPDesk_Logger::ERROR ); 48 48 } 49 49 /** … … 77 77 * @param array $backtrace Backtrace information with snapshot of error env. 78 78 */ 79 public static function log_message_backtrace( $message, $level = \ILKinguinVendor\WPDesk_Logger::DEBUG, array $backtrace)79 public static function log_message_backtrace( $message, array $backtrace, $level = \ILKinguinVendor\WPDesk_Logger::DEBUG ) 80 80 { 81 81 $message .= ' Backtrace: ' . \json_encode($backtrace); -
kinguin/trunk/vendor_prefixed/wpdesk/wp-plugin-flow/composer.json
r2720754 r2777307 10 10 "php": ">=5.6", 11 11 "wpdesk\/wp-basic-requirements": "^3.2.3", 12 "wpdesk\/wp-builder": "^1.4.4" 12 "wpdesk\/wp-builder": "^1.4.4", 13 "wpdesk\/wp-wpdesk-license": "^2.10.1", 14 "wpdesk\/wp-wpdesk-helper": "^2.4", 15 "wpdesk\/wp-wpdesk-tracker": "^2.3.1" 13 16 }, 14 17 "require-dev": { … … 17 20 "squizlabs\/php_codesniffer": "^3.4.2", 18 21 "10up\/wp_mock": "^0.2", 19 "wpdesk\/wp-wpdesk-composer": "^2.3", 20 "wpdesk\/wp-wpdesk-license": "^2.10.1", 21 "wpdesk\/wp-wpdesk-helper": "^2.4", 22 "wpdesk\/wp-wpdesk-tracker": "^2.3.1" 22 "wpdesk\/wp-wpdesk-composer": "^2.3" 23 23 }, 24 24 "autoload": { -
kinguin/trunk/vendor_prefixed/wpdesk/wp-plugin-flow/src/plugin-init-php52-free.php
r2745667 r2777307 8 8 * @var string $plugin_class_name 9 9 * @var string $plugin_text_domain 10 * @var string $ kinguin_plugin_dir10 * @var string $plugin_dir 11 11 * @var string $plugin_file 12 12 * @var array $requirements … … 18 18 // Code in PHP >= 5.3 but understandable by older parsers 19 19 if (\PHP_VERSION_ID > 50300) { 20 require_once $ kinguin_plugin_dir . '/vendor/autoload.php';20 require_once $plugin_dir . '/vendor/autoload.php'; 21 21 $plugin_init_factory = new \ILKinguinVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimpleFactory(\true); 22 22 } -
kinguin/trunk/vendor_prefixed/wpdesk/wp-plugin-flow/src/plugin-init-php52.php
r2745667 r2777307 8 8 * @var string $plugin_class_name 9 9 * @var string $plugin_text_domain 10 * @var string $ kinguin_plugin_dir10 * @var string $plugin_dir 11 11 * @var string $plugin_file 12 12 * @var array $requirements … … 19 19 // Code in PHP >= 5.3 but understandable by older parsers 20 20 if (\PHP_VERSION_ID > 50300) { 21 require_once $ kinguin_plugin_dir . '/vendor/autoload.php';21 require_once $plugin_dir . '/vendor/autoload.php'; 22 22 if (!isset($plugin_init_factory)) { 23 23 $plugin_init_factory = new \ILKinguinVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimpleFactory(); … … 30 30 $plugin_class_name, 31 31 $plugin_text_domain, 32 $ kinguin_plugin_dir,32 $plugin_dir, 33 33 $plugin_file, 34 34 $requirements, -
kinguin/trunk/vendor_prefixed/wpdesk/wp-wpdesk-helper/composer.json
r2720754 r2777307 10 10 "php": ">=5.6", 11 11 "wpdesk\/wp-logs": "^1.6.0", 12 "wpdesk\/wp-wpdesk-license": "^2.6", 13 "wpdesk\/wp-wpdesk-tracker": "^2.0.4", 12 14 "wpdesk\/wp-builder": "^1.2", 13 15 "wpdesk\/wp-notice": "^3.1.1", … … 20 22 "mockery\/mockery": "*", 21 23 "10up\/wp_mock": "*", 22 "wimg\/php-compatibility": "^8", 23 "wpdesk\/wp-wpdesk-license": "^2.6", 24 "wpdesk\/wp-wpdesk-tracker": "^2.0.4" 24 "wimg\/php-compatibility": "^8" 25 25 }, 26 26 "autoload": { -
kinguin/trunk/vendor_prefixed/wpdesk/wp-wpdesk-helper/src/PrefixedHelperAsLibrary.php
r2720754 r2777307 63 63 { 64 64 $this->add_wpdesk_menu(); 65 //$subscription_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\LicenseIntegration();66 //$subscription_integration->hooks();65 $subscription_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\LicenseIntegration(); 66 $subscription_integration->hooks(); 67 67 $settingsPage = new \ILKinguinVendor\WPDesk\Helper\Page\SettingsPage(); 68 68 $settings_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\SettingsIntegration($settingsPage); 69 //$tracker_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\TrackerIntegration($settingsPage);69 $tracker_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\TrackerIntegration($settingsPage); 70 70 $logger_integration = new \ILKinguinVendor\WPDesk\Helper\Integration\LogsIntegration($settingsPage); 71 71 $settings_integration->add_hookable($logger_integration); 72 //$settings_integration->add_hookable($tracker_integration);72 $settings_integration->add_hookable($tracker_integration); 73 73 $settings_integration->hooks(); 74 //self::$tracker = $tracker_integration->get_tracker();74 self::$tracker = $tracker_integration->get_tracker(); 75 75 self::$logger = $logger_integration->get_logger(); 76 76 (new \ILKinguinVendor\WPDesk\Helper\UpgradeSoonNotice())->show_info_about_upgrade_if_old_env(); -
kinguin/trunk/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php
r2720754 r2777307 48 48 \ILKinguinVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS)); 49 49 } else { 50 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \ ILKinguinVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));50 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS), \ILKinguinVendor\WPDesk_Logger::ERROR ); 51 51 } 52 52 } … … 68 68 \ILKinguinVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS)); 69 69 } else { 70 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \ ILKinguinVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));70 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS), \ILKinguinVendor\WPDesk_Logger::ERROR ); 71 71 } 72 72 } … … 97 97 \ILKinguinVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS)); 98 98 } else { 99 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \ ILKinguinVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));99 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS), \ILKinguinVendor\WPDesk_Logger::ERROR ); 100 100 } 101 101 } -
kinguin/trunk/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php
r2720754 r2777307 202 202 \ILKinguinVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS)); 203 203 } else { 204 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \ ILKinguinVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));204 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS), \ILKinguinVendor\WPDesk_Logger::ERROR ); 205 205 } 206 206 } … … 235 235 } else { 236 236 if (\class_exists('ILKinguinVendor\\WPDesk_Logger_Factory')) { 237 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is not an object', \ ILKinguinVendor\WPDesk_Logger::DEBUG, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));237 \ILKinguinVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is not an object', \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS), \ILKinguinVendor\WPDesk_Logger::DEBUG ); 238 238 } else { 239 239 \error_log("Unserialize error. Please send this report to support@wpdesk.net. Request: {$request}. Raw Response: {$raw_response}");
Note: See TracChangeset
for help on using the changeset viewer.