Changeset 1674966
- Timestamp:
- 06/09/2017 06:31:34 PM (9 years ago)
- Location:
- em-beer-manager
- Files:
-
- 74 added
- 3 deleted
- 25 edited
-
tags/3.1.0 (added)
-
tags/3.1.0/README.txt (added)
-
tags/3.1.0/assets (added)
-
tags/3.1.0/assets/beer-styles.txt (added)
-
tags/3.1.0/assets/css (added)
-
tags/3.1.0/assets/css/admin.css (added)
-
tags/3.1.0/assets/css/output.css (added)
-
tags/3.1.0/assets/css/widgets.css (added)
-
tags/3.1.0/assets/fonts (added)
-
tags/3.1.0/assets/fonts/beer-icons.eot (added)
-
tags/3.1.0/assets/fonts/beer-icons.svg (added)
-
tags/3.1.0/assets/fonts/beer-icons.ttf (added)
-
tags/3.1.0/assets/fonts/beer-icons.woff (added)
-
tags/3.1.0/assets/img (added)
-
tags/3.1.0/assets/img/checkin-button-1.png (added)
-
tags/3.1.0/assets/img/checkin-button-2.png (added)
-
tags/3.1.0/assets/img/donate.png (added)
-
tags/3.1.0/assets/img/star-25.svg (added)
-
tags/3.1.0/assets/img/star-50.svg (added)
-
tags/3.1.0/assets/img/star-75.svg (added)
-
tags/3.1.0/assets/img/star-empty.svg (added)
-
tags/3.1.0/assets/img/star-full.svg (added)
-
tags/3.1.0/assets/img/ut-credit.png (added)
-
tags/3.1.0/assets/img/ut-icon-1.png (added)
-
tags/3.1.0/assets/img/ut-icon-2.png (added)
-
tags/3.1.0/assets/js (added)
-
tags/3.1.0/assets/js/admin.js (added)
-
tags/3.1.0/em-beer-manager.php (added)
-
tags/3.1.0/includes (added)
-
tags/3.1.0/includes/admin (added)
-
tags/3.1.0/includes/admin/embm-admin-actions.php (added)
-
tags/3.1.0/includes/admin/embm-admin-footer.php (added)
-
tags/3.1.0/includes/admin/embm-admin-notices.php (added)
-
tags/3.1.0/includes/admin/embm-admin-settings.php (added)
-
tags/3.1.0/includes/admin/integrations (added)
-
tags/3.1.0/includes/admin/integrations/embm-integrations-authorize.php (added)
-
tags/3.1.0/includes/admin/integrations/embm-integrations-untappd.php (added)
-
tags/3.1.0/includes/admin/integrations/embm-integrations-utfb.php (added)
-
tags/3.1.0/includes/admin/tabs (added)
-
tags/3.1.0/includes/admin/tabs/embm-tabs-labs.php (added)
-
tags/3.1.0/includes/admin/tabs/embm-tabs-untappd.php (added)
-
tags/3.1.0/includes/admin/tabs/embm-tabs-usage.php (added)
-
tags/3.1.0/includes/admin/tabs/embm-tabs-utfb.php (added)
-
tags/3.1.0/includes/embm-admin.php (added)
-
tags/3.1.0/includes/embm-core.php (added)
-
tags/3.1.0/includes/embm-output.php (added)
-
tags/3.1.0/includes/embm-upgrades.php (added)
-
tags/3.1.0/includes/metaboxes (added)
-
tags/3.1.0/includes/metaboxes/embm-metabox-extras.php (added)
-
tags/3.1.0/includes/metaboxes/embm-metabox-profile.php (added)
-
tags/3.1.0/includes/metaboxes/embm-metabox-untappd.php (added)
-
tags/3.1.0/includes/output (added)
-
tags/3.1.0/includes/output/embm-output-filters.php (added)
-
tags/3.1.0/includes/output/embm-output-shortcodes.php (added)
-
tags/3.1.0/includes/templates (added)
-
tags/3.1.0/includes/templates/embm-template-comments.php (added)
-
tags/3.1.0/includes/widgets (added)
-
tags/3.1.0/includes/widgets/embm-widget-list.php (added)
-
tags/3.1.0/includes/widgets/embm-widget-untappd.php (added)
-
tags/3.1.0/languages (added)
-
tags/3.1.0/languages/embm-is_IS.mo (added)
-
tags/3.1.0/languages/embm-is_IS.po (added)
-
tags/3.1.0/languages/embm-nb_NO.mo (added)
-
tags/3.1.0/languages/embm-nb_NO.po (added)
-
tags/3.1.0/languages/embm-pt_BR.mo (added)
-
tags/3.1.0/languages/embm-pt_BR.po (added)
-
tags/3.1.0/license.txt (added)
-
trunk/README.txt (modified) (8 diffs)
-
trunk/assets/beer-styles.txt (modified) (1 diff)
-
trunk/assets/css/admin.css (modified) (7 diffs)
-
trunk/assets/css/output.css (modified) (3 diffs)
-
trunk/assets/css/widgets.css (modified) (1 diff)
-
trunk/assets/img/donate.png (added)
-
trunk/assets/js/admin.js (modified) (9 diffs)
-
trunk/em-beer-manager.php (modified) (3 diffs)
-
trunk/includes/admin/embm-admin-actions.php (modified) (13 diffs)
-
trunk/includes/admin/embm-admin-authorize.php (deleted)
-
trunk/includes/admin/embm-admin-footer.php (modified) (2 diffs)
-
trunk/includes/admin/embm-admin-notices.php (modified) (7 diffs)
-
trunk/includes/admin/embm-admin-settings.php (modified) (5 diffs)
-
trunk/includes/admin/embm-admin-untappd.php (deleted)
-
trunk/includes/admin/integrations (added)
-
trunk/includes/admin/integrations/embm-integrations-authorize.php (added)
-
trunk/includes/admin/integrations/embm-integrations-untappd.php (added)
-
trunk/includes/admin/integrations/embm-integrations-utfb.php (added)
-
trunk/includes/admin/labs (deleted)
-
trunk/includes/admin/tabs/embm-tabs-labs.php (modified) (2 diffs)
-
trunk/includes/admin/tabs/embm-tabs-untappd.php (added)
-
trunk/includes/admin/tabs/embm-tabs-usage.php (modified) (1 diff)
-
trunk/includes/admin/tabs/embm-tabs-utfb.php (added)
-
trunk/includes/embm-admin.php (modified) (5 diffs)
-
trunk/includes/embm-core.php (modified) (5 diffs)
-
trunk/includes/embm-output.php (modified) (13 diffs)
-
trunk/includes/embm-upgrades.php (modified) (1 diff)
-
trunk/includes/metaboxes/embm-metabox-extras.php (modified) (1 diff)
-
trunk/includes/metaboxes/embm-metabox-profile.php (modified) (1 diff)
-
trunk/includes/metaboxes/embm-metabox-untappd.php (modified) (8 diffs)
-
trunk/includes/output/embm-output-filters.php (modified) (7 diffs)
-
trunk/includes/output/embm-output-shortcodes.php (modified) (5 diffs)
-
trunk/includes/templates/embm-template-comments.php (modified) (1 diff)
-
trunk/includes/widgets/embm-widget-list.php (modified) (1 diff)
-
trunk/includes/widgets/embm-widget-untappd.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
em-beer-manager/trunk/README.txt
r1647727 r1674966 2 2 Contributors: ErinMorelli 3 3 Donate link: http://www.erinmorelli.com/projects/em-beer-manager/ 4 Tags: beer, beers, brewery, untappd 4 Tags: beer, beers, brewery, untappd, untappd for business 5 5 Requires at least: 3.0.1 6 Tested up to: 4. 7.27 Stable tag: 3. 0.56 Tested up to: 4.8.0 7 Stable tag: 3.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Manage your beers with WordPress. Integrates simply with Untappd beer check-ins. Great for everyone from home brewers to professional breweries!11 Manage and display your beers with WordPress. Integrates simply with Untappd and Untappd for Business. Great for everyone from home brewers to professional breweries! 12 12 13 13 … … 18 18 * A custom beer "style" taxonomy for classifying your beers pre-populated with styles from Untappd 19 19 * A customizable "group" taxonomy for categorizing and grouping your beers 20 * "Menu" taxonomy for creating beer menus 20 21 * Shortcodes and template tags for displaying all or a select number of beers 21 22 * Custom meta boxes to store detailed information about each beer, including ABV, IBU, and ingredients … … 24 25 * A "Recent Check-Ins" widget for displaying recent beer check-ins for your brewery on Untappd 25 26 * Custom page display for beers and styles 26 * [Experimental] Import your brewery's beers directly from Untappd 27 * [Beta] Import your brewery's beers directly from Untappd 28 * [Beta] Import your beers and menus from Untappd for Business 27 29 28 30 = Usage = … … 157 159 == Frequently Asked Questions == 158 160 161 = Can I use content filters with EM Beer Manager? = 162 163 Yes! New in v3.1.0, you can apply content filters to different parts of EM Beer Manager's output: 164 165 * `embm_beer_filter_beer` = The full beer post content 166 * `embm_beer_filter_untappd` = The Untappd check-in button 167 * `embm_beer_filter_profile` = The beer profile content 168 * `embm_beer_filter_extras` = The beer extras content 169 * `embm_beer_filter_rating` = The full beer rating content 170 * `embm_beer_filter_rating_stars` = Just the stars of the rating content 171 * `embm_beer_filter_rating_styles` = CSS styles for the rating stars 172 * `embm_beer_filter_reviews` = The beer reviews content 173 174 175 = Why is an Untappd account required in addition to an UTFB account? = 176 177 Untappd for Business (UTFB) account credentials do not work with Untappd's API. In order to link Untappd data to beers imported from UTFB, Untappd API access is also needed. 178 179 An Untappd brewery account is not required to work with UTFB. A standard user account will work. 180 181 182 = Where do I find my Untappd for Business API key? = 183 184 You can find your API key under the ["API Access Tokens"](https://business.untappd.com/api_tokens) section of your account. 185 186 159 187 = Why am I seeing a "rate-limit" error? = 160 188 … … 236 264 237 265 Try refreshing your permalinks by going to "Settings" -> "Permalinks" and clicking the "Save Settings" button. If you are running EM Beer Manager 1.7.1 or earlier, it may be due to your site's theme overriding the EM Beer Manager templates. We recommend updating to version 1.8.0 or higher, but you can also edit the templates in the plugin file to suit your needs. They're located in wp-content -> plugins -> em-beer-manager -> templates. 238 239 240 266 241 267 … … 253 279 == Changelog == 254 280 281 = 3.1.0 = 282 * [NEW] Connect to and import beers/menus from your Untappd for Business account 283 * [NEW] Sync your imported beers with changes from Untappd 284 * [NEW] Beer images now link to their respective beer 285 * [FIXED] Bug with how beer styles were displaying in titles 286 255 287 = 3.0.5 = 256 288 * [FIXED] Broken brewery account authentication for Labs … … 389 421 390 422 391 392 423 == Upgrade Notice == 424 425 = 3.1.0 = 426 Adds support for Untappd for Business accounts 393 427 394 428 = 3.0.5 = … … 458 492 * Norwegian Bokmål (nb_NO) - *thanks to __[Lars Kvisle](http://www.lars.kvisle.no)__* 459 493 * Brazilian Portuguese (pt_BR) - *thanks to __Lucas Alexandre__* 460 461 462 == Planned Features ==463 464 * Post/Page “Add Beer” page/post editor button to auto-generate shortcode input465 * Customization for “Beer Profile” input fields (e.g. allow users to remove “Additions/Spices” or add “OG”)466 * Allow users to select additional fields to show in the beer list widget (e.g. "ABV") -
em-beer-manager/trunk/assets/beer-styles.txt
r1584363 r1674966 84 84 Lambic - Kriek 85 85 Lambic - Other 86 Maibock /HellesBock86 Maibock / Heller (Helles) Bock 87 87 Malt Beer 88 88 Malt Liquor -
em-beer-manager/trunk/assets/css/admin.css
r1584363 r1674966 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2017, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or … … 153 153 width: 50px; 154 154 } 155 .embm-settings--page .embm-settings--status .embm-untappd--user-link { 155 .embm-settings--page .embm-settings--status .embm-untappd--user-link, 156 .embm-settings--page .embm-settings--status .embm-utfb--account-link { 156 157 text-decoration: none; 157 158 } 158 .embm-settings--page .embm-settings--status .embm-untappd--user-link .dashicons::before { 159 .embm-settings--page .embm-settings--status .embm-untappd--user-link .dashicons::before, 160 .embm-settings--page .embm-settings--status .embm-utfb--account-link .dashicons::before { 159 161 font-size: 18px; 160 162 } 161 .embm-settings--page .embm-settings--status .embm-untappd--deauthorize { 163 .embm-settings--page .embm-settings--status .embm-untappd--deauthorize, 164 .embm-settings--page .embm-settings--status .embm-utfb--disconnect { 162 165 margin-left: 4px; 163 166 } … … 171 174 padding: 3px 5px 2px; 172 175 } 173 .embm-settings--page . embm-settings--tab-labs .dashicons-warning {176 .embm-settings--page .dashicons-warning { 174 177 color: #FFB900; 175 178 cursor: help; … … 234 237 235 238 /** 236 * Style EM Beer Manager labs page 237 */ 238 .embm-settings--tab-labs .warning { 239 * Style EM Beer Manager settings tabs 240 */ 241 .embm-settings--page .embm-nav-tab > span { 242 bottom: 2px; 243 color: #888; 244 display: inline-block; 245 font-size: 10px; 246 font-weight: normal; 247 line-height: 14px; 248 position: relative; 249 } 250 .embm-settings--tab .warning, 251 .embm-metabox--untappd .warning { 239 252 color: red; 240 253 font-weight: bold; 241 254 } 242 .embm-settings--tab -labs.emphasis {255 .embm-settings--tab .emphasis { 243 256 font-weight: 600; 244 257 text-transform: uppercase; 245 258 } 246 .embm-settings--tab -labs.labs-section {259 .embm-settings--tab .labs-section { 247 260 color: #23282d; 248 261 font-size: 14px; 249 262 font-weight: 600; 250 263 } 251 .embm-settings--tab -labs.embm-labs--import-select {264 .embm-settings--tab .embm-labs--import-select { 252 265 margin-right: 10px; 266 } 267 268 269 /** 270 * Style UTFB tab 271 */ 272 #embm-labs-utfb .embm-utfb-section--import-all { 273 padding-top: 15px; 253 274 } 254 275 … … 318 339 } 319 340 .embm-metabox--untappd-checkboxes, 320 .embm-metabox--untappd- flush{341 .embm-metabox--untappd-actions { 321 342 float: left; 322 343 } … … 325 346 width: 40%; 326 347 } 327 .embm-metabox--untappd- flush{348 .embm-metabox--untappd-actions { 328 349 max-width: calc(60% - 40px); 329 350 } 330 .embm-metabox--untappd- flush.dashicons {351 .embm-metabox--untappd-actions .dashicons { 331 352 line-height: 26px; 332 353 color: #FFB900; … … 335 356 @media only screen and (max-width: 960px) { 336 357 .embm-metabox--untappd .embm-metabox--untappd-checkboxes, 337 .embm-metabox--untappd .embm-metabox--untappd- flush{358 .embm-metabox--untappd .embm-metabox--untappd-actions { 338 359 float: none; 339 360 width: 100% !important; 340 361 } 341 362 } 342 363 .embm-metabox--utfb ul { 364 list-style-type: none; 365 margin: 0; 366 padding: 0; 367 } 368 .embm-metabox--utfb ul > li { 369 display: inline-block; 370 } 371 .embm-metabox--utfb ul > li:not(:last-child)::after { 372 content: '/'; 373 } 343 374 344 375 /** -
em-beer-manager/trunk/assets/css/output.css
r1584363 r1674966 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2017, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or … … 57 57 text-decoration: none; 58 58 } 59 .embm-beer .embm-beer--image > .wp-post-image { 59 .embm-beer .embm-beer--image a { 60 border: 0; 61 box-shadow: none; 62 text-decoration: none; 63 } 64 .embm-beer .embm-beer--image .wp-post-image { 60 65 display: block; 61 66 float: left; … … 63 68 width: 150px; 64 69 } 65 .embm-beer .embm-beer--image >img {70 .embm-beer .embm-beer--image img { 66 71 height: auto; 67 72 width: 150px; -
em-beer-manager/trunk/assets/css/widgets.css
r1584363 r1674966 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2017, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/assets/js/admin.js
r1584363 r1674966 1 1 /** 2 * Copyright (c) 2013-201 6, Erin Morelli.2 * Copyright (c) 2013-2017, Erin Morelli. 3 3 * 4 4 * This program is free software; you can redistribute it and/or … … 42 42 }, 43 43 ajax_response = function (response) { 44 if ( typeof response === 'object' && response.hasOwnProperty('redirect')) {44 if (response && typeof response === 'object' && response.hasOwnProperty('redirect')) { 45 45 window.location = response.redirect; 46 46 } else { … … 48 48 } 49 49 }, 50 ajax_error = function (spinner) {50 ajax_error = function (spinner) { 51 51 spinner.removeClass(); 52 52 spinner.addClass('dashicons dashicons-warning'); … … 56 56 untappd_check = $('#embm_untappd_check'), 57 57 nav_hidden = (localStorage.embm_hide_settings_nav === 'true'), 58 utfb_sections = $('tr.embm-utfb-section'), 58 59 hash, 59 60 page, … … 62 63 // Detect Internet Explorer 63 64 function isInternetExplorer() { 64 var ua = window.navigator.userAgent ;65 varmsie = ua.indexOf('MSIE ');65 var ua = window.navigator.userAgent, 66 msie = ua.indexOf('MSIE '); 66 67 return (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./i)); 67 68 } … … 332 333 ); 333 334 } 334 }) 335 .fail(function() { 335 }).fail(function () { 336 ajax_error(spinner); 337 }); 338 }); 339 340 // Handle beer sync requests 341 $('.embm-metabox--untappd-sync a').on('click', function (e) { 342 e.preventDefault(); 343 344 // Check for user confirmation 345 if (!window.confirm(embm_settings.sync_confirm_single)) { 346 return; 347 } 348 349 // Get API root 350 var api_root = $(this).data('api-root'); 351 352 // Start spinner 353 spinner.insertAfter($(this)); 354 355 // Set AJAX params 356 ajax_params.action = 'embm-untappd-sync'; 357 ajax_params.sync_type = 1; 358 ajax_params.post_id = url_params.post; 359 ajax_params.api_root = api_root; 360 361 // Make AJAX request 362 $.post(ajaxurl, ajax_params, function (response) { 363 spinner.remove(); 364 365 // Show error for bad response 366 if (typeof response === 'string') { 367 $(e.target).parent().append( 368 '<span class="dashicons dashicons-warning" title="' + response + '"></span>' 369 ); 370 } else { 371 // Reload page 372 location.reload(); 373 } 374 }).fail(function () { 336 375 ajax_error(spinner); 337 376 }); … … 366 405 widget.append(error); 367 406 } 368 }) 369 .fail(function() { 370 ajax_error(spinner); 371 }); 372 }); 373 374 /* ---- LABS ---- */ 407 }).fail(function () { 408 ajax_error(spinner); 409 }); 410 }); 411 412 /* ---- LABS / UNTAPPD ---- */ 375 413 376 414 // Redirect to flush Untappd cache … … 388 426 spinner.remove(); 389 427 ajax_response(response); 390 }) 391 .fail(function() { 428 }).fail(function () { 392 429 ajax_error(spinner); 393 430 }); … … 417 454 spinner.remove(); 418 455 ajax_response(response); 419 }) 420 .fail(function() { 456 }).fail(function () { 457 ajax_error(spinner); 458 }); 459 }); 460 461 // Handle sync requests 462 $('a.embm-untappd--sync').on('click', function (e) { 463 e.preventDefault(); 464 465 // Check for user confirmation 466 if (!window.confirm(embm_settings.sync_confirm_plural)) { 467 return; 468 } 469 470 var api_root = $('#embm-untappd-api-root').val(); 471 472 // Start spinner 473 spinner.insertAfter($(this)); 474 475 // Set AJAX params 476 ajax_params.action = 'embm-untappd-sync'; 477 ajax_params.sync_type = 2; 478 ajax_params.api_root = api_root; 479 480 // Make AJAX request & reload page 481 $.post(ajaxurl, ajax_params, function (response) { 482 spinner.remove(); 483 ajax_response(response); 484 }).fail(function () { 485 ajax_error(spinner); 486 }); 487 }); 488 489 /* ---- LABS / UTFB ---- */ 490 491 // Connect a UTFB account 492 $('a.embm-utfb--connect').on('click', function (e) { 493 e.preventDefault(); 494 495 // Start spinner 496 spinner.insertAfter($(this)); 497 498 ajax_params.action = 'embm-utfb-connect'; 499 ajax_params.api_key = $('#embm-utfb--apikey').val(); 500 ajax_params.email = $('#embm-utfb--email').val(); 501 502 // Make AJAX request & reload page 503 $.post(ajaxurl, ajax_params, function (response) { 504 spinner.remove(); 505 ajax_response(response); 506 }).fail(function () { 507 ajax_error(spinner); 508 }); 509 }); 510 511 // Disconnect a UTFB account 512 $('a.embm-utfb--disconnect').on('click', function (e) { 513 e.preventDefault(); 514 ajax_params.action = 'embm-utfb-disconnect'; 515 $.post(ajaxurl, ajax_params, ajax_response); 516 }); 517 518 // Toggle enable/disable section items 519 function toggle_utfb_section(section, disable) { 520 var section_select = section.find('select.embm-utfb--dropdown'), 521 section_buttons = section.find('button.button'); 522 523 // Enable items 524 [section_select, section_buttons].forEach(function (item) { 525 item.prop('disabled', disable); 526 item.prop('title', disable ? embm_settings.utfb_section_notice : null); 527 item.css('cursor', disable ? 'not-allowed' : 'pointer'); 528 }); 529 530 // Reset selects 531 if (disable) { 532 section_select.val(''); 533 } 534 } 535 536 // Load next utfb import dropdown 537 function load_utfb_dropdown(dropdown) { 538 var resource = $(dropdown).data('action'), 539 resource_id = $(dropdown).val(); 540 541 // Bail if no resource 542 if (!resource) { 543 return false; 544 } 545 546 // Reset all child sections 547 $(dropdown) 548 .closest('.embm-utfb-section') 549 .nextAll('.embm-utfb-section') 550 .each(function (idx, child_section) { 551 toggle_utfb_section($(child_section), true); 552 }); 553 554 // Check for resource ID 555 if (!resource_id) { 556 return false; 557 } 558 559 ajax_params.action = 'embm-utfb-dropdown'; 560 ajax_params.resource = resource; 561 ajax_params.resource_id = resource_id; 562 563 // Make AJAX request & reload page 564 $.post(ajaxurl, ajax_params, function (response) { 565 if (response.error) { 566 return; 567 } 568 569 // Find objects for resource 570 var select = $('#embm-utfb-' + resource + '-id'); 571 572 // Remove existing options 573 select.children('option').each(function (idx, option) { 574 if (idx) { 575 $(option).remove(); 576 } 577 }); 578 579 // Populate menus select 580 response.items.forEach(function (item) { 581 select.append('<option value=' + item.id + '>' + item.name + '</option>'); 582 }); 583 584 // Enable items 585 toggle_utfb_section($('tr.embm-utfb-section--' + resource), false); 586 }); 587 } 588 589 // Handle select dropdown changes 590 $('select.embm-utfb--dropdown').on('change', function (e) { 591 e.preventDefault(); 592 load_utfb_dropdown(this); 593 594 // If this is the location dropdown, update the sync button 595 if (this.id === 'embm-utfb-location-id') { 596 var location = $(this), 597 sync_button = $('button.embm-utfb--sync'); 598 599 sync_button.prop('disabled', !location.val() ? true : false); 600 sync_button.css('cursor', !location.val() ? 'not-allowed' : 'pointer'); 601 } 602 }); 603 604 // Check for value on page load 605 utfb_sections.each(function (idx, section) { 606 var select = $(section).find('select.embm-utfb--dropdown'), 607 sync_button = $('button.embm-utfb--sync'); 608 609 // Disable sync button if no location selected 610 if (!idx && !select.val()) { 611 sync_button.prop('disabled', true); 612 sync_button.css('cursor', 'not-allowed'); 613 } 614 615 if (select.val() || !idx) { 616 // Load the dropdown 617 load_utfb_dropdown(select); 618 } else { 619 // Disable items 620 toggle_utfb_section($(section), true); 621 } 622 }); 623 624 // Import UTFB objects 625 $('.embm-utfb--import').on('click', function (e) { 626 e.preventDefault(); 627 628 // Get import data 629 var resources = {}, 630 resource = $(this).data('resource'), 631 resource_types = embm_settings.utfb_resources, 632 import_all = $(this).parent().hasClass('embm-utfb-section--import-all'); 633 634 // Start spinner 635 spinner.insertAfter($(this)); 636 637 // Get resource IDs 638 resource_types.forEach(function (resource_type) { 639 resources[resource_type] = $('#embm-utfb-' + resource_type + '-id').val(); 640 }); 641 642 // Set up ajax action 643 ajax_params.action = 'embm-utfb-import'; 644 ajax_params.resource = resource; 645 ajax_params.resources = resources; 646 ajax_params.import_all = import_all; 647 648 // Make AJAX request & reload page 649 $.post(ajaxurl, ajax_params, function (response) { 650 spinner.remove(); 651 ajax_response(response); 652 }).fail(function () { 653 ajax_error(spinner); 654 }); 655 }); 656 657 // Sync UTFB objects 658 $('button.embm-utfb--sync').on('click', function (e) { 659 e.preventDefault(); 660 661 // Check for user confirmation 662 if (!window.confirm(embm_settings.sync_confirm_utfb)) { 663 return; 664 } 665 666 // Get import data 667 var resources = {}, 668 resource_types = ['location', 'menu', 'section', 'beer']; 669 670 // Start spinner 671 spinner.insertAfter($(this)); 672 673 // Get resource IDs 674 resource_types.forEach(function (resource_type) { 675 resources[resource_type] = $('#embm-utfb-' + resource_type + '-id').val(); 676 }); 677 678 // Set up ajax action 679 ajax_params.action = 'embm-utfb-sync'; 680 ajax_params.resource = 'menu'; 681 ajax_params.resources = resources; 682 ajax_params.import_all = true; 683 684 // Make AJAX request & reload page 685 $.post(ajaxurl, ajax_params, function (response) { 686 spinner.remove(); 687 ajax_response(response); 688 }).fail(function () { 689 ajax_error(spinner); 690 }); 691 }); 692 693 // Redirect to flush UTFB cache 694 $('a.embm-utfb--flush').on('click', function (e) { 695 e.preventDefault(); 696 697 // Start spinner 698 spinner.insertAfter($(this)); 699 700 // Set AJAX params 701 ajax_params.action = 'embm-utfb-flush'; 702 703 // Make AJAX request & reload page 704 $.post(ajaxurl, ajax_params, function (response) { 705 spinner.remove(); 706 ajax_response(response); 707 }).fail(function () { 421 708 ajax_error(spinner); 422 709 }); -
em-beer-manager/trunk/em-beer-manager.php
r1647727 r1674966 3 3 * Plugin Name: EM Beer Manager 4 4 * Plugin URI: https://www.erinmorelli.com/projects/em-beer-manager 5 * Description: Catalog and display your beers with WordPress. Integrates very simply with Untappd for individual beer check-ins. Great for everyone from home brewers to professional breweries!6 * Version: 3. 0.55 * Description: Manage and display your beers with WordPress. Integrates simply with Untappd and Untappd for Business. Great for everyone from home brewers to professional breweries! 6 * Version: 3.1.0 7 7 * Author: Erin Morelli 8 8 * Author URI: https://www.erinmorelli.com/ … … 14 14 15 15 /** 16 * Copyright (c) 2013-201 6, Erin Morelli.16 * Copyright (c) 2013-2017, Erin Morelli. 17 17 * 18 18 * This program is free software; you can redistribute it and/or … … 49 49 { 50 50 // Set current version 51 $embm_curr_version = '3. 0.5';51 $embm_curr_version = '3.1.0'; 52 52 53 53 // Define version key name -
em-beer-manager/trunk/includes/admin/embm-admin-actions.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 147 147 148 148 // Flush the transient cache 149 EMBM_Admin_Untappd_flush( );149 EMBM_Admin_Untappd_flush(EMBM_UNTAPPD_CACHE); 150 150 151 151 // Send response … … 235 235 // Set up response 236 236 $response = array( 237 'redirect' => get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' success', 2, 'labs'))237 'redirect' => get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'success', 2, 'untappd')) 238 238 ); 239 239 … … 243 243 // Check for error 244 244 if (!is_object($brewery)) { 245 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 1, 'labs'));245 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 246 246 wp_send_json($response); 247 247 return; … … 253 253 // Check for error 254 254 if (!is_array($beer_list)) { 255 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 1, 'labs'));255 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 256 256 wp_send_json($response); 257 257 return; … … 287 287 // Check for error 288 288 if (!is_object($beer)) { 289 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 1, 'labs'));289 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 290 290 break; 291 291 } … … 302 302 // Check for errors 303 303 if ($has_errors) { 304 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 5, 'labs'));304 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 5, 'untappd')); 305 305 } 306 306 break; … … 327 327 // Check for error 328 328 if (!is_object($beer)) { 329 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 1, 'labs'));329 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 330 330 break; 331 331 } … … 338 338 $response['redirect'] = $res; 339 339 } else { 340 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' success', 1, 'labs'));340 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'success', 1, 'untappd')); 341 341 } 342 342 break; … … 360 360 // Check for error 361 361 if (!is_object($beer)) { 362 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 1, 'labs'));362 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 363 363 break; 364 364 } … … 375 375 // Check for errors 376 376 if ($has_errors) { 377 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 5, 'labs'));377 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 5, 'untappd')); 378 378 } 379 379 break; … … 382 382 default: 383 383 // Setup return URL 384 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, ' error', 4, 'labs'));384 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 4, 'untappd')); 385 385 } 386 386 … … 391 391 // Add flush beer action to AJAX 392 392 add_action('wp_ajax_embm-untappd-import', 'EMBM_Admin_Actions_Untappd_import'); 393 394 /** 395 * Sync beer data from Untappd to WP 396 * 397 * @return void 398 */ 399 function EMBM_Admin_Actions_Untappd_sync() 400 { 401 // Check AJAX referrer 402 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 403 404 // Get sync vars 405 $sync_type = intval($_POST['sync_type']); 406 $api_root = $_POST['api_root']; 407 408 // Set up response 409 $response = array( 410 'redirect' => get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'sync', 'success', 1, 'untappd')) 411 ); 412 413 // Handle sync types 414 switch ($sync_type) { 415 416 // Sync specific beer 417 case 1: 418 // Get post id 419 $post_id = $_POST['post_id']; 420 421 // Make sure we have an ID 422 if (!$post_id) { 423 wp_die(); 424 } 425 426 // Get post from ID 427 $post = get_post($post_id); 428 429 // Get beer from API 430 $beer = EMBM_Admin_Untappd_Beer_get($api_root, $post->embm_untappd); 431 432 // Check for error 433 if (!is_object($beer)) { 434 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 435 break; 436 } 437 438 // Run import with brewery check 439 $res = EMBM_Admin_Untappd_sync($post->ID, $beer); 440 441 // Check response 442 if (!is_null($res)) { 443 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'sync', 'error', 1, 'untappd')); 444 } else { 445 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'sync', 'success', 2, 'untappd')); 446 } 447 break; 448 449 // Sync all beers 450 case 2: 451 // Set error tracker 452 $has_errors = false; 453 454 // Get all the Untappd beers in the database 455 $beer_list = get_posts( 456 array( 457 'post_type' => 'embm_beer', 458 'numberposts' => -1 459 ) 460 ); 461 462 // Iteratively add beers 463 foreach ($beer_list as $item) { 464 // Check for Untappd ID 465 if ($item->embm_untappd == '') { 466 continue; 467 } 468 469 // Get beer from API 470 $beer = EMBM_Admin_Untappd_Beer_get($api_root, $item->embm_untappd); 471 472 // Check for error 473 if (!is_object($beer)) { 474 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'import', 'error', 1, 'untappd')); 475 break; 476 } 477 478 // Run import 479 $res = EMBM_Admin_Untappd_sync($item->ID, $beer); 480 481 // Check response 482 if (!is_null($res)) { 483 $has_errors = true; 484 } 485 } 486 487 // Check for errors 488 if ($has_errors) { 489 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'sync', 'error', 2, 'untappd')); 490 } 491 break; 492 493 // Fallback 494 default: 495 // Setup return URL 496 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UNTAPPD_RETURN_URL, 'sync', 'error', 1, 'untappd')); 497 } 498 499 // Send response 500 wp_send_json($response); 501 } 502 503 // Add flush beer action to AJAX 504 add_action('wp_ajax_embm-untappd-sync', 'EMBM_Admin_Actions_Untappd_sync'); 505 506 /** 507 * Connect to a UTFB account 508 * 509 * @return void 510 */ 511 function EMBM_Admin_Actions_Utfb_connect() 512 { 513 // Check AJAX referrer 514 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 515 516 // Get POST data 517 $credentials = array( 518 'apikey' => $_POST['api_key'], 519 'email' => $_POST['email'] 520 ); 521 522 // Test for validity 523 $is_valid = EMBM_Admin_Utfb_validate($credentials); 524 525 // Respond to validity 526 if ($is_valid) { 527 // Store credentials 528 update_option('embm_utfb_credentials', $credentials); 529 530 // Set up redirect URL 531 $redirect_url = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'success', 1, 'utfb')); 532 } else { 533 // Set up redirect URL 534 $redirect_url = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'error', 1, 'utfb')); 535 } 536 537 // Set up response 538 $response = array( 539 'redirect' => $redirect_url 540 ); 541 542 // Send response 543 wp_send_json($response); 544 } 545 546 // Add UTFB connect action to AJAX 547 add_action('wp_ajax_embm-utfb-connect', 'EMBM_Admin_Actions_Utfb_connect'); 548 549 /** 550 * Disconnect to a UTFB account 551 * 552 * @return void 553 */ 554 function EMBM_Admin_Actions_Utfb_disconnect() 555 { 556 // Check AJAX referrer 557 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 558 559 // Remove connected account information 560 delete_option('embm_utfb_credentials'); 561 562 // Flush caches 563 EMBM_Admin_Untappd_flush(EMBM_UTFB_CACHE); 564 565 // Send response 566 wp_die(); 567 } 568 569 // Add UTFB connect action to AJAX 570 add_action('wp_ajax_embm-utfb-disconnect', 'EMBM_Admin_Actions_Utfb_disconnect'); 571 572 /** 573 * Get UTFB menus for a locations 574 * 575 * @return void 576 */ 577 function EMBM_Admin_Actions_Utfb_dropdown() 578 { 579 // Check AJAX referrer 580 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 581 582 // Get POST data 583 $resource = $_POST['resource']; 584 $resource_id = $_POST['resource_id']; 585 586 // Get credentials 587 $auth = get_option('embm_utfb_credentials'); 588 589 // Get resource map 590 $resource_map = $GLOBALS['EMBM_UTFB_RESOURCE_MAP']; 591 592 // Return error if resource does not exist 593 if (!array_key_exists($resource, $resource_map)) { 594 wp_send_json_error(); 595 return; 596 } 597 598 // Get correct resource function from map 599 $resource_func = $resource_map[$resource]['plural']; 600 601 // Get items from resource 602 $items = $resource_func($auth, $resource_id); 603 604 // Check response 605 if (is_null($items)) { 606 wp_send_json_error(); 607 return; 608 } 609 610 // Set up response 611 $response = array( 612 'items' => $items 613 ); 614 615 // Send response 616 wp_send_json($response); 617 } 618 619 // Add UTFB menus action to AJAX 620 add_action('wp_ajax_embm-utfb-dropdown', 'EMBM_Admin_Actions_Utfb_dropdown'); 621 622 /** 623 * Import objects from UTFB 624 * 625 * @return void 626 */ 627 function EMBM_Admin_Actions_Utfb_import() 628 { 629 // Check AJAX referrer 630 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 631 632 // Get POST data 633 $resource = $_POST['resource']; 634 $resources = $_POST['resources']; 635 $import_all = ($_POST['import_all'] == 'true') ? true : false; 636 637 // Get credentials 638 $auth = get_option('embm_utfb_credentials'); 639 640 // Get UTFB objects to import 641 $objects = EMBM_Admin_Utfb_resources($auth, $resources, $resource, $import_all); 642 643 // Run import 644 $error_code = EMBM_Admin_Utfb_import($objects); 645 646 // Check response 647 if ($error_code !== 0) { 648 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'error', $error_code, 'utfb')); 649 } else { 650 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'success', 2, 'utfb')); 651 } 652 653 // Send response 654 wp_send_json($response); 655 } 656 657 // Add UTFB import action to AJAX 658 add_action('wp_ajax_embm-utfb-import', 'EMBM_Admin_Actions_Utfb_import'); 659 660 /** 661 * Flush the UTFB cache 662 * 663 * @return void 664 */ 665 function EMBM_Admin_Actions_Utfb_flush() 666 { 667 // Check AJAX referrer 668 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 669 670 // Flush the UTFB cache 671 EMBM_Admin_Untappd_flush(EMBM_UTFB_CACHE); 672 673 // Send response 674 wp_die(); 675 } 676 677 // Add flush beer action to AJAX 678 add_action('wp_ajax_embm-utfb-flush', 'EMBM_Admin_Actions_Utfb_flush'); 679 680 /** 681 * Sync data from UTFB with existing beers 682 * 683 * @return void 684 */ 685 function EMBM_Admin_Actions_Utfb_sync() 686 { 687 // Check AJAX referrer 688 check_ajax_referer(EMBM_AJAX_NONCE, '_nonce'); 689 690 // Get POST data 691 $resource = $_POST['resource']; 692 $resources = $_POST['resources']; 693 $import_all = ($_POST['import_all'] == 'true') ? true : false; 694 695 // Get credentials 696 $auth = get_option('embm_utfb_credentials'); 697 698 // Get UTFB objects to import 699 $objects = EMBM_Admin_Utfb_resources($auth, $resources, $resource, $import_all); 700 701 // Run sync 702 $error_code = EMBM_Admin_Utfb_sync($objects); 703 704 // Check response 705 if ($error_code !== 0) { 706 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'error', $error_code, 'utfb')); 707 } else { 708 $response['redirect'] = get_admin_url(null, sprintf(EMBM_UTFB_RETURN_URL, 'success', 3, 'utfb')); 709 } 710 711 // Send response 712 wp_send_json($response); 713 } 714 715 // Add flush beer action to AJAX 716 add_action('wp_ajax_embm-utfb-sync', 'EMBM_Admin_Actions_Utfb_sync'); -
em-beer-manager/trunk/includes/admin/embm-admin-footer.php
r1647727 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 37 37 target="_blank" 38 38 > 39 <img src=" https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" alt="<?php _e('Donate', 'embm'); ?>" border="0" />39 <img src="<?php echo EMBM_PLUGIN_URL; ?>assets/img/donate.png" alt="<?php _e('Donate', 'embm'); ?>" border="0" /> 40 40 </a> 41 41 </p> -
em-beer-manager/trunk/includes/admin/embm-admin-notices.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 20 20 */ 21 21 22 $SUCCESS_TITLE = __('Success!', 'embm'); 23 $ERROR_TITLE = __('ERROR', 'embm') . ':'; 24 $WARNING_TITLE = __('WARNING', 'embm') . ':'; 25 22 26 // Map of notices 23 27 $GLOBALS['EMBM_NOTICE_MAP'] = array( … … 25 29 '1' => array( 26 30 'type' => 'updated', 27 'title' => __('Success!', 'embm'),31 'title' => $SUCCESS_TITLE, 28 32 'message' => __('Your beer styles have been restored.', 'embm') 29 33 ) … … 32 36 '1' => array( 33 37 'type' => 'updated', 34 'title' => __('Success!', 'embm'),38 'title' => $SUCCESS_TITLE, 35 39 'message' => __('Your beer has been imported from Untappd.', 'embm') 36 40 ), 37 41 '2' => array( 38 42 'type' => 'updated', 39 'title' => __('Success!', 'embm'),43 'title' => $SUCCESS_TITLE, 40 44 'message' => __('Your beers have been imported from Untappd.', 'embm') 41 45 ) … … 44 48 '1' => array( 45 49 'type' => 'error', 46 'title' => __('ERROR', 'embm') . ':',50 'title' => $ERROR_TITLE, 47 51 'message' => __('There was a problem! You may have reached your API token\'s rate limit for the hour. Please try again later.', 'embm') 48 52 ), 49 53 '2' => array( 50 54 'type' => 'error', 51 'title' => __('ERROR', 'embm') . ':',55 'title' => $ERROR_TITLE, 52 56 'message' => __('There was a problem during the import! The beer you specified was not found on Untappd.', 'embm') 53 57 ), 54 58 '3' => array( 55 59 'type' => 'error', 56 'title' => __('ERROR', 'embm') . ':',60 'title' => $ERROR_TITLE, 57 61 'message' => __('This beer does not belong to your brewery! You can only import beers that are owned by your Untappd brewery account.', 'embm') 58 62 ), 59 63 '4' => array( 60 64 'type' => 'error', 61 'title' => __('ERROR', 'embm') . ':',65 'title' => $ERROR_TITLE, 62 66 'message' => __('There was a problem during the import! Please try again later.', 'embm') 63 67 ), 64 68 '5' => array( 65 69 'type' => 'warning', 66 'title' => __('WARNING', 'embm') . ':',70 'title' => $WARNING_TITLE, 67 71 'message' => __('There was a problem during the import! One or more beers was not imported. Please try again later.', 'embm') 68 72 ) 69 73 ), 74 'sync-success' => array( 75 '1' => array( 76 'type' => 'updated', 77 'title' => $SUCCESS_TITLE, 78 'message' => __('Your beers have been updated from Untappd.', 'embm') 79 ), 80 '2' => array( 81 'type' => 'updated', 82 'title' => $SUCCESS_TITLE, 83 'message' => __('Your beer has been updated from Untappd.', 'embm') 84 ) 85 ), 86 'sync-error' => array( 87 '1' => array( 88 'type' => 'error', 89 'title' => $ERROR_TITLE, 90 'message' => __('There was a problem during the sync! Please try again later.', 'embm') 91 ), 92 '2' => array( 93 'type' => 'warning', 94 'title' => $WARNING_TITLE, 95 'message' => __('There was a problem during the sync! One or more beers were not updated. Please try again later.', 'embm') 96 ) 97 ), 70 98 'save-error' => array( 71 99 '1' => array( 72 100 'type' => 'error', 73 'title' => __('ERROR', 'embm') . ':',101 'title' => $ERROR_TITLE, 74 102 'message' => __('There was a problem saving your beer\'s Untappd data!', 'embm').' '. 75 103 __('You may have reached your API token\'s rate limit for the hour. Please try again later.', 'embm') … … 79 107 '1' => array( 80 108 'type' => 'error', 81 'title' => __('ERROR', 'embm') . ':',109 'title' => $ERROR_TITLE, 82 110 'message' => __('There was a problem retrieving check-in data from Untappd!', 'embm').' '. 83 111 __('Please try again later.', 'embm') … … 85 113 '2' => array( 86 114 'type' => 'error', 87 'title' => __('ERROR', 'embm') . ':',115 'title' => $ERROR_TITLE, 88 116 'message' => __('There was a problem refreshing check-in data from Untappd!', 'embm').' '. 89 117 __('Please try again later.', 'embm') 118 ) 119 ), 120 'utfb-error' => array( 121 '1' => array( 122 'type' => 'error', 123 'title' => $ERROR_TITLE, 124 'message' => __('There was a problem connecting your Untappd for Business account! Please try again later.', 'embm') 125 ), 126 '2' => array( 127 'type' => 'error', 128 'title' => $ERROR_TITLE, 129 'message' => __('There was a problem during the import! Please try again later.', 'embm') 130 ), 131 '3' => array( 132 'type' => 'warning', 133 'title' => $WARNING_TITLE, 134 'message' => __('There was a problem during the import! One or more beers were not imported. Please try again later.', 'embm') 135 ), 136 '4' => array( 137 'type' => 'warning', 138 'title' => $WARNING_TITLE, 139 'message' => __('There was a problem during the sync! One or more beers were not updated. Please try again later.', 'embm') 140 ) 141 ), 142 'utfb-success' => array( 143 '1' => array( 144 'type' => 'updated', 145 'title' => $SUCCESS_TITLE, 146 'message' => __('Your Untappd for Business account has been connected.', 'embm') 147 ), 148 '2' => array( 149 'type' => 'updated', 150 'title' => $SUCCESS_TITLE, 151 'message' => __('Your beers have been imported from your Untappd for Business account.', 'embm') 152 ), 153 '3' => array( 154 'type' => 'updated', 155 'title' => $SUCCESS_TITLE, 156 'message' => __('Your beers have been synced with your Untappd for Business menus.', 'embm') 90 157 ) 91 158 ) -
em-beer-manager/trunk/includes/admin/embm-admin-settings.php
r1586946 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 22 22 // Import additional admin functions 23 23 require EMBM_PLUGIN_DIR.'includes/admin/embm-admin-notices.php'; 24 require EMBM_PLUGIN_DIR.'includes/admin/ embm-admin-authorize.php';24 require EMBM_PLUGIN_DIR.'includes/admin/integrations/embm-integrations-authorize.php'; 25 25 26 26 // Set global admin page object … … 596 596 function EMBM_Admin_Settings_page() 597 597 { 598 // Get tabs data 599 $tabs = array( 600 array( 601 'id' => 'untappd', 602 'name' => sprintf('%s <span>%s</span>', __('Untappd Import', 'embm'), __('Labs', 'embm')), 603 'hide' => EMBM_Core_Beer_disabled() 604 ), 605 array( 606 'id' => 'utfb', 607 'name' => sprintf('%s <span>%s</span>', __('Untappd for Business Import', 'embm'), __('Labs', 'embm')), 608 'hide' => EMBM_Core_Beer_disabled() 609 ), 610 array( 611 'id' => 'usage', 612 'name' => __('Usage', 'embm'), 613 'hide' => false 614 ) 615 ); 616 598 617 // Get settings page sections 599 618 global $wp_settings_sections; … … 618 637 <div id="embm-settings--tabs" class="embm-settings--tabs-wrapper"> 619 638 <ul class="nav-tab-wrapper"> 620 <li><a href="#settings" class="embm-nav-tab nav-tab nav-tab-active nav-tab-settings"><?php _e('Settings', 'embm'); ?></a></li> 621 <li><a href="#labs" class="embm-nav-tab nav-tab nav-tab-labs"><?php _e('Labs', 'embm'); ?></a></li> 622 <li><a href="#usage" class="embm-nav-tab nav-tab nav-tab-usage"><?php _e('Usage', 'embm'); ?></a></li> 639 <li> 640 <a href="#settings" class="embm-nav-tab nav-tab nav-tab-active nav-tab-settings"> 641 <?php _e('Settings', 'embm'); ?> 642 </a> 643 </li> 644 <?php foreach ($tabs as $tab) : ?> 645 <?php if (!$tab['hide']) : ?> 646 <li> 647 <a href="#<?php echo $tab['id']; ?>" class="embm-nav-tab nav-tab nav-tab-<?php echo $tab['id']; ?>"> 648 <?php echo $tab['name']; ?> 649 </a> 650 </li> 651 <?php endif; ?> 652 <?php endforeach; ?> 623 653 </ul> 624 654 … … 649 679 </div> 650 680 651 < div id="labs" class="embm-settings--tab-labs">652 <?php i nclude_once EMBM_PLUGIN_DIR.'includes/admin/tabs/embm-tabs-labs.php';?>653 </div>654 655 <div id="usage" class="embm-settings--tab-usage">656 <?php include_once EMBM_PLUGIN_DIR.'includes/admin/tabs/embm-tabs-usage.php'; ?>657 < /div>681 <?php foreach ($tabs as $tab) : ?> 682 <?php if (!$tab['hide']) : ?> 683 <div id="<?php echo $tab['id']; ?>" class="embm-settings--tab embm-settings--tab-<?php echo $tab['id']; ?>"> 684 <?php include_once EMBM_PLUGIN_DIR.'includes/admin/tabs/embm-tabs-'.$tab['id'].'.php'; ?> 685 </div> 686 <?php endif; ?> 687 <?php endforeach; ?> 658 688 </div> 659 689 -
em-beer-manager/trunk/includes/admin/tabs/embm-tabs-labs.php
r1586946 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 37 37 38 38 <hr /> 39 40 <?php41 42 // Load Untappd labs page43 if (!EMBM_Core_Beer_disabled()) {44 echo '<h2>'.__('Import from Untappd', 'embm').'</h2>';45 include_once EMBM_PLUGIN_DIR.'includes/admin/labs/embm-labs-untappd.php';46 } else {47 echo '<h2>'.__('No Labs features are available right now!', 'embm').'</h2>';48 } -
em-beer-manager/trunk/includes/admin/tabs/embm-tabs-usage.php
r1584318 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/embm-admin.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 21 21 22 22 // Include additional Admin functions 23 require EMBM_PLUGIN_DIR.'includes/admin/embm-admin-untappd.php'; 23 require EMBM_PLUGIN_DIR.'includes/admin/integrations/embm-integrations-untappd.php'; 24 require EMBM_PLUGIN_DIR.'includes/admin/integrations/embm-integrations-utfb.php'; 24 25 require EMBM_PLUGIN_DIR.'includes/admin/embm-admin-actions.php'; 25 26 require EMBM_PLUGIN_DIR.'includes/admin/embm-admin-settings.php'; … … 54 55 $ajax_nonce = wp_create_nonce(EMBM_AJAX_NONCE); 55 56 57 // Set sync confirmation text 58 $confirm = __('Are you sure you want to continue?', 'embm'); 59 $sconfirm = __('WARNING: This will override any changes you have made to %s. %s', 'embm'); 60 $uconfirm = __('WARNING: This will override any custom menu associations you have made. %s', 'embm'); 61 56 62 // Share EMBM settings with admin script 57 63 wp_localize_script( … … 62 68 'plugin_url' => EMBM_PLUGIN_URL, 63 69 'options' => get_option('embm_options'), 64 'error' => __('There was a problem with your request! Please try again later.', 'embm') 70 'error' => __('There was a problem with your request! Please try again later.', 'embm'), 71 'utfb_resources' => array_keys($GLOBALS['EMBM_UTFB_RESOURCE_MAP']), 72 'utfb_section_notice' => __('Select an option from the dropdown in the section above to enable.', 'embm'), 73 'sync_confirm_plural' => sprintf($sconfirm, __('your imported beers', 'embm'), $confirm), 74 'sync_confirm_single' => sprintf($sconfirm, __('this beer', 'embm'), $confirm), 75 'sync_confirm_utfb' => sprintf($uconfirm, $confirm) 65 76 ) 66 77 ); … … 277 288 $screen->add_help_tab($default_help['untappd_id']); 278 289 $screen->add_help_tab($default_help['untappd_limit']); 290 291 // Untappd for Business help tab 292 $screen->add_help_tab( 293 array( 294 'id' => 'embm-utfb-integration', 295 'title' => __('Untappd for Business Integration', 'embm'), 296 'content' => '<p><strong>'. 297 __('Why is an Untappd account required in addition to an UTFB account?', 'embm'). 298 '</strong></p><p>'. 299 __('Untappd for Business (UTFB) account credentials do not work with Untappd\'s API. In order to link Untappd data to beers imported from UTFB, Untappd API access is also needed.', 'embm'). 300 '</p><p>'. 301 __('An Untappd brewery account is not required to work with UTFB. A standard user account will work.', 'embm'). 302 '</p><p><strong>'. 303 __('Where do I find my API key?', 'embm'). 304 '</strong></p><p>'. 305 sprintf( 306 __('You can find your API key under the "API Access Tokens" section %s.', 'embm'), 307 sprintf( 308 '<a href="https://business.untappd.com/api_tokens" target="_blank">%s</a>', 309 __('here', 'embm') 310 ) 311 ). 312 '</p>' 313 ) 314 ); 279 315 280 316 // Settings FAQ help tab -
em-beer-manager/trunk/includes/embm-core.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 51 51 'capability_type' => 'post', 52 52 'hierarchical' => false, 53 'taxonomies' => array('embm_style', 'embm_group' ),53 'taxonomies' => array('embm_style', 'embm_group', 'embm_menu'), 54 54 'has-archive' => true, 55 55 'menu_position' => 5, … … 483 483 // Loads the custom Group taxonomy 484 484 add_action('init', 'EMBM_Core_group', 0); 485 486 /** 487 * Loads the custom EMBM menu taxonomy 488 * 489 * @return void 490 */ 491 function EMBM_Core_menu() 492 { 493 // Set custom taxonomy terminology 494 $labels = array( 495 'name' => __('Menus', 'embm'), 496 'singular_name' => __('Menu', 'embm'), 497 'search_items' => __('Search Menus', 'embm'), 498 'all_items' => __('All Menus', 'embm'), 499 'edit_item' => __('Edit Menu', 'embm'), 500 'update_item' => __('Update Menu', 'embm'), 501 'add_new_item' => __('Add New Menu', 'embm'), 502 'new_item_name' => __('New Menu Name', 'embm'), 503 'popular_items' => __('Popular Menus', 'embm'), 504 'choose_from_most_used' => __('Choose from the most used menus', 'embm'), 505 'separate_items_with_commas' => __('Separate menus with commas', 'embm'), 506 'add_or_remove_items' => __('Add or remove menus', 'embm'), 507 'menu_name' => __('Menus', 'embm') 508 ); 509 510 // Set up custom taxonomy options 511 $args = array( 512 'hierarchical' => true, 513 'labels' => $labels, 514 'show_ui' => true, 515 'show_admin_column' => true, 516 'query_var' => true, 517 'rewrite' => array( 518 'slug' => 'beer/menu', 519 'with_front' => false 520 ), 521 'show_in_rest' => true, 522 'rest_base' => 'embm_menus', 523 'rest_controller_class' => 'WP_REST_Terms_Controller', 524 ); 525 526 // Register the group taxonomy with the EMBM custom post type 527 register_taxonomy('embm_menu', array('embm_beer'), $args); 528 } 529 530 // Loads the custom Group taxonomy 531 add_action('init', 'EMBM_Core_menu', 0); 485 532 486 533 /** … … 777 824 { 778 825 // Get list of errors 779 $errors = get_transient($GLOBALS[ 'EMBM_UNTAPPD_CACHE']['save_errors']);826 $errors = get_transient($GLOBALS[EMBM_UNTAPPD_CACHE]['save_errors']); 780 827 if (!$errors) { 781 828 return; … … 803 850 804 851 // Remove the errors from cache 805 delete_transient($GLOBALS[ 'EMBM_UNTAPPD_CACHE']['save_errors']);852 delete_transient($GLOBALS[EMBM_UNTAPPD_CACHE]['save_errors']); 806 853 } 807 854 -
em-beer-manager/trunk/includes/embm-output.php
r1584774 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 44 44 45 45 // Beer title 46 if (is_page() || is_archive() || is_tax('embm_group') ) {46 if (is_page() || is_archive() || is_tax('embm_group') || is_tax('embm_menu')) { 47 47 $output .= '<a href="'.get_permalink($beer_id).'" title="'.get_the_title($beer_id).'">'; 48 48 $output .= '<span class="embm-beer--header-title">'.get_the_title($beer_id).'</span>'; … … 69 69 if (get_the_post_thumbnail($beer_id) != '') { 70 70 $output .= '<div class="embm-beer--image">'."\n"; 71 $output .= '<a href="'.get_permalink($beer_id).'">'."\n"; 71 72 $output .= get_the_post_thumbnail($beer_id, 'full')."\n"; 73 $output .= '</a>'."\n"; 72 74 $output .= '</div>'."\n"; 73 75 } … … 98 100 99 101 // Set read more link 100 if ((is_tax('embm_style') || is_archive()) && !is_tax('embm_group') ) {102 if ((is_tax('embm_style') || is_archive()) && !is_tax('embm_group') && !is_tax('embm_menu')) { 101 103 $output .= ' <a class="read-more" href="'.get_permalink($beer_id).'">'; 102 104 $output .= __('More', 'embm').'...'; … … 156 158 $output .= '</div>'."\n"; 157 159 160 // Add hook-able content filter 161 $output = apply_filters('embm_beer_filter_beer', $output); 162 158 163 // Return HTML content 159 164 return $output; … … 199 204 $output .= '<img src="'.$untap_img.'" alt="'.$untap_title.'" border="0" />'; 200 205 $output .= '</a></div>'; 206 207 // Add hook-able content filter 208 $output = apply_filters('embm_beer_filter_untappd', $output); 201 209 202 210 // Return HTML content … … 282 290 $output .= '</div>'."\n"; 283 291 292 // Add hook-able content filter 293 $output = apply_filters('embm_beer_filter_profile', $output); 294 284 295 // Return HTML content 285 296 return $output; … … 343 354 $output .= '</div>'."\n"; 344 355 356 // Add hook-able content filter 357 $output = apply_filters('embm_beer_filter_extras', $output); 358 345 359 // Return HTML content 346 360 return $output; … … 399 413 $output .= EMBM_Output_Rating_styles(); 400 414 $output .= '</div>'."\n"; 415 416 // Add hook-able content filter 417 $output = apply_filters('embm_beer_filter_rating', $output); 401 418 402 419 // Return HTML output … … 442 459 } 443 460 } 461 462 // Add hook-able content filter 463 $stars = apply_filters('embm_beer_filter_rating_stars', $stars); 444 464 445 465 // Return HTML output … … 469 489 $styles .= '</style>'; 470 490 491 // Add hook-able content filter 492 $styles = apply_filters('embm_beer_filter_rating_styles', $styles); 493 471 494 // Return CSS content 472 495 return $styles; … … 577 600 $output .= '</div>'."\n"; 578 601 602 // Add hook-able content filter 603 $output = apply_filters('embm_beer_filter_reviews', $output); 604 579 605 // Return HTML output 580 606 return $output; … … 652 678 // End review 653 679 $output .= '</div>'."\n"; 680 681 // Add hook-able content filter 682 $output = apply_filters('embm_beer_filter_review_content', $output); 654 683 655 684 // Return HTML output -
em-beer-manager/trunk/includes/embm-upgrades.php
r1586946 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/metaboxes/embm-metabox-extras.php
r1584318 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/metaboxes/embm-metabox-profile.php
r1584318 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/metaboxes/embm-metabox-untappd.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 61 61 62 62 // Set custom post data values 63 $utfb_id = isset($beer_entry['embm_utfb']) ? esc_attr($beer_entry['embm_utfb'][0]) : ''; 63 64 $untappd_id = isset($beer_entry['embm_untappd']) ? esc_attr($beer_entry['embm_untappd'][0]) : ''; 64 65 $hide_rating = isset($beer_entry['embm_hide_rating']) ? esc_attr($beer_entry['embm_hide_rating'][0]) : ''; … … 71 72 $beer_found = false; 72 73 $show_api_error = (null !== $untappd_data && !is_object($untappd_data)); 74 $utfb_data = null; 75 76 // Check for UTFB account 77 if ($utfb_id !== '') { 78 $utfb_data = EMBM_Core_Beer_attr($post->ID, 'utfb_data'); 79 80 // Check for matching Untappd id 81 if (property_exists($utfb_data, 'untappd_id') && $utfb_data->untappd_id == $untappd_id) { 82 $beer_found = true; 83 } 84 85 // Get the UTFB menus 86 $menus = wp_get_object_terms($post->ID, 'embm_menu', array('order' => 'DESC')); 87 } 73 88 74 89 // Get token … … 146 161 data-value="<?php echo $untappd_id; ?>" 147 162 value="<?php echo $untappd_id; ?>" 148 <?php if ( $is_brewery&& $beer_found && !$show_api_error) : ?>163 <?php if (($is_brewery || $utfb_id !== '') && $beer_found && !$show_api_error) : ?> 149 164 readonly 150 165 <?php endif; ?> … … 171 186 <?php endif; ?> 172 187 </div> 188 <div class="embm-metabox__field embm-metabox--utfb"> 189 <?php if (null !== $utfb_data && $utfb_id !== '' && !$show_api_error) : ?> 190 <p> 191 <strong><?php _e('Untappd for Business Menus', 'embm'); ?></strong><br /> 192 <ul> 193 <?php foreach ($menus as $menu): ?> 194 <li> 195 <a 196 href="<?php echo get_term_link($menu->slug, 'embm_menu'); ?>" 197 title="<?php echo esc_html($menu->name); ?>" 198 ><?php echo esc_html($menu->name); ?></a> 199 </li> 200 <?php endforeach; ?> 201 </ul> 202 </p> 203 <?php endif; ?> 204 </div> 173 205 </div> 174 206 <div class="embm-metabox__right"> … … 206 238 </div> 207 239 </div> 208 <div class="embm-metabox--untappd-flush"> 209 <p> 210 <strong><?php _e('Refresh Untappd Beer Data', 'embm'); ?></strong> 211 </p> 212 <p> 213 <a href="#" class="button-secondary" data-api-root="<?php echo $api_root; ?>"> 214 <?php _e('Flush Cache', 'embm'); ?> 215 </a> 216 </p> 217 <p class="description"> 218 <?php _e('This is automatically done daily.', 'embm'); ?> 219 </p> 240 <div class="embm-metabox--untappd-actions"> 241 <div class="embm-metabox--untappd-flush"> 242 <p> 243 <strong><?php _e('Refresh Untappd Beer Data', 'embm'); ?></strong> 244 </p> 245 <p> 246 <a href="#" class="button-secondary" data-api-root="<?php echo $api_root; ?>"> 247 <?php _e('Flush Cache', 'embm'); ?> 248 </a> 249 </p> 250 <p class="description"> 251 <?php _e('This is automatically done daily.', 'embm'); ?> 252 </p> 253 </div> 254 <div class="embm-metabox--untappd-sync"> 255 <p> 256 <strong><?php _e('Sync Untappd Beer Data', 'embm'); ?></strong> 257 </p> 258 <p> 259 <a href="#" class="button-secondary" data-api-root="<?php echo $api_root; ?>"> 260 <?php _e('Sync Data', 'embm'); ?> 261 </a> 262 </p> 263 <p class="description"> 264 <span class="warning"><?php _e('WARNING', 'embm'); ?>:</span> 265 <?php _e('This will override any changes you have made to this beer.', 'embm'); ?> 266 </p> 267 </div> 220 268 </div> 221 269 <?php elseif ($show_api_error && null !== $token) : ?> … … 294 342 $res = EMBM_Admin_Untappd_beer($_POST['embm-untappd-api-root'], $beer_id, $post_id, true); 295 343 if (is_null($res) || is_string($res)) { 296 $errors = get_transient($GLOBALS[ 'EMBM_UNTAPPD_CACHE']['save_errors']);344 $errors = get_transient($GLOBALS[EMBM_UNTAPPD_CACHE]['save_errors']); 297 345 if (is_array($errors) && !array_key_exists('1', $errors)) { 298 346 array_push($errors, '1'); … … 300 348 $errors = array('1'); 301 349 } 302 set_transient($GLOBALS[ 'EMBM_UNTAPPD_CACHE']['save_errors'], $errors, HOUR_IN_SECONDS);350 set_transient($GLOBALS[EMBM_UNTAPPD_CACHE]['save_errors'], $errors, HOUR_IN_SECONDS); 303 351 return; 304 352 } -
em-beer-manager/trunk/includes/output/embm-output-filters.php
r1584318 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 39 39 40 40 // Enter the post loop 41 if (in_the_loop() && (is_singular('embm_beer') || is_tax('embm_style') || is_tax('embm_group') )) {41 if (in_the_loop() && (is_singular('embm_beer') || is_tax('embm_style') || is_tax('embm_group') || is_tax('embm_menu'))) { 42 42 43 43 // Set view defaults … … 145 145 if (has_post_thumbnail($post->ID)) { 146 146 $thumb .= '<div class="embm-beer--image">'."\n"; 147 $thumb .= '<a href="'.get_permalink($post->ID).'">'."\n"; 147 148 $thumb .= get_the_post_thumbnail($post->ID, 'full')."\n"; 149 $thumb .= '</a>'."\n"; 148 150 $thumb .= '</div>'."\n"; 149 151 } … … 187 189 function EMBM_Output_Filters_classes($classes) 188 190 { 189 if (is_singular('embm_beer') || is_tax('embm_style') || is_tax('embm_group') ) {191 if (is_singular('embm_beer') || is_tax('embm_style') || is_tax('embm_group') || is_tax('embm_menu')) { 190 192 $classes[] = 'embm-beer'; 191 193 } … … 213 215 214 216 // Display beer style 215 if ($style && (is_singular('embm_beer') || is_tax('embm_group') ) && in_the_loop() && ($title == $post->post_title)) {217 if ($style && (is_singular('embm_beer') || is_tax('embm_group') || is_tax('embm_menu')) && in_the_loop() && ($title == $post->post_title)) { 216 218 // Check for the_title() call 217 219 $is_the_title = false; … … 224 226 } 225 227 226 // Bail if this isn't a the_title() call 227 if (!$is_the_title ) {228 // Bail if this isn't a the_title() call or if we've already done this 229 if (!$is_the_title || did_action('embm_title_filter_applied') !== 0) { 228 230 return $title; 229 231 } … … 237 239 $output .= '</a>)</span>'."\n"; 238 240 241 // Append formatting to title 239 242 $title .= $output; 243 244 // Mark action as done 245 do_action('embm_title_filter_applied'); 240 246 } 241 247 -
em-beer-manager/trunk/includes/output/embm-output-shortcodes.php
r1583981 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 162 162 'paginate' => 'true', 163 163 'orderby' => '', 164 'order' => '' 164 'order' => '', 165 'meta_key' => '' 165 166 ), 166 167 $atts, … … 236 237 'sort' => array( 237 238 'key' => 'order', 239 'default' => '', 240 'type' => 'string' 241 ), 242 'meta_key' => array( 243 'key' => 'meta_key', 238 244 'default' => '', 239 245 'type' => 'string' … … 268 274 $sortby = $beers['sortby']; 269 275 $sort = strtoupper($beers['sort']); 276 $meta_key = $beers['meta_key']; 270 277 271 278 // Initialize output string … … 325 332 if ($sort != '') { 326 333 $args['order'] = $sort; 334 } 335 336 // Add meta key 337 if ($meta_key != '') { 338 $args['meta_key'] = $meta_key; 327 339 } 328 340 -
em-beer-manager/trunk/includes/templates/embm-template-comments.php
r1583981 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/widgets/embm-widget-list.php
r1584318 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or -
em-beer-manager/trunk/includes/widgets/embm-widget-untappd.php
r1584363 r1674966 1 1 <?php 2 2 /** 3 * Copyright (c) 2013-201 6, Erin Morelli.3 * Copyright (c) 2013-2017, Erin Morelli. 4 4 * 5 5 * This program is free software; you can redistribute it and/or … … 394 394 // Include Untappd functions 395 395 if (!function_exists('EMBM_Admin_Untappd_checkins')) { 396 include_once EMBM_PLUGIN_DIR.'includes/admin/ embm-admin-untappd.php';396 include_once EMBM_PLUGIN_DIR.'includes/admin/integrations/embm-integrations-untappd.php'; 397 397 } 398 398 if (!function_exists('EMBM_Admin_Authorize_token')) { 399 include_once EMBM_PLUGIN_DIR.'includes/admin/ embm-admin-authorize.php';399 include_once EMBM_PLUGIN_DIR.'includes/admin/integrations/embm-integrations-authorize.php'; 400 400 } 401 401
Note: See TracChangeset
for help on using the changeset viewer.