home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (xmlsitemap_engines_test.module)

This example Drupal source code file (xmlsitemap_engines_test.module) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

access, array, callback, engines, function, no, php, recieved, return, sitemap, true, type, url, xmlsitemap_engines_test_pinged

The xmlsitemap_engines_test.module Drupal example source code

<?php
// $Id: xmlsitemap_engines_test.module,v 1.6 2010/01/31 19:37:13 davereid Exp $

/**
 * Implements hook_menu().
 */
function xmlsitemap_engines_test_menu() {
  $items['ping'] = array(
    'page callback' => 'xmlsitemap_engines_test_pinged',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * Implements hook_xmlsitemap_engine_info().
 */
function xmlsitemap_engines_test_xmlsitemap_engine_info() {
  $engines['simpletest'] = array(
    'name' => t('SimpleTest'),
    'url' => 'http://example.com/',
  );
  return $engines;
}

/**
 * Implements hook_xmlsitemap_engine_info_alter().
 */
function xmlsitemap_engines_test_xmlsitemap_engine_info_alter(&$engines) {
  $engines['simpletest']['url'] = url('ping', array('absolute' => TRUE, 'query' => array('sitemap' => ''))) . '[sitemap]';
}

function xmlsitemap_engines_test_pinged() {
  if (empty($_GET['sitemap']) || !valid_url($_GET['sitemap'])) {
    watchdog('xmlsitemap', 'No valid sitemap parameter provided.', array(), WATCHDOG_WARNING);
    // @todo Remove this? Causes an extra watchdog error to be handled.
    return MENU_NOT_FOUND;
  }
  else {
    watchdog('xmlsitemap', 'Recieved ping for @sitemap.', array('@sitemap' => $_GET['sitemap']));
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal xmlsitemap_engines_test.module source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.