Skip to content
Snippets Groups Projects
Commit 299a9299 authored by Earl Miles's avatar Earl Miles
Browse files

#248640: Comment/documentation cleanup by Keith Smith, plus a hopeful fix for clean urls off

parent 6829e02b
No related branches found
No related tags found
No related merge requests found
; $Id$ ; $Id$
name = Advanced help name = Advanced help
description = Allow advanced help and documentation description = Allow advanced help and documentation.
core = 6.x core = 6.x
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
function advanced_help_install() { function advanced_help_install() {
drupal_set_message('Installing advanced_help'); drupal_set_message('Installing advanced_help.');
drupal_install_schema('advanced_help'); drupal_install_schema('advanced_help');
} }
......
...@@ -17,27 +17,27 @@ ...@@ -17,27 +17,27 @@
* [TOPIC_ID] * [TOPIC_ID]
* title = "Title of topic" * title = "Title of topic"
* file = filename of topic, without the .html extension * file = filename of topic, without the .html extension
* weight = How important the topic is on the index page * weight = the importance of the topic on the index page
* parent = the optional topic parent to use in the breadcrumb. Can be either topic or module%topic * parent = the optional topic parent to use in the breadcrumb. Can be either topic or module%topic
* @endcode * @endcode
* *
* All topics are addressed by the module that provides the topic, and the topic * All topics are addressed by the module that provides the topic, and the topic
* id. Modules can embed links anywhere they want with this: * id. Links may be embedded as in the following example:
* *
* @code * @code
* $output .= theme('advanced_help_topic', $module, $topic); * $output .= theme('advanced_help_topic', $module, $topic);
* @endcode * @endcode
* *
* You can link to other topics using <a href="topic:module/topic">. Using * Link to other topics using <a href="topic:module/topic">. (Using
* this format will ensure that the popup/not-popup stays consistent from * this format ensures the popup status remains consistent for all
* link to link. * links.)
*/ */
/** /**
* Implementation of hook_menu(). * Implementation of hook_menu().
*/ */
function advanced_help_menu() { function advanced_help_menu() {
// view help topic index // View help topic index.
$items['admin/advanced_help'] = array( $items['admin/advanced_help'] = array(
'title' => module_exists('help') ? 'Advanced help' : 'Help', 'title' => module_exists('help') ? 'Advanced help' : 'Help',
'page callback' => 'advanced_help_index_page', 'page callback' => 'advanced_help_index_page',
...@@ -52,7 +52,7 @@ function advanced_help_menu() { ...@@ -52,7 +52,7 @@ function advanced_help_menu() {
'access arguments' => array('view advanced help index'), 'access arguments' => array('view advanced help index'),
); );
// view help topic // View help topic.
$items['help/%/%'] = array( $items['help/%/%'] = array(
'page callback' => 'advanced_help_topic_page', 'page callback' => 'advanced_help_topic_page',
'page arguments' => array(1, 2), 'page arguments' => array(1, 2),
...@@ -64,7 +64,7 @@ function advanced_help_menu() { ...@@ -64,7 +64,7 @@ function advanced_help_menu() {
} }
/** /**
* Implementation of hook_theme() * Implementation of hook_theme().
*/ */
function advanced_help_theme() { function advanced_help_theme() {
$hooks['advanced_help_topic'] = array( $hooks['advanced_help_topic'] = array(
...@@ -99,7 +99,7 @@ function advanced_help_uasort($id_a, $id_b) { ...@@ -99,7 +99,7 @@ function advanced_help_uasort($id_a, $id_b) {
} }
/** /**
* Page callback for advanced help search * Page callback for advanced help search.
*/ */
function advanced_help_search_view() { function advanced_help_search_view() {
if (!module_exists('search')) { if (!module_exists('search')) {
...@@ -136,7 +136,7 @@ function advanced_help_search_view() { ...@@ -136,7 +136,7 @@ function advanced_help_search_view() {
$popup = !empty($_GET['popup']) && user_access('view advanced help popup'); $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
if ($popup) { if ($popup) {
$GLOBALS['devel_shutdown'] = FALSE; // prevent devel module from spewing. $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
drupal_set_breadcrumb(array_reverse($breadcrumb)); drupal_set_breadcrumb(array_reverse($breadcrumb));
print theme('advanced_help_popup', $output); print theme('advanced_help_popup', $output);
return; return;
...@@ -153,7 +153,7 @@ function advanced_help_search_view() { ...@@ -153,7 +153,7 @@ function advanced_help_search_view() {
function advanced_help_index_page($module = '') { function advanced_help_index_page($module = '') {
$topics = advanced_help_get_topics(); $topics = advanced_help_get_topics();
// print a search widget // Print a search widget.
$output = ''; $output = '';
if (module_exists('search')) { if (module_exists('search')) {
$output .= drupal_get_form('advanced_help_search_form'); $output .= drupal_get_form('advanced_help_search_form');
...@@ -177,7 +177,7 @@ function advanced_help_index_page($module = '') { ...@@ -177,7 +177,7 @@ function advanced_help_index_page($module = '') {
$output .= theme('item_list', $items); $output .= theme('item_list', $items);
} }
else { else {
// print a module index. // Print a module index.
$modules = array(); $modules = array();
$result = db_query("SELECT * FROM {system}"); $result = db_query("SELECT * FROM {system}");
while ($info = db_fetch_object($result)) { while ($info = db_fetch_object($result)) {
...@@ -200,7 +200,7 @@ function advanced_help_index_page($module = '') { ...@@ -200,7 +200,7 @@ function advanced_help_index_page($module = '') {
$popup = !empty($_GET['popup']) && user_access('view advanced help popup'); $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
if ($popup) { if ($popup) {
$GLOBALS['devel_shutdown'] = FALSE; // prevent devel module from spewing. $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
drupal_set_breadcrumb(array_reverse($breadcrumb)); drupal_set_breadcrumb(array_reverse($breadcrumb));
print theme('advanced_help_popup', $output); print theme('advanced_help_popup', $output);
return; return;
...@@ -229,7 +229,7 @@ function advanced_help_get_tree($topics, $module, $topic_ids) { ...@@ -229,7 +229,7 @@ function advanced_help_get_tree($topics, $module, $topic_ids) {
return $items; return $items;
} }
/** /**
* Build a hierarchy for a single module's worth of topics. * Build a hierarchy for a single module's topics.
*/ */
function advanced_help_get_topic_hierarchy(&$topics) { function advanced_help_get_topic_hierarchy(&$topics) {
foreach ($topics as $topic => $info) { foreach ($topics as $topic => $info) {
...@@ -243,13 +243,13 @@ function advanced_help_get_topic_hierarchy(&$topics) { ...@@ -243,13 +243,13 @@ function advanced_help_get_topic_hierarchy(&$topics) {
$parent = ''; $parent = '';
} }
else if (strpos($info['parent'], '%')) { else if (strpos($info['parent'], '%')) {
// items that parent to another module are top level here. // Items that parent to another module are top level here.
$parent = ''; $parent = '';
} }
else { else {
$parent = $info['parent']; $parent = $info['parent'];
if (empty($topics[$parent])) { if (empty($topics[$parent])) {
// if it doesn't exist, top level. // If it doesn't exist, top level.
$parent = ''; $parent = '';
} }
} }
...@@ -317,13 +317,13 @@ function advanced_help_topic_page($module, $topic) { ...@@ -317,13 +317,13 @@ function advanced_help_topic_page($module, $topic) {
drupal_set_title($info['title']); drupal_set_title($info['title']);
// set up breadcrumb // Set up breadcrumb.
$breadcrumb = array(); $breadcrumb = array();
$parent = $info; $parent = $info;
$pmodule = $module; $pmodule = $module;
// Loop checker // Loop checker.
$checked = array(); $checked = array();
while (!empty($parent['parent'])) { while (!empty($parent['parent'])) {
if (strpos($parent['parent'], '%')) { if (strpos($parent['parent'], '%')) {
...@@ -355,7 +355,7 @@ function advanced_help_topic_page($module, $topic) { ...@@ -355,7 +355,7 @@ function advanced_help_topic_page($module, $topic) {
} }
if ($popup) { if ($popup) {
$GLOBALS['devel_shutdown'] = FALSE; // prevent devel module from spewing. $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
drupal_set_breadcrumb(array_reverse($breadcrumb)); drupal_set_breadcrumb(array_reverse($breadcrumb));
print theme('advanced_help_popup', $output); print theme('advanced_help_popup', $output);
return; return;
...@@ -375,7 +375,7 @@ function advanced_help_perm() { ...@@ -375,7 +375,7 @@ function advanced_help_perm() {
} }
/** /**
* Display a help icon with a link to view the topic in a popup * Display a help icon with a link to view the topic in a popup.
*/ */
function theme_advanced_help_topic($module, $topic) { function theme_advanced_help_topic($module, $topic) {
$image = '<span>' . t('Help') . '</span>'; $image = '<span>' . t('Help') . '</span>';
...@@ -409,7 +409,7 @@ function theme_advanced_help_topic($module, $topic) { ...@@ -409,7 +409,7 @@ function theme_advanced_help_topic($module, $topic) {
} }
/** /**
* Load and render a help topic * Load and render a help topic.
*/ */
function advanced_help_get_topic_filename($module, $topic) { function advanced_help_get_topic_filename($module, $topic) {
init_theme(); init_theme();
...@@ -420,11 +420,11 @@ function advanced_help_get_topic_filename($module, $topic) { ...@@ -420,11 +420,11 @@ function advanced_help_get_topic_filename($module, $topic) {
return; return;
} }
// search paths: // Search paths:
$paths = array( $paths = array(
path_to_theme() . '/help', // allow theme override path_to_theme() . '/help', // Allow theme override.
drupal_get_path('module', $module) . "/po/help/$language->language", // translations drupal_get_path('module', $module) . "/po/help/$language->language", // Translations.
$info['path'], // in same directory as .inc file $info['path'], // In same directory as .inc file.
); );
foreach ($paths as $path) { foreach ($paths as $path) {
...@@ -435,7 +435,7 @@ function advanced_help_get_topic_filename($module, $topic) { ...@@ -435,7 +435,7 @@ function advanced_help_get_topic_filename($module, $topic) {
} }
/** /**
* Load and render a help topic * Load and render a help topic.
*/ */
function advanced_help_view_topic($module, $topic, $popup = FALSE) { function advanced_help_view_topic($module, $topic, $popup = FALSE) {
$file = advanced_help_get_topic_filename($module, $topic); $file = advanced_help_get_topic_filename($module, $topic);
...@@ -443,18 +443,18 @@ function advanced_help_view_topic($module, $topic, $popup = FALSE) { ...@@ -443,18 +443,18 @@ function advanced_help_view_topic($module, $topic, $popup = FALSE) {
if ($file) { if ($file) {
// @todo is this trusted output? // @todo is this trusted output?
$output = file_get_contents($file); $output = file_get_contents($file);
// Make some exchanges // Make some exchanges.
if ($popup) { if ($popup) {
$output = preg_replace('/href="topic:([^"]+)"/', 'href="/help/$1?popup=true"', $output); $output = preg_replace('/href="topic:([^"]+)"/', 'href="' . url('help/$1', array('query' => 'popup=true')) . '"', $output);
$output = preg_replace('/src="topic:([^"]+)"/', 'src="/help/$1?popup=true"', $output); $output = preg_replace('/src="topic:([^"]+)"/', 'src="' . url('help/$1', array('query' => 'popup=true')) . '"', $output);
} }
else { else {
$output = preg_replace('/href="topic:([^"]+)"/', 'href="/help/$1"', $output); $output = preg_replace('/href="topic:([^"]+)"/', 'href="' . url('help/$1') . '"', $output);
$output = preg_replace('/src="topic:([^"]+)"/', 'src="/help/$1"', $output); $output = preg_replace('/src="topic:([^"]+)"/', 'src="' . url('help/$1') . '"', $output);
} }
$output = preg_replace('/href="path:([^"]+)"/', 'href="/' . $info['path'] . '/$1"', $output); $output = preg_replace('/href="path:([^"]+)"/', 'href="' . url($info['path']) . '/$1"', $output);
$output = preg_replace('/src="path:([^"]+)"/', 'src="/' . $info['path'] . '/$1"', $output); $output = preg_replace('/src="path:([^"]+)"/', 'src="' . url($info['path']) . '/$1"', $output);
return '<div class="advanced-help-topic">' . $output . '</div>'; return '<div class="advanced-help-topic">' . $output . '</div>';
} }
...@@ -471,7 +471,7 @@ function advanced_help_get_topic($module, $topic) { ...@@ -471,7 +471,7 @@ function advanced_help_get_topic($module, $topic) {
} }
/** /**
* Search the system for all available help topics * Search the system for all available help topics.
*/ */
function advanced_help_get_topics() { function advanced_help_get_topics() {
static $topics = NULL; static $topics = NULL;
...@@ -496,7 +496,7 @@ function advanced_help_get_topics() { ...@@ -496,7 +496,7 @@ function advanced_help_get_topics() {
$translation = parse_ini_file("$module_path/po/help/$language->language/module.help.ini", TRUE); $translation = parse_ini_file("$module_path/po/help/$language->language/module.help.ini", TRUE);
} }
foreach ($info as $name => $topic) { foreach ($info as $name => $topic) {
// each topic should have a name, a title, a file and of course the path. // Each topic should have a name, a title, a file and of course the path.
$topics[$module][$name] = array( $topics[$module][$name] = array(
'name' => $name, 'name' => $name,
'title' => !empty($translation['name']['title']) ? $translation['name']['title'] : $topic['title'], 'title' => !empty($translation['name']['title']) ? $translation['name']['title'] : $topic['title'],
...@@ -538,7 +538,7 @@ function advanced_help_search($op = 'search', $keys = null) { ...@@ -538,7 +538,7 @@ function advanced_help_search($op = 'search', $keys = null) {
$result = db_query("SELECT * FROM {advanced_help_index} WHERE sid IN ($placeholders)", $sids); $result = db_query("SELECT * FROM {advanced_help_index} WHERE sid IN ($placeholders)", $sids);
while ($sid = db_fetch_object($result)) { while ($sid = db_fetch_object($result)) {
// guard against removed help topics that are still indexed. // Guard against removed help topics that are still indexed.
if (empty($topics[$sid->module][$sid->topic])) { if (empty($topics[$sid->module][$sid->topic])) {
continue; continue;
} }
...@@ -553,7 +553,7 @@ function advanced_help_search($op = 'search', $keys = null) { ...@@ -553,7 +553,7 @@ function advanced_help_search($op = 'search', $keys = null) {
} }
/** /**
* Get or create an sid (search id) to correllate to each topic for * Get or create an sid (search id) that correllates to each topic for
* the search system. * the search system.
*/ */
function advanced_help_get_sids(&$topics) { function advanced_help_get_sids(&$topics) {
...@@ -585,18 +585,18 @@ function advanced_help_update_index() { ...@@ -585,18 +585,18 @@ function advanced_help_update_index() {
$count = 0; $count = 0;
foreach ($topics as $module => $module_topics) { foreach ($topics as $module => $module_topics) {
// fast forward if necessary // Fast forward if necessary.
if (!empty($last['module']) && $last['module'] != $module) { if (!empty($last['module']) && $last['module'] != $module) {
continue; continue;
} }
foreach ($module_topics as $topic => $info) { foreach ($module_topics as $topic => $info) {
// fast forward if necessary // Fast forward if necessary.
if (!empty($last['topic']) && $last['topic'] != $topic) { if (!empty($last['topic']) && $last['topic'] != $topic) {
continue; continue;
} }
// if we've been looking to catch up, and we have, reset so we // If we've been looking to catch up, and we have, reset so we
// stop fast forwarding. // stop fast forwarding.
if (!empty($last['module'])) { if (!empty($last['module'])) {
unset($last['topic']); unset($last['topic']);
...@@ -615,7 +615,7 @@ function advanced_help_update_index() { ...@@ -615,7 +615,7 @@ function advanced_help_update_index() {
if ($count >= $limit) { if ($count >= $limit) {
$last['topic'] = $topic; $last['topic'] = $topic;
$last['module'] = $module; $last['module'] = $module;
// don't change time if we stop // Don't change time if we stop.
variable_set('advanced_help_last_cron', $last); variable_set('advanced_help_last_cron', $last);
return; return;
} }
...@@ -626,16 +626,16 @@ function advanced_help_update_index() { ...@@ -626,16 +626,16 @@ function advanced_help_update_index() {
} }
/** /**
* Fill in a bunch of page variables for our specialized popup page * Fill in a bunch of page variables for our specialized popup page.
*/ */
function template_preprocess_advanced_help_popup(&$variables) { function template_preprocess_advanced_help_popup(&$variables) {
// Add favicon // Add favicon.
if (theme_get_setting('toggle_favicon')) { if (theme_get_setting('toggle_favicon')) {
drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />'); drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
} }
global $theme; global $theme;
// Construct page title // Construct page title.
if (drupal_get_title()) { if (drupal_get_title()) {
$head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
} }
...@@ -698,7 +698,7 @@ function advanced_help_l($text, $dest, $options = array()) { ...@@ -698,7 +698,7 @@ function advanced_help_l($text, $dest, $options = array()) {
} }
/** /**
* Format a url but preserve popup identity. * Format a URL but preserve popup identity.
*/ */
function advanced_help_url($dest, $options = array()) { function advanced_help_url($dest, $options = array()) {
$popup = !empty($_GET['popup']) && user_access('view advanced help popup'); $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
......
<p>The advanced help system is a pluggable system to provide advanced help facilities for Drupal and modules. Currently it does not provide much in the way of help by itself, but instead it provides a facility to make it easier and more powerful to for modules to provide help. <p>The <em>Advanced help</em> system is a pluggable system that provides advanced help facilities for Drupal and its modules. Although the advanced help does not provide general help by itself, it provides a powerful and easy framework that modules may use to provide their own help.
</p> </p>
<p> <p>
Modules utilizing this help system should create a 'help' directory in their Modules utilizing <em>Advanced help</em> should create a 'help' subdirectory inside their
module. Inside that directory place MODULENAME.help.ini which will be formatted module's directory. Place the file MODULENAME.help.ini in this subdirectory, formatted
like this: similar to the following example:
</p> </p>
<pre> <pre>
[buses] [buses]
...@@ -12,29 +12,27 @@ title = "How buses are tied into the system" ...@@ -12,29 +12,27 @@ title = "How buses are tied into the system"
file = buses file = buses
[TOPIC_ID] [TOPIC_ID]
title = "Title of topic" title = "Title of topic".
file = filename of topic, without the .html extension file = filename of topic, without the .html extension.
weight = How important the topic is on the index page weight = How important the topic is on the index page.
parent = the optional topic parent to use in the breadcrumb. parent = The optional topic parent to use in the breadcrumb,
Can be either topic or module%topic either topic or module%topic.
</pre> </pre>
<p> <p>
All topics are addressed by the module that provides the topic, and the topic All topics are addressed by the module providing the topic, and by the topic
id. Modules can embed links anywhere they want with this: id. To embed links, use the following format:
</p> </p>
<code> <code>
$output .= theme('advanced_help_topic', $module, $topic); $output .= theme('advanced_help_topic', $module, $topic);
</code> </code>
<p>When writing help files, you can link to other topics using <strong>&lt;a href=&quot;topic:module/topic"&gt;</strong>. Using <p>Inside your help file, link to other topics using the format <strong>&lt;a href=&quot;topic:module/topic"&gt;</strong>. This
this format will ensure that the popup/not-popup stays consistent from format will ensure the popup status remains consistent when switching between links.</p>
link to link.</p>
<p>You can also use <strong>&lt;a href=&quot;path:example.jpg"&gt;</strong> to reference items <p>Use <strong>&lt;a href=&quot;path:example.jpg"&gt;</strong> to reference items
within the help directory, such as images to embed within the help.</p> within the help directory, such as images you wish to embed within the help text.</p>
<p> <p>If the search module is enabled, the contents of help system will be indexed on cron. If you enable new modules and wish to immediately index its help text, visit the "Administration -> Reports -> Status report" and manually click the "Run cron manually" link.</p>
If the search module is enabled, this help system will be indexed on cron. If you enable new modules and immediately want to search its help, visit <a href="/admin/reports/status/run-cron">run cron</a> to facilitate this.</p>
<p>Example: <a href="path:nowhere.jpg">Don't click this!</a></p> <p>Example: <a href="path:nowhere.jpg">Don't click this!</a></p>
<p><b>PHP</b> (<i>PHP: Hypertext Preprocessor</i>) is a computer <a target="_blank" href="http://en.wikipedia.org/Scripting_language" title="Scripting language">scripting language</a>, originally designed for producing <a target="_blank" href="http://en.wikipedia.org/Dynamic_web_page" title="Dynamic web page">dynamic web pages</a>. It is mainly used in <a target="_blank" href="http://en.wikipedia.org/Server-side_scripting" title="Server-side scripting">server-side scripting</a>, but can be used from a <a target="_blank" href="http://en.wikipedia.org/Command_line_interface" title="Command line interface">command line interface</a> or in <a target="_blank" href="http://en.wikipedia.org/Standalone" title="Standalone">standalone</a> <a target="_blank" href="http://en.wikipedia.org/Graphical_user_interface" title="Graphical user interface">graphical applications</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[2]</a></sup></p> <p><b>PHP</b> (<i>PHP: Hypertext Preprocessor</i>) is a computer <a target="_blank" href="http://en.wikipedia.org/wiki/Scripting_language" title="Scripting language">scripting language</a>, originally designed for producing <a target="_blank" href="http://en.wikipedia.org/wiki/Dynamic_web_page" title="Dynamic web page">dynamic web pages</a>. It is mainly used in <a target="_blank" href="http://en.wikipedia.org/wiki/Server-side_scripting" title="Server-side scripting">server-side scripting</a>, but can be used from a <a target="_blank" href="http://en.wikipedia.org/wiki/Command_line_interface" title="Command line interface">command line interface</a> or in <a target="_blank" href="http://en.wikipedia.org/wiki/Standalone" title="Standalone">standalone</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface">graphical applications</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[2]</a></sup></p>
<p>While PHP was originally created by <a target="_blank" href="http://en.wikipedia.org/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a> in 1994, the main implementation of PHP is now produced by The PHP Group and serves as the <a target="_blank" href="http://en.wikipedia.org/De_facto_standard" title="De facto standard"><i>de facto</i> standard</a> for PHP as there is no <a target="_blank" href="http://en.wikipedia.org/Formal_specification" title="Formal specification">formal specification</a>.<sup id="cite_ref-history_2-0" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> Released under the <a target="_blank" href="http://en.wikipedia.org/PHP_License" title="PHP License">PHP License</a>, the <a target="_blank" href="http://en.wikipedia.org/Free_Software_Foundation" title="Free Software Foundation">Free Software Foundation</a> considers it to be <a target="_blank" href="http://en.wikipedia.org/Free_software" title="Free software">free software</a>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3" title="">[4]</a></sup></p> <p>While PHP was originally created by <a target="_blank" href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a> in 1994, the main implementation of PHP is now produced by The PHP Group and serves as the <a target="_blank" href="http://en.wikipedia.org/wiki/De_facto_standard" title="De facto standard"><i>de facto</i> standard</a> for PHP as there is no <a target="_blank" href="http://en.wikipedia.org/wiki/Formal_specification" title="Formal specification">formal specification</a>.<sup id="cite_ref-history_2-0" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> Released under the <a target="_blank" href="http://en.wikipedia.org/wiki/PHP_License" title="PHP License">PHP License</a>, the <a target="_blank" href="http://en.wikipedia.org/wiki/Free_Software_Foundation" title="Free Software Foundation">Free Software Foundation</a> considers it to be <a target="_blank" href="http://en.wikipedia.org/wiki/Free_software" title="Free software">free software</a>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3" title="">[4]</a></sup></p>
<p>PHP is a widely-used general-purpose scripting language that is especially suited for <a target="_blank" href="http://en.wikipedia.org/Web_development" title="Web development">web development</a> and can be embedded into <a target="_blank" href="http://en.wikipedia.org/HTML" title="HTML">HTML</a>. It generally runs on a <a target="_blank" href="http://en.wikipedia.org/Web_server" title="Web server">web server</a>, taking PHP code as its input and creating <a target="_blank" href="http://en.wikipedia.org/Web_page" title="Web page">web pages</a> as output. It can be deployed on most web servers and on almost every <a target="_blank" href="http://en.wikipedia.org/Operating_system" title="Operating system">operating system</a> and <a target="_blank" href="http://en.wikipedia.org/Platform_%28computing%29" class="mw-redirect" title="Platform (computing)">platform</a> free of charge.<sup id="cite_ref-foundations_4-0" class="reference"><a href="#cite_note-foundations-4" title="">[5]</a></sup> PHP is installed on more than 20 million websites and 1 million <a target="_blank" href="http://en.wikipedia.org/Server_%28computing%29" title="Server (computing)">servers</a>, although the number of websites with PHP <a target="_blank" href="http://en.wikipedia.org/Installation_%28computer_programs%29" title="Installation (computer programs)">installed</a> has declined since August 2005.<sup id="cite_ref-usage_5-0" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup> It is also the most popular <a target="_blank" href="http://en.wikipedia.org/Apache_HTTP_Server" title="Apache HTTP Server">Apache</a> module among computers using Apache as a web server.<sup id="cite_ref-usage_5-1" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup> The most recent major release of PHP was version 5.2.5 on <a target="_blank" href="http://en.wikipedia.org/November_8" title="November 8">November 8</a>, <a target="_blank" href="http://en.wikipedia.org/2007" title="2007">2007</a>.<sup id="cite_ref-php5changelog_6-0" class="reference"><a href="#cite_note-php5changelog-6" title="">[7]</a></sup></p> <p>PHP is a widely-used general-purpose scripting language that is especially suited for <a target="_blank" href="http://en.wikipedia.org/wiki/Web_development" title="Web development">web development</a> and can be embedded into <a target="_blank" href="http://en.wikipedia.org/wiki/HTML" title="HTML">HTML</a>. It generally runs on a <a target="_blank" href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web server</a>, taking PHP code as its input and creating <a target="_blank" href="http://en.wikipedia.org/wiki/Web_page" title="Web page">web pages</a> as output. It can be deployed on most web servers and on almost every <a target="_blank" href="http://en.wikipedia.org/wiki/Operating_system" title="Operating system">operating system</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Platform_%28computing%29" class="mw-redirect" title="Platform (computing)">platform</a> free of charge.<sup id="cite_ref-foundations_4-0" class="reference"><a href="#cite_note-foundations-4" title="">[5]</a></sup> PHP is installed on more than 20 million websites and 1 million <a target="_blank" href="http://en.wikipedia.org/wiki/Server_%28computing%29" title="Server (computing)">servers</a>, although the number of websites with PHP <a target="_blank" href="http://en.wikipedia.org/wiki/Installation_%28computer_programs%29" title="Installation (computer programs)">installed</a> has declined since August 2005.<sup id="cite_ref-usage_5-0" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup> It is also the most popular <a target="_blank" href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" title="Apache HTTP Server">Apache</a> module among computers using Apache as a web server.<sup id="cite_ref-usage_5-1" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup> The most recent major release of PHP was version 5.2.5 on <a target="_blank" href="http://en.wikipedia.org/wiki/November_8" title="November 8">November 8</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/2007" title="2007">2007</a>.<sup id="cite_ref-php5changelog_6-0" class="reference"><a href="#cite_note-php5changelog-6" title="">[7]</a></sup></p>
This diff is collapsed.
<p>PHP is a popular target of <a target="_blank" href="http://en.wikipedia.org/Hacker" title="Hacker">hackers</a> who exploit vulnerable applications written in PHP. Software vulnerabilities related to PHP are identified among the <a target="_blank" href="http://en.wikipedia.org/Common_Vulnerabilities_and_Exposures" title="Common Vulnerabilities and Exposures">CVE (Common Vulnerabilities and Exposures)</a> records, available from the <a target="_blank" href="http://en.wikipedia.org/National_Vulnerability_Database" title="National Vulnerability Database">National Vulnerability Database</a>. The proportion of vulnerabilities related to PHP, out of the total of all common vulnerabilities, amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 33.8% for the first quarter of 2008. More than a quarter of all software vulnerabilities listed in this database are related to PHP, and more than a third of vulnerabilities listed recently. Most of these vulnerabilities can be exploited remotely, that is without being logged on the computer hosting the vulnerable application.<sup id="cite_ref-27" class="reference"><a href="#cite_note-27" title="">[28]</a></sup> Such exploitation is made possible due to poor programming habits, such as failing to check data before entering it into a database, and features of the language such as <code>register_globals</code>, which is now deprecated.<sup id="cite_ref-register_globals_21-1" class="reference"><a href="#cite_note-register_globals-21" title="">[22]</a></sup> These result in <a target="_blank" href="http://en.wikipedia.org/Code_injection" title="Code injection">code injection</a>, <a target="_blank" href="http://en.wikipedia.org/Cross-site_scripting" title="Cross-site scripting">cross-site scripting</a> and other <a target="_blank" href="http://en.wikipedia.org/Application_security" title="Application security">application security</a> issues. It's important to note that none of these attacks are exclusive to PHP and all are avoidable by following proper coding techniques and principles.</p> <p>PHP is a popular target of <a target="_blank" href="http://en.wikipedia.org/wiki/Hacker" title="Hacker">hackers</a> who exploit vulnerable applications written in PHP. Software vulnerabilities related to PHP are identified among the <a target="_blank" href="http://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures" title="Common Vulnerabilities and Exposures">CVE (Common Vulnerabilities and Exposures)</a> records, available from the <a target="_blank" href="http://en.wikipedia.org/wiki/National_Vulnerability_Database" title="National Vulnerability Database">National Vulnerability Database</a>. The proportion of vulnerabilities related to PHP, out of the total of all common vulnerabilities, amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 33.8% for the first quarter of 2008. More than a quarter of all software vulnerabilities listed in this database are related to PHP, and more than a third of vulnerabilities listed recently. Most of these vulnerabilities can be exploited remotely, that is without being logged on the computer hosting the vulnerable application.<sup id="cite_ref-27" class="reference"><a href="#cite_note-27" title="">[28]</a></sup> Such exploitation is made possible due to poor programming habits, such as failing to check data before entering it into a database, and features of the language such as <code>register_globals</code>, which is now deprecated.<sup id="cite_ref-register_globals_21-1" class="reference"><a href="#cite_note-register_globals-21" title="">[22]</a></sup> These result in <a target="_blank" href="http://en.wikipedia.org/wiki/Code_injection" title="Code injection">code injection</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/Cross-site_scripting" title="Cross-site scripting">cross-site scripting</a> and other <a target="_blank" href="http://en.wikipedia.org/wiki/Application_security" title="Application security">application security</a> issues. It's important to note that none of these attacks are exclusive to PHP and all are avoidable by following proper coding techniques and principles.</p>
This diff is collapsed.
<p>PHP is a general-purpose scripting language that is especially suited for <a target="_blank" href="http://en.wikipedia.org/Web_development" title="Web development">web development</a>. It is the fourth most popular computer programming language, ranking behind <a target="_blank" href="http://en.wikipedia.org/Java_%28programming_language%29" title="Java (programming language)">Java</a>, <a target="_blank" href="http://en.wikipedia.org/C_%28programming_language%29" title="C (programming language)">C</a>, and <a target="_blank" href="http://en.wikipedia.org/Visual_Basic" title="Visual Basic">Visual Basic</a>.<sup id="cite_ref-22" class="reference"><a href="#cite_note-22" title="">[23]</a></sup> PHP generally runs on a <a target="_blank" href="http://en.wikipedia.org/Web_server" title="Web server">web server</a>, taking PHP code as its input and creating <a target="_blank" href="http://en.wikipedia.org/Web_page" title="Web page">web pages</a> as output. It can also be used for <a target="_blank" href="http://en.wikipedia.org/Command-line" class="mw-redirect" title="Command-line">command-line</a> scripting and <a target="_blank" href="http://en.wikipedia.org/Client-side" title="Client-side">client-side</a> <a target="_blank" href="http://en.wikipedia.org/Graphical_user_interface" title="Graphical user interface">GUI</a> applications. PHP can be deployed on most <a target="_blank" href="http://en.wikipedia.org/Web_server" title="Web server">web servers</a>, many <a target="_blank" href="http://en.wikipedia.org/Operating_system" title="Operating system">operating systems</a> and <a target="_blank" href="http://en.wikipedia.org/Platform_%28computing%29" class="mw-redirect" title="Platform (computing)">platforms</a>, and can be used with many <a target="_blank" href="http://en.wikipedia.org/Relational_database_management_system" title="Relational database management system">relational database management systems</a>. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.<sup id="cite_ref-foundations_4-1" class="reference"><a href="#cite_note-foundations-4" title="">[5]</a></sup></p> <p>PHP is a general-purpose scripting language that is especially suited for <a target="_blank" href="http://en.wikipedia.org/wiki/Web_development" title="Web development">web development</a>. It is the fourth most popular computer programming language, ranking behind <a target="_blank" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29" title="Java (programming language)">Java</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a>, and <a target="_blank" href="http://en.wikipedia.org/wiki/Visual_Basic" title="Visual Basic">Visual Basic</a>.<sup id="cite_ref-22" class="reference"><a href="#cite_note-22" title="">[23]</a></sup> PHP generally runs on a <a target="_blank" href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web server</a>, taking PHP code as its input and creating <a target="_blank" href="http://en.wikipedia.org/wiki/Web_page" title="Web page">web pages</a> as output. It can also be used for <a target="_blank" href="http://en.wikipedia.org/wiki/Command-line" class="mw-redirect" title="Command-line">command-line</a> scripting and <a target="_blank" href="http://en.wikipedia.org/wiki/Client-side" title="Client-side">client-side</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface">GUI</a> applications. PHP can be deployed on most <a target="_blank" href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web servers</a>, many <a target="_blank" href="http://en.wikipedia.org/wiki/Operating_system" title="Operating system">operating systems</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Platform_%28computing%29" class="mw-redirect" title="Platform (computing)">platforms</a>, and can be used with many <a target="_blank" href="http://en.wikipedia.org/wiki/Relational_database_management_system" title="Relational database management system">relational database management systems</a>. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.<sup id="cite_ref-foundations_4-1" class="reference"><a href="#cite_note-foundations-4" title="">[5]</a></sup></p>
<p>PHP primarily acts as a <a target="_blank" href="http://en.wikipedia.org/Filter_%28software%29" title="Filter (software)">filter</a><sup id="cite_ref-23" class="reference"><a href="#cite_note-23" title="">[24]</a></sup>, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. From PHP 4, the PHP <a target="_blank" href="http://en.wikipedia.org/Parser" class="mw-redirect" title="Parser">parser</a> <a target="_blank" href="http://en.wikipedia.org/Compiler" title="Compiler">compiles</a> input to produce <a target="_blank" href="http://en.wikipedia.org/Bytecode" title="Bytecode">bytecode</a> for processing by the <a target="_blank" href="http://en.wikipedia.org/Zend_Engine" title="Zend Engine">Zend Engine</a>, giving improved performance over its <a target="_blank" href="http://en.wikipedia.org/Interpreter_%28computing%29" title="Interpreter (computing)">interpreter</a> predecessor.<sup id="cite_ref-24" class="reference"><a href="#cite_note-24" title="">[25]</a></sup></p> <p>PHP primarily acts as a <a target="_blank" href="http://en.wikipedia.org/wiki/Filter_%28software%29" title="Filter (software)">filter</a><sup id="cite_ref-23" class="reference"><a href="#cite_note-23" title="">[24]</a></sup>, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. From PHP 4, the PHP <a target="_blank" href="http://en.wikipedia.org/wiki/Parser" class="mw-redirect" title="Parser">parser</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Compiler" title="Compiler">compiles</a> input to produce <a target="_blank" href="http://en.wikipedia.org/wiki/Bytecode" title="Bytecode">bytecode</a> for processing by the <a target="_blank" href="http://en.wikipedia.org/wiki/Zend_Engine" title="Zend Engine">Zend Engine</a>, giving improved performance over its <a target="_blank" href="http://en.wikipedia.org/wiki/Interpreter_%28computing%29" title="Interpreter (computing)">interpreter</a> predecessor.<sup id="cite_ref-24" class="reference"><a href="#cite_note-24" title="">[25]</a></sup></p>
<p>Originally designed to create dynamic web pages, PHP's principal focus is <a target="_blank" href="http://en.wikipedia.org/Server-side_scripting" title="Server-side scripting">server-side scripting</a><sup id="cite_ref-25" class="reference"><a href="#cite_note-25" title="">[26]</a></sup>, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a <a target="_blank" href="http://en.wikipedia.org/Client_%28computing%29" title="Client (computing)">client</a>, such as <a target="_blank" href="http://en.wikipedia.org/Microsoft" title="Microsoft">Microsoft</a>'s <a target="_blank" href="http://en.wikipedia.org/ASP.NET" title="ASP.NET">ASP.NET</a> system, <a target="_blank" href="http://en.wikipedia.org/Sun_Microsystems" title="Sun Microsystems">Sun Microsystems</a>' <a target="_blank" href="http://en.wikipedia.org/JavaServer_Pages" title="JavaServer Pages">JavaServer Pages</a><sup id="cite_ref-26" class="reference"><a href="#cite_note-26" title="">[27]</a></sup>, and <a target="_blank" href="http://en.wikipedia.org/Mod_perl" title="Mod perl">mod_perl</a>. PHP has also attracted the development of many <a target="_blank" href="http://en.wikipedia.org/Software_framework" title="Software framework">frameworks</a> that provide building blocks and a design structure to promote <a target="_blank" href="http://en.wikipedia.org/Rapid_application_development" title="Rapid application development">rapid application development</a> (RAD). Some of these include <a target="_blank" href="http://en.wikipedia.org/CakePHP" title="CakePHP">CakePHP</a>, <a target="_blank" href="http://en.wikipedia.org/PRADO" title="PRADO">PRADO</a>, <a target="_blank" href="http://en.wikipedia.org/Symfony" title="Symfony">Symfony</a> and <a target="_blank" href="http://en.wikipedia.org/Zend_Framework" title="Zend Framework">Zend Framework</a>, offering features similar to other <a target="_blank" href="http://en.wikipedia.org/List_of_web_application_frameworks" title="List of web application frameworks">web application frameworks</a>.</p> <p>Originally designed to create dynamic web pages, PHP's principal focus is <a target="_blank" href="http://en.wikipedia.org/wiki/Server-side_scripting" title="Server-side scripting">server-side scripting</a><sup id="cite_ref-25" class="reference"><a href="#cite_note-25" title="">[26]</a></sup>, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a <a target="_blank" href="http://en.wikipedia.org/wiki/Client_%28computing%29" title="Client (computing)">client</a>, such as <a target="_blank" href="http://en.wikipedia.org/wiki/Microsoft" title="Microsoft">Microsoft</a>'s <a target="_blank" href="http://en.wikipedia.org/wiki/ASP.NET" title="ASP.NET">ASP.NET</a> system, <a target="_blank" href="http://en.wikipedia.org/wiki/Sun_Microsystems" title="Sun Microsystems">Sun Microsystems</a>' <a target="_blank" href="http://en.wikipedia.org/wiki/JavaServer_Pages" title="JavaServer Pages">JavaServer Pages</a><sup id="cite_ref-26" class="reference"><a href="#cite_note-26" title="">[27]</a></sup>, and <a target="_blank" href="http://en.wikipedia.org/wiki/Mod_perl" title="Mod perl">mod_perl</a>. PHP has also attracted the development of many <a target="_blank" href="http://en.wikipedia.org/wiki/Software_framework" title="Software framework">frameworks</a> that provide building blocks and a design structure to promote <a target="_blank" href="http://en.wikipedia.org/wiki/Rapid_application_development" title="Rapid application development">rapid application development</a> (RAD). Some of these include <a target="_blank" href="http://en.wikipedia.org/wiki/CakePHP" title="CakePHP">CakePHP</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/PRADO" title="PRADO">PRADO</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/Symfony" title="Symfony">Symfony</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Zend_Framework" title="Zend Framework">Zend Framework</a>, offering features similar to other <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_web_application_frameworks" title="List of web application frameworks">web application frameworks</a>.</p>
<p>The <a target="_blank" href="http://en.wikipedia.org/LAMP_%28software_bundle%29" title="LAMP (software bundle)">LAMP</a> architecture has become popular in the web industry as a way of deploying web applications. PHP is commonly used as the <i>P</i> in this bundle alongside <a target="_blank" href="http://en.wikipedia.org/Linux" title="Linux">Linux</a>, <a target="_blank" href="http://en.wikipedia.org/Apache_HTTP_Server" title="Apache HTTP Server">Apache</a> and <a target="_blank" href="http://en.wikipedia.org/MySQL" title="MySQL">MySQL</a>, although the <i>P</i> can also refer to <a target="_blank" href="http://en.wikipedia.org/Python_%28programming_language%29" title="Python (programming language)">Python</a> or <a target="_blank" href="http://en.wikipedia.org/Perl" title="Perl">Perl</a>.</p> <p>The <a target="_blank" href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29" title="LAMP (software bundle)">LAMP</a> architecture has become popular in the web industry as a way of deploying web applications. PHP is commonly used as the <i>P</i> in this bundle alongside <a target="_blank" href="http://en.wikipedia.org/wiki/Linux" title="Linux">Linux</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" title="Apache HTTP Server">Apache</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/MySQL" title="MySQL">MySQL</a>, although the <i>P</i> can also refer to <a target="_blank" href="http://en.wikipedia.org/wiki/Python_%28programming_language%29" title="Python (programming language)">Python</a> or <a target="_blank" href="http://en.wikipedia.org/wiki/Perl" title="Perl">Perl</a>.</p>
<p>As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module.<sup id="cite_ref-usage_5-2" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup></p> <p>As of April 2007, over 20 million Internet domains were hosted on servers with PHP installed, and PHP was recorded as the most popular Apache module.<sup id="cite_ref-usage_5-2" class="reference"><a href="#cite_note-usage-5" title="">[6]</a></sup></p>
; $Id$ ; $Id$
name = Advanced help example name = Advanced help example
description = A example help module to demonstrate the advanced help module description = A example help module to demonstrate the advanced help module.
core = 6.x core = 6.x
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Implementation of hook_menu(). * Implementation of hook_menu().
*/ */
function help_example_menu() { function help_example_menu() {
// view help topic index // View help topic index.
$items['admin/help_example'] = array( $items['admin/help_example'] = array(
'title' => 'Example help', 'title' => 'Example help',
'page callback' => 'help_example_index_page', 'page callback' => 'help_example_index_page',
...@@ -21,6 +21,6 @@ function help_example_menu() { ...@@ -21,6 +21,6 @@ function help_example_menu() {
function help_example_index_page() { function help_example_index_page() {
$output = theme('advanced_help_topic', 'help_example', 'about-php'); $output = theme('advanced_help_topic', 'help_example', 'about-php');
$output .= '&nbsp;' . t('Click the help icon to view the example help. Be sure to run cron to update the index if you want to try out the search features.'); $output .= '&nbsp;' . t('Click the help icon to view some example help about the PHP programming language (from wikipedia.org). Be sure to run cron to update the index if you want to try out the search features.');
return $output; return $output;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment