Skip to content

Commit 518677f

Browse files
Angelo Oufacebook-github-bot
Angelo Ou
authored andcommitted
Fix linter errors for ./includes/fbutils.php files (#3075)
Summary: ## Description This PR fixes `phpcs` issues in `./includes/fbutils.php`. Comments were also added for several functions. The fixes were made manually (in conjunction with `./vendor/bin/phpcbf`) to ensure that the logic remains the same. Running `./vendor/bin/phpcs`: ``` FILE: /Users/angeloou/Local Sites/test-site-i/app/public/wp-content/plugins/facebook-for-woocommerce/includes/fbutils.php ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 131 ERRORS AND 25 WARNINGS AFFECTING 95 LINES ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 37 | ERROR | [ ] Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing) 38 | ERROR | [ ] Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing) 40 | ERROR | [ ] Member variable "$validGenderArray" is not in valid snake_case format, try "$valid_gender_array" (WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase) 40 | ERROR | [ ] Missing member variable doc comment (Squiz.Commenting.VariableComment.Missing) 145 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 163 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 184 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 210 | ERROR | [ ] Doc comment for parameter "$wpid" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 213 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 214 | ERROR | [ ] Doc comment for parameter $id does not match actual variable name $wpid (Squiz.Commenting.FunctionComment.ParamNameNoMatch) 225 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction) 232 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning) 242 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 250 | ERROR | [ ] Doc comment for parameter "$string" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 250 | ERROR | [ ] Doc comment for parameter "$strip_html_tags" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 257 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 258 | ERROR | [ ] Missing parameter name (Squiz.Commenting.FunctionComment.MissingParamName) 261 | WARNING | [ ] It is recommended not to use reserved keyword "string" as function parameter name. Found: $string | | (Universal.NamingConventions.NoReservedKeywordParameterNames.stringFound) 272 | WARNING | [x] Found precision alignment of 1 spaces. (Universal.WhiteSpace.PrecisionAlignment.Found) 272 | ERROR | [x] Line indented incorrectly; expected 3 tabs, found 3 tabs and 1 spaces (Generic.WhiteSpace.ScopeIndent.IncorrectExact) 272 | ERROR | [x] No space after opening parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis) 272 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket) 272 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket) 272 | ERROR | [x] No space before closing parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis) 272 | ERROR | [x] Expected 1 space after closing parenthesis; found 0 (Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis) 272 | ERROR | [x] Space between opening control structure and closing parenthesis is required (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis) 274 | WARNING | [x] Found precision alignment of 1 spaces. (Universal.WhiteSpace.PrecisionAlignment.Found) 274 | ERROR | [x] Line indented incorrectly; expected 3 tabs, found 3 tabs and 1 spaces (Generic.WhiteSpace.ScopeIndent.IncorrectExact) 286 | ERROR | [x] No space after opening parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis) 286 | ERROR | [x] No space before closing parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis) 286 | ERROR | [x] Expected 1 space after closing parenthesis; found 0 (Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis) 286 | ERROR | [x] Space between opening control structure and closing parenthesis is required (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis) 296 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 315 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 318 | ERROR | [ ] Method name "isWoocommerceIntegration" in class WC_Facebookcommerce_Utils is not in snake case format, try "is_woocommerce_integration" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 325 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 328 | ERROR | [ ] Method name "getIntegrationName" in class WC_Facebookcommerce_Utils is not in snake case format, try "get_integration_name" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 339 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 345 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 345 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 365 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 365 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 366 | WARNING | [ ] Not using strict comparison for in_array; supply true for $strict argument. (WordPress.PHP.StrictInArray.MissingTrueStrict) 383 | ERROR | [ ] Doc comment for parameter "$message" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 383 | ERROR | [ ] Doc comment for parameter "$object" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 383 | ERROR | [ ] Doc comment for parameter "$error" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 383 | ERROR | [ ] Doc comment for parameter "$ems" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 387 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 388 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 388 | WARNING | [ ] It is recommended not to use reserved keyword "object" as function parameter name. Found: $object | | (Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound) 389 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 390 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 390 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line (Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine) 395 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode) 401 | ERROR | [ ] Using short ternaries is not allowed as they are rarely used correctly (Universal.Operators.DisallowShortTernary.Found) 404 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket) 404 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket) 410 | WARNING | [ ] error_log() found. Debug code should not normally be used in production. (WordPress.PHP.DevelopmentFunctions.error_log_error_log) 417 | ERROR | [ ] Doc comment for parameter "$tip_id" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 417 | ERROR | [ ] Doc comment for parameter "$channel_id" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 417 | ERROR | [ ] Doc comment for parameter "$event" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 417 | ERROR | [ ] Doc comment for parameter "$ems" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 421 | ERROR | [ ] Using short ternaries is not allowed as they are rarely used correctly (Universal.Operators.DisallowShortTernary.Found) 424 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket) 424 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket) 430 | WARNING | [ ] error_log() found. Debug code should not normally be used in production. (WordPress.PHP.DevelopmentFunctions.error_log_error_log) 435 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 435 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 435 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 435 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 439 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 439 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 439 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 439 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 442 | WARNING | [ ] It is recommended not to use reserved keyword "die" as function parameter name. Found: $die (Universal.NamingConventions.NoReservedKeywordParameterNames.dieFound) 458 | ERROR | [ ] access tags are prohibited (WooCommerce.Commenting.CommentTags.AccessTag) 466 | ERROR | [ ] Doc comment for parameter "$product_group_id" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 466 | ERROR | [ ] Doc comment for parameter "$compare_condition" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 466 | ERROR | [ ] Doc comment for parameter "$post_type" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 470 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 471 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 472 | ERROR | [x] Multi-line function declaration not indented correctly; expected 12 spaces but found 8 (Squiz.Functions.MultiLineFunctionDeclaration.Indent) 472 | ERROR | [x] The closing parenthesis of a multi-line function declaration must be on a new line (Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine) 475 | WARNING | [ ] Detected usage of meta_query, possible slow query. (WordPress.DB.SlowDBQuery.slow_db_query_meta_query) 491 | ERROR | [ ] You must use "/**" style comments for a function comment (Squiz.Commenting.FunctionComment.WrongStyle) 514 | WARNING | [ ] parse_url() is discouraged because of inconsistency in the output across PHP versions; use wp_parse_url() instead. | | (WordPress.WP.AlternativeFunctions.parse_url_parse_url) 585 | WARNING | [ ] Not using strict comparison for in_array; supply true for $strict argument. (WordPress.PHP.StrictInArray.MissingTrueStrict) 598 | ERROR | [ ] You must use "/**" style comments for a function comment (Squiz.Commenting.FunctionComment.WrongStyle) 602 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 625 | ERROR | [ ] You must use "/**" style comments for a function comment (Squiz.Commenting.FunctionComment.WrongStyle) 626 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket) 626 | ERROR | [x] Expected 1 space after the array opener in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine) 626 | ERROR | [x] Expected 1 space before the array closer in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine) 626 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket) 629 | ERROR | [ ] Method name "validateGender" in class WC_Facebookcommerce_Utils is not in snake case format, try "validate_gender" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 630 | ERROR | [ ] Object property "$validGenderArray" is not in valid snake_case format, try "$valid_gender_array" (WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase) 633 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 633 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 637 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 637 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 637 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 640 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 645 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 645 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 648 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 648 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 648 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 648 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 662 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 662 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 671 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 695 | ERROR | [ ] Doc comment for parameter "$from" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 695 | ERROR | [ ] Doc comment for parameter "$date_cap" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 699 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual) 699 | ERROR | [ ] Use Yoda Condition checks, you must. (WordPress.PHP.YodaConditions.NotYoda) 804 | ERROR | [x] Expected a new line after the array opener in a multi line array. Found: 1 space (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerMultiLine) 804 | ERROR | [x] Each item in a multi-line array must be on a new line. Found: 1 space (WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine) 807 | ERROR | [x] There should be a comma after the last array item in a multi-line array. (NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine) 807 | ERROR | [ ] Array closer not aligned correctly; expected 12 space(s) but found 14 (WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned) 807 | ERROR | [x] Expected a new line before the array closer in a multi line array. Found: 1 space (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserMultiLine) 835 | ERROR | [x] Must use "self::" for local static member reference (Squiz.Classes.SelfMemberReference.NotUsed) 842 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment (Generic.Commenting.DocComment.SpacingBeforeTags) 845 | ERROR | [x] Expected 5 spaces after parameter type; 1 found (Squiz.Commenting.FunctionComment.SpacingAfterParamType) 847 | ERROR | [ ] Method name "logExceptionImmediatelyToMeta" in class WC_Facebookcommerce_Utils is not in snake case format, try "log_exception_immediately_to_meta" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 847 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen) 847 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose) 848 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket) 848 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket) 853 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment (Generic.Commenting.DocComment.SpacingBeforeTags) 856 | ERROR | [x] Expected 2 spaces after parameter type; 1 found (Squiz.Commenting.FunctionComment.SpacingAfterParamType) 858 | ERROR | [ ] Method name "logToMeta" in class WC_Facebookcommerce_Utils is not in snake case format, try "log_to_meta" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 858 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen) 858 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose) 859 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning) 864 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space (Generic.Formatting.MultipleStatementAlignment.NotSameWarning) 889 | WARNING | [x] Found precision alignment of 1 spaces. (Universal.WhiteSpace.PrecisionAlignment.Found) 890 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 891 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 892 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 892 | ERROR | [x] Expected 2 spaces after parameter type; 1 found (Squiz.Commenting.FunctionComment.SpacingAfterParamType) 893 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 894 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 894 | ERROR | [x] Expected 2 spaces after parameter type; 1 found (Squiz.Commenting.FunctionComment.SpacingAfterParamType) 895 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 896 | ERROR | [x] Expected 10 spaces before asterisk; 9 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar) 897 | ERROR | [ ] Method name "getContextData" in class WC_Facebookcommerce_Utils is not in snake case format, try "get_context_data" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 897 | ERROR | [x] Expected 1 spaces after opening parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen) 897 | WARNING | [ ] It is recommended not to use reserved keyword "default" as function parameter name. Found: $default | | (Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound) 897 | ERROR | [x] Expected 1 spaces before closing parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose) 898 | ERROR | [x] Opening brace should be on the same line as the declaration (Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine) 899 | ERROR | [x] Array keys must be surrounded by spaces unless they contain a string or an integer. (WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys) 902 | ERROR | [ ] Doc comment for parameter "$message" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 902 | ERROR | [ ] Doc comment for parameter "$level" missing (Squiz.Commenting.FunctionComment.MissingParamTag) 906 | ERROR | [ ] Method name "logWithDebugModeEnabled" in class WC_Facebookcommerce_Utils is not in snake case format, try "log_with_debug_mode_enabled" | | (WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid) 914 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode) 922 | ERROR | [x] The closing brace for the class must go on the next line after the body (PSR2.Classes.ClassDeclaration.CloseBraceAfterBody) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 72 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ``` ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected Pull Request resolved: #3075 Test Plan: 1. Run `./vendor/bin/phpcs`, you should get: ``` FILE: /Users/angeloou/Local Sites/test-site-i/app/public/wp-content/plugins/facebook-for-woocommerce/includes/fbutils.php --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 8 WARNINGS AFFECTING 8 LINES --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 360 | WARNING | Not using strict comparison for in_array; supply true for $strict argument. (WordPress.PHP.StrictInArray.MissingTrueStrict) 397 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode) 414 | WARNING | error_log() found. Debug code should not normally be used in production. (WordPress.PHP.DevelopmentFunctions.error_log_error_log) 440 | WARNING | error_log() found. Debug code should not normally be used in production. (WordPress.PHP.DevelopmentFunctions.error_log_error_log) 507 | WARNING | Detected usage of meta_query, possible slow query. (WordPress.DB.SlowDBQuery.slow_db_query_meta_query) 553 | WARNING | parse_url() is discouraged because of inconsistency in the output across PHP versions; use wp_parse_url() instead. (WordPress.WP.AlternativeFunctions.parse_url_parse_url) 624 | WARNING | Not using strict comparison for in_array; supply true for $strict argument. (WordPress.PHP.StrictInArray.MissingTrueStrict) 1018 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ``` 2. Run extension and test the basic functionality to ensure everything still works as intended. **!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!** MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V2 https://internalfb.com/intern/testinfra/testrun/16044073752117332 MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2 https://internalfb.com/intern/testinfra/testrun/16607023705525620 Reviewed By: carterbuce Differential Revision: D73451039 Pulled By: ajello-meta fbshipit-source-id: 1cbd23ad296b7c482e580f5def7d24e1806e70b0
1 parent 2e57f1e commit 518677f

18 files changed

+355
-252
lines changed

class-wc-facebookcommerce.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function init() {
185185
array( $this, 'force_user_agent_in_latin' )
186186
);
187187

188-
if ( \WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
188+
if ( \WC_Facebookcommerce_Utils::is_woocommerce_integration() ) {
189189
include_once 'facebook-commerce.php';
190190

191191
require_once __DIR__ . '/includes/fbproductfeed.php';

facebook-commerce-pixel-event.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function get_event_script( $event_name, $params, $method = 'track' ) {
283283
* @param string $method Name of the pixel's fbq() function to call.
284284
*/
285285
public function inject_event( $event_name, $params, $method = 'track' ) {
286-
if ( WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
286+
if ( WC_Facebookcommerce_Utils::is_woocommerce_integration() ) {
287287
$code = $this->get_event_code( $event_name, self::build_params( $params, $event_name ), $method );
288288

289289
// If we have add to cart redirect enabled, we must defer the AddToCart events to render them the next page load.
@@ -439,7 +439,7 @@ public static function build_event( $event_name, $params, $method = 'track' ) {
439439
"/* %s Facebook Integration Event Tracking */\n" .
440440
"fbq('set', 'agent', '%s', '%s');\n" .
441441
"fbq('%s', '%s', %s, %s);",
442-
WC_Facebookcommerce_Utils::getIntegrationName(),
442+
WC_Facebookcommerce_Utils::get_integration_name(),
443443
Event::get_platform_identifier(),
444444
self::get_pixel_id(),
445445
esc_js( $method ),
@@ -454,7 +454,7 @@ public static function build_event( $event_name, $params, $method = 'track' ) {
454454
"/* %s Facebook Integration Event Tracking */\n" .
455455
"fbq('set', 'agent', '%s', '%s');\n" .
456456
"fbq('%s', '%s', %s);",
457-
WC_Facebookcommerce_Utils::getIntegrationName(),
457+
WC_Facebookcommerce_Utils::get_integration_name(),
458458
Event::get_platform_identifier(),
459459
self::get_pixel_id(),
460460
esc_js( $method ),
@@ -643,7 +643,7 @@ public static function set_access_token( $access_token ) {
643643
private static function get_version_info() {
644644
global $wp_version;
645645

646-
if ( WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
646+
if ( WC_Facebookcommerce_Utils::is_woocommerce_integration() ) {
647647
return array(
648648
'source' => 'woocommerce',
649649
'version' => WC()->version,

facebook-commerce.php

+29-29
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ private function find_variation_product_item_ids( string $product_group_id ): ar
624624
} while ( $response = $this->facebook_for_woocommerce->get_api()->next( $response, 2 ) );
625625
} catch ( ApiException $e ) {
626626
$message = sprintf( 'There was an error trying to find the IDs for Product Items in the Product Group %s: %s', $product_group_id, $e->getMessage() );
627-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
627+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
628628
}
629629

630630
return $product_item_ids;
@@ -1361,7 +1361,7 @@ public function create_product_group( WC_Facebook_Product $woo_product, string $
13611361
}
13621362
} catch ( ApiException $e ) {
13631363
$message = sprintf( 'There was an error trying to create the product group: %s', $e->getMessage() );
1364-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1364+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
13651365
}
13661366

13671367
return null;
@@ -1386,7 +1386,7 @@ public function update_product_group( WC_Facebook_Product $woo_product ) {
13861386
$variants = $woo_product->prepare_variants_for_group();
13871387

13881388
if ( ! $variants ) {
1389-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled(
1389+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled(
13901390
sprintf(
13911391
/* translators: %1$s is referring to facebook product group id. */
13921392
__(
@@ -1428,7 +1428,7 @@ public function update_product_group( WC_Facebook_Product $woo_product ) {
14281428
}
14291429
} catch ( ApiException $e ) {
14301430
$message = sprintf( 'There was an error trying to update Product Group %s: %s', $fb_product_group_id, $e->getMessage() );
1431-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1431+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
14321432
}
14331433
}
14341434

@@ -1456,7 +1456,7 @@ public function create_product_item_batch_api( $woo_product, $retailer_id, $prod
14561456
}
14571457
} catch ( ApiException $e ) {
14581458
$message = sprintf( 'There was an error trying to create a product item: %s', $e->getMessage() );
1459-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1459+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
14601460
}
14611461

14621462
return '';
@@ -1486,7 +1486,7 @@ public function create_product_item( $woo_product, $retailer_id, $product_group_
14861486
}
14871487
} catch ( ApiException $e ) {
14881488
$message = sprintf( 'There was an error trying to create a product item: %s', $e->getMessage() );
1489-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1489+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
14901490
}
14911491

14921492
return '';
@@ -1620,7 +1620,7 @@ public function update_product_item_batch_api( WC_Facebook_Product $woo_product,
16201620
}
16211621
} catch ( ApiException $e ) {
16221622
$message = sprintf( 'There was an error trying to update a product item: %s', $e->getMessage() );
1623-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1623+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
16241624
}
16251625
}
16261626

@@ -1654,7 +1654,7 @@ public function update_product_item( WC_Facebook_Product $woo_product, string $f
16541654
}
16551655
} catch ( ApiException $e ) {
16561656
$message = sprintf( 'There was an error trying to update a product item: %s', $e->getMessage() );
1657-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1657+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
16581658
}
16591659
}
16601660

@@ -1688,7 +1688,7 @@ public function create_or_update_product_set_item( $product_set_data, $product_s
16881688
}
16891689
} catch ( ApiException $e ) {
16901690
$message = sprintf( 'There was an error trying to create/update a product set: %s', $e->getMessage() );
1691-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1691+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
16921692
}
16931693
}
16941694

@@ -1707,7 +1707,7 @@ public function delete_product_set_item( string $fb_product_set_id ) {
17071707
$this->facebook_for_woocommerce->get_api()->delete_product_set_item( $fb_product_set_id, $allow_live_deletion );
17081708
} catch ( ApiException $e ) {
17091709
$message = sprintf( 'There was an error trying to delete a product set item: %s', $e->getMessage() );
1710-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
1710+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
17111711
}
17121712
}
17131713

@@ -1903,7 +1903,7 @@ public function remove_resync_message() {
19031903
* @return void
19041904
*/
19051905
public function display_error_message( string $msg ): void {
1906-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $msg );
1906+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $msg );
19071907
set_transient( 'facebook_plugin_api_error', $msg, self::FB_MESSAGE_DISPLAY_TIME );
19081908
}
19091909

@@ -2066,7 +2066,7 @@ public function delete_post_meta_loop( array $products ) {
20662066
**/
20672067
public function reset_all_products() {
20682068
if ( ! is_admin() ) {
2069-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled(
2069+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled(
20702070
'Not resetting any FBIDs from products,
20712071
must call reset from admin context.'
20722072
);
@@ -2075,7 +2075,7 @@ public function reset_all_products() {
20752075
}
20762076

20772077
// Include draft products (omit 'post_status' => 'publish')
2078-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Removing FBIDs from all products' );
2078+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Removing FBIDs from all products' );
20792079

20802080
$post_ids = get_posts(
20812081
[
@@ -2102,7 +2102,7 @@ public function reset_all_products() {
21022102
$post_ids = array_merge( $post_ids, $children );
21032103
$this->delete_post_meta_loop( $post_ids );
21042104

2105-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Product FBIDs deleted' );
2105+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Product FBIDs deleted' );
21062106

21072107
return true;
21082108
}
@@ -2121,7 +2121,7 @@ public function reset_single_product( int $wp_id ) {
21212121

21222122
$this->delete_post_meta_loop( $products );
21232123

2124-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Deleted FB Metadata for product ' . $wp_id );
2124+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Deleted FB Metadata for product ' . $wp_id );
21252125
}
21262126

21272127
/**
@@ -2230,12 +2230,12 @@ private function sync_facebook_products() {
22302230
*/
22312231
private function sync_facebook_products_using_background_processor() {
22322232
if ( ! $this->is_product_sync_enabled() ) {
2233-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Sync to Facebook is disabled' );
2233+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Sync to Facebook is disabled' );
22342234
throw new PluginException( __( 'Product sync is disabled.', 'facebook-for-woocommerce' ) );
22352235
}
22362236

22372237
if ( ! $this->is_configured() || ! $this->get_product_catalog_id() ) {
2238-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( sprintf( 'Not syncing, the plugin is not configured or the Catalog ID is missing' ) );
2238+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( sprintf( 'Not syncing, the plugin is not configured or the Catalog ID is missing' ) );
22392239
throw new PluginException( __( 'The plugin is not configured or the Catalog ID is missing.', 'facebook-for-woocommerce' ) );
22402240
}
22412241

@@ -2250,7 +2250,7 @@ private function sync_facebook_products_using_background_processor() {
22502250
}
22512251

22522252
if ( $currently_syncing ) {
2253-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Not syncing again, sync already in progress' );
2253+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Not syncing again, sync already in progress' );
22542254
WC_Facebookcommerce_Utils::fblog(
22552255
'Tried to sync during an in-progress sync!',
22562256
[],
@@ -2263,10 +2263,10 @@ private function sync_facebook_products_using_background_processor() {
22632263
$catalog = $this->facebook_for_woocommerce->get_api()->get_catalog( $this->get_product_catalog_id() );
22642264
} catch ( ApiException $e ) {
22652265
$message = sprintf( 'There was an error trying to delete a product set item: %s', $e->getMessage() );
2266-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
2266+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
22672267
}
22682268
if ( $catalog->id ) {
2269-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Not syncing, invalid product catalog!' );
2269+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Not syncing, invalid product catalog!' );
22702270
WC_Facebookcommerce_Utils::fblog(
22712271
'Tried to sync with an invalid product catalog!',
22722272
[],
@@ -2300,9 +2300,9 @@ private function sync_facebook_products_using_background_processor() {
23002300
set_transient( self::FB_SYNC_IN_PROGRESS, true, self::FB_SYNC_TIMEOUT );
23012301
set_transient( self::FB_SYNC_REMAINING, (int) $total );
23022302
$this->display_info_message( $starting_message );
2303-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $starting_message );
2303+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $starting_message );
23042304
foreach ( $post_ids as $post_id ) {
2305-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Pushing post to queue: ' . $post_id );
2305+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Pushing post to queue: ' . $post_id );
23062306
$this->background_processor->push_to_queue( $post_id );
23072307
}
23082308

@@ -2332,7 +2332,7 @@ private function sync_facebook_products_using_background_processor() {
23322332
$this->on_product_publish( $post_id );
23332333
++$count;
23342334
}
2335-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( 'Synced ' . $count . ' products' );
2335+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( 'Synced ' . $count . ' products' );
23362336
$this->remove_sticky_message();
23372337
$this->display_info_message( 'Facebook product sync complete!' );
23382338
delete_transient( self::FB_SYNC_IN_PROGRESS );
@@ -2925,10 +2925,10 @@ public function delete_product_item( int $wp_id ): void {
29252925
if ( $fb_product_item_id ) {
29262926
try {
29272927
$pi_result = $this->facebook_for_woocommerce->get_api()->delete_product_item( $fb_product_item_id );
2928-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $pi_result );
2928+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $pi_result );
29292929
} catch ( ApiException $e ) {
29302930
$message = sprintf( 'There was an error trying to delete a product set item: %s', $e->getMessage() );
2931-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
2931+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
29322932
}
29332933
}
29342934
}
@@ -2947,10 +2947,10 @@ public function delete_product_group( int $product_id ) {
29472947
// TODO: replace with a call to API::delete_product_group() {WV 2020-05-26}
29482948
try {
29492949
$pg_result = $this->facebook_for_woocommerce->get_api()->delete_product_group( $product_group_id );
2950-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $pg_result );
2950+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $pg_result );
29512951
} catch ( ApiException $e ) {
29522952
$message = sprintf( 'There was an error trying to delete a product group: %s', $e->getMessage() );
2953-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
2953+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
29542954
}
29552955
}
29562956
}
@@ -3023,7 +3023,7 @@ public function update_fb_visibility( $product_id, $visibility ) {
30233023
}
30243024
} catch ( ApiException $e ) {
30253025
$message = sprintf( 'There was an error trying to update product item: %s', $e->getMessage() );
3026-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
3026+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
30273027
}
30283028
}
30293029
}
@@ -3099,7 +3099,7 @@ public function get_product_fbid( string $fbid_type, int $wp_id, $woo_product =
30993099
}
31003100
} catch ( Exception $e ) {
31013101
/* @TODO: Log exception. */
3102-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $e->getMessage() );
3102+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $e->getMessage() );
31033103
$this->display_error_message(
31043104
sprintf(
31053105
/* translators: Placeholders %1$s - original error message from Facebook API */

includes/API/Plugin/Settings/Handler.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,11 @@ private function maybe_trigger_feed_uploads( bool $should_trigger_product_sync,
275275
if ( facebook_for_woocommerce()->get_integration()->allow_full_batch_api_sync() ) {
276276
facebook_for_woocommerce()->get_products_sync_handler()->create_or_update_all_products();
277277
} else {
278-
\WC_Facebookcommerce_Utils::logToMeta( 'Initial full product sync disabled by filter hook `facebook_for_woocommerce_allow_full_batch_api_sync`' );
278+
\WC_Facebookcommerce_Utils::log_to_meta( 'Initial full product sync disabled by filter hook `facebook_for_woocommerce_allow_full_batch_api_sync`' );
279279
}
280280
}
281281
} catch ( \Exception $exception ) {
282-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
282+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
283283
$exception,
284284
[
285285
'event' => 'product_sync',
@@ -295,7 +295,7 @@ private function maybe_trigger_feed_uploads( bool $should_trigger_product_sync,
295295
facebook_for_woocommerce()->feed_manager->run_all_feed_uploads();
296296
}
297297
} catch ( \Exception $exception ) {
298-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
298+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
299299
$exception,
300300
[
301301
'event' => 'feed_upload',

includes/Checkout.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function load_checkout_permalink_template( $template ) {
9898
try {
9999
WC()->cart->add_to_cart( $product_id, $quantity );
100100
} catch ( \Exception $e ) {
101-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
101+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
102102
$e,
103103
array(
104104
'flow_name' => 'checkout',
@@ -110,7 +110,7 @@ public function load_checkout_permalink_template( $template ) {
110110
);
111111
}
112112
} else {
113-
\WC_Facebookcommerce_Utils::logToMeta(
113+
\WC_Facebookcommerce_Utils::log_to_meta(
114114
'Failed to add product to cart',
115115
array(
116116
'flow_name' => 'checkout',

includes/ExternalVersionUpdate/Update.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function send_new_version_to_facebook_server() {
8989
}
9090
return update_option( self::LATEST_VERSION_SENT, WC_Facebookcommerce_Utils::PLUGIN_VERSION );
9191
} catch ( Exception $e ) {
92-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $e->getMessage() );
92+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $e->getMessage() );
9393
// If the request fails, we should retry it in the next heartbeat.
9494
return false;
9595
}

includes/Feed/AbstractFeed.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function send_request_to_upload_feed(): void {
170170
get_api()->
171171
create_common_data_feed_upload( $cpi_id, $data );
172172
} catch ( \Exception $exception ) {
173-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
173+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
174174
$exception,
175175
[
176176
'event' => 'feed_upload',
@@ -233,7 +233,7 @@ public function get_feed_secret(): string {
233233
*/
234234
public function handle_feed_data_request(): void {
235235
$name = static::get_data_stream_name();
236-
\WC_Facebookcommerce_Utils::logWithDebugModeEnabled( "{$name} feed: Meta is requesting feed file." );
236+
\WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( "{$name} feed: Meta is requesting feed file." );
237237

238238
$file_path = $this->feed_writer->get_file_path();
239239

@@ -271,7 +271,7 @@ public function handle_feed_data_request(): void {
271271
// fpassthru might be disabled in some hosts (like Flywheel).
272272
// phpcs:ignore
273273
if ( \WC_Facebookcommerce_Utils::is_fpassthru_disabled() || ! @fpassthru( $file ) ) {
274-
\WC_Facebookcommerce_Utils::logWithDebugModeEnabled( "{$name} feed: fpassthru is disabled: getting file contents." );
274+
\WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( "{$name} feed: fpassthru is disabled: getting file contents." );
275275
//phpcs:ignore
276276
$contents = @stream_get_contents( $file );
277277
if ( ! $contents ) {
@@ -280,7 +280,7 @@ public function handle_feed_data_request(): void {
280280
echo $contents; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
281281
}
282282
} catch ( \Exception $exception ) {
283-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
283+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
284284
$exception,
285285
[
286286
'event' => 'feed_upload',

includes/Feed/CsvFeedFileWriter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function write_feed_file( array $data ): void {
110110
// Step 3: Rename temporary feed file to final feed file.
111111
$this->promote_temp_file();
112112
} catch ( PluginException $exception ) {
113-
\WC_Facebookcommerce_Utils::logExceptionImmediatelyToMeta(
113+
\WC_Facebookcommerce_Utils::log_exception_immediately_to_meta(
114114
$exception,
115115
[
116116
'event' => 'feed_upload',

includes/Feed/FeedConfigurationDetection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function get_data_source_feed_tracker_info() {
8686
$metadata = $this->get_feed_metadata( $feed['id'] );
8787
} catch ( Exception $e ) {
8888
$message = sprintf( 'There was an error trying to get feed metadata: %s', $e->getMessage() );
89-
WC_Facebookcommerce_Utils::logWithDebugModeEnabled( $message );
89+
WC_Facebookcommerce_Utils::log_with_debug_mode_enabled( $message );
9090
continue;
9191
}
9292

0 commit comments

Comments
 (0)