-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor operations in All_in_One_SEO_Pack_Opengraph::add_meta() #2941
Conversation
@EkoJR I tested this and found one problem. If the site is set to HTTPS, the og:image:secure_url and og:video:secure_url meta tags are not correctly set and the following notices get output when viewing the site: Undefined index: thumbnail_1 in aioseop_opengraph.php on line 1667 The meta tags looks like this (i.e. they are missing the URL for the image/video and the property is incorrect): To reproduce this, follow these steps:
|
Nice catch @wpsmort I added changes for the an SSL enabled site. Should be good now. |
This is tested and is good. |
'twitter:domain' => $domain, | ||
'twitter:title' => $title, | ||
'twitter:description' => $description, | ||
'twitter:image' => $twitter_thumbnail, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code occurs three times. Wouldn't it be better to pull this into one or two separate functions? (I'm referring to the associative array blob where all tags are assigned a variable) so that we can keep this centralized in one spot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you are referring to the reference array that occurs two times. It was intentionally done that way to make it painfully obvious to remove it when the filter hook is changed.
You are right though. I was split on the idea and you thought of it too, so I'll change it.
@EkoJR just one small comment. |
This is good now. |
* Add support for Google Tag Manager #2983 * 3.3 (#17) * Add PHPCompatibility sniffs to PHPCS & fix issues (#2907) * Add PHPCompatibility sniffs to PHPCS #2851 * Ignore Composer & VScode for Git #2851 * Fix PHP compatibility issues (1) #2851 * Don't check PHP compatibility of unit tests #2851 * Fix PHP compatibility issues (2) #2851 * Move parse_ini_string() to compatibility/php-functions.php #2851 * Fix typo #2851 * Fix typo (2) #2851 * Add Grunt task set for Travis CI builds #2851 * Add Travis CI support for PHPCompatibility #2851 * Print installed sniffs after "composer install" in Travis CI #2851 * Delete composer.lock #2851 * Move parse_ini_string() from aioseop_functions.php to compatibility/php-functions.php #2851 * Remove compat-gutenberg.php * Readd compat-gutenberg.php * Fix Grunt #2851 * Fix path to compat files #2851 * Add package-lock.json to .gitignore #2851 * Add composer.lock to .gitignore #2851 * Fix phpDoc in compatibility/php-funcitons.php #2851 * Change schema person's name & logo to add the option of manually ente… (#2920) * Change schema person's name & logo to add the option of manually entered name & image * Grunt * Add Schema to AMP plugin (#2879) * Fix loose comparator in AMP Head causing a return with empty description * Move AMP hooks to separate function for AMP hooks * Add remove hook for AMP Schema * Add AIOSEOP's Schema to AMP * Dev-change aioseop_amp_description filter to only affect meta descriptions * Add filter aioseop_amp_schema to enable/disable schema on AMP posts * Dev-Fix disable schema filter and no meta desc. * Invert if statement and add third decimal to phpDoc since tags #506 * Add third decimal to phpDoc since tag (2) #506 * Fix Grunt issue * Fix Grunt issue (2) * Change bin path for phpcs (#2966) * Change bin path for phpcs #2965 * Delete phpcs and phpcompatibility script entries #2965 * Add new line to init-grunt.sh #2965 * Refactor operations in All_in_One_SEO_Pack_Opengraph::add_meta() (#2941) * Change variable variables to direct variables * Change early initialize thumbnail variable to use image variable * Change operations from call filter to call method * Add filter documentation * Change to group operations together * Add dev notes * Grunt * Dev-Fix filter params * Dev-Add dev note * Dev-Fix error on SSL enabled site * Dev-Change duplicate code to function * Only output meta descriptions if autogenerate descriptions is enabled (#2947) * Fix issue 2439 * Dev-Change to strict comparator * Dev-Fix empty value check * Dev-Change applied changes The excerpt was being added elsewhere as a final fallback * Revert previous changes #2439 * Refactor code #2439 * Remove unneeded check #2439 * Fix Grunt issue * Fix SEO for search results page (#2964) * Added/updated help text for new Schema fields (#2959) * #2958 Added/updated help text for new Schema fields * Add missing i18n domains #2958 * Resolves #2411 (#2955) * 3.2.10 to 3.3 (#2986) * Update help text for Sitemap Indexes setting (#2961) * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Update help text for Sitemap Indexes setting #2954 * Remove version check for Gutenberg/Chrome compatibility fix and check if user agent is set (#2928) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Remove WP v5.3 version check and move function out of action hook #2914 * Invert version_compare and prefix functions #2914 * Fix phpDocs #2914 * Rename compat-gutenberg.php to gutenberg-chrome.php #2914 * Fix undefined index HTTP_USER_AGENT #2952 * version bump to 3.2.10 * Update readme.txt * Delete duplicate file * Fix file paths * Fix Grunt issues #2990 * Fix Grunt issues #2983 * Fix undefined class error #2983
* Refactor & move get_robots_meta() #2684 * Grunt fixes #2684 * PHPCS fixes #2684 * Fix minor bugs #2684 * tmp * Remove tmp unit tests #2684 * Fix Grunt issues #2684 * Fix Scrutinizer issues #2684 * Fix phpDoc * Add remote XDebug listener script for VScode #2684 * Skip test_title_format_macros #2684 * Fix fatal error and Grunt #2684 * Remove check for AIOSEOP Pro #2684 * PR comments #2684 * 3.3 (#17) * Add PHPCompatibility sniffs to PHPCS & fix issues (#2907) * Add PHPCompatibility sniffs to PHPCS #2851 * Ignore Composer & VScode for Git #2851 * Fix PHP compatibility issues (1) #2851 * Don't check PHP compatibility of unit tests #2851 * Fix PHP compatibility issues (2) #2851 * Move parse_ini_string() to compatibility/php-functions.php #2851 * Fix typo #2851 * Fix typo (2) #2851 * Add Grunt task set for Travis CI builds #2851 * Add Travis CI support for PHPCompatibility #2851 * Print installed sniffs after "composer install" in Travis CI #2851 * Delete composer.lock #2851 * Move parse_ini_string() from aioseop_functions.php to compatibility/php-functions.php #2851 * Remove compat-gutenberg.php * Readd compat-gutenberg.php * Fix Grunt #2851 * Fix path to compat files #2851 * Add package-lock.json to .gitignore #2851 * Add composer.lock to .gitignore #2851 * Fix phpDoc in compatibility/php-funcitons.php #2851 * Change schema person's name & logo to add the option of manually ente… (#2920) * Change schema person's name & logo to add the option of manually entered name & image * Grunt * Add Schema to AMP plugin (#2879) * Fix loose comparator in AMP Head causing a return with empty description * Move AMP hooks to separate function for AMP hooks * Add remove hook for AMP Schema * Add AIOSEOP's Schema to AMP * Dev-change aioseop_amp_description filter to only affect meta descriptions * Add filter aioseop_amp_schema to enable/disable schema on AMP posts * Dev-Fix disable schema filter and no meta desc. * Invert if statement and add third decimal to phpDoc since tags #506 * Add third decimal to phpDoc since tag (2) #506 * Fix Grunt issue * Fix Grunt issue (2) * Change bin path for phpcs (#2966) * Change bin path for phpcs #2965 * Delete phpcs and phpcompatibility script entries #2965 * Add new line to init-grunt.sh #2965 * Refactor operations in All_in_One_SEO_Pack_Opengraph::add_meta() (#2941) * Change variable variables to direct variables * Change early initialize thumbnail variable to use image variable * Change operations from call filter to call method * Add filter documentation * Change to group operations together * Add dev notes * Grunt * Dev-Fix filter params * Dev-Add dev note * Dev-Fix error on SSL enabled site * Dev-Change duplicate code to function * Only output meta descriptions if autogenerate descriptions is enabled (#2947) * Fix issue 2439 * Dev-Change to strict comparator * Dev-Fix empty value check * Dev-Change applied changes The excerpt was being added elsewhere as a final fallback * Revert previous changes #2439 * Refactor code #2439 * Remove unneeded check #2439 * Fix Grunt issue * Fix SEO for search results page (#2964) * Added/updated help text for new Schema fields (#2959) * #2958 Added/updated help text for new Schema fields * Add missing i18n domains #2958 * Resolves #2411 (#2955) * 3.2.10 to 3.3 (#2986) * Update help text for Sitemap Indexes setting (#2961) * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Update help text for Sitemap Indexes setting #2954 * Remove version check for Gutenberg/Chrome compatibility fix and check if user agent is set (#2928) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Remove WP v5.3 version check and move function out of action hook #2914 * Invert version_compare and prefix functions #2914 * Fix phpDocs #2914 * Rename compat-gutenberg.php to gutenberg-chrome.php #2914 * Fix undefined index HTTP_USER_AGENT #2952 * version bump to 3.2.10 * Update readme.txt * Delete duplicate file * Fix file paths * Fix Grunt issues #2990 * Skip failing unit test #2684 * Remove launch.json * PR comments #2684 * Change identation * Grunt fixes
* Refactor aioseop-count-chars.js #2755 * Clear preview snippet description when "Autogenerated Descriptions" is disabled #2975 * Fix #2927, #2747, #2337 * Set character treshold to 55 for OG:title and OG:description #2413 * Change let to var + minify * Use minified JavaScript files instead * Fix variable naming * Fix Grunt issues * Revert minified js * 3.3 (#17) * Add PHPCompatibility sniffs to PHPCS & fix issues (#2907) * Add PHPCompatibility sniffs to PHPCS #2851 * Ignore Composer & VScode for Git #2851 * Fix PHP compatibility issues (1) #2851 * Don't check PHP compatibility of unit tests #2851 * Fix PHP compatibility issues (2) #2851 * Move parse_ini_string() to compatibility/php-functions.php #2851 * Fix typo #2851 * Fix typo (2) #2851 * Add Grunt task set for Travis CI builds #2851 * Add Travis CI support for PHPCompatibility #2851 * Print installed sniffs after "composer install" in Travis CI #2851 * Delete composer.lock #2851 * Move parse_ini_string() from aioseop_functions.php to compatibility/php-functions.php #2851 * Remove compat-gutenberg.php * Readd compat-gutenberg.php * Fix Grunt #2851 * Fix path to compat files #2851 * Add package-lock.json to .gitignore #2851 * Add composer.lock to .gitignore #2851 * Fix phpDoc in compatibility/php-funcitons.php #2851 * Change schema person's name & logo to add the option of manually ente… (#2920) * Change schema person's name & logo to add the option of manually entered name & image * Grunt * Add Schema to AMP plugin (#2879) * Fix loose comparator in AMP Head causing a return with empty description * Move AMP hooks to separate function for AMP hooks * Add remove hook for AMP Schema * Add AIOSEOP's Schema to AMP * Dev-change aioseop_amp_description filter to only affect meta descriptions * Add filter aioseop_amp_schema to enable/disable schema on AMP posts * Dev-Fix disable schema filter and no meta desc. * Invert if statement and add third decimal to phpDoc since tags #506 * Add third decimal to phpDoc since tag (2) #506 * Fix Grunt issue * Fix Grunt issue (2) * Change bin path for phpcs (#2966) * Change bin path for phpcs #2965 * Delete phpcs and phpcompatibility script entries #2965 * Add new line to init-grunt.sh #2965 * Refactor operations in All_in_One_SEO_Pack_Opengraph::add_meta() (#2941) * Change variable variables to direct variables * Change early initialize thumbnail variable to use image variable * Change operations from call filter to call method * Add filter documentation * Change to group operations together * Add dev notes * Grunt * Dev-Fix filter params * Dev-Add dev note * Dev-Fix error on SSL enabled site * Dev-Change duplicate code to function * Only output meta descriptions if autogenerate descriptions is enabled (#2947) * Fix issue 2439 * Dev-Change to strict comparator * Dev-Fix empty value check * Dev-Change applied changes The excerpt was being added elsewhere as a final fallback * Revert previous changes #2439 * Refactor code #2439 * Remove unneeded check #2439 * Fix Grunt issue * Fix SEO for search results page (#2964) * Added/updated help text for new Schema fields (#2959) * #2958 Added/updated help text for new Schema fields * Add missing i18n domains #2958 * Resolves #2411 (#2955) * 3.2.10 to 3.3 (#2986) * Update help text for Sitemap Indexes setting (#2961) * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Update help text for Sitemap Indexes setting #2954 * Remove version check for Gutenberg/Chrome compatibility fix and check if user agent is set (#2928) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Only show Welcome Screen on major version updates (#2922) * add get_major_version function #2662 * only show welcome screen on major version updates #2662 * remove function * move function to aioseop_functions.php * Remove class keywords #2662 * Grunt & WPCS * Fix conflict between Chromium v77.0.3865.75 and Gutenberg (#2921) * Fix conflict between Chromium v77.0.3865.75 and Gutenberg #2914 * Grunt fixes #2914 * Revert removed package tag #2914 * Target WP 5.0 <= X < 5.3 #2914 * Move echo statement inside version check #2914 * Do proper version checks #2914 * Fix phpDoc #2914 * Add filter hook to disable schema.org markup (#2915) * Add filter hook to disable schema.org markup * fix return value for schema filter * Grunt fix #2913 * reversing schema filter logic and using a boolean instead of string * Remove WP v5.3 version check and move function out of action hook #2914 * Invert version_compare and prefix functions #2914 * Fix phpDocs #2914 * Rename compat-gutenberg.php to gutenberg-chrome.php #2914 * Fix undefined index HTTP_USER_AGENT #2952 * version bump to 3.2.10 * Update readme.txt * Delete duplicate file * Fix file paths * Fix Grunt issues #2990 * Add characterCounter to ignored JS variables * Fix bugs * Update character counter when editor changes #2977 * Fix bug where counter background colour doesn't change * PR comments * Support non-default plugin path * Remove unused code * Remove unneeded variable declaration * Include post-new.php as edit page * Use legacy code for taxonomies * Fix Grunt issues * Revert minified scripts * Variable alignment * Use let (ES6) and align variables
Issue #2938
Proposed changes
Refactors operations in
All_in_One_SEO_Pack_Opengraph::add_meta()
to fix a number problems that made tracking variables and debugging difficult.Types of changes
What types of changes does your code introduce?
Checklist
Testing instructions
Code refactor, so no changes to expected output. Testing would primarily be on the frontend.
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...