Changeset 2144962
- Timestamp:
- 08/25/2019 12:14:03 AM (6 years ago)
- Location:
- auto-post-woocommerce-products/trunk
- Files:
-
- 189 added
- 33 deleted
- 25 edited
-
README.txt (modified) (2 diffs)
-
admin/apwp-functions-admin.php (modified) (11 diffs)
-
admin/apwp-schedule-tab.php (modified) (5 diffs)
-
admin/apwp-twitter-tab.php (modified) (1 diff)
-
admin/apwp-woocommerce-tab.php (modified) (2 diffs)
-
admin/auto-post-woocommerce-products-cron.php (modified) (14 diffs)
-
admin/auto-post-woocommerce-products-settings.php (modified) (2 diffs)
-
admin/auto-post-woocommerce-products-tabs.php (modified) (1 diff)
-
admin/class-auto-post-woocommerce-products-admin.php (modified) (2 diffs)
-
admin/css/account.css.map (deleted)
-
admin/css/add-ons.css.map (deleted)
-
admin/css/affiliation.css.map (deleted)
-
admin/css/apwp-accordian-styles.css.map (deleted)
-
admin/css/apwp-checkbox-styles.css.map (deleted)
-
admin/css/apwp-colors.css.map (deleted)
-
admin/css/apwp-fonts.css.map (deleted)
-
admin/css/apwp-icons.css.map (deleted)
-
admin/css/apwp-mixins.css.map (deleted)
-
admin/css/apwp-nav-colors.css.map (deleted)
-
admin/css/apwp-product-list-styles.css.map (deleted)
-
admin/css/apwp-radiobutton-styles.css.map (deleted)
-
admin/css/apwp-stats-table-styles.css.map (deleted)
-
admin/css/apwp-styles.css (modified) (1 diff)
-
admin/css/apwp-styles.css.map (deleted)
-
admin/css/apwp-tooltips.css.map (deleted)
-
admin/css/brands.css.map (deleted)
-
admin/css/checkout.css.map (deleted)
-
admin/css/common.css.map (deleted)
-
admin/css/connect.css.map (deleted)
-
admin/css/customizer.css.map (deleted)
-
admin/css/debug.css.map (deleted)
-
admin/css/dialog-boxes.css.map (deleted)
-
admin/css/fontawesome.css.map (deleted)
-
admin/css/gdpr-optin-notice.css.map (deleted)
-
admin/css/regular.css.map (deleted)
-
admin/css/solid.css.map (deleted)
-
admin/css/v4-shims.css.map (deleted)
-
admin/images/setup/de_DE/error4.png (deleted)
-
admin/images/setup/en_US/error4.png (deleted)
-
admin/images/setup/es_ES/error4.png (deleted)
-
admin/images/setup/fr_FR/error4.png (deleted)
-
admin/images/setup/pt_PT/error4.png (deleted)
-
admin/includes/apwp-add-social-icons.php (modified) (5 diffs)
-
admin/includes/apwp-check-setup.php (modified) (3 diffs)
-
admin/includes/apwp-dashboard-widget.php (modified) (1 diff)
-
admin/includes/apwp-debug.php (modified) (14 diffs)
-
admin/includes/apwp-inventory-update-functions.php (modified) (4 diffs)
-
admin/includes/apwp-list-table-functions.php (modified) (3 diffs)
-
admin/includes/apwp-quick-edit.php (modified) (1 diff)
-
admin/includes/class-apwp-cron-functions.php (modified) (5 diffs)
-
admin/includes/class-apwp-labels.php (modified) (4 diffs)
-
admin/includes/class-apwp-short-links.php (modified) (5 diffs)
-
admin/includes/display-quick-start-tab.php (modified) (2 diffs)
-
admin/src/Bitly (deleted)
-
admin/src/Twitter/OAuth.php (modified) (39 diffs)
-
admin/src/Twitter/Twitter.php (modified) (4 diffs)
-
admin/src/bitly-api.php (added)
-
admin/vendor (added)
-
admin/vendor/composer (added)
-
admin/vendor/composer.json (added)
-
admin/vendor/composer.lock (added)
-
admin/vendor/composer/ClassLoader.php (added)
-
admin/vendor/composer/LICENSE (added)
-
admin/vendor/composer/autoload_classmap.php (added)
-
admin/vendor/composer/autoload_files.php (added)
-
admin/vendor/composer/autoload_namespaces.php (added)
-
admin/vendor/composer/autoload_psr4.php (added)
-
admin/vendor/composer/autoload_real.php (added)
-
admin/vendor/composer/autoload_static.php (added)
-
admin/vendor/composer/installed.json (added)
-
admin/vendor/vendor (added)
-
admin/vendor/vendor/autoload.php (added)
-
admin/vendor/vendor/composer (added)
-
admin/vendor/vendor/composer/ClassLoader.php (added)
-
admin/vendor/vendor/composer/LICENSE (added)
-
admin/vendor/vendor/composer/autoload_classmap.php (added)
-
admin/vendor/vendor/composer/autoload_files.php (added)
-
admin/vendor/vendor/composer/autoload_namespaces.php (added)
-
admin/vendor/vendor/composer/autoload_psr4.php (added)
-
admin/vendor/vendor/composer/autoload_real.php (added)
-
admin/vendor/vendor/composer/autoload_static.php (added)
-
admin/vendor/vendor/composer/installed.json (added)
-
admin/vendor/vendor/guzzlehttp (added)
-
admin/vendor/vendor/guzzlehttp/guzzle (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/CHANGELOG.md (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/LICENSE (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/README.md (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/UPGRADING.md (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/composer.json (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Client.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/ClientInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/HandlerStack.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/MessageFormatter.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Middleware.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/Pool.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/RequestOptions.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/TransferStats.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/UriTemplate.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/functions.php (added)
-
admin/vendor/vendor/guzzlehttp/guzzle/src/functions_include.php (added)
-
admin/vendor/vendor/guzzlehttp/promises (added)
-
admin/vendor/vendor/guzzlehttp/promises/CHANGELOG.md (added)
-
admin/vendor/vendor/guzzlehttp/promises/LICENSE (added)
-
admin/vendor/vendor/guzzlehttp/promises/Makefile (added)
-
admin/vendor/vendor/guzzlehttp/promises/README.md (added)
-
admin/vendor/vendor/guzzlehttp/promises/composer.json (added)
-
admin/vendor/vendor/guzzlehttp/promises/src (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/AggregateException.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/CancellationException.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/Coroutine.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/EachPromise.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/FulfilledPromise.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/Promise.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/PromiseInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/PromisorInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/RejectedPromise.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/RejectionException.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/TaskQueue.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/TaskQueueInterface.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/functions.php (added)
-
admin/vendor/vendor/guzzlehttp/promises/src/functions_include.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7 (added)
-
admin/vendor/vendor/guzzlehttp/psr7/CHANGELOG.md (added)
-
admin/vendor/vendor/guzzlehttp/psr7/LICENSE (added)
-
admin/vendor/vendor/guzzlehttp/psr7/README.md (added)
-
admin/vendor/vendor/guzzlehttp/psr7/composer.json (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/AppendStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/BufferStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/CachingStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/DroppingStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/FnStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/InflateStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/LazyOpenStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/LimitStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/MessageTrait.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/MultipartStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/NoSeekStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/PumpStream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/Request.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/Response.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/Rfc7230.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/ServerRequest.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/Stream.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/StreamWrapper.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/UploadedFile.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/Uri.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/UriNormalizer.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/UriResolver.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/functions.php (added)
-
admin/vendor/vendor/guzzlehttp/psr7/src/functions_include.php (added)
-
admin/vendor/vendor/psr (added)
-
admin/vendor/vendor/psr/http-message (added)
-
admin/vendor/vendor/psr/http-message/CHANGELOG.md (added)
-
admin/vendor/vendor/psr/http-message/LICENSE (added)
-
admin/vendor/vendor/psr/http-message/README.md (added)
-
admin/vendor/vendor/psr/http-message/composer.json (added)
-
admin/vendor/vendor/psr/http-message/src (added)
-
admin/vendor/vendor/psr/http-message/src/MessageInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/RequestInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/ResponseInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/ServerRequestInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/StreamInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/UploadedFileInterface.php (added)
-
admin/vendor/vendor/psr/http-message/src/UriInterface.php (added)
-
admin/vendor/vendor/psr/http-server-handler (added)
-
admin/vendor/vendor/psr/http-server-handler/LICENSE (added)
-
admin/vendor/vendor/psr/http-server-handler/README.md (added)
-
admin/vendor/vendor/psr/http-server-handler/composer.json (added)
-
admin/vendor/vendor/psr/http-server-handler/src (added)
-
admin/vendor/vendor/psr/http-server-handler/src/RequestHandlerInterface.php (added)
-
admin/vendor/vendor/psr/log (added)
-
admin/vendor/vendor/psr/log/.gitignore (added)
-
admin/vendor/vendor/psr/log/LICENSE (added)
-
admin/vendor/vendor/psr/log/Psr (added)
-
admin/vendor/vendor/psr/log/Psr/Log (added)
-
admin/vendor/vendor/psr/log/Psr/Log/AbstractLogger.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/InvalidArgumentException.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/LogLevel.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/LoggerAwareInterface.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/LoggerAwareTrait.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/LoggerInterface.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/LoggerTrait.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/NullLogger.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/Test (added)
-
admin/vendor/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php (added)
-
admin/vendor/vendor/psr/log/Psr/Log/Test/TestLogger.php (added)
-
admin/vendor/vendor/psr/log/README.md (added)
-
admin/vendor/vendor/psr/log/composer.json (added)
-
admin/vendor/vendor/ralouphie (added)
-
admin/vendor/vendor/ralouphie/getallheaders (added)
-
admin/vendor/vendor/ralouphie/getallheaders/LICENSE (added)
-
admin/vendor/vendor/ralouphie/getallheaders/README.md (added)
-
admin/vendor/vendor/ralouphie/getallheaders/composer.json (added)
-
admin/vendor/vendor/ralouphie/getallheaders/src (added)
-
admin/vendor/vendor/ralouphie/getallheaders/src/getallheaders.php (added)
-
admin/vendor/vendor/zendframework (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/CHANGELOG.md (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/LICENSE.md (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/README.md (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/composer.json (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/ConfigProvider.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter/EmitterInterface.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter/EmitterStack.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter/SapiEmitter.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter/SapiEmitterTrait.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Emitter/SapiStreamEmitter.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Exception (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Exception/EmitterException.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Exception/ExceptionInterface.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/Exception/InvalidEmitterException.php (added)
-
admin/vendor/vendor/zendframework/zend-httphandlerrunner/src/RequestHandlerRunner.php (added)
-
auto-post-woocommerce-products.php (modified) (2 diffs)
-
includes/class-auto-post-woocommerce-products-activator.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
auto-post-woocommerce-products/trunk/README.txt
r2134375 r2144962 5 5 Requires at least: 5.0 6 6 Tested up to: 5.2.2 7 Stable tag: 2.1.4. 38 Requires PHP at least: 5.6.35Recommended 7.27 Stable tag: 2.1.4.4 8 Requires PHP at least: 7.0 Recommended 7.2 9 9 WC requires at least: 3.3.0 10 WC tested up to: 3. 6.510 WC tested up to: 3.7 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 76 76 77 77 == Changelog == 78 = 2.1.4.4 = 79 * 24-AUG-2019 80 * Corrected Twitter auto posting issue. 81 * Updated to use new Bitly API v4 and corrected previous Bitly errors. 82 * Fixed issue with "sharing buttons" not showing on the individual sharing page. 83 * Pinterest should now show the sale price when product is on sale. 84 * Moved the RESET AUTO POST PRODUCTS box from the categories tab to the STATUS tab. 85 78 86 = 2.1.4.3 = 79 87 * 05-AUG-2019 -
auto-post-woocommerce-products/trunk/admin/apwp-functions-admin.php
r2134375 r2144962 531 531 532 532 /** 533 * Load script async534 *535 * @param string $url The java url to load.536 * @since 2.1.3.2537 *538 * @return mixed539 */540 function apwp_async_scripts( $url )541 {542 543 if ( strpos( $url, '#asyncload' ) === false ) {544 return $url;545 } else {546 return str_replace( '#asyncload', '', $url ) . "' async='async 'defer='defer";547 }548 549 }550 551 add_filter(552 'clean_url',553 'apwp_async_scripts',554 11,555 1556 );557 /**558 533 * Get the current user default admin WordPress theme 559 534 * … … 664 639 $labels = new Apwp_Labels(); 665 640 $_setup = new Apwp_Check_Setup(); 641 $products = new WC_Product_factory(); 666 642 $id = get_the_ID(); 643 $product = $products->get_product( $id ); 667 644 $sale = false; 668 645 $_onsale1 = ''; … … 671 648 $price = get_post_meta( $id, '_price', true ); 672 649 $reg = get_post_meta( $id, '_regular_price', true ); 650 $date_to = get_post_meta( $id, '_sale_price_dates_to', true ); 651 $date_from = get_post_meta( $id, '_sale_price_dates_from', true ); 673 652 $sh_desc = apwp_get_excerpt( $id ); 674 653 $card_type = 'summary'; 675 if ( false=== $reg ) {654 if ( '' === $reg ) { 676 655 $reg = $price; 677 656 } … … 682 661 // If on sale add on sale to title. 683 662 $check_disc_setting = get_option( 'apwp_discount' ); 684 if ( $price < $reg ) { 663 664 if ( $product->is_on_sale() ) { 685 665 $sale = true; 686 } 666 $price = get_post_meta( $id, '_sale_price', true ); 667 } 668 687 669 688 670 if ( $sale && 'checked' === $check_disc_setting ) { … … 967 949 function apwp_display_header() 968 950 { 951 $beta = get_option( 'apwp_is_beta_version' ); 969 952 $labels = new Apwp_Labels(); 970 953 $_type = apwp_get_fs_plan_title(); 971 954 $url = esc_url( 'https://www.cilcreations.com/apwp' ); 955 $beta_desc = ''; 956 if ( $beta ) { 957 $beta_desc = '<span style="color: red;"> beta</span>'; 958 } 972 959 ?> 973 960 <a href="<?php … … 988 975 <div class="description logo-title"> 989 976 <?php 990 echo $labels->product_list_labels['version'] . ' ' . APWP_VERSION . $_type . '</b>' ;977 echo $labels->product_list_labels['version'] . ' ' . APWP_VERSION . ' ' . $beta_desc . $_type . '</b>' ; 991 978 echo ' ' . $labels->product_list_labels['by'] ; 992 979 ?> … … 1203 1190 1204 1191 /** 1192 * Get file size for log 1193 * 1194 * @param int $bytes File size in bytes. 1195 * @param int $decimals Number of decimal places. 1196 * @since 2.1.4.4 1197 * 1198 * @return string 1199 */ 1200 function apwp_filesize( $bytes, $decimals = 2 ) 1201 { 1202 return sprintf( "%.{$decimals}f", $bytes ) . ' bytes'; 1203 } 1204 1205 /** 1205 1206 * FUNCTION TO TRUNCATE LOG FILES 1206 1207 * … … 1216 1217 } 1217 1218 $size = filesize( $path ); 1218 $max_size = 10485760; 1219 1220 if ( $size > $max_size ) { 1221 // Greater than 10MB. 1219 $_size = $size; 1220 if ( 0 === $size ) { 1221 return; 1222 } 1223 $_size = apwp_filesize( $size ); 1224 1225 if ( $size > 524880 ) { 1222 1226 rename( $path, $path . '.old-' . time() ); 1223 1227 file_put_contents( $path, '', FILE_APPEND ); 1224 1228 // Create empty log file. 1229 apwp_add_to_debug( 'Trim log file "' . wp_basename( $path ) . '" Filesize: ' . $_size, '<span style="color: purple;">APWCP</span>' ); 1225 1230 } 1226 1231 … … 1264 1269 return; 1265 1270 } 1266 $local_time = date_i18n( get_option( 'time_format' ), $time + APWP_TIME_OFFSET);1271 $local_time = date_i18n( get_option( 'time_format' ), $time ); 1267 1272 return $local_time; 1268 1273 } … … 1544 1549 function apwp_reset_plugin() 1545 1550 { 1546 $cron = new Apwp_Cron_Functions(); 1547 $cron->atwc_delete_schedule(); 1551 apwp_deactivate_apwp_cron(); 1548 1552 update_option( APWP_SCHEDULE_PAGE, 'pause_schedule' ); 1549 1553 delete_option( 'apwp_view_all' ); … … 1559 1563 delete_transient( 'apwp_prod_list_data' ); 1560 1564 delete_transient( 'apwp_prod_list_data_check' ); 1561 apwp_set_onetime_cron( [ 1562 'create', 1563 'data', 1564 'trash', 1565 'rebuild' 1566 ] ); 1565 apwp_set_onetime_cron( [ 'create', 'data', 'trash' ] ); 1567 1566 apwp_set_products_array(); 1568 1567 apwp_add_to_debug( 'APWCP plugin has been reset.', '<span style="color: green;">INFO</span>' ); -
auto-post-woocommerce-products/trunk/admin/apwp-schedule-tab.php
r2134375 r2144962 45 45 $show_if_local = ''; 46 46 } 47 $next_post = apwp_convert_time( $cron->get_next_cron_run() + APWP_TIME_OFFSET );48 $next_post_diff = human_time_diff( $cron->get_next_cron_run(), time() );47 $next_post = apwp_convert_time( wp_next_scheduled( 'auto_post_woo_prod_cron' ) + APWP_TIME_OFFSET ); 48 $next_post_diff = human_time_diff( wp_next_scheduled( 'auto_post_woo_prod_cron' ), time() ); 49 49 // The following will check if the tweet has been sent and next tweet scheduled. 50 50 // Each step involves JS timer to refresh the page until completed. … … 96 96 } 97 97 $next_post = apwp_convert_time( get_option( 'apwp_next_time_cron_runs' ) + APWP_TIME_OFFSET ); 98 $next_post_diff = human_time_diff( $cron->get_next_cron_run(), time() );98 $next_post_diff = human_time_diff( wp_next_scheduled( 'auto_post_woo_prod_cron' ), time() ); 99 99 } elseif ( $last_tweet && false === $last_tweet['last_post_successful'] ) { 100 100 $_update = $labels->schedule_labels['last-post-failed']; … … 105 105 } 106 106 107 $next_ = $cron->get_next_cron_run();107 $next_ = wp_next_scheduled( 'auto_post_woo_prod_cron' ); 108 108 109 109 if ( !$next_ ) { … … 112 112 113 113 if ( $next_post > time() + 30 ) { 114 $next_post = apwp_convert_time( $cron->get_next_cron_run() + APWP_TIME_OFFSET );115 $next_post_diff = human_time_diff( $cron->get_next_cron_run(), time() );114 $next_post = apwp_convert_time( wp_next_scheduled( 'auto_post_woo_prod_cron' ) + APWP_TIME_OFFSET ); 115 $next_post_diff = human_time_diff( wp_next_scheduled( 'auto_post_woo_prod_cron' ), time() ); 116 116 delete_option( 'apwp_next_time_cron_runs' ); 117 117 set_transient( 'apwp_cron_check', 'done', HOUR_IN_SECONDS ); … … 456 456 $a[$ck2] = 'checked'; 457 457 } 458 $opt = get_option( APWP_SCHEDULE_PAGE ); 459 $apwp_current_sched = $opt; 460 461 if ( !$cron->get_next_cron_run() ) { 462 update_option( $opt, 'pause_schedule' ); 458 $apwp_current_sched = get_option( APWP_SCHEDULE_PAGE ); 459 460 if ( !wp_next_scheduled( 'auto_post_woo_prod_cron' ) ) { 461 update_option( $apwp_current_sched, 'pause_schedule' ); 463 462 $apwp_current_sched = 'pause_schedule'; 464 463 update_option( 'atwc_previous_selection', '' ); -
auto-post-woocommerce-products/trunk/admin/apwp-twitter-tab.php
r2134375 r2144962 259 259 } else { 260 260 $current = 0; 261 update_option( 'apwp_current_status', 'posted' );262 // Prevent issue if installing and not using autopost.263 261 } 264 262 -
auto-post-woocommerce-products/trunk/admin/apwp-woocommerce-tab.php
r2122132 r2144962 28 28 */ 29 29 function apwp_display_tab_two() { 30 global $apwp_theme;31 30 $labels = new Apwp_Labels(); 32 31 $prod_to_post = 0; … … 53 52 ?> 54 53 </form> 55 <?php56 if ( get_option( 'atwc_products_post' ) ) {57 $prod_to_post = get_option( 'atwc_products_post' );58 if ( empty( $prod_to_post ) ) {59 $prod_to_post = 0;60 apwp_set_onetime_cron( [ 'create' ] );61 } else {62 $prod_to_post = count( get_option( 'atwc_products_post' ) );63 }64 }65 ?>66 <div class="auto-post-cue-note b shadows-upper">67 <div class="subtitle-apwp" style="text-align: center; background: gainsboro; padding: 8px; padding-bottom: 10px; border-bottom: 1px solid gray;">68 <?php69 echo $labels->other_tabs_labels['current-post-data'];70 ?>71 </div>72 <table style="width: 100%;">73 <tr>74 <td style="width: 50%; text-align: center;">75 <div class="other-items-clicks-green">76 <span class="other-numbers2">77 <?php echo number_format_i18n( $ttl ); ?></span></div>78 <br /><span class="dash2">79 <?php80 echo _n( 'Product to Tweet', 'Products to Tweet', $ttl, 'auto-post-woocommerce-products' );81 ?>82 </span>83 </td>84 <td style="width: 50%; text-align: center;">85 <div class="low-items">86 <span class="other-numbers2">87 <?php echo number_format_i18n( $prod_to_post ); ?></span></div>88 <br /><span class="dash2">89 <?php90 echo $labels->other_tabs_labels['scheduled-tweet'];91 ?>92 </span>93 </td>94 </tr>95 </table>96 <hr />97 <div style="margin: 10px;">98 <?php99 echo $labels->other_tabs_labels['auto-post-desc'];100 ?>101 <br /><br />102 <?php103 echo $labels->other_tabs_labels['posting-info'];104 ?>105 <hr />106 <div class="subtitle-apwp" style="text-align: center; padding-bottom: 10px;">107 <?php108 echo $labels->other_tabs_labels['reset-list'];109 ?>110 </div>111 <form method="post" action="admin.php?page=atwc_products_options&tab=woocom_settings" style="text-align: center;">112 <button type="submit" class="<?php echo $apwp_theme; ?> shadows-btn" value="" id="reset_pr_tweet" name="reset_pr_tweet">113 <?php echo $labels->other_tabs_labels['reset-button-txt']; ?></button>114 </form>115 </div>116 </div>117 </div>118 54 </div> 119 55 <?php -
auto-post-woocommerce-products/trunk/admin/auto-post-woocommerce-products-cron.php
r2134375 r2144962 71 71 * @return array 72 72 */ 73 private $ in_cue_array;73 private $cued; 74 74 75 75 /** … … 92 92 */ 93 93 private $product; 94 95 /** 96 * Is this an automated cron posting or manual. 97 * 98 * @var bool 99 * @since 2.1.4.1 100 * 101 * @return mixed 102 */ 103 private $auto; 94 104 95 105 /** … … 107 117 $cued = get_option( 'atwc_products_post' ); 108 118 109 if ( ! $posted ) {119 if ( ! $posted || null === $posted ) { 110 120 $posted = []; 111 121 } 112 if ( ! $cued ) {122 if ( ! $cued || null === $cued ) { 113 123 $cued = []; 114 124 } 115 125 116 $this-> set_posted_array( $posted );117 $this-> set_in_cue_array( $cued );126 $this->posted = $posted; 127 $this->cued = $cued; 118 128 } 119 129 … … 128 138 */ 129 139 public function apwp_run_auto_cron( $auto ) { 130 if ( empty( $this->get_in_cue_array() ) ) { 131 $this->set_in_cue_array( apwp_rebuild_products_array() ); 132 } 133 134 $this->set_item_to_tweet( $this->in_cue_array[0] ); 135 140 $this->auto = $auto; 141 $is_auto = ( true === $auto ) ? 'true' : 'false'; 142 apwp_add_to_debug( 'Starting auto cron Twitter posting. auto = ' . $is_auto, '<span style="color: green;">CRON</span>' ); 143 144 if ( empty( $this->cued ) ) { 145 $_new = apwp_set_products_array(); 146 $this->cued = $_new['prod_ids']; 147 } 148 149 $_temp = $this->cued; 150 $this->set_item_to_tweet( $_temp['0'] ); 136 151 // Get woocommerce info on product. 137 152 $item = $this->product->get_product( $this->get_item_to_tweet() ); … … 140 155 if ( ! $item->is_in_stock() ) { 141 156 while ( ! $item->is_in_stock() ) : 142 $this->remove_id_from_array( 0);157 $this->remove_id_from_array(); 143 158 apwp_add_to_debug( 'OUT OF STOCK! ID: ' . $this->get_item_to_tweet() . ' - ' . $item->get_title(), '<span style="color: chocolate;">CRON</span>' ); 144 159 $item = $this->apwp_find_new_product(); 145 146 if ( ! $item ) {147 apwp_add_to_debug( 'Resetting product array.', '<span style="color: green;">CRON</span>' );148 $this->set_in_cue_array( apwp_rebuild_products_array() );149 $item = $this->apwp_find_new_product();150 }151 152 160 endwhile; 153 161 } … … 155 163 $hash = $this->get_hashtags(); 156 164 $title = $this->get_title( $item ); 157 $this->remove_id_from_array( 0);165 $this->remove_id_from_array(); 158 166 $_on_sale = $this->set_on_sale_percentage( $item ); 159 167 $url = $this->apwp_get_bitly_link(); 160 168 $status = $this->get_status_message( $title, $_on_sale, $hash, $url ); 161 $this->send_tweet( $status , $auto);169 $this->send_tweet( $status ); 162 170 } 163 171 … … 170 178 */ 171 179 private function apwp_find_new_product() { 172 $temp = $this-> get_in_cue_array();180 $temp = $this->cued; 173 181 174 182 if ( count( $temp ) >= 1 ) { … … 176 184 $item = $this->product->get_product( $this->get_item_to_tweet() ); 177 185 } else { 178 apwp_set_onetime_cron( [ 'create' ] ); 179 return false; 186 $_new = apwp_set_products_array(); 187 $temp = $_new['prod_ids']; 188 $this->set_item_to_tweet( $temp[0] ); 189 $item = $this->product->get_product( $temp[0] ); 190 $this->cued = $temp; 180 191 } 181 192 … … 200 211 * Remove the product from the cue and place it in posted 201 212 * 202 * @param int $_num Number corresponds to in_cue_array[$KEY].203 213 * @since 2.1.3.0 204 214 * 205 215 * @return mixed 206 216 */ 207 private function remove_id_from_array( $_num ) { 208 $temp = $this->get_in_cue_array(); 209 unset( $temp[ $_num ] ); 210 $this->set_in_cue_array( array_merge( $temp ) ); 211 $temp = $this->get_posted_array(); 212 array_push( $temp, $this->get_item_to_tweet() ); 213 $this->set_posted_array( $temp ); 214 update_option( 'atwc_products_post', $this->get_in_cue_array() ); 217 private function remove_id_from_array() { 218 apwp_add_to_debug( 'CUED: ' . count( $this->cued ) . ' POSTED: ' . count( $this->posted ) ); 219 unset( $this->cued[0] ); 220 array_push( $this->posted, $this->get_item_to_tweet() ); 221 update_option( 'atwc_products_post', array_merge( $this->cued ) ); 215 222 update_option( 'atwc_last_item_tweeted', $this->get_item_to_tweet() ); 216 update_option( 'atwc_products_posted', $this->get_posted_array() ); 223 update_option( 'atwc_products_posted', $this->posted ); 224 apwp_add_to_debug( 'CUED: ' . count( $this->cued ) . ' POSTED: ' . count( $this->posted ) ); 217 225 } 218 226 … … 301 309 $url = get_permalink( $this->get_item_to_tweet() ); 302 310 if ( ! apwp_check_local_host() ) { 303 apwp_add_to_debug( 'BITLY short link for #' . $this->get_item_to_tweet() . ' is empty do to invalid response from Bitly...using product url.', '<span style="color: red;">CRON</span>' );311 apwp_add_to_debug( 'BITLY short link for #' . $this->get_item_to_tweet() . ' is empty do to invalid response from Bitly...using long product url.', '<span style="color: chocolate;">CRON</span>' ); 304 312 } 305 313 } … … 325 333 * 326 334 * @param string $status The completed posting. 327 * @param bool $auto Tell function if this is an automated posting or manual.328 335 * @since 2.1.3.0 329 336 * 330 337 * @return void 331 338 */ 332 private function send_tweet( $status , $auto) {339 private function send_tweet( $status ) { 333 340 $time_date = apwp_convert_time_log( time() ); 341 // Maintain logs. 342 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'post_log', 0, 100 ); 343 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'error_log', 0, 300 ); 344 345 if ( $this->auto ) { // If wp_cron initiated. 346 set_transient( 'apwp_cron_check', 'no', HOUR_IN_SECONDS ); 347 } 348 334 349 if ( apwp_check_local_host() ) { 335 $this->simulate_tweet_on_localhost( $time_date, $status, $auto ); 336 } elseif ( get_option( 'atwc_twitter' ) ) { 337 $tweet = $this->twitter_post( $status, $this->get_item_to_tweet(), $time_date ); 338 339 if ( $tweet ) { 340 // update the shared date. 341 apwp_update_last_shared_date( $this->get_item_to_tweet() ); 342 } else { 343 update_option( 'atwc_twitter_success', false ); 344 } 345 } 346 347 if ( $auto ) { // If wp_cron initiated. 348 set_transient( 'apwp_cron_check', 'no', DAY_IN_SECONDS ); 349 } 350 351 // Maintain post log. 352 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'post_log', 0, 100 ); 353 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'debug.log', 0, 200 ); 354 355 // Install complete - prevents the refresh message from showing after activation. 356 if ( get_option( 'apwp_current_status' ) === 'installing' ) { 357 update_option( 'apwp_current_status', 'posted' ); 358 } 359 360 apwp_set_onetime_cron( [ 'data', 'rebuild' ] ); 350 $this->simulate_tweet_on_localhost( $time_date, $status ); 351 return; 352 } 353 354 $tweet = $this->twitter_post( $status, $this->get_item_to_tweet(), $time_date ); 355 356 if ( $tweet ) { 357 // update the shared date. 358 apwp_update_last_shared_date( $this->get_item_to_tweet() ); 359 } else { 360 update_option( 'atwc_twitter_success', false ); 361 } 362 apwp_set_onetime_cron( [ 'data' ] ); 361 363 } 362 364 … … 394 396 } 395 397 398 apwp_set_onetime_cron( [ 'data' ] ); 396 399 file_put_contents( __DIR__ . '/post_log', '[<b>' . $time_date . '</b>] TWEETED PROD ID #' . $id . ': ' . $status . PHP_EOL, FILE_APPEND | LOCK_EX ); 397 400 apwp_add_to_debug( 'TWITTER post sent successfully.', '<span style="color: green;">CRON</span>' ); … … 404 407 * @param string $time_date Current time/date for log entry. 405 408 * @param string $status The post that was "sent". 406 * @param bool $auto Manual or auto posting.407 409 * @since 2.1.3.0 408 410 * 409 411 * @return void 410 412 */ 411 private function simulate_tweet_on_localhost( $time_date, $status , $auto) {413 private function simulate_tweet_on_localhost( $time_date, $status ) { 412 414 // For testing and debugging. 413 415 apwp_update_last_shared_date( $this->get_item_to_tweet() ); 414 415 if ( get_option( 'apwp_current_status' ) === 'installing' ) {416 update_option( 'apwp_current_status', 'completed' );417 }418 419 416 file_put_contents( APWP_PLUGIN_PATH . 'post_log', '[<b>' . $time_date . '</b>] {<span style="color: chocolate;">localhost</span>} TWEETED PROD ID #' . $this->get_item_to_tweet() . ': ' . $status . PHP_EOL, FILE_APPEND | LOCK_EX ); 420 417 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'post_log', 0, 100 ); 421 apwp_trim_log_to_length( APWP_PLUGIN_PATH . ' debug.log', 0, 200 );418 apwp_trim_log_to_length( APWP_PLUGIN_PATH . 'error_log', 0, 300 ); 422 419 apwp_trim_log_to_length( WP_CONTENT_DIR . '\debug.log', 0, 800 ); 423 if ( $auto ) { // If wp_cron initiated. 424 set_transient( 'apwp_cron_check', 'no', DAY_IN_SECONDS ); 425 } 426 427 apwp_set_onetime_cron( [ 'data', 'rebuild' ] ); 420 apwp_set_onetime_cron( [ 'data' ] ); 428 421 apwp_add_to_debug( 'TWITTER simulated post completed.', '<span style="color: green;">CRON</span>' ); 429 422 } 430 431 /**432 * Get array holding our posted products433 *434 * @return array435 */436 public function get_posted_array() {437 return $this->posted_array;438 }439 440 /**441 * Set array holding our posted products442 *443 * @param array $posted_array Array holding our posted products.444 *445 * @return self446 */447 public function set_posted_array( array $posted_array ) {448 $this->posted_array = $posted_array;449 return $this;450 }451 452 /**453 * Get array holding our cued products454 *455 * @return array456 */457 public function get_in_cue_array() {458 return $this->in_cue_array;459 }460 461 /**462 * Set array holding our cued products463 *464 * @param array $array_data Array holding our cued products.465 *466 * @return self467 */468 public function set_in_cue_array( $array_data ) {469 $this->in_cue_array = $array_data;470 471 return $this;472 }473 474 475 423 476 424 /** … … 490 438 * @return self 491 439 */ 492 public function set_item_to_tweet( int$item_to_tweet ) {493 $this->item_to_tweet = $item_to_tweet;440 public function set_item_to_tweet( $item_to_tweet ) { 441 $this->item_to_tweet = (string) $item_to_tweet; 494 442 495 443 return $this; 496 444 } 445 497 446 } -
auto-post-woocommerce-products/trunk/admin/auto-post-woocommerce-products-settings.php
r2134375 r2144962 249 249 if ( !get_option( 'apwp_delete_all_settings' ) ) { 250 250 update_option( 'apwp_delete_all_settings', 'unchecked' ); 251 }252 if ( !get_option( 'apwp_current_status' ) ) {253 update_option( 'apwp_current_status', 'installing' );254 251 } 255 252 … … 336 333 delete_post_meta_by_key( '_product_cost_other_apwp' ); 337 334 delete_post_meta_by_key( '_product_cost_apwp' ); 335 delete_post_meta_by_key( '_stats_referrers_last_seven_apwp' ); 336 delete_post_meta_by_key( '_stats_referrers_today_apwp' ); 337 delete_post_meta_by_key( '_stats_referrers_last_month_apwp' ); 338 delete_post_meta_by_key( '_stats_referrers_all_time_apwp' ); 338 339 } 339 340 -
auto-post-woocommerce-products/trunk/admin/auto-post-woocommerce-products-tabs.php
r2134375 r2144962 22 22 23 23 require_once APWP_INCLUDES_PATH . 'class-apwp-hashtag.php'; 24 require_once APWP_INCLUDES_PATH . 'apwp-add-social-icons.php'; 24 25 /** 25 26 * Display the page header portion and the selected tab page -
auto-post-woocommerce-products/trunk/admin/class-auto-post-woocommerce-products-admin.php
r2124737 r2144962 15 15 * Created Saturday, Jun-15-2019 at 13:33:29 16 16 */ 17 17 18 if ( !function_exists( 'apwp_fs' ) ) { 18 /** 19 * Create a helper function for easy SDK access. 20 * 21 * @since 2.0.0 22 * 23 * @return mixed 24 */ 19 // Create a helper function for easy SDK access. 25 20 function apwp_fs() 26 21 { … … 61 56 return $apwp_fs; 62 57 } 63 64 } 65 apwp_fs(); 66 // Init Freemius. 67 do_action( 'apwp_fs_loaded' ); 68 // Signal that SDK was initiated. 69 /** 70 * Plugin URL for Freemius 71 * 72 * @since 2.0.0 73 * 74 * @return mixed 75 */ 76 function apwp_fs_settings_url() 77 { 78 return admin_url( '/admin.php?page=atwc_products_options&tab=twitter_settings' ); 79 } 80 81 apwp_fs()->add_filter( 'connect_url', 'apwp_fs_settings_url' ); 82 apwp_fs()->add_filter( 'after_skip_url', 'apwp_fs_settings_url' ); 83 apwp_fs()->add_filter( 'after_connect_url', 'apwp_fs_settings_url' ); 84 apwp_fs()->add_filter( 'after_pending_connect_url', 'apwp_fs_settings_url' ); 58 59 // Init Freemius. 60 apwp_fs(); 61 // Signal that SDK was initiated. 62 do_action( 'apwp_fs_loaded' ); 63 function apwp_fs_settings_url() 64 { 65 return admin_url( '/admin.php?page=atwc_products_options&tab=twitter_settings' ); 66 } 67 68 apwp_fs()->add_filter( 'connect_url', 'apwp_fs_settings_url' ); 69 apwp_fs()->add_filter( 'after_skip_url', 'apwp_fs_settings_url' ); 70 apwp_fs()->add_filter( 'after_connect_url', 'apwp_fs_settings_url' ); 71 apwp_fs()->add_filter( 'after_pending_connect_url', 'apwp_fs_settings_url' ); 72 } 73 85 74 /** 86 75 * -
auto-post-woocommerce-products/trunk/admin/css/apwp-styles.css
r2134375 r2144962 10437 10437 .dash, .dash2 { font-weight: 500; text-align: center; padding: 0 5px 0 5px; font-size: 0.9em; font-style: italic; } 10438 10438 10439 .dash2 { font-size: 1em; }10439 .dash2 { font-size: 1em; color: #111; font-style: normal; font-weight: bold; } 10440 10440 10441 10441 td.dash-apwp2-sale { color: green; font-weight: 700; } -
auto-post-woocommerce-products/trunk/admin/includes/apwp-add-social-icons.php
r2122132 r2144962 40 40 foreach ( $inventory as $product ) { 41 41 42 if ( (string)$product['id'] === $last_id ) {42 if ( $product['id'] === $last_id ) { 43 43 $prod = $product; 44 44 break; … … 85 85 $tumblr = $links['tumblr']; 86 86 87 if ( !apwp_check_local_host() && !is_ssl() ) {87 if ( !apwp_check_local_host() && is_ssl() ) { 88 88 if ( apwp_fs()->is_not_paying() ) { 89 89 $repost = '</span><table style="width: 75%; margin-left: 18%;"><tr><td>' . $twit_url . '</td><td> </td><td>' . $fb_url . '</td></tr><tr><td>' . $tumblr . '</td></tr></table>'; … … 110 110 function apwp_get_social_links( $data ) 111 111 { 112 $sh_url = $data['short_url'];112 $sh_url = urlencode_deep( $data['short_url'] ); 113 113 $url = $data['url']; 114 114 $last_id = $data['last_id']; 115 $desc = $data['desc'];115 $desc = urlencode_deep( $data['desc'] ); 116 116 $image = $data['image']; 117 117 $_twit_tags = $data['_twit_tags']; … … 126 126 <div id="fb-root"></div> 127 127 <script> 128 (function(d, s, id) { 129 var js, fjs = d.getElementsByTagName(s)[0]; 130 if (d.getElementById(id)) 131 return; 128 (function(d, s, id) { 129 var js, fjs = d.getElementsByTagName(s)[0]; 130 if (d.getElementById(id)) 131 return; 132 js = d.createElement(s); 133 js.id = id; 134 js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0&appId=<?php 135 echo $val ; 136 ?>&autoLogAppEvents=1'; 137 fjs.parentNode.insertBefore(js, fjs); 138 }(document, 'script', 'facebook-jssdk')); 139 </script> 140 <script id="tumblr-js" async src="https://assets.tumblr.com/share-button.js"></script> 141 <script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script> 142 <script> 143 window.twttr = (function(d, s, id) { 144 var js, fjs = d.getElementsByTagName(s)[0], 145 t = window.twttr || {}; 146 if (d.getElementById(id)) return t; 132 147 js = d.createElement(s); 133 148 js.id = id; 134 js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.0&appId=<?php 135 echo $val ; 136 ?>&autoLogAppEvents=1'; 149 js.src = "https://platform.twitter.com/widgets.js"; 137 150 fjs.parentNode.insertBefore(js, fjs); 138 }(document, 'script', 'facebook-jssdk')); 151 152 t._e = []; 153 t.ready = function(f) { 154 t._e.push(f); 155 }; 156 157 return t; 158 }(document, "script", "twitter-wjs")); 139 159 </script> 140 141 160 <?php 142 $fb_url = '<div class="fb-share-button" data-href="' . $ sh_url . '" data-layout="button" data-size="large" data-mobile-iframe="true"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=' . urlencode_deep( $sh_url ) . '&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div>';161 $fb_url = '<div class="fb-share-button" data-href="' . $url . '" data-layout="button" data-size="large"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=' . urlencode_deep( $sh_url ) . '&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div>'; 143 162 // twitter. 144 $twit_url = '<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-size="large" data-text="' . $desc . '" data-url="' . $sh_url . '" data-hashtags="' . $_twit_tags . '" data-show-count="false">Tweet</a>';163 $twit_url = "<a href='https://twitter.com/share?ref_src=twsrc%5Etfw&text={$desc}&url={$sh_url}&hashtags={$_twit_tags}' class='twitter-share-button' data-show-count='false'>Tweet</a><script async src='https://platform.twitter.com/widgets.js' charset='utf-8'></script>"; 145 164 // Tumblr. 146 165 $tumblr = "<a class='tumblr-share-button' data-color='blue' data-notes='none' href='https://www.tumblr.com/widgets/share/tool?canonicalUrl={$url}&tags={$tum_hashtgs}&title={$title}&posttype=link&content={$sh_url}&caption={$caption}'></a>"; … … 160 179 ]; 161 180 } 162 163 /**164 * Enqueue social media scripts165 *166 * @since 1.0.0167 *168 * @return mixed169 */170 function apwp_enqueue_social_scripts()171 {172 wp_enqueue_script(173 'apwp-pinterest-script',174 'http://assets.pinterest.com/js/pinit.js#asyncload',175 [ 'jquery' ],176 APWP_VERSION,177 true178 );179 wp_enqueue_script(180 'apwp-tumblr-script',181 'https://assets.tumblr.com/share-button.js#asyncload',182 [ 'jquery' ],183 APWP_VERSION,184 true185 );186 wp_enqueue_script(187 'apwp-twitter-script',188 'https://platform.twitter.com/widgets.js#asyncload',189 [ 'jquery' ],190 APWP_VERSION,191 true192 );193 } -
auto-post-woocommerce-products/trunk/admin/includes/apwp-check-setup.php
r2124737 r2144962 67 67 68 68 if ( filter_input( INPUT_POST, 'reset_pr_tweet' ) ) { 69 apwp_set_onetime_cron( [ 'create' ]);69 apwp_set_products_array(); 70 70 } 71 71 … … 85 85 update_option( APWP_SCHEDULE_PAGE, 'pause_schedule' ); 86 86 $apwp_current_sched = 'pause_schedule'; 87 $cron->atwc_delete_schedule();87 apwp_deactivate_apwp_cron(); 88 88 } 89 89 } … … 214 214 apwp_set_onetime_cron( [ 'data' ] ); 215 215 } 216 if ( empty( get_option( 'atwc_products_post' ) ) ) {217 apwp_set_onetime_cron( [ 'rebuild' ] );218 }219 220 216 return true; 221 217 } -
auto-post-woocommerce-products/trunk/admin/includes/apwp-dashboard-widget.php
r2124737 r2144962 227 227 $cron = new Apwp_Cron_Functions(); 228 228 $_sched = wp_get_schedules(); 229 $timestamp = $cron->get_next_cron_run();229 $timestamp = wp_next_scheduled( 'auto_post_woo_prod_cron' ); 230 230 $_time_format = get_option( 'time_format' ); 231 231 $_date_format = 'd-M-Y ' . $_time_format; -
auto-post-woocommerce-products/trunk/admin/includes/apwp-debug.php
r2134375 r2144962 199 199 <?php 200 200 $this->apwp_get_reset_button(); 201 $this->apwp_display_autopost_reset(); 201 202 ?> 202 203 <a id="apwpinfo"></a> … … 320 321 global $apwp_current_sched ; 321 322 $_schedules = wp_get_schedules(); 322 323 $my_schedule = 'PAUSED'; 323 324 if ( 'pause_schedule' !== $apwp_current_sched ) { 324 $my_schedule = $_schedules[$apwp_current_sched]['display']; 325 } else { 326 $my_schedule = 'PAUSED'; 327 } 328 325 if ( in_array( $apwp_current_sched, $_schedules, true ) ) { 326 $my_schedule = $_schedules[$apwp_current_sched]['display']; 327 } 328 } 329 329 $cron = new Apwp_Cron_Functions(); 330 330 ?> … … 344 344 <td class="debug-label">Next Posting </td> 345 345 <td class="debug-data"><?php 346 echo ( $cron->get_next_cron_run() ? apwp_convert_time( $cron->get_next_cron_run() ) : 'n/a' ) ;346 echo ( wp_next_scheduled( 'auto_post_woo_prod_cron' ) ? apwp_convert_time( wp_next_scheduled( 'auto_post_woo_prod_cron' ) ) : 'n/a' ) ; 347 347 ?></td> 348 348 </tr> … … 933 933 ?> 934 934 </div><br /> 935 <div> 935 <div><span style="font-weight: bold;"> 936 936 <?php 937 937 echo $this->label->other_tabs_labels['reset-plugin-desc2'] ; 938 938 ?> 939 </ div>939 </span></div> 940 940 </div><br /> 941 941 <div style="text-align:center;"> … … 953 953 954 954 /** 955 * Undocumented function 956 * 957 * @since 1.0.0 958 * 959 * @return mixed 960 */ 961 public function apwp_display_autopost_reset() 962 { 963 global $apwp_theme ; 964 $labels = new Apwp_Labels(); 965 $ttl = get_option( 'apwp_total_products_to_tweet' ); 966 $prod_to_post = 0; 967 968 if ( get_option( 'atwc_products_post' ) ) { 969 $prod_to_post = get_option( 'atwc_products_post' ); 970 971 if ( empty($prod_to_post) ) { 972 $prod_to_post = 0; 973 apwp_set_onetime_cron( [ 'create' ] ); 974 } else { 975 $prod_to_post = count( get_option( 'atwc_products_post' ) ); 976 } 977 978 } 979 980 ?> 981 </div> 982 <div class="debug-split-container debug-instructions" style="margin-top: 5px;"> 983 <div class="qstart-heading"> 984 <?php 985 echo $labels->other_tabs_labels['current-post-data'] ; 986 ?> 987 </div> 988 <table style="width: 100%; margin-top: 3px;"> 989 <tr> 990 <td style="width: 50%; text-align: center;"> 991 <div class="other-items-clicks-green"> 992 <span class="other-numbers2"> 993 <?php 994 echo number_format_i18n( $ttl ) ; 995 ?></span></div> 996 <br /><span class="dash2"> 997 <?php 998 echo _n( 999 'Product to Tweet', 1000 'Products to Tweet', 1001 $ttl, 1002 'auto-post-woocommerce-products' 1003 ) ; 1004 ?> 1005 </span> 1006 </td> 1007 <td style="width: 50%; text-align: center;"> 1008 <div class="low-items"> 1009 <span class="other-numbers2"> 1010 <?php 1011 echo number_format_i18n( $prod_to_post ) ; 1012 ?></span></div> 1013 <br /><span class="dash2"> 1014 <?php 1015 echo $labels->other_tabs_labels['scheduled-tweet'] ; 1016 ?> 1017 </span> 1018 </td> 1019 </tr> 1020 </table> 1021 <hr /> 1022 <div class="debug-inst"> 1023 <?php 1024 echo $labels->other_tabs_labels['auto-post-desc'] ; 1025 ?> 1026 <br /><br /> 1027 <?php 1028 echo $labels->other_tabs_labels['posting-info'] ; 1029 ?> 1030 <hr /> 1031 <div class="subtitle-apwp" style="text-align: center; padding-bottom: 10px;"> 1032 <?php 1033 echo $labels->other_tabs_labels['reset-list'] ; 1034 ?> 1035 </div> 1036 <form method="post" action="admin.php?page=atwc_products_options&tab=debug" style="text-align: center;"> 1037 <button type="submit" class="<?php 1038 echo $apwp_theme ; 1039 ?> shadows-btn" value="reset_pr_tweet" id="reset_pr_tweet" name="reset_pr_tweet"> 1040 <?php 1041 echo $labels->other_tabs_labels['reset-button-txt'] ; 1042 ?></button> 1043 </form><br/> 1044 </div> 1045 </div> 1046 </div> 1047 </div> 1048 <?php 1049 } 1050 1051 /** 955 1052 * Get for displaying UNCHECKED in the list 956 1053 * … … 969 1066 * @return self 970 1067 */ 971 public function set_unchecked( string$unchecked )1068 public function set_unchecked( $unchecked ) 972 1069 { 973 1070 $this->get_unchecked = $unchecked; … … 992 1089 * @return self 993 1090 */ 994 public function set_checked( string$checked )1091 public function set_checked( $checked ) 995 1092 { 996 1093 $this->get_checked = $checked; … … 1015 1112 * @return self 1016 1113 */ 1017 public function set_false( string$false )1114 public function set_false( $false ) 1018 1115 { 1019 1116 $this->false = $false; … … 1038 1135 * @return self 1039 1136 */ 1040 public function set_true( string$true )1137 public function set_true( $true ) 1041 1138 { 1042 1139 $this->true = $true; … … 1061 1158 * @return self 1062 1159 */ 1063 public function set_ok( string$ok )1160 public function set_ok( $ok ) 1064 1161 { 1065 1162 $this->ok = $ok; … … 1084 1181 * @return self 1085 1182 */ 1086 public function set_attention( string$attention )1183 public function set_attention( $attention ) 1087 1184 { 1088 1185 $this->attention = $attention; … … 1107 1204 * @return self 1108 1205 */ 1109 public function set_error( string$error )1206 public function set_error( $error ) 1110 1207 { 1111 1208 $this->error = $error; … … 1130 1227 * @return self 1131 1228 */ 1132 public function set_no( string$no )1229 public function set_no( $no ) 1133 1230 { 1134 1231 $this->no = $no; … … 1153 1250 * @return self 1154 1251 */ 1155 public function set_yes( string$yes )1252 public function set_yes( $yes ) 1156 1253 { 1157 1254 $this->yes = $yes; -
auto-post-woocommerce-products/trunk/admin/includes/apwp-inventory-update-functions.php
r2134375 r2144962 112 112 break; 113 113 case 'create': 114 delete_transient( 'apwp_create_product_array_check');114 apwp_set_products_array(); 115 115 break; 116 116 case 'on_sale': … … 278 278 if ( !$_enabled ) { 279 279 unset( $in_que[$value['id']], $posted[$value['id']] ); 280 array_merge( $in_que ); 281 array_merge( $posted ); 280 282 continue; 281 283 } … … 301 303 302 304 } 303 $in_que = array_merge( $in_que );304 305 update_option( 'apwp_auto_post_products_list', $my_array ); 305 update_option( 'atwc_products_post', $in_que);306 update_option( 'atwc_products_post', array_merge( $in_que ) ); 306 307 update_option( 'atwc_products_posted', array_merge( $posted ) ); 307 308 set_transient( 'apwp_rebuild_product_array_check', 'x', 30 * MINUTE_IN_SECONDS ); 308 return $in_que;309 return array_merge( $in_que ); 309 310 } 310 311 … … 320 321 { 321 322 $my_products = get_transient( 'apwp_prod_list_data' ); 323 update_option( 'atwc_products_post', [] ); 324 update_option( 'atwc_products_posted', [] ); 322 325 $products_to_tweet = []; 323 326 $auto_list = []; -
auto-post-woocommerce-products/trunk/admin/includes/apwp-list-table-functions.php
r2134375 r2144962 1794 1794 * If using premium plan, get recent click data 1795 1795 * 1796 * @param int $ product_id Product ID.1796 * @param int $id Product ID. 1797 1797 * @param string $prod_type Product type. 1798 1798 * 1799 1799 * @return int 1800 1800 */ 1801 function apwp__get_recent_clicks( $product_id, $prod_type ) 1802 { 1803 $data = ''; 1804 return $data; 1805 } 1806 1807 /** 1808 * If using premium plan, get today's click data 1809 * 1810 * @param int $product_id Product ID. 1801 function apwp__get_recent_clicks( $id, $prod_type ) 1802 { 1803 if ( 'variation' === $prod_type ) { 1804 return ''; 1805 } 1806 } 1807 1808 /** 1809 * If using premium plan, get today's click data. 1810 * 1811 * @param int $id Product ID. 1811 1812 * @param string $prod_type Product type. 1812 1813 * 1813 1814 * @return int 1814 1815 */ 1815 function apwp__get_today_clicks( $product_id, $prod_type ) 1816 { 1817 $data = ''; 1818 return $data; 1816 function apwp__get_today_clicks( $id, $prod_type ) 1817 { 1818 if ( 'variation' === $prod_type ) { 1819 return ''; 1820 } 1819 1821 } 1820 1822 … … 1822 1824 * If using premium plan, get total click data 1823 1825 * 1824 * @param int $ product_id Product ID.1826 * @param int $id Product ID. 1825 1827 * @param string $prod_type Product type. 1826 1828 * 1827 1829 * @return int 1828 1830 */ 1829 function apwp__get_clicks( $product_id, $prod_type ) 1830 { 1831 $data = ''; 1832 return $data; 1831 function apwp__get_clicks( $id, $prod_type ) 1832 { 1833 if ( 'variation' === $prod_type ) { 1834 return ''; 1835 } 1833 1836 } 1834 1837 … … 1836 1839 * If using premium plan, get click data for last 30 days 1837 1840 * 1838 * @param int $ product_id Product ID.1841 * @param int $id Product ID. 1839 1842 * @param string $prod_type Product type. 1840 1843 * 1841 1844 * @return int 1842 1845 */ 1843 function apwp__get_last30_clicks( $product_id, $prod_type ) 1844 { 1845 $data = ''; 1846 return $data; 1846 function apwp__get_last30_clicks( $id, $prod_type ) 1847 { 1848 if ( 'variation' === $prod_type ) { 1849 return ''; 1850 } 1847 1851 } 1848 1852 -
auto-post-woocommerce-products/trunk/admin/includes/apwp-quick-edit.php
r2134375 r2144962 245 245 246 246 if ( !$errors ) { 247 apwp_set_onetime_cron( [ 248 'rebuild', 249 'data', 250 'on_sale', 251 'cats' 252 ] ); 247 apwp_set_onetime_cron( [ 'data', 'on_sale', 'cats' ] ); 253 248 wp_safe_redirect( $link ); 254 249 return; -
auto-post-woocommerce-products/trunk/admin/includes/class-apwp-cron-functions.php
r2134375 r2144962 29 29 { 30 30 /** 31 * Get the next time cron is scheduled32 *33 * @since 1.0.034 *35 * @return mixed Timestamp on success and DISABLED on failure.36 */37 public function get_next_cron_run()38 {39 $time_next_cron = wp_next_scheduled( 'auto_post_woo_prod_cron' );40 return $time_next_cron;41 }42 43 /**44 * Delete the cron events/schedules45 *46 * @since 1.0.047 *48 * @return void49 */50 public function atwc_delete_schedule()51 {52 $timestamp = wp_next_scheduled( 'auto_post_woo_prod_cron' );53 wp_unschedule_event( $timestamp, 'auto_post_woo_prod_cron' );54 wp_clear_scheduled_hook( 'auto_post_woo_prod_cron' );55 }56 57 /**58 31 * Update cron schedule when changes are made 59 32 * … … 68 41 $opt = get_option( APWP_SCHEDULE_PAGE ); 69 42 $apwp_current_sched = $opt; 70 $this->atwc_delete_schedule();43 \apwp_deactivate_apwp_cron(); 71 44 72 45 if ( 'pause_schedule' === $apwp_current_sched ) { … … 76 49 $next = $_sched[$apwp_current_sched]['interval']; 77 50 78 if ( ! $this->get_next_cron_run() ) {51 if ( !wp_next_scheduled( 'auto_post_woo_prod_cron' ) ) { 79 52 wp_schedule_single_event( time(), 'auto_post_woo_prod_cron', array( false ) ); 80 53 wp_schedule_event( time() + $next, $apwp_current_sched, 'auto_post_woo_prod_cron' ); … … 88 61 // Hook into WP Cron to run postings. 89 62 add_filter( 'cron_schedules', 'apwp_add_schedules' ); 90 add_action( 'auto_post_woo_prod_cron', 'apwp_run_cron' ); 63 add_action( 64 'auto_post_woo_prod_cron', 65 'apwp_run_cron', 66 10, 67 1 68 ); 91 69 /** 92 70 * For accessing and running our auto posting cron job … … 116 94 wp_unschedule_event( $timestamp, 'auto_post_woo_prod_cron' ); 117 95 wp_clear_scheduled_hook( 'auto_post_woo_prod_cron' ); 118 }119 120 /**121 * Disable Twitter auto posting122 *123 * @since 2.0.3124 *125 * @return void126 */127 function apwp_disable_twitter_auto_post()128 {129 $cron = new Apwp_Cron_Functions();130 $cron->atwc_delete_schedule();131 }132 133 /**134 * Enable Twitter auto posting135 *136 * @since 2.0.3137 *138 * @return bool139 */140 function apwp_enable_twitter_auto_post()141 {142 $click_data = new Apwp_Short_Links();143 $click_data->set_bitly_array();144 return true;145 96 } 146 97 -
auto-post-woocommerce-products/trunk/admin/includes/class-apwp-labels.php
r2134375 r2144962 142 142 private function set_quick_start_updates_array() { 143 143 $labels = [ 144 '1' => __( 'Corrected issue for the error "Call to a member function get_category_ids() on boolean". ', 'auto-post-woocommerce-products' ), 145 '2' => __( 'Corrected issue for Auto post list refreshing before all auto post products have been posted to Twitter. ', 'auto-post-woocommerce-products' ), 144 '1' => __( 'Corrected Twitter auto posting issue.', 'auto-post-woocommerce-products' ), 145 '2' => __( 'Updated to use new Bitly API v4 and corrected previous Bitly errors.', 'auto-post-woocommerce-products' ), 146 '3' => __( 'Pinterest should now show the sale price when product is on sale.', 'auto-post-woocommerce-products' ), 147 '4' => __( 'Fixed issue with "sharing buttons" not showing on the individual sharing page.', 'auto-post-woocommerce-products' ), 148 '5' => __( 'Moved the RESET AUTO POST PRODUCTS box from the categories tab to the STATUS tab.', 'auto-post-woocommerce-products' ), 146 149 147 150 ]; … … 353 356 esc_url( 354 357 'https://www.cilcreations.com/apwp/knowledgebase/settings-tab/' 355 )356 ),357 358 'additional-help-curl-link' => sprintf(359 wp_kses(360 /* translators: %s: url */ __(361 'For additional information, <a href="%s" title="https://www.cilcreations.com/apwp/knowledgebase/enable-curl-via-the-php-ini-file/" target="_blank">see this knowledge base article</a>.',362 'auto-post-woocommerce-products'363 ),364 [365 'a' =>366 [367 'href' => [],368 'target' => [],369 ],370 ]371 ),372 esc_url(373 'https://www.cilcreations.com/apwp/knowledgebase/enable-curl-via-the-php-ini-file/'374 358 ) 375 359 ), … … 1067 1051 'reset-plugin' => __( 'APWCP Reset plugin', 'auto-post-woocommerce-products' ), 1068 1052 'reset-plugin-desc1' => __( 'In the event this plugin is not functioning correctly, you may click the button below to reset certain items. The reset items will be erased and recreated, hopefully correcting your issue. Before proceeding with the reset, please clear your browser cache by pressing and holding the CTRL+SHIFT+DELETE keys on your keyboard.', 'auto-post-woocommerce-products' ), 1069 'reset-plugin-desc2' => __( 'The items to be reset will be: <em>product list temporary data files, auto posting, auto posting products list and product list view filters/settings.', 'auto-post-woocommerce-products' ),1053 'reset-plugin-desc2' => __( 'The items to be reset will be: product list temporary data files, auto posting, auto posting products list and product list view filters/settings.', 'auto-post-woocommerce-products' ), 1070 1054 'reset-plugin-sub' => __( 'Resetting plugin', 'auto-post-woocommerce-products' ), 1071 1055 'scheduled-tweet' => __( 'Scheduled to Tweet', 'auto-post-woocommerce-products' ), … … 1502 1486 'quick-start11' => __( 'Finally, click on the Schedule tab. Scroll down the page until you see the section "Set your schedule". Select how often you would like to automatically post a product to Twitter and save. You are now setup and your CRON schedule is activated! Your first auto post to Twitter has been sent.', 'auto-post-woocommerce-products' ), 1503 1487 'quick-start2' => __( 'Simply press Ctrl Shift Delete on your keyboard, holding all three buttons down to open the browser window for erasing temporary internet files. When you have the window open, make sure the option for CACHE is checked and any others you would like the browser to delete. Refresh the page and everything should look fine.', 'auto-post-woocommerce-products' ), 1504 'quick-start3' => __( 'If you are seeing the above error regarding your Apache server cURL installation, please click the link in the error box for instructions on enabling this module. This is required for auto posting to function.', 'auto-post-woocommerce-products' ),1505 1488 'quick-start4' => __( 'If this is the first time you have installed this plugin, you should be seeing the following messages on your screen:', 'auto-post-woocommerce-products' ), 1506 1489 'quick-start5' => __( 'This message is telling you to enter the Twitter and Bitly API access codes. To get your codes, click on the Settings tab, scroll to the bottom and then click on the link to create a Twitter App. If you wish to skip setting this up, you may disable the Twitter auto posting feature on the', 'auto-post-woocommerce-products' ), -
auto-post-woocommerce-products/trunk/admin/includes/class-apwp-short-links.php
r2134375 r2144962 18 18 * Includes 19 19 */ 20 require_once APWP_PLUGIN_PATH . 'src/ Bitly/bitly-new.php';20 require_once APWP_PLUGIN_PATH . 'src/bitly-api.php'; 21 21 register_deactivation_hook( __FILE__, 'apwp_deactivate_bitly_update_data' ); 22 22 register_activation_hook( __FILE__, 'apwp_activate_bitly_update_data' ); … … 34 34 { 35 35 /** 36 * Bitly access token.37 *38 * @since 2.1.2.039 *40 * @var type string41 */42 protected $bit_token = '' ;43 /**44 36 * Construct 45 37 * … … 55 47 // Prevents this from executing during testing. 56 48 } 57 58 $option = get_option( 'atwc_products_twitter_options_page' );59 $this->bit_token = $option['bitly_code'];60 61 if ( !$this->bit_token || '' === $this->bit_token ) {62 apwp_add_to_debug( 'BITLY token not found.', '<span style="color: red;">BITLY</span>' );63 return;64 }65 49 66 50 } … … 69 53 * Retrieve short url 70 54 * 71 * @since 1.0.055 * @since 2.1.4.4 72 56 * @param string $url Product url. 73 57 * … … 76 60 public function bitly_get_short_url( $url ) 77 61 { 78 79 if ( apwp_check_local_host() ) { 80 return ''; 81 // Prevents this from executing during testing. 82 } 83 84 $s_url = $this->bitly_url_shorten( $url, $this->bit_token ); 62 $bitly_api = new APWP_BITLY_API(); 63 $s_url = $bitly_api->apwp_get_bitly_link( $url ); 85 64 $sh_url = trim( $s_url ); 86 87 if ( 'empty' === $s_url ) {88 apwp_add_to_debug( 'BITLY DID NOT RETURN A PROPER RESPONSE.', '<span style="color: red;">BITLY</span>' );89 $sh_url = '';90 // If bitly error then use the full url.91 }92 93 94 if ( 'no_token' === $s_url ) {95 apwp_add_to_debug( 'BITLY token not found.', '<span style="color: red;">BITLY</span>' );96 $sh_url = '';97 }98 99 65 return $sh_url; 100 }101 102 /**103 * Shorten long url with Bitly.104 *105 * @since 1.0.0106 *107 * @param string $long_url Product long url.108 *109 * @return string short url Product Bitly link.110 */111 public function bitly_url_shorten( $long_url )112 {113 114 if ( apwp_check_local_host() ) {115 return;116 // Prevents this from executing during testing.117 }118 119 $result = [];120 $bitly = new Bitly2( null, null, $this->bit_token );121 // Create new Bitly API client.122 $result = $bitly->shorten( $long_url );123 if ( isset( $result['data'] ) ) {124 apwp_add_to_debug( $result['data'], '<span style="color: chocolate;">BITLY</span>' );125 }126 127 if ( isset( $result ) ) {128 return $result['url'];129 } else {130 return 'empty';131 }132 133 66 } 134 67 -
auto-post-woocommerce-products/trunk/admin/includes/display-quick-start-tab.php
r2121574 r2144962 14 14 * Created Tuesday, Jun-18-2019 at 02:01:12 15 15 */ 16 16 require_once APWP_PLUGIN_PATH . 'src/bitly-api.php'; 17 17 /** 18 18 * Quick start tab … … 96 96 </p> 97 97 <p class="apwp-para"> 98 <div style="text-align: center;">99 <img alt="" class="apwp-setup" src="<?php echo $img_pth . 'error4.png'; ?>" />100 </div>101 98 <a id="twitter"></a> 102 <p class="apwp-para">103 <?php104 echo $label->product_list_labels['quick-start3'] . ' ';105 echo $label->link_labels['additional-help-curl-link'];106 ?>107 </p>108 109 99 <p class="apwp-quick-start-sub">>> 110 100 <?php -
auto-post-woocommerce-products/trunk/admin/src/Twitter/OAuth.php
r1900832 r2144962 23 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 24 THE SOFTWARE. 25 */25 */ 26 26 27 27 /* Generic exception class 28 28 */ 29 class Twitter_OAuthException extends Exception 30 { 29 class Twitter_OAuthException extends Exception { 31 30 // pass 32 31 } 33 32 34 class Twitter_OAuthConsumer 35 { 33 class Twitter_OAuthConsumer { 34 /** 35 * @var mixed 36 */ 36 37 public $key; 38 /** 39 * @var mixed 40 */ 37 41 public $secret; 38 42 39 40 public function __construct($key, $secret, $callback_url = null) 41 { 42 $this->key = $key; 43 $this->secret = $secret; 43 /** 44 * @param $key 45 * @param $secret 46 * @param $callback_url 47 */ 48 public function __construct( $key, $secret, $callback_url = null ) { 49 $this->key = $key; 50 $this->secret = $secret; 44 51 $this->callback_url = $callback_url; 45 52 } 46 53 47 48 public function __toString() 49 { 54 public function __toString() { 50 55 return "OAuthConsumer[key=$this->key,secret=$this->secret]"; 51 56 } 52 57 } 53 58 54 class Twitter_OAuthToken 55 { 59 class Twitter_OAuthToken { 56 60 // access tokens and request tokens 61 /** 62 * @var mixed 63 */ 57 64 public $key; 65 /** 66 * @var mixed 67 */ 58 68 public $secret; 59 60 69 61 70 /** … … 63 72 * secret = the token secret 64 73 */ 65 public function __construct($key, $secret) 66 { 67 $this->key = $key; 74 public function __construct( $key, $secret ) { 75 $this->key = $key; 68 76 $this->secret = $secret; 69 77 } 70 71 78 72 79 /** … … 74 81 * would respond to request_token and access_token calls with 75 82 */ 76 public function to_string() 77 { 83 public function to_string() { 78 84 return 'oauth_token=' . 79 Twitter_OAuthUtil::urlencode_rfc3986($this->key) . 80 '&oauth_token_secret=' . 81 Twitter_OAuthUtil::urlencode_rfc3986($this->secret); 82 } 83 84 85 public function __toString() 86 { 85 Twitter_OAuthUtil::urlencode_rfc3986( $this->key ) . 86 '&oauth_token_secret=' . 87 Twitter_OAuthUtil::urlencode_rfc3986( $this->secret ); 88 } 89 90 /** 91 * @return mixed 92 */ 93 public function __toString() { 87 94 return $this->to_string(); 88 95 } … … 93 100 * See section 9 ("Signing Requests") in the spec 94 101 */ 95 abstract class Twitter_OAuthSignatureMethod 96 { 102 abstract class Twitter_OAuthSignatureMethod { 97 103 /** 98 104 * Needs to return the name of the Signature Method (ie HMAC-SHA1) … … 100 106 */ 101 107 abstract public function get_name(); 102 103 108 104 109 /** … … 112 117 * @return string 113 118 */ 114 abstract public function build_signature($request, $consumer, $token); 115 119 abstract public function build_signature( $request, $consumer, $token ); 116 120 117 121 /** … … 123 127 * @return bool 124 128 */ 125 public function check_signature( $request, $consumer, $token, $signature)126 {127 $built = $this->build_signature($request, $consumer, $token); 129 public function check_signature( $request, $consumer, $token, $signature ) { 130 $built = $this->build_signature( $request, $consumer, $token ); 131 128 132 return $built == $signature; 129 133 } … … 137 141 * - Chapter 9.2 ("HMAC-SHA1") 138 142 */ 139 class Twitter_OAuthSignatureMethod_HMAC_SHA1 extends Twitter_OAuthSignatureMethod 140 { 141 public function get_name() 142 { 143 class Twitter_OAuthSignatureMethod_HMAC_SHA1 extends Twitter_OAuthSignatureMethod { 144 public function get_name() { 143 145 return 'HMAC-SHA1'; 144 146 } 145 147 146 147 public function build_signature($request, $consumer, $token) 148 { 149 $base_string = $request->get_signature_base_string(); 148 /** 149 * @param $request 150 * @param $consumer 151 * @param $token 152 */ 153 public function build_signature( $request, $consumer, $token ) { 154 $base_string = $request->get_signature_base_string(); 150 155 $request->base_string = $base_string; 151 156 152 157 $key_parts = [ 153 158 $consumer->secret, 154 ( $token) ? $token->secret : '',159 ( $token ) ? $token->secret : '', 155 160 ]; 156 161 157 $key_parts = Twitter_OAuthUtil::urlencode_rfc3986( $key_parts);158 $key = implode('&', $key_parts);159 160 return base64_encode( hash_hmac('sha1', $base_string, $key, true));162 $key_parts = Twitter_OAuthUtil::urlencode_rfc3986( $key_parts ); 163 $key = implode( '&', $key_parts ); 164 165 return base64_encode( hash_hmac( 'sha1', $base_string, $key, true ) ); 161 166 } 162 167 } … … 167 172 * - Chapter 9.4 ("PLAINTEXT") 168 173 */ 169 class Twitter_OAuthSignatureMethod_PLAINTEXT extends Twitter_OAuthSignatureMethod 170 { 171 public function get_name() 172 { 174 class Twitter_OAuthSignatureMethod_PLAINTEXT extends Twitter_OAuthSignatureMethod { 175 public function get_name() { 173 176 return 'PLAINTEXT'; 174 177 } 175 176 178 177 179 /** … … 184 186 * OAuthRequest handles this! 185 187 */ 186 public function build_signature($request, $consumer, $token) 187 { 188 public function build_signature( $request, $consumer, $token ) { 188 189 $key_parts = [ 189 190 $consumer->secret, 190 ( $token) ? $token->secret : '',191 ( $token ) ? $token->secret : '', 191 192 ]; 192 193 193 $key_parts = Twitter_OAuthUtil::urlencode_rfc3986($key_parts);194 $key = implode('&', $key_parts);194 $key_parts = Twitter_OAuthUtil::urlencode_rfc3986( $key_parts ); 195 $key = implode( '&', $key_parts ); 195 196 $request->base_string = $key; 196 197 … … 207 208 * - Chapter 9.3 ("RSA-SHA1") 208 209 */ 209 abstract class Twitter_OAuthSignatureMethod_RSA_SHA1 extends Twitter_OAuthSignatureMethod 210 { 211 public function get_name() 212 { 210 abstract class Twitter_OAuthSignatureMethod_RSA_SHA1 extends Twitter_OAuthSignatureMethod { 211 public function get_name() { 213 212 return 'RSA-SHA1'; 214 213 } 215 216 214 217 215 // Up to the SP to implement this lookup of keys. Possible ideas are: … … 221 219 // 222 220 // Either way should return a string representation of the certificate 223 abstract protected function fetch_public_cert(&$request); 224 221 /** 222 * @param $request 223 */ 224 abstract protected function fetch_public_cert( &$request ); 225 225 226 226 // Up to the SP to implement this lookup of keys. Possible ideas are: … … 228 228 // 229 229 // Either way should return a string representation of the certificate 230 abstract protected function fetch_private_cert(&$request); 231 232 233 public function build_signature($request, $consumer, $token) 234 { 230 /** 231 * @param $request 232 */ 233 abstract protected function fetch_private_cert( &$request ); 234 235 /** 236 * @param $request 237 * @param $consumer 238 * @param $token 239 */ 240 public function build_signature( $request, $consumer, $token ) { 241 $base_string = $request->get_signature_base_string(); 242 $request->base_string = $base_string; 243 244 // Fetch the private key cert based on the request 245 $cert = $this->fetch_private_cert( $request ); 246 247 // Pull the private key ID from the certificate 248 $privatekeyid = openssl_get_privatekey( $cert ); 249 250 // Sign using the key 251 $ok = openssl_sign( $base_string, $signature, $privatekeyid ); 252 253 // Release the key resource 254 openssl_free_key( $privatekeyid ); 255 256 return base64_encode( $signature ); 257 } 258 259 /** 260 * @param $request 261 * @param $consumer 262 * @param $token 263 * @param $signature 264 * @return mixed 265 */ 266 public function check_signature( $request, $consumer, $token, $signature ) { 267 $decoded_sig = base64_decode( $signature, true ); 268 235 269 $base_string = $request->get_signature_base_string(); 236 $request->base_string = $base_string; 237 238 // Fetch the private key cert based on the request 239 $cert = $this->fetch_private_cert($request); 240 241 // Pull the private key ID from the certificate 242 $privatekeyid = openssl_get_privatekey($cert); 243 244 // Sign using the key 245 $ok = openssl_sign($base_string, $signature, $privatekeyid); 270 271 // Fetch the public key cert based on the request 272 $cert = $this->fetch_public_cert( $request ); 273 274 // Pull the public key ID from the certificate 275 $publickeyid = openssl_get_publickey( $cert ); 276 277 // Check the computed signature against the one passed in the query 278 $ok = openssl_verify( $base_string, $decoded_sig, $publickeyid ); 246 279 247 280 // Release the key resource 248 openssl_free_key($privatekeyid); 249 250 return base64_encode($signature); 251 } 252 253 254 public function check_signature($request, $consumer, $token, $signature) 255 { 256 $decoded_sig = base64_decode($signature, true); 257 258 $base_string = $request->get_signature_base_string(); 259 260 // Fetch the public key cert based on the request 261 $cert = $this->fetch_public_cert($request); 262 263 // Pull the public key ID from the certificate 264 $publickeyid = openssl_get_publickey($cert); 265 266 // Check the computed signature against the one passed in the query 267 $ok = openssl_verify($base_string, $decoded_sig, $publickeyid); 268 269 // Release the key resource 270 openssl_free_key($publickeyid); 271 272 return $ok == 1; 281 openssl_free_key( $publickeyid ); 282 283 return 1 == $ok; 273 284 } 274 285 } 275 286 276 class Twitter_OAuthRequest 277 { 287 class Twitter_OAuthRequest { 278 288 // for debug purposes 289 /** 290 * @var mixed 291 */ 279 292 public $base_string; 293 /** 294 * @var string 295 */ 280 296 public static $version = '1.0'; 297 /** 298 * @var string 299 */ 281 300 public static $POST_INPUT = 'php://input'; 301 /** 302 * @var mixed 303 */ 282 304 protected $parameters; 305 /** 306 * @var mixed 307 */ 283 308 protected $http_method; 309 /** 310 * @var mixed 311 */ 284 312 protected $http_url; 285 313 286 287 public function __construct($http_method, $http_url, $parameters = null) 288 { 289 $parameters = ($parameters) ? $parameters : []; 290 $parameters = array_merge(Twitter_OAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters); 291 $this->parameters = $parameters; 314 /** 315 * @param $http_method 316 * @param $http_url 317 * @param $parameters 318 */ 319 public function __construct( $http_method, $http_url, $parameters = null ) { 320 $parameters = ( $parameters ) ? $parameters : []; 321 $parameters = array_merge( Twitter_OAuthUtil::parse_parameters( parse_url( $http_url, PHP_URL_QUERY ) ), $parameters ); 322 $this->parameters = $parameters; 292 323 $this->http_method = $http_method; 293 $this->http_url = $http_url; 294 } 295 324 $this->http_url = $http_url; 325 } 296 326 297 327 /** 298 328 * attempt to build up a request from what was passed to the server 299 329 */ 300 public static function from_request($http_method = null, $http_url = null, $parameters = null) 301 { 302 $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') 303 ? 'http' 304 : 'https'; 305 $http_url = ($http_url) ? $http_url : $scheme . 306 '://' . $_SERVER['HTTP_HOST'] . 307 ':' . 308 $_SERVER['SERVER_PORT'] . 309 $_SERVER['REQUEST_URI']; 310 $http_method = ($http_method) ? $http_method : $_SERVER['REQUEST_METHOD']; 330 public static function from_request( $http_method = null, $http_url = null, $parameters = null ) { 331 $scheme = ( ! isset( $_SERVER['HTTPS'] ) || 'on' != $_SERVER['HTTPS'] ) 332 ? 'http' 333 : 'https'; 334 $http_url = ( $http_url ) ? $http_url : $scheme . 335 '://' . $_SERVER['HTTP_HOST'] . 336 ':' . 337 $_SERVER['SERVER_PORT'] . 338 $_SERVER['REQUEST_URI']; 339 $http_method = ( $http_method ) ? $http_method : $_SERVER['REQUEST_METHOD']; 311 340 312 341 // We weren't handed any parameters, so let's find the ones relevant to … … 314 343 // If you run XML-RPC or similar you should use this to provide your own 315 344 // parsed parameter-list 316 if ( !$parameters) {345 if ( ! $parameters ) { 317 346 // Find request headers 318 347 $request_headers = Twitter_OAuthUtil::get_headers(); 319 348 320 349 // Parse the query-string to find GET parameters 321 $parameters = Twitter_OAuthUtil::parse_parameters( $_SERVER['QUERY_STRING']);350 $parameters = Twitter_OAuthUtil::parse_parameters( $_SERVER['QUERY_STRING'] ); 322 351 323 352 // It's a POST request of the proper content-type, so parse POST 324 353 // parameters and add those overriding any duplicates from GET 325 if ($http_method == 'POST' 326 && isset($request_headers['Content-Type']) 327 && strstr($request_headers['Content-Type'], 328 'application/x-www-form-urlencoded') 329 ) { 354 if ( 'POST' == $http_method && isset( $request_headers['Content-Type'] ) 355 && strstr( $request_headers['Content-Type'], 356 'application/x-www-form-urlencoded' ) 357 ) { 330 358 $post_data = Twitter_OAuthUtil::parse_parameters( 331 file_get_contents( self::$POST_INPUT)359 file_get_contents( self::$POST_INPUT ) 332 360 ); 333 $parameters = array_merge( $parameters, $post_data);361 $parameters = array_merge( $parameters, $post_data ); 334 362 } 335 363 336 364 // We have a Authorization-header with OAuth data. Parse the header 337 365 // and add those overriding any duplicates from GET or POST 338 if ( isset($request_headers['Authorization']) && substr($request_headers['Authorization'], 0, 6) == 'OAuth ') {366 if ( isset( $request_headers['Authorization'] ) && substr( $request_headers['Authorization'], 0, 6 ) == 'OAuth ' ) { 339 367 $header_parameters = Twitter_OAuthUtil::split_header( 340 368 $request_headers['Authorization'] 341 369 ); 342 $parameters = array_merge($parameters, $header_parameters); 343 } 344 } 345 346 return new self($http_method, $http_url, $parameters); 347 } 348 370 $parameters = array_merge( $parameters, $header_parameters ); 371 } 372 } 373 374 return new self( $http_method, $http_url, $parameters ); 375 } 349 376 350 377 /** 351 378 * pretty much a helper function to set up the request 352 379 */ 353 public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = null) 354 { 355 $parameters = ($parameters) ? $parameters : []; 356 $defaults = ['oauth_version' => self::$version, 357 'oauth_nonce' => self::generate_nonce(), 358 'oauth_timestamp' => self::generate_timestamp(), 359 'oauth_consumer_key' => $consumer->key, ]; 360 if ($token) { 380 public static function from_consumer_and_token( $consumer, $token, $http_method, $http_url, $parameters = null ) { 381 $parameters = ( $parameters ) ? $parameters : []; 382 $defaults = ['oauth_version' => self::$version, 383 'oauth_nonce' => self::generate_nonce(), 384 'oauth_timestamp' => self::generate_timestamp(), 385 'oauth_consumer_key' => $consumer->key]; 386 if ( $token ) { 361 387 $defaults['oauth_token'] = $token->key; 362 388 } 363 389 364 $parameters = array_merge($defaults, $parameters); 365 366 return new self($http_method, $http_url, $parameters); 367 } 368 369 370 public function set_parameter($name, $value, $allow_duplicates = true) 371 { 372 if ($allow_duplicates && isset($this->parameters[$name])) { 390 $parameters = array_merge( $defaults, $parameters ); 391 392 return new self( $http_method, $http_url, $parameters ); 393 } 394 395 /** 396 * @param $name 397 * @param $value 398 * @param $allow_duplicates 399 */ 400 public function set_parameter( $name, $value, $allow_duplicates = true ) { 401 if ( $allow_duplicates && isset( $this->parameters[$name] ) ) { 373 402 // We have already added parameter(s) with this name, so add to the list 374 if ( is_scalar($this->parameters[$name])) {403 if ( is_scalar( $this->parameters[$name] ) ) { 375 404 // This is the first duplicate, so transform scalar (string) 376 405 // into an array so we can add the duplicates … … 384 413 } 385 414 386 387 public function get_parameter($name) 388 { 389 return isset($this->parameters[$name]) ? $this->parameters[$name] : null; 390 } 391 392 393 public function get_parameters() 394 { 415 /** 416 * @param $name 417 */ 418 public function get_parameter( $name ) { 419 return isset( $this->parameters[$name] ) ? $this->parameters[$name] : null; 420 } 421 422 /** 423 * @return mixed 424 */ 425 public function get_parameters() { 395 426 return $this->parameters; 396 427 } 397 428 398 399 public function unset_parameter($name)400 {401 unset($this->parameters[$name]);402 }403 429 /** 430 * @param $name 431 */ 432 public function unset_parameter( $name ) { 433 unset( $this->parameters[$name] ); 434 } 404 435 405 436 /** … … 407 438 * @return string 408 439 */ 409 public function get_signable_parameters() 410 { 440 public function get_signable_parameters() { 411 441 // Grab all parameters 412 442 $params = $this->parameters; … … 414 444 // Remove oauth_signature if present 415 445 // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.") 416 if (isset($params['oauth_signature'])) { 417 unset($params['oauth_signature']); 418 } 419 420 return Twitter_OAuthUtil::build_http_query($params); 421 } 422 446 if ( isset( $params['oauth_signature'] ) ) { 447 unset( $params['oauth_signature'] ); 448 } 449 450 return Twitter_OAuthUtil::build_http_query( $params ); 451 } 423 452 424 453 /** … … 429 458 * and the concated with &. 430 459 */ 431 public function get_signature_base_string() 432 { 460 public function get_signature_base_string() { 433 461 $parts = [ 434 462 $this->get_normalized_http_method(), … … 437 465 ]; 438 466 439 $parts = Twitter_OAuthUtil::urlencode_rfc3986($parts); 440 441 return implode('&', $parts); 442 } 443 467 $parts = Twitter_OAuthUtil::urlencode_rfc3986( $parts ); 468 469 return implode( '&', $parts ); 470 } 444 471 445 472 /** 446 473 * just uppercases the http method 447 474 */ 448 public function get_normalized_http_method() 449 { 450 return strtoupper($this->http_method); 451 } 452 475 public function get_normalized_http_method() { 476 return strtoupper( $this->http_method ); 477 } 453 478 454 479 /** … … 456 481 * scheme://host/path 457 482 */ 458 public function get_normalized_http_url() 459 { 460 $parts = parse_url($this->http_url); 461 462 $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http'; 463 $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80'); 464 $host = (isset($parts['host'])) ? $parts['host'] : ''; 465 $path = (isset($parts['path'])) ? $parts['path'] : ''; 466 467 if (($scheme == 'https' && $port != '443') 468 || ($scheme == 'http' && $port != '80')) { 483 public function get_normalized_http_url() { 484 $parts = parse_url( $this->http_url ); 485 486 $scheme = ( isset( $parts['scheme'] ) ) ? $parts['scheme'] : 'http'; 487 $port = ( isset( $parts['port'] ) ) ? $parts['port'] : ( ( 'https' == $scheme ) ? '443' : '80' ); 488 $host = ( isset( $parts['host'] ) ) ? $parts['host'] : ''; 489 $path = ( isset( $parts['path'] ) ) ? $parts['path'] : ''; 490 491 if ( ( 'https' == $scheme && '443' != $port ) 492 || ( 'http' == $scheme && '80' != $port ) ) { 469 493 $host = "$host:$port"; 470 494 } 495 471 496 return "$scheme://$host$path"; 472 497 } 473 498 474 475 499 /** 476 500 * builds a url usable for a GET request 477 501 */ 478 public function to_url() 479 { 502 public function to_url() { 480 503 $post_data = $this->to_postdata(); 481 $out = $this->get_normalized_http_url();482 if ( $post_data) {504 $out = $this->get_normalized_http_url(); 505 if ( $post_data ) { 483 506 $out .= '?' . $post_data; 484 507 } 508 485 509 return $out; 486 510 } 487 511 488 489 512 /** 490 513 * builds the data one would send in a POST request 491 514 */ 492 public function to_postdata() 493 { 494 return Twitter_OAuthUtil::build_http_query($this->parameters); 495 } 496 515 public function to_postdata() { 516 return Twitter_OAuthUtil::build_http_query( $this->parameters ); 517 } 497 518 498 519 /** 499 520 * builds the Authorization: header 500 521 */ 501 public function to_header($realm = null) 502 { 522 public function to_header( $realm = null ) { 503 523 $first = true; 504 if ( $realm) {505 $out = 'Authorization: OAuth realm="' . Twitter_OAuthUtil::urlencode_rfc3986($realm) . '"';524 if ( $realm ) { 525 $out = 'Authorization: OAuth realm="' . Twitter_OAuthUtil::urlencode_rfc3986( $realm ) . '"'; 506 526 $first = false; 507 527 } else { … … 510 530 511 531 $total = []; 512 foreach ( $this->parameters as $k => $v) {513 if ( substr($k, 0, 5) != 'oauth') {532 foreach ( $this->parameters as $k => $v ) { 533 if ( substr( $k, 0, 5 ) != 'oauth' ) { 514 534 continue; 515 535 } 516 if ( is_array($v)) {517 throw new Twitter_OAuthException( 'Arrays not supported in headers');518 } 519 $out .= ( $first) ? ' ' : ',';520 $out .= Twitter_OAuthUtil::urlencode_rfc3986( $k) .521 '="' .522 Twitter_OAuthUtil::urlencode_rfc3986($v) .523 '"';536 if ( is_array( $v ) ) { 537 throw new Twitter_OAuthException( 'Arrays not supported in headers' ); 538 } 539 $out .= ( $first ) ? ' ' : ','; 540 $out .= Twitter_OAuthUtil::urlencode_rfc3986( $k ) . 541 '="' . 542 Twitter_OAuthUtil::urlencode_rfc3986( $v ) . 543 '"'; 524 544 $first = false; 525 545 } 546 526 547 return $out; 527 548 } 528 549 529 530 public function __toString() 531 { 550 /** 551 * @return mixed 552 */ 553 public function __toString() { 532 554 return $this->to_url(); 533 555 } 534 556 535 536 public function sign_request($signature_method, $consumer, $token) 537 { 557 /** 558 * @param $signature_method 559 * @param $consumer 560 * @param $token 561 */ 562 public function sign_request( $signature_method, $consumer, $token ) { 538 563 $this->set_parameter( 539 564 'oauth_signature_method', … … 541 566 false 542 567 ); 543 $signature = $this->build_signature($signature_method, $consumer, $token); 544 $this->set_parameter('oauth_signature', $signature, false); 545 } 546 547 548 public function build_signature($signature_method, $consumer, $token) 549 { 550 $signature = $signature_method->build_signature($this, $consumer, $token); 568 $signature = $this->build_signature( $signature_method, $consumer, $token ); 569 $this->set_parameter( 'oauth_signature', $signature, false ); 570 } 571 572 /** 573 * @param $signature_method 574 * @param $consumer 575 * @param $token 576 * @return mixed 577 */ 578 public function build_signature( $signature_method, $consumer, $token ) { 579 $signature = $signature_method->build_signature( $this, $consumer, $token ); 580 551 581 return $signature; 552 582 } 553 583 554 555 584 /** 556 585 * util function: current timestamp 557 586 */ 558 private static function generate_timestamp() 559 { 587 private static function generate_timestamp() { 560 588 return time(); 561 589 } 562 590 563 564 591 /** 565 592 * util function: current nonce 566 593 */ 567 private static function generate_nonce() 568 { 569 $mt = microtime(); 594 private static function generate_nonce() { 595 $mt = microtime(); 570 596 $rand = mt_rand(); 571 597 572 return md5( $mt . $rand); // md5s look nicer than numbers598 return md5( $mt . $rand ); // md5s look nicer than numbers 573 599 } 574 600 } 575 601 576 class Twitter_OAuthServer 577 { 602 class Twitter_OAuthServer { 603 /** 604 * @var int 605 */ 578 606 protected $timestamp_threshold = 300; // in seconds, five minutes 579 protected $version = '1.0'; // hi blaine 607 /** 608 * @var string 609 */ 610 protected $version = '1.0'; // hi blaine 611 /** 612 * @var array 613 */ 580 614 protected $signature_methods = []; 581 615 616 /** 617 * @var mixed 618 */ 582 619 protected $data_store; 583 620 584 585 public function __construct($data_store) 586 { 621 /** 622 * @param $data_store 623 */ 624 public function __construct( $data_store ) { 587 625 $this->data_store = $data_store; 588 626 } 589 627 590 591 public function add_signature_method($signature_method) 592 { 628 /** 629 * @param $signature_method 630 */ 631 public function add_signature_method( $signature_method ) { 593 632 $this->signature_methods[$signature_method->get_name()] = 594 633 $signature_method; 595 634 } 596 635 597 598 636 // high level functions 599 600 637 601 638 /** … … 603 640 * returns the request token on success 604 641 */ 605 public function fetch_request_token(&$request) 606 { 607 $this->get_version($request); 608 609 $consumer = $this->get_consumer($request); 642 public function fetch_request_token( &$request ) { 643 $this->get_version( $request ); 644 645 $consumer = $this->get_consumer( $request ); 610 646 611 647 // no token required for the initial token request 612 648 $token = null; 613 649 614 $this->check_signature( $request, $consumer, $token);650 $this->check_signature( $request, $consumer, $token ); 615 651 616 652 // Rev A change 617 $callback = $request->get_parameter('oauth_callback');618 $new_token = $this->data_store->new_request_token( $consumer, $callback);653 $callback = $request->get_parameter( 'oauth_callback' ); 654 $new_token = $this->data_store->new_request_token( $consumer, $callback ); 619 655 620 656 return $new_token; 621 657 } 622 623 658 624 659 /** … … 626 661 * returns the access token on success 627 662 */ 628 public function fetch_access_token(&$request) 629 { 630 $this->get_version($request); 631 632 $consumer = $this->get_consumer($request); 663 public function fetch_access_token( &$request ) { 664 $this->get_version( $request ); 665 666 $consumer = $this->get_consumer( $request ); 633 667 634 668 // requires authorized request token 635 $token = $this->get_token( $request, $consumer, 'request');636 637 $this->check_signature( $request, $consumer, $token);669 $token = $this->get_token( $request, $consumer, 'request' ); 670 671 $this->check_signature( $request, $consumer, $token ); 638 672 639 673 // Rev A change 640 $verifier = $request->get_parameter('oauth_verifier');641 $new_token = $this->data_store->new_access_token( $token, $consumer, $verifier);674 $verifier = $request->get_parameter( 'oauth_verifier' ); 675 $new_token = $this->data_store->new_access_token( $token, $consumer, $verifier ); 642 676 643 677 return $new_token; 644 678 } 645 679 646 647 680 /** 648 681 * verify an api call, checks all the parameters 649 682 */ 650 public function verify_request( &$request)651 {652 $ this->get_version($request);653 $ consumer = $this->get_consumer($request);654 $t oken = $this->get_token($request, $consumer, 'access');655 $this->check_signature($request, $consumer, $token); 683 public function verify_request( &$request ) { 684 $this->get_version( $request ); 685 $consumer = $this->get_consumer( $request ); 686 $token = $this->get_token( $request, $consumer, 'access' ); 687 $this->check_signature( $request, $consumer, $token ); 688 656 689 return [$consumer, $token]; 657 690 } 658 691 659 660 692 // Internals from here 661 662 693 663 694 /** 664 * version 1 665 */ 666 private function get_version(&$request) 667 { 668 $version = $request->get_parameter('oauth_version'); 669 if (!$version) { 695 * version 1 696 */ 697 private function get_version( &$request ) { 698 $version = $request->get_parameter( 'oauth_version' ); 699 if ( ! $version ) { 670 700 // Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present. 671 701 // Chapter 7.0 ("Accessing Protected Ressources") 672 702 $version = '1.0'; 673 703 } 674 if ($version !== $this->version) { 675 throw new Twitter_OAuthException("OAuth version '$version' not supported"); 676 } 704 if ( $version !== $this->version ) { 705 throw new Twitter_OAuthException( "OAuth version '$version' not supported" ); 706 } 707 677 708 return $version; 678 709 } 679 710 680 681 711 /** 682 712 * figure out the signature with some defaults 683 713 */ 684 private function get_signature_method($request) 685 { 714 private function get_signature_method( $request ) { 686 715 $signature_method = $request instanceof Twitter_OAuthRequest 687 ? $request->get_parameter('oauth_signature_method')688 : null;689 690 if ( !$signature_method) {716 ? $request->get_parameter( 'oauth_signature_method' ) 717 : null; 718 719 if ( ! $signature_method ) { 691 720 // According to chapter 7 ("Accessing Protected Ressources") the signature-method 692 721 // parameter is required, and we can't just fallback to PLAINTEXT 693 throw new Twitter_OAuthException( 'No signature method parameter. This parameter is required');694 } 695 696 if ( !in_array($signature_method,697 array_keys($this->signature_methods), true)) {722 throw new Twitter_OAuthException( 'No signature method parameter. This parameter is required' ); 723 } 724 725 if ( ! in_array( $signature_method, 726 array_keys( $this->signature_methods ), true ) ) { 698 727 throw new Twitter_OAuthException( 699 728 "Signature method '$signature_method' not supported " . 700 729 'try one of the following: ' . 701 implode( ', ', array_keys($this->signature_methods))730 implode( ', ', array_keys( $this->signature_methods ) ) 702 731 ); 703 732 } 733 704 734 return $this->signature_methods[$signature_method]; 705 735 } 706 736 707 708 737 /** 709 738 * try to find the consumer for the provided request's consumer key 710 739 */ 711 private function get_consumer($request) 712 { 740 private function get_consumer( $request ) { 713 741 $consumer_key = $request instanceof Twitter_OAuthRequest 714 ? $request->get_parameter('oauth_consumer_key')715 : null;716 717 if ( !$consumer_key) {718 throw new Twitter_OAuthException( 'Invalid consumer key');719 } 720 721 $consumer = $this->data_store->lookup_consumer( $consumer_key);722 if ( !$consumer) {723 throw new Twitter_OAuthException( 'Invalid consumer');742 ? $request->get_parameter( 'oauth_consumer_key' ) 743 : null; 744 745 if ( ! $consumer_key ) { 746 throw new Twitter_OAuthException( 'Invalid consumer key' ); 747 } 748 749 $consumer = $this->data_store->lookup_consumer( $consumer_key ); 750 if ( ! $consumer ) { 751 throw new Twitter_OAuthException( 'Invalid consumer' ); 724 752 } 725 753 … … 727 755 } 728 756 729 730 757 /** 731 758 * try to find the token for the provided request's token key 732 759 */ 733 private function get_token($request, $consumer, $token_type = 'access') 734 { 760 private function get_token( $request, $consumer, $token_type = 'access' ) { 735 761 $token_field = $request instanceof Twitter_OAuthRequest 736 ? $request->get_parameter('oauth_token')737 : null;762 ? $request->get_parameter( 'oauth_token' ) 763 : null; 738 764 739 765 $token = $this->data_store->lookup_token( 740 766 $consumer, $token_type, $token_field 741 767 ); 742 if (!$token) { 743 throw new Twitter_OAuthException("Invalid $token_type token: $token_field"); 744 } 768 if ( ! $token ) { 769 throw new Twitter_OAuthException( "Invalid $token_type token: $token_field" ); 770 } 771 745 772 return $token; 746 773 } 747 748 774 749 775 /** … … 751 777 * should guess the signature method appropriately 752 778 */ 753 private function check_signature($request, $consumer, $token) 754 { 779 private function check_signature( $request, $consumer, $token ) { 755 780 // this should probably be in a different method 756 781 $timestamp = $request instanceof Twitter_OAuthRequest 757 ? $request->get_parameter('oauth_timestamp')758 : null;782 ? $request->get_parameter( 'oauth_timestamp' ) 783 : null; 759 784 $nonce = $request instanceof Twitter_OAuthRequest 760 ? $request->get_parameter('oauth_nonce')761 : null;762 763 $this->check_timestamp( $timestamp);764 $this->check_nonce( $consumer, $token, $nonce, $timestamp);765 766 $signature_method = $this->get_signature_method( $request);767 768 $signature = $request->get_parameter( 'oauth_signature');785 ? $request->get_parameter( 'oauth_nonce' ) 786 : null; 787 788 $this->check_timestamp( $timestamp ); 789 $this->check_nonce( $consumer, $token, $nonce, $timestamp ); 790 791 $signature_method = $this->get_signature_method( $request ); 792 793 $signature = $request->get_parameter( 'oauth_signature' ); 769 794 $valid_sig = $signature_method->check_signature( 770 795 $request, … … 774 799 ); 775 800 776 if (!$valid_sig) { 777 throw new Twitter_OAuthException('Invalid signature'); 778 } 779 } 780 801 if ( ! $valid_sig ) { 802 throw new Twitter_OAuthException( 'Invalid signature' ); 803 } 804 } 781 805 782 806 /** 783 807 * check that the timestamp is new enough 784 808 */ 785 private function check_timestamp($timestamp) 786 { 787 if (!$timestamp) { 809 private function check_timestamp( $timestamp ) { 810 if ( ! $timestamp ) { 788 811 throw new Twitter_OAuthException( 789 812 'Missing timestamp parameter. The parameter is required' … … 793 816 // verify that timestamp is recentish 794 817 $now = time(); 795 if ( abs($now - $timestamp) > $this->timestamp_threshold) {818 if ( abs( $now - $timestamp ) > $this->timestamp_threshold ) { 796 819 throw new Twitter_OAuthException( 797 820 "Expired timestamp, yours $timestamp, ours $now" … … 800 823 } 801 824 802 803 825 /** 804 826 * check that the nonce is not repeated 805 827 */ 806 private function check_nonce($consumer, $token, $nonce, $timestamp) 807 { 808 if (!$nonce) { 828 private function check_nonce( $consumer, $token, $nonce, $timestamp ) { 829 if ( ! $nonce ) { 809 830 throw new Twitter_OAuthException( 810 831 'Missing nonce parameter. The parameter is required' … … 819 840 $timestamp 820 841 ); 821 if ( $found) {822 throw new Twitter_OAuthException( "Nonce already used: $nonce");842 if ( $found ) { 843 throw new Twitter_OAuthException( "Nonce already used: $nonce" ); 823 844 } 824 845 } 825 846 } 826 847 827 class Twitter_OAuthDataStore 828 { 829 public function lookup_consumer($consumer_key) 830 { 848 class Twitter_OAuthDataStore { 849 /** 850 * @param $consumer_key 851 */ 852 public function lookup_consumer( $consumer_key ) { 831 853 // implement me 832 854 } 833 855 834 835 public function lookup_token($consumer, $token_type, $token) 836 { 856 /** 857 * @param $consumer 858 * @param $token_type 859 * @param $token 860 */ 861 public function lookup_token( $consumer, $token_type, $token ) { 837 862 // implement me 838 863 } 839 864 840 841 public function lookup_nonce($consumer, $token, $nonce, $timestamp) 842 { 865 /** 866 * @param $consumer 867 * @param $token 868 * @param $nonce 869 * @param $timestamp 870 */ 871 public function lookup_nonce( $consumer, $token, $nonce, $timestamp ) { 843 872 // implement me 844 873 } 845 874 846 847 public function new_request_token($consumer, $callback = null) 848 { 875 /** 876 * @param $consumer 877 * @param $callback 878 */ 879 public function new_request_token( $consumer, $callback = null ) { 849 880 // return a new token attached to this consumer 850 881 } 851 882 852 853 public function new_access_token($token, $consumer, $verifier = null) 854 { 883 /** 884 * @param $token 885 * @param $consumer 886 * @param $verifier 887 */ 888 public function new_access_token( $token, $consumer, $verifier = null ) { 855 889 // return a new access token attached to this consumer 856 890 // for the user associated with this token if the request token … … 860 894 } 861 895 862 class Twitter_OAuthUtil 863 { 864 public static function urlencode_rfc3986($input) 865 { 866 if (is_array($input)) { 867 return array_map(['Twitter_OAuthUtil', 'urlencode_rfc3986'], $input); 896 class Twitter_OAuthUtil { 897 /** 898 * @param $input 899 */ 900 public static function urlencode_rfc3986( $input ) { 901 if ( is_array( $input ) ) { 902 return array_map( ['Twitter_OAuthUtil', 'urlencode_rfc3986'], $input ); 868 903 } else { 869 if ( is_scalar($input)) {904 if ( is_scalar( $input ) ) { 870 905 return str_replace( 871 '+',872 ' ',873 str_replace('%7E', '~', rawurlencode($input))874 );906 '+', 907 ' ', 908 str_replace( '%7E', '~', rawurlencode( $input ) ) 909 ); 875 910 } else { 876 911 return ''; … … 878 913 } 879 914 } 880 881 915 882 916 // This decode function isn't taking into consideration the above 883 917 // modifications to the encoding process. However, this method doesn't 884 918 // seem to be used anywhere so leaving it as is. 885 public static function urldecode_rfc3986($string) 886 { 887 return urldecode($string); 888 } 889 919 /** 920 * @param $string 921 */ 922 public static function urldecode_rfc3986( $string ) { 923 return urldecode( $string ); 924 } 890 925 891 926 // Utility function for turning the Authorization: header into … … 894 929 // May 28th, 2010 - method updated to tjerk.meesters for a speed improvement. 895 930 // see http://code.google.com/p/oauth/issues/detail?id=163 896 public static function split_header($header, $only_allow_oauth_parameters = true) 897 { 931 /** 932 * @param $header 933 * @param $only_allow_oauth_parameters 934 * @return mixed 935 */ 936 public static function split_header( $header, $only_allow_oauth_parameters = true ) { 898 937 $params = []; 899 if (preg_match_all('/(' . ($only_allow_oauth_parameters ? 'oauth_' : '') . '[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) { 900 foreach ($matches[1] as $i => $h) { 901 $params[$h] = self::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]); 902 } 903 if (isset($params['realm'])) { 904 unset($params['realm']); 905 } 906 } 938 if ( preg_match_all( '/(' . ( $only_allow_oauth_parameters ? 'oauth_' : '' ) . '[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) { 939 foreach ( $matches[1] as $i => $h ) { 940 $params[$h] = self::urldecode_rfc3986( empty( $matches[3][$i] ) ? $matches[4][$i] : $matches[3][$i] ); 941 } 942 if ( isset( $params['realm'] ) ) { 943 unset( $params['realm'] ); 944 } 945 } 946 907 947 return $params; 908 948 } 909 949 910 911 950 // helper to try to sort out headers for people who aren't running apache 912 public static function get_headers() 913 { 914 if (function_exists('apache_request_headers')) { 951 /** 952 * @return mixed 953 */ 954 public static function get_headers() { 955 if ( function_exists( 'apache_request_headers' ) ) { 915 956 // we need this to get the actual Authorization: header 916 957 // because apache tends to tell us it doesn't exist … … 922 963 // request 923 964 $out = []; 924 foreach ( $headers as $key => $value) {965 foreach ( $headers as $key => $value ) { 925 966 $key = str_replace( 926 ' ',927 '-',928 ucwords(strtolower(str_replace('-', ' ', $key)))929 );967 ' ', 968 '-', 969 ucwords( strtolower( str_replace( '-', ' ', $key ) ) ) 970 ); 930 971 $out[$key] = $value; 931 972 } … … 934 975 // that $_SERVER actually contains what we need 935 976 $out = []; 936 if ( isset($_SERVER['CONTENT_TYPE'])) {977 if ( isset( $_SERVER['CONTENT_TYPE'] ) ) { 937 978 $out['Content-Type'] = $_SERVER['CONTENT_TYPE']; 938 979 } 939 if ( isset($_ENV['CONTENT_TYPE'])) {980 if ( isset( $_ENV['CONTENT_TYPE'] ) ) { 940 981 $out['Content-Type'] = $_ENV['CONTENT_TYPE']; 941 982 } 942 983 943 foreach ( $_SERVER as $key => $value) {944 if ( substr($key, 0, 5) == 'HTTP_') {984 foreach ( $_SERVER as $key => $value ) { 985 if ( substr( $key, 0, 5 ) == 'HTTP_' ) { 945 986 // this is chaos, basically it is just there to capitalize the first 946 987 // letter of every word that is not an initial HTTP and strip HTTP … … 949 990 ' ', 950 991 '-', 951 ucwords( strtolower(str_replace('_', ' ', substr($key, 5))))992 ucwords( strtolower( str_replace( '_', ' ', substr( $key, 5 ) ) ) ) 952 993 ); 953 994 $out[$key] = $value; … … 955 996 } 956 997 } 998 957 999 return $out; 958 1000 } 959 960 1001 961 1002 // This function takes a input like a=b&a=c&d=e and returns the parsed 962 1003 // parameters like this 963 1004 // ['a' => array('b','c'), 'd' => 'e'] 964 public static function parse_parameters($input) 965 { 966 if (!isset($input) || !$input) { 1005 /** 1006 * @param $input 1007 * @return mixed 1008 */ 1009 public static function parse_parameters( $input ) { 1010 if ( ! isset( $input ) || ! $input ) { 967 1011 return []; 968 1012 } 969 1013 970 $pairs = explode( '&', $input);1014 $pairs = explode( '&', $input ); 971 1015 972 1016 $parsed_parameters = []; 973 foreach ( $pairs as $pair) {974 $split = explode('=', $pair, 2);975 $parameter = self::urldecode_rfc3986( $split[0]);976 $value = isset($split[1]) ? self::urldecode_rfc3986($split[1]) : '';977 978 if ( isset($parsed_parameters[$parameter])) {1017 foreach ( $pairs as $pair ) { 1018 $split = explode( '=', $pair, 2 ); 1019 $parameter = self::urldecode_rfc3986( $split[0] ); 1020 $value = isset( $split[1] ) ? self::urldecode_rfc3986( $split[1] ) : ''; 1021 1022 if ( isset( $parsed_parameters[$parameter] ) ) { 979 1023 // We have already recieved parameter(s) with this name, so add to the list 980 1024 // of parameters with this name 981 1025 982 if ( is_scalar($parsed_parameters[$parameter])) {1026 if ( is_scalar( $parsed_parameters[$parameter] ) ) { 983 1027 // This is the first duplicate, so transform scalar (string) into an array 984 1028 // so we can add the duplicates … … 991 1035 } 992 1036 } 1037 993 1038 return $parsed_parameters; 994 1039 } 995 1040 996 997 public static function build_http_query($params) 998 { 999 if (!$params) { 1041 /** 1042 * @param $params 1043 */ 1044 public static function build_http_query( $params ) { 1045 if ( ! $params ) { 1000 1046 return ''; 1001 1047 } 1002 1048 1003 1049 // Urlencode both keys and values 1004 $keys = self::urlencode_rfc3986(array_keys($params));1005 $values = self::urlencode_rfc3986( array_values($params));1006 $params = array_combine( $keys, $values);1050 $keys = self::urlencode_rfc3986( array_keys( $params ) ); 1051 $values = self::urlencode_rfc3986( array_values( $params ) ); 1052 $params = array_combine( $keys, $values ); 1007 1053 1008 1054 // Parameters are sorted by name, using lexicographical byte value ordering. 1009 1055 // Ref: Spec: 9.1.1 (1) 1010 uksort( $params, 'strcmp');1056 uksort( $params, 'strcmp' ); 1011 1057 1012 1058 $pairs = []; 1013 foreach ( $params as $parameter => $value) {1014 if ( is_array($value)) {1059 foreach ( $params as $parameter => $value ) { 1060 if ( is_array( $value ) ) { 1015 1061 // If two or more parameters share the same name, they are sorted by their value 1016 1062 // Ref: Spec: 9.1.1 (1) 1017 1063 // June 12th, 2010 - changed to sort because of issue 164 by hidetaka 1018 sort( $value, SORT_STRING);1019 foreach ( $value as $duplicate_value) {1064 sort( $value, SORT_STRING ); 1065 foreach ( $value as $duplicate_value ) { 1020 1066 $pairs[] = $parameter . '=' . $duplicate_value; 1021 1067 } … … 1026 1072 // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61) 1027 1073 // Each name-value pair is separated by an '&' character (ASCII code 38) 1028 return implode('&', $pairs); 1074 1075 return implode( '&', $pairs ); 1029 1076 } 1030 1077 } -
auto-post-woocommerce-products/trunk/admin/src/Twitter/Twitter.php
r1910091 r2144962 25 25 const RETWEETS = 128; // include retweets 26 26 27 27 28 28 /* * #@- */ 29 29 … … 54 54 * @param string app secret 55 55 * @param string optional access token 56 * @param string opti nal access token secret56 * @param string optional access token secret 57 57 * @throws TwitterException when CURL extension is not loaded 58 58 */ … … 123 123 * @param string $id The id# of the post to retweet 124 124 * @param string $message The retweet @ 125 * 125 * 126 126 * @return 127 127 */ … … 474 474 class TwitterException extends Exception 475 475 { 476 477 } 476 477 } -
auto-post-woocommerce-products/trunk/auto-post-woocommerce-products.php
r2134375 r2144962 11 11 * Description: APWCP is a powerful tool to assist you in managing your WooCommerce inventory and advertising your products on social media. 12 12 * Tested up to: 5.2.2 13 * Version: 2.1.4. 313 * Version: 2.1.4.4 14 14 * Author: Carl Lockett III, CIL Creations 15 15 * Author URI: http://www.cilcreations.com/apwp 16 16 * WC requires at least: 3.3.0 17 * WC tested up to: 3. 6.517 * WC tested up to: 3.7 18 18 * License: GPL-3.0+ 19 19 * License URI: http://opensource.org/licenses/gpl-license.php GNU Public License … … 32 32 33 33 require plugin_dir_path( __FILE__ ) . 'includes/class-auto-post-woocommerce-products.php'; 34 define( 'APWP_VERSION', '2.1.4.3' ); 34 define( 'APWP_VERSION', '2.1.4.4' ); 35 update_option( 'apwp_is_beta_version', false ); 35 36 register_activation_hook( __FILE__, 'apwp_activate' ); 36 37 register_deactivation_hook( __FILE__, 'apwp_deactivate' ); -
auto-post-woocommerce-products/trunk/includes/class-auto-post-woocommerce-products-activator.php
r2121574 r2144962 34 34 delete_transient( 'apwp_prod_list_search_id' ); 35 35 delete_transient( 'apwp_prod_list_search' ); 36 apwp_reset_plugin();37 36 apwp_set_onetime_cron( [ 'trash', 'cats' ] ); // Update product data. 38 37 }
Note: See TracChangeset
for help on using the changeset viewer.