Changeset 3364102
- Timestamp:
- 09/18/2025 04:10:28 PM (5 months ago)
- File:
-
- 1 edited
-
slickplan-importer/trunk/slickplan.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
slickplan-importer/trunk/slickplan.php
r3251225 r3364102 6 6 Author: Slickplan.com <[email protected]> 7 7 Author URI: https://slickplan.com/ 8 Version: 2. 4.68 Version: 2.5.0 9 9 License: GPL-3.0 - https://www.gnu.org/licenses/gpl-3.0.html 10 10 */ … … 706 706 } 707 707 708 if ( 709 isset($data['contents']['meta_title']) 710 or isset($data['contents']['meta_description']) 711 or isset($data['contents']['meta_focus_keyword']) 712 ) { 713 // SEO by Yoast integration 714 if (class_exists('WPSEO_Meta') and method_exists('WPSEO_Meta', 'set_value')) { 715 WPSEO_Meta::set_value('title', $this->_metaTitle($data['contents']['meta_title'] ?? ''), $page['ID']); 716 if (isset($data['contents']['meta_description']) and $data['contents']['meta_description']) { 717 WPSEO_Meta::set_value('metadesc', $data['contents']['meta_description'], $page['ID']); 718 } 719 if (isset($data['contents']['meta_focus_keyword']) and $data['contents']['meta_focus_keyword']) { 720 WPSEO_Meta::set_value('focuskw', $data['contents']['meta_focus_keyword'], $page['ID']); 721 } 722 } 723 // All In One SEO Pack integration 724 if ( 725 defined('AIOSEO_VERSION') 726 and version_compare(AIOSEO_VERSION, '4.0.0', '>=') 727 and method_exists('\\AIOSEO\\Plugin\\Common\\Models\\Post', 'savePost') 728 ) { 729 $keywords = $data['contents']['meta_focus_keyword'] ?? ''; 730 if ($keywords) { 731 $keywords = explode(',', $keywords); 732 $keywords = array_map('trim', $keywords); 733 $keywords = wp_json_encode($keywords); 734 } 735 \AIOSEO\Plugin\Common\Models\Post::savePost($page['ID'], [ 736 'title' => $this->_metaTitle($data['contents']['meta_title'] ?? '', 'aio'), 737 'description' => $data['contents']['meta_description'] ?? '', 738 'keywords' => $keywords, 739 ]); 740 } 741 } 708 // SEO by Yoast integration 709 $this->_importPageYoast($data['contents'], $page['ID']); 710 // All In One SEO Pack integration 711 $this->_importPageAioSeo($data['contents'], $page['ID']); 712 742 713 $page['url'] = get_permalink($page['ID']); 743 714 … … 757 728 } 758 729 return $page; 730 } 731 732 private function _importPageYoast(array $data, $pageId) 733 { 734 if (!class_exists('WPSEO_Meta') or !method_exists('WPSEO_Meta', 'set_value')) { 735 return; 736 } 737 738 if ($seoValue = $this->_metaTitle($data['meta_title'] ?? '')) { 739 WPSEO_Meta::set_value('title', $seoValue, $pageId); 740 } 741 if ($seoValue = $data['meta_description'] ?? '') { 742 WPSEO_Meta::set_value('metadesc', $seoValue, $pageId); 743 } 744 if ($seoValue = $data['meta_focus_keyword'] ?? '') { 745 WPSEO_Meta::set_value('focuskw', $seoValue, $pageId); 746 } 747 if ($seoValue = $data['canonical_url'] ?? '') { 748 WPSEO_Meta::set_value('canonical', WPSEO_Utils::sanitize_url($seoValue), $pageId); 749 } 750 if (!empty($seoValue = array_filter(explode(',', $data['meta_robots'] ?? '')))) { 751 if (in_array('noindex', $seoValue, true)) { 752 WPSEO_Meta::set_value('meta-robots-noindex', '1', $pageId); 753 } 754 if (in_array('nofollow', $seoValue, true)) { 755 WPSEO_Meta::set_value('meta-robots-nofollow', '1', $pageId); 756 } 757 $seoValue = array_filter($seoValue, function ($item) { 758 return $item !== 'noindex' && $item !== 'nofollow'; 759 }); 760 if (!empty($seoValue)) { 761 WPSEO_Meta::set_value('meta-robots-adv', implode(',', $seoValue), $pageId); 762 } 763 } 764 } 765 766 private function _importPageAioSeo(array $data, $pageId) 767 { 768 if ( 769 !defined('AIOSEO_VERSION') 770 or !version_compare(AIOSEO_VERSION, '4.0.0', '>=') 771 or !method_exists('\\AIOSEO\\Plugin\\Common\\Models\\Post', 'savePost') 772 ) { 773 return; 774 } 775 776 $seoData = []; 777 if ($seoValue = $this->_metaTitle($data['meta_title'] ?? '', 'aio')) { 778 $seoData['title'] = $seoValue; 779 } 780 if ($seoValue = $data['meta_description'] ?? '') { 781 $seoData['description'] = $seoValue; 782 } 783 if (!empty($seoValue = array_filter(array_map('trim', explode(',', $data['meta_focus_keyword'] ?? ''))))) { 784 $seoData['keywords'] = wp_json_encode($seoValue); 785 } 786 if ($seoValue = $data['canonical_url'] ?? '') { 787 $seoData['canonicalUrl'] = $seoValue; 788 } 789 if (!empty($seoValue = array_filter(explode(',', $data['meta_robots'] ?? '')))) { 790 $seoData['default'] = false; 791 $seoData['noindex'] = in_array('noindex', $seoValue, true); 792 $seoData['nofollow'] = in_array('nofollow', $seoValue, true); 793 $seoData['noarchive'] = in_array('noarchive', $seoValue, true); 794 $seoData['notranslate'] = in_array('notranslate', $seoValue, true); 795 $seoData['noimageindex'] = in_array('noimageindex', $seoValue, true); 796 $seoData['nosnippet'] = in_array('nosnippet', $seoValue, true); 797 $seoData['noodp'] = in_array('noodp', $seoValue, true); 798 } 799 if (!empty($seoData)) { 800 \AIOSEO\Plugin\Common\Models\Post::savePost($pageId, $seoData); 801 } 759 802 } 760 803 … … 1512 1555 $cell['contents']['assignee']['@attributes'] 1513 1556 )) { 1514 $array['users'][$cell['contents']['assignee']['@value']] 1515 = $cell['contents']['assignee']['@attributes']; 1557 $array['users'][$cell['contents']['assignee']['@value']] = $cell['contents']['assignee']['@attributes']; 1516 1558 } 1517 1559 if (isset($cell['@attributes']['id'])) {
Note: See TracChangeset
for help on using the changeset viewer.