-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c445f3
commit cd5b454
Showing
72 changed files
with
4,614 additions
and
249 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
namespace AIOSEO\Plugin\Common\Sitemap; | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
use AIOSEO\Plugin\Common\Models; | ||
|
||
/** | ||
* Handles our sitemap search engine ping feature. | ||
* | ||
* @since 4.0.0 | ||
*/ | ||
class Ping { | ||
/** | ||
* Registers our hooks. | ||
* | ||
* @since 4.0.0 | ||
*/ | ||
public function init() { | ||
if ( 0 === (int) get_option( 'blog_public' ) ) { | ||
return; | ||
} | ||
|
||
add_action( 'init', [ $this, 'scheduleRecurring' ] ); | ||
|
||
// Ping sitemap on each post update. | ||
add_action( 'save_post', [ $this, 'schedule' ], 1000, 2 ); | ||
add_action( 'delete_post', [ $this, 'schedule' ], 1000, 2 ); | ||
|
||
// Action Scheduler hooks. | ||
add_action( 'aioseo_sitemap_ping', [ $this, 'ping' ] ); | ||
add_action( 'aioseo_sitemap_ping_recurring', [ $this, 'ping' ] ); | ||
} | ||
|
||
/** | ||
* Schedules a sitemap ping. | ||
* | ||
* @since 4.0.0 | ||
* | ||
* @param integer $postId The ID of the post. | ||
* @param \WP_Post $post The post object. | ||
* @return void | ||
*/ | ||
public function schedule( $postId, $post = null ) { | ||
if ( ! aioseo()->helpers->isValidPost( $post ) ) { | ||
return; | ||
} | ||
|
||
// If Limit Modified Date is enabled, let's return early. | ||
$aioseoPost = Models\Post::getPost( $postId ); | ||
if ( $aioseoPost->limit_modified_date ) { | ||
return; | ||
} | ||
|
||
// First, unschedule any ping actions that might already be enqueued. | ||
aioseo()->actionScheduler->unschedule( 'aioseo_sitemap_ping' ); | ||
// Then, schedule the new ping. | ||
aioseo()->actionScheduler->scheduleSingle( 'aioseo_sitemap_ping', 30 ); | ||
} | ||
|
||
/** | ||
* Schedules the recurring sitemap ping. | ||
* | ||
* @since 4.0.0 | ||
* | ||
* @return void | ||
*/ | ||
public function scheduleRecurring() { | ||
try { | ||
if ( ! as_next_scheduled_action( 'aioseo_sitemap_ping_recurring' ) ) { | ||
|
||
$interval = apply_filters( 'aioseo_sitemap_ping_recurring', DAY_IN_SECONDS ); | ||
as_schedule_recurring_action( strtotime( 'tomorrow' ), $interval, 'aioseo_sitemap_ping_recurring', [], 'aioseo' ); | ||
} | ||
} catch ( \Exception $e ) { | ||
// Do nothing. | ||
} | ||
} | ||
|
||
/** | ||
* Pings search engines when the sitemap is updated. | ||
* | ||
* @since 4.0.0 | ||
* | ||
* @param array $sitemapUrls Sitemap URLs that should be sent to the remote endpoints. | ||
* @return void | ||
*/ | ||
public function ping( $sitemapUrls = [] ) { | ||
$endpoints = apply_filters( 'aioseo_sitemap_ping_urls', [ | ||
'https://www.google.com/ping?sitemap=' | ||
] ); | ||
|
||
if ( aioseo()->options->sitemap->general->enable ) { | ||
$sitemapUrls[] = aioseo()->sitemap->helpers->getUrl( 'general' ); | ||
} | ||
if ( aioseo()->options->sitemap->rss->enable ) { | ||
$sitemapUrls[] = aioseo()->sitemap->helpers->getUrl( 'rss' ); | ||
} | ||
|
||
$addonsSitemapUrls = aioseo()->addons->doAddonFunction( 'ping', 'getPingUrls' ); | ||
foreach ( $addonsSitemapUrls as $addonSitemapUrls ) { | ||
if ( is_array( $addonSitemapUrls ) ) { | ||
$sitemapUrls = array_merge( $sitemapUrls, $addonSitemapUrls ); | ||
} | ||
} | ||
|
||
foreach ( $endpoints as $endpoint ) { | ||
foreach ( $sitemapUrls as $url ) { | ||
wp_remote_get( $endpoint . urlencode( $url ) ); | ||
} | ||
} | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { __ } from '@wordpress/i18n' | ||
|
||
const td = import.meta.env.VITE_TEXTDOMAIN | ||
|
||
export const useHeadlineResult = () => { | ||
const strings = { | ||
wordBalance : __('Word balance', td), | ||
characterCount : __('Character Count', td), | ||
sentiment : __('Sentiment', td), | ||
wordCount : __('Word Count', td), | ||
headlineType : __('Headline Type', td), | ||
goal : __('Goal: ', td) | ||
} | ||
|
||
return { | ||
strings | ||
} | ||
} |
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,38 @@ | ||
import { __, sprintf } from '@wordpress/i18n' | ||
import { useRootStore } from '@/vue/stores' | ||
|
||
const td = import.meta.env.VITE_TEXTDOMAIN | ||
|
||
export function useSearchConsole () { | ||
const strings = { | ||
aioseoCanNowVerify : sprintf( | ||
// Translators: 1 - The plugin short name ("AIOSEO"). | ||
__('%1$s can now verify whether your site is correctly verified with Google Search Console and that your sitemaps have been submitted correctly. Connect with Google Search Console now to ensure your content is being added to Google as soon as possible for increased rankings.', td), | ||
import.meta.env.VITE_SHORT_NAME | ||
), | ||
connectToGoogleSearchConsole : __('Connect to Google Search Console', td), | ||
connectToGoogleToAddSitemaps : __('Connect to Google to automatically add sitemaps and keep them in sync.', td), | ||
syncYourSiteWithGsc : __('Upgrade to Pro to unlock Search Statistics and sync your site with Google Search Console. Get valuable insights right inside your WordPress dashboard, track keyword rankings and search performance for individual posts with actionable insights to help you rank higher in search results!', td), | ||
fixSitemapErrors : __('Fix Errors', td), | ||
aioseoHasFoundSomeErrorsInSitemaps : sprintf( | ||
// Translators: 1 - The plugin short name ("AIOSEO"). | ||
__('%1$s has found some errors in sitemaps that were previously submitted to Google Search Console. Since %1$s manages your sitemaps, these additional sitemaps can be removed.', td), | ||
import.meta.env.VITE_SHORT_NAME | ||
), | ||
thereAreSitemapsWithErrors : __('There are sitemaps with errors', td), | ||
gscFeature1 : __('Google Search Console Metrics', td), | ||
gscFeature2 : __('SEO Changes Performance Tracking', td), | ||
gscFeature3 : __('Top Content Discovery', td), | ||
gscFeature4 : __('Content Decay Tracking', td) | ||
} | ||
|
||
const redirectToGscSettings = () => { | ||
const rootStore = useRootStore() | ||
window.location.href = `${rootStore.aioseo.urls.aio.settings}&aioseo-scroll=google-search-console-settings&aioseo-highlight=google-search-console-settings#/webmaster-tools?activetool=googleSearchConsole` | ||
} | ||
|
||
return { | ||
strings, | ||
redirectToGscSettings | ||
} | ||
} |
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,25 @@ | ||
import { useAccessControl } from './AccessControl' | ||
import { useHeadlineResult } from './HeadlineResult' | ||
import { useJsonValues } from './JsonValues' | ||
import { useNotifications } from './Notifications' | ||
import { useSeoSiteScore } from './SeoSiteScore' | ||
import { useTruSeoScore } from './TruSeoScore' | ||
import { useIndexStatus } from './IndexStatus' | ||
import { useSearchConsole } from './SearchConsole' | ||
import { useWebmasterTools } from './WebmasterTools' | ||
import { useWidgets } from './Widgets' | ||
import { useWizard } from './Wizard' | ||
|
||
export { | ||
useAccessControl, | ||
useHeadlineResult, | ||
useJsonValues, | ||
useNotifications, | ||
useSeoSiteScore, | ||
useTruSeoScore, | ||
useIndexStatus, | ||
useSearchConsole, | ||
useWebmasterTools, | ||
useWidgets, | ||
useWizard | ||
} |
Oops, something went wrong.