-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-with-AIO-SEO fix/#1899-HTML-Title-Issue-with-AIO-SEO
- Loading branch information
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/modules/all-in-one-seo-pack-integration/all-in-one-seo-pack-integration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* @package PublishPress Authors | ||
* @author PublishPress | ||
* | ||
* Copyright (C) 2018 PublishPress | ||
* | ||
* This file is part of PublishPress Authors | ||
* | ||
* PublishPress Authors is free software: you can redistribute it | ||
* and/or modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* PublishPress is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PublishPress. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
use MultipleAuthors\Classes\Legacy\Module; | ||
use MultipleAuthors\Factory; | ||
|
||
if (!class_exists('MA_All_In_One_Seo_Pack_Integration')) { | ||
/** | ||
* class MA_All_In_One_Seo_Pack_Integration | ||
*/ | ||
class MA_All_In_One_Seo_Pack_Integration extends Module | ||
{ | ||
public $module_name = 'all_in_one_seo_pack_integration'; | ||
|
||
/** | ||
* Instance for the module | ||
* | ||
* @var stdClass | ||
*/ | ||
public $module; | ||
public $module_url; | ||
|
||
/** | ||
* Construct the MA_All_In_One_Seo_Pack_Integration class | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->module_url = $this->get_module_url(__FILE__); | ||
|
||
// Register the module with PublishPress | ||
$args = [ | ||
'title' => __('All In One Seo Pack Integration', 'publishpress-authors'), | ||
'short_description' => __('Add compatibility with the All In One Seo Pack plugin', 'publishpress-authors'), | ||
'module_url' => $this->module_url, | ||
'icon_class' => 'dashicons dashicons-feedback', | ||
'slug' => 'all-in-one-seo-pack-integration', | ||
'default_options' => [ | ||
'enabled' => 'on', | ||
], | ||
'options_page' => false, | ||
'autoload' => true, | ||
]; | ||
|
||
// Apply a filter to the default options | ||
$args['default_options'] = apply_filters( | ||
'pp_all_in_one_seo_pack_integration_default_options', | ||
$args['default_options'] | ||
); | ||
|
||
$legacyPlugin = Factory::getLegacyPlugin(); | ||
|
||
$this->module = $legacyPlugin->register_module($this->module_name, $args); | ||
|
||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Initialize the module. Conditionally loads if the module is enabled | ||
*/ | ||
public function init() | ||
{ | ||
add_filter('aioseo_title', [$this, 'all_in_one_seo_pack_author_title']); | ||
} | ||
|
||
/** | ||
* Set author page title | ||
* | ||
* @param string title | ||
* @return string | ||
*/ | ||
public function all_in_one_seo_pack_author_title($title) { | ||
|
||
if (is_author() && !is_tax('author')) { | ||
$archiveAuthor = get_archive_author(); | ||
if (is_object($archiveAuthor) && isset($archiveAuthor->display_name)) { | ||
$title = $archiveAuthor->display_name . $title; | ||
} | ||
} | ||
|
||
return $title; | ||
} | ||
|
||
} | ||
} |