This repository has been archived by the owner on May 17, 2023. It is now read-only.
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
0 parents
commit fed31a0
Showing
3 changed files
with
211 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
=== Rel Publisher === | ||
Contributors: chrisguitarguy, agencypmg | ||
Donate link: http://www.pwsausa.org/give.htm | ||
Tags: google+, google plus, social, rel publisher | ||
Requires at least: 3.4 | ||
Tested up to: 3.4.1 | ||
Stable tag: 1.0 | ||
License: GPLv2 | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
Rel Publisher is a simple plugin that lets you easily add <link rel="publisher" /> to your site. | ||
|
||
== Description == | ||
|
||
Google+ pages can verify their URLs by adding `<link rel="publisher" href="your_plus_page_here" />` to the `<head>` section of a website. | ||
|
||
This plugin lets you do that. | ||
|
||
[More information](http://support.google.com/plus/bin/answer.py?hl=en&answer=1713826) on the Google+ help pages. | ||
|
||
== Installation == | ||
|
||
Use the built in installer or | ||
|
||
1. Click the big button to download the latest version | ||
2. Unzip the file and place the `rel-publisher` folder in your plugin directory | ||
3. Login and activate the plugin | ||
|
||
== Frequently Asked Questions == | ||
|
||
= Where is the options page? = | ||
|
||
There isn't one. Just a single field and section on the general options page. | ||
|
||
== Screenshots == | ||
|
||
1. The field on the admin page. | ||
|
||
== Changelog == | ||
|
||
= 1.0 = | ||
* First version. | ||
|
||
== Upgrade Notice == | ||
|
||
n/a |
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,165 @@ | ||
<?php | ||
/* | ||
Plugin Name: Rel Publisher | ||
Plugin URI: https://github.com/AgencyPMG/Rel-Publisher | ||
Description: A simple plugin that adds a <link rel="publisher" /> to your <head> section -- userful for Google+ | ||
Version: 1.0 | ||
Text Domain: rel-publisher | ||
Domain Path: /lang | ||
Author: Christopher Davis | ||
Author URI: http://pmg.co/people/chris | ||
License: GPL2 | ||
Copyright 2012 Performance Media Group <seo@pmg.co> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License, version 2, as | ||
published by the Free Software Foundation. | ||
This program 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 this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
PMG_Rel_Publisher::init(); | ||
|
||
class PMG_Rel_Publisher | ||
{ | ||
/** | ||
* Our option name | ||
* | ||
* @since 1.0 | ||
*/ | ||
const OPTION = 'pmg_rel_publisher'; | ||
|
||
/** | ||
* Page on which this option will reside. | ||
* | ||
* @since 1.0 | ||
*/ | ||
const PAGE = 'general'; | ||
|
||
/** | ||
* Secton for this option. | ||
* | ||
* @since 1.0 | ||
*/ | ||
const SECT = 'rel_publisher'; | ||
|
||
/** | ||
* Adds actions and such. | ||
* | ||
* @since 1.0 | ||
* @access public | ||
* @uses add_action | ||
* @return null | ||
*/ | ||
public static function init() | ||
{ | ||
add_action( | ||
'admin_init', | ||
array(__CLASS__, 'settings') | ||
); | ||
|
||
add_action( | ||
'wp_head', | ||
array(__CLASS__, 'head'), | ||
3 | ||
); | ||
} | ||
|
||
/** | ||
* Hooked into `admin_init`. Registers the settings and adds settings | ||
* fields and sections. | ||
* | ||
* @since 1.0 | ||
* @access public | ||
* @uses register_setting | ||
* @uses add_settings_section | ||
* @uses add_settings_field | ||
* @return null | ||
*/ | ||
public static function settings() | ||
{ | ||
register_setting( | ||
self::PAGE, | ||
self::OPTION, | ||
array(__CLASS__, 'validate') | ||
); | ||
|
||
add_settings_section( | ||
self::SECT, | ||
__('Rel Publisher', 'rel-publisher'), | ||
'__return_false', | ||
self::PAGE | ||
); | ||
|
||
add_settings_field( | ||
'rel-publisher-gplus', | ||
__('Google+ URL', 'rel-publisher'), | ||
array(__CLASS__, 'field'), | ||
self::PAGE, | ||
self::SECT, | ||
array('label_for' => self::OPTION) | ||
); | ||
} | ||
|
||
/** | ||
* Callback function for the settings field. | ||
* | ||
* @since 1.0 | ||
* @access public | ||
* @uses get_option | ||
* @uses esc_attr | ||
* @return null | ||
*/ | ||
public static function field() | ||
{ | ||
printf( | ||
'<input type="text" class="regular-text" id="%1$s" name="%1$s" value="%2$s" />', | ||
esc_attr(self::OPTION), | ||
esc_attr(get_option(self::OPTION, '')) | ||
); | ||
} | ||
|
||
/** | ||
* Settings validation callback. Escapes the URL if it happens to be there. | ||
* | ||
* @since 1.0 | ||
* @access public | ||
* @uses esc_url_raw | ||
* @return string Empty or the escaped URL. | ||
*/ | ||
public static function validate($dirty) | ||
{ | ||
$clean = ''; | ||
if($dirty) | ||
$clean = esc_url_raw($dirty); | ||
|
||
return $clean; | ||
} | ||
|
||
/** | ||
* Hooked into `wp_head`. Spits out the rel="publish" link if we have a | ||
* google+ url. | ||
* | ||
* @since 1.0 | ||
* @access public | ||
* @uses get_option | ||
* @return null | ||
*/ | ||
public static function head() | ||
{ | ||
$gplus = get_option(self::OPTION); | ||
|
||
if(!$gplus) | ||
return; | ||
|
||
printf("<link rel='publisher' href='%s' />\n", esc_url($gplus)); | ||
} | ||
} // end class |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.