This commit is contained in:
root@pico committed 2015-05-01 21:20:47 +02:00
1 parent 70d2335bba
commit 7428b67da5
1086 files changed
+94145 -59082

No files matched your search

@@ -1,118 +1,111 @@
<?php
/**
* @package Frontend
*
* This code handles the Google+ specific output that's not covered by OpenGraph.
* @package WPSEO\Frontend
*/
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
/**
* This code handles the Google+ specific output that's not covered by OpenGraph.
*/
class WPSEO_GooglePlus {
if ( ! class_exists( 'WPSEO_GooglePlus' ) ) {
class WPSEO_GooglePlus extends WPSEO_Frontend {
/**
* @var object Instance of this class
*/
public static $instance;
/**
* @var object Instance of this class
*/
public static $instance;
/**
* Class constructor.
*/
public function __construct() {
add_action( 'wpseo_googleplus', array( $this, 'google_plus_title' ), 10 );
add_action( 'wpseo_googleplus', array( $this, 'description' ), 11 );
add_action( 'wpseo_googleplus', array( $this, 'google_plus_image' ), 12 );
/**
* Class constructor.
*/
public function __construct() {
add_action( 'wpseo_googleplus', array( $this, 'google_plus_title' ), 10 );
add_action( 'wpseo_googleplus', array( $this, 'description' ), 11 );
add_action( 'wpseo_googleplus', array( $this, 'google_plus_image' ), 12 );
add_action( 'wpseo_head', array( $this, 'output' ), 40 );
}
add_action( 'wpseo_head', array( $this, 'output' ), 40 );
/**
* Get the singleton instance of this class
*
* @return object
*/
public static function get_instance() {
if ( ! ( self::$instance instanceof self ) ) {
self::$instance = new self();
}
/**
* Get the singleton instance of this class
*
* @return object
*/
public static function get_instance() {
if ( ! ( self::$instance instanceof self ) ) {
self::$instance = new self();
}
return self::$instance;
}
return self::$instance;
}
/**
* Output the Google+ specific content
*/
public function output() {
/**
* Output the Google+ specific content
* Action: 'wpseo_googleplus' - Hook to add all Google+ specific output to.
*/
public function output() {
do_action( 'wpseo_googleplus' );
}
/**
* Output the Google+ specific description
*/
public function description() {
if ( is_singular() ) {
$desc = WPSEO_Meta::get_value( 'google-plus-description' );
/**
* Action: 'wpseo_googleplus' - Hook to add all Google+ specific output to.
* Filter: 'wpseo_googleplus_desc' - Allow developers to change the Google+ specific description output
*
* @api string $desc The description string
*/
do_action( 'wpseo_googleplus' );
}
$desc = trim( apply_filters( 'wpseo_googleplus_desc', $desc ) );
/**
* Output the Google+ specific description
*/
public function description() {
if ( is_singular() ) {
$desc = WPSEO_Meta::get_value( 'google-plus-description' );
/**
* Filter: 'wpseo_googleplus_desc' - Allow developers to change the Google+ specific description output
*
* @api string $desc The description string
*/
$desc = trim( apply_filters( 'wpseo_googleplus_desc', $desc ) );
if ( is_string( $desc ) && '' !== $desc ) {
echo '<meta itemprop="description" content="' . esc_attr( $desc ) . '">' . "\n";
}
}
}
/**
* Output the Google+ specific title
*/
public function google_plus_title() {
if ( is_singular() ) {
$title = WPSEO_Meta::get_value( 'google-plus-title' );
/**
* Filter: 'wpseo_googleplus_title' - Allow developers to change the Google+ specific title
*
* @api string $title The title string
*/
$title = trim( apply_filters( 'wpseo_googleplus_title', $title ) );
if ( is_string( $title ) && $title !== '' ) {
$title = wpseo_replace_vars( $title, get_post() );
echo '<meta itemprop="name" content="' . esc_attr( $title ) . '">' . "\n";
}
}
}
/**
* Output the Google+ specific image
*/
public function google_plus_image() {
if ( is_singular() ) {
$image = WPSEO_Meta::get_value( 'google-plus-image' );
/**
* Filter: 'wpseo_googleplus_image' - Allow changing the Google+ image
*
* @api string $img Image URL string
*/
$image = trim( apply_filters( 'wpseo_googleplus_image', $image ) );
if ( is_string( $image ) && $image !== '' ) {
echo '<meta itemprop="image" content="' . esc_url( $image ) . '">' . "\n";
}
if ( is_string( $desc ) && '' !== $desc ) {
echo '<meta itemprop="description" content="', esc_attr( $desc ), '">', "\n";
}
}
}
} // end if class exists
/**
* Output the Google+ specific title
*/
public function google_plus_title() {
if ( is_singular() ) {
$title = WPSEO_Meta::get_value( 'google-plus-title' );
/**
* Filter: 'wpseo_googleplus_title' - Allow developers to change the Google+ specific title
*
* @api string $title The title string
*/
$title = trim( apply_filters( 'wpseo_googleplus_title', $title ) );
if ( is_string( $title ) && $title !== '' ) {
$title = wpseo_replace_vars( $title, get_post() );
echo '<meta itemprop="name" content="', esc_attr( $title ), '">', "\n";
}
}
}
/**
* Output the Google+ specific image
*/
public function google_plus_image() {
if ( is_singular() ) {
$image = WPSEO_Meta::get_value( 'google-plus-image' );
/**
* Filter: 'wpseo_googleplus_image' - Allow changing the Google+ image
*
* @api string $img Image URL string
*/
$image = trim( apply_filters( 'wpseo_googleplus_image', $image ) );
if ( is_string( $image ) && $image !== '' ) {
echo '<meta itemprop="image" content="', esc_url( $image ), '">', "\n";
}
}
}
}