/* Plugin Name: RSS Validator Plugin URI: http://andrewnorcross.com/plugins/ Description: Checks your RSS feed against the W3 RSS validator for errors Version: 1.1 Author: Andrew Norcross Author URI: http://andrewnorcross.com Copyright 2012 Andrew Norcross 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 */ // http://feed2.w3.org/docs/soap.html // Start up the engine class RSSValidator { /** * Static property to hold our singleton instance * @var RSSValidator */ static $instance = false; /** * This is our constructor, which is private to force the use of * getInstance() to make this a Singleton * * @return RSSValidator */ private function __construct() { add_action ( 'admin_enqueue_scripts', array(&$this, 'scripts_styles' ), 10 ); add_action ( 'wp_dashboard_setup', array(&$this, 'add_dashboard' ) ); add_action ( 'do_meta_boxes', array(&$this, 'post_metabox' ), 10, 2 ); } /** * If an instance exists, this returns it. If not, it creates one and * retuns it. * * @return RSSValidator */ public static function getInstance() { if ( !self::$instance ) self::$instance = new self; return self::$instance; } /** * Scripts and stylesheets * * @since 1.0 */ public function scripts_styles($hook) { // for post editor if ( $hook == 'post-new.php' || $hook == 'post.php' ) : wp_enqueue_style( 'validator-style', plugins_url('/lib/css/rss-validator.css', __FILE__), array(), null, 'all' ); wp_enqueue_script( 'validator-init', plugins_url('/lib/js/validator.init.js', __FILE__) , array('jquery'), null, true ); endif; // for dashboard $current_screen = get_current_screen(); if ( 'dashboard' == $current_screen->base ) : wp_enqueue_style( 'validator-style', plugins_url('/lib/css/rss-validator.css', __FILE__), array(), null, 'all' ); wp_enqueue_script( 'validator-init', plugins_url('/lib/js/validator.init.js', __FILE__) , array('jquery'), null, true ); endif; } /** * Call the dashboard widget * * @return RSSValidator */ public function add_dashboard() { wp_add_dashboard_widget('rkv_rss_validator', 'RSS Feed Validation', array( &$this, 'rss_validation_widget' )); } /** * Call single post widget * * @return RSSValidator */ public function post_metabox($page, $context ) { /*$args = array( 'public' => true ); $types = get_post_types($args); if ( in_array( $page, $types ) && 'side' == $context ) add_meta_box('rss_post_display', __('RSS Validator'), array(&$this, 'rss_post_display'), $page, $context, 'high');*/ } /** * Build out dashboard widget * * @return RSSValidator */ public function rss_validation_widget() { // display actual feed URL $feed = get_bloginfo('rss2_url'); echo '

Your main RSS feed: '.$feed.'

'; // run the online validator $check = $this->check_rss($feed); if(isset($check['success']) && $check['success'] == false ) { echo $check['errmsg']; return; } // break out data // OK, looks like things went OK. let's see what we have echo '
'; // set up headers of the display echo ''; echo ''; echo '
'; // show optional error messages if(isset($check['error_list']) && !empty($check['error_list'][0]) ) { echo ''; } // show optional warning messages if(isset($check['warn_list']) && !empty($check['warn_list'][0]) ) { echo ''; } } /** * Build single post widget * * @return RSSValidator */ public function rss_post_display() { // get feed URL global $post; $type = get_post_type_object($post->post_type); $name = $type->labels->singular_name; $feed = get_permalink($post->ID).'feed/'; echo '

This '.$name.' RSS feed
'.$feed.'

'; // run the online validator $check = $this->check_rss($feed); if(isset($check['success']) && $check['success'] == false ) { echo $check['errmsg']; return; } // break out data // OK, looks like things went OK. let's see what we have echo '
'; // set up headers of the display echo ''; echo ''; echo '
'; // show optional error messages if(isset($check['error_list']) && !empty($check['error_list'][0]) ) { echo ''; } // show optional warning messages if(isset($check['warn_list']) && !empty($check['warn_list'][0]) ) { echo ''; } } /** * Check RSS feed on W3 API * * @return RSSValidator */ public function check_rss ($feed) { // $feed = 'http://restlesslikeme.com/feed/'; $request = new WP_Http; $url = 'http://validator.w3.org/feed/check.cgi?url='.urlencode($feed).'&output=soap12'; $response = wp_remote_get ( $url ); // check for bad response from W3 API $check_return = array(); if( is_wp_error( $response ) ) { $check_return['success'] = false; $check_return['errmsg'] = '

Sorry, there was an error with your request.

'; } if(!is_wp_error( $response ) ) { $feed_data = $response['body']; $return_xml = simplexml_load_string( (string) $feed_data ); $return_xml->registerXPathNamespace( 'm', 'http://www.w3.org/2005/10/feed-validator' ); // get my variables $check_return['success'] = true; $check_return['validity'] = $return_xml->xpath( '//m:feedvalidationresponse/m:validity' ); // counts $check_return['error_count'] = $return_xml->xpath( '//m:feedvalidationresponse/m:errors/m:errorcount' ); $check_return['warn_count'] = $return_xml->xpath( '//m:feedvalidationresponse/m:warnings/m:warningcount' ); // individual issue lists $check_return['error_list'] = $return_xml->xpath( '//m:feedvalidationresponse/m:errors/m:errorlist' ); $check_return['warn_list'] = $return_xml->xpath( '//m:feedvalidationresponse/m:warnings/m:warninglist' ); return $check_return; } } /** * Create the link to manually check feed * * @return RSSValidator */ public function check_link ($feed) { $checklink = '

See complete details on W3 Validator site

'; return $checklink; } /// end class } // Instantiate our class $RSSValidator = RSSValidator::getInstance(); Institucionales - Página 4 de 25 - Revista ASIA SUR

Institucionales

index19
Febrero 2015
1798

[AS 176] Colección Otoño – Invierno de Index

Ripley lanzó la colección otoño-invierno 2015 de su exclusiva marca de ropa, Index,…

_MG_3904-45
Febrero 2015
737

[AS 176] Tomando la vida de forma exquisita

Ivette Johnson, Vanessa Rosales y Karla Tiravanti
Febrero 2015
1491

[AS 176] Inka Challenge 2015

El pasado 7 de febrero, Asia fue el escenario del Inka Challenge…

DSC_0188
Febrero 2015
1073

[AS 175] 2do dj Night Training en Vanna Coach

El pasado jueves 29 de enero se realizó el segundo entrenamiento del…

Team Boca Jr Kids
Febrero 2015
1027

[AS 175] Entrenamiento con la Escuela de Fútbol de Boca Juniors

El pasado sábado 31 de enero, se realizó un nuevo entrenamiento de…

Daniela Flores Guerra y Valeria Piazza
Febrero 2015
1415

[AS 175] Blue Ribbon Party by PERONI

El pasado viernes 30 de enero, Peroni Nastro Azzurro celebró el evento…

IMG_7750
Febrero 2015
1109

[AS 174] 1er Inter Playas Futbol 11 en Boulevard de Asia

Comenzó el campeonato Inter Playas, Categoria Mayores 35 años, en el Centro Deportivo…

Team O'Neill
Febrero 2015
884

[AS 174] O’Neill México Surftrip

El equipo de O’Neill, integrado por Lucca, Gustavo y Andrés, llegó a…

Daniel Castillo, Maria Paz Guerrero, Dolores Ruda, Lourdes Gomez de la Torre, Andrea Noriega, Itala Caillaux, Amelie Caillaux y Gabriel Reaño
Febrero 2015
1597

[AS 174] Una noche en CM

Los socios e invitados a una de las discotecas más exclusivas del…

IMG_8369
Febrero 2015
1356

[AS 174] Fiesta Lua by Corona Extra

El pasado 24 de enero se realizó la tercera edición de Lua,…

camila milla_7566
Febrero 2015
1564

[AS 174] #16Noches en tu salsa

El sábado 24 de enero la orquesta de Salsa Ray Callao puso…

Paul Güell, Diana Leí, Luis felipe Inurritegui y Karla Chuquihuara
Febrero 2015
1573

[AS 173] Nuevo Pisco Intipalka en CM

El pasado sábado 17 de enero se llevó a cabo el lanzamiento…

Página 4 de 25« Primera...23456...1020...Última »