Révision 00c2605a
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/advanced_help/advanced-help-popup.tpl.php | ||
---|---|---|
15 | 15 |
<?php print $scripts; ?> |
16 | 16 |
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyled Content in IE */ ?> </script> |
17 | 17 |
</head> |
18 |
<body> |
|
18 |
<body class="advanced-help-popup-body">
|
|
19 | 19 |
<div id="page"> |
20 | 20 |
<div id="header"> |
21 | 21 |
<?php if (!empty($search_box)): ?> |
drupal7/sites/all/modules/advanced_help/advanced_help.info | ||
---|---|---|
1 | 1 |
name = Advanced help |
2 |
description = Allow advanced help and documentation.
|
|
2 |
description = Provide extended help and documentation.
|
|
3 | 3 |
core = 7.x |
4 | 4 |
|
5 |
; Information added by Drupal.org packaging script on 2013-12-12 |
|
6 |
version = "7.x-1.1" |
|
5 |
attributions[click_icon][type] = 'asset' |
|
6 |
attributions[click_icon][exception] = '#2460769' |
|
7 |
attributions[click_icon][author] = 'Gisle Hannemyr' |
|
8 |
attributions[click_icon][hide] = TRUE |
|
9 |
attributions[click_icon][title] = 'click_icon.png' |
|
10 |
attributions[click_icon][license] = 'Creative Commons 0' |
|
11 |
attributions[click_icon][license_url] = 'https://creativecommons.org/publicdomain/zero/1.0/' |
|
12 |
|
|
13 |
; Information added by Drupal.org packaging script on 2015-03-27 |
|
14 |
version = "7.x-1.2" |
|
7 | 15 |
core = "7.x" |
8 | 16 |
project = "advanced_help" |
9 |
datestamp = "1386871727"
|
|
17 |
datestamp = "1427460482"
|
|
10 | 18 |
|
drupal7/sites/all/modules/advanced_help/advanced_help.module | ||
---|---|---|
205 | 205 |
|
206 | 206 |
$output = array(); |
207 | 207 |
// Print a search widget. |
208 |
$output['advanced_help_search'] = module_exists('search') ? drupal_get_form('advanced_help_search_form') : t('Enable the search module to search help.');
|
|
208 |
$output['advanced_help_search'] = module_exists('search') ? drupal_get_form('advanced_help_search_form') : array('#markup' => t('Enable the search module to search help.'));
|
|
209 | 209 |
|
210 | 210 |
$breadcrumb = array(); |
211 | 211 |
if ($module) { |
... | ... | |
230 | 230 |
$result = db_query('SELECT * FROM {system}'); |
231 | 231 |
foreach ($result as $info) { |
232 | 232 |
$module_info = unserialize($info->info); |
233 |
$modules[$info->name] = $module_info['name'];
|
|
233 |
$modules[$info->name] = isset($module_info['name']) ? $module_info['name'] : $info->name;
|
|
234 | 234 |
} |
235 | 235 |
|
236 | 236 |
asort($modules); |
... | ... | |
563 | 563 |
'html' => TRUE) |
564 | 564 |
); |
565 | 565 |
} |
566 |
else { |
|
566 |
elseif (user_access('view advanced help topic')) {
|
|
567 | 567 |
return l($text, "help/$module/$topic", array( |
568 | 568 |
'attributes' => array( |
569 | 569 |
'class' => $class, |
... | ... | |
632 | 632 |
|
633 | 633 |
$output = file_get_contents($file); |
634 | 634 |
if (isset($info['readme file']) && $info['readme file']) { |
635 |
// Readme files are treated as plain text: filter accordingly. |
|
636 |
$output = check_plain($output); |
|
635 |
$ext = pathinfo($file, PATHINFO_EXTENSION); |
|
636 |
if ('md' == $ext && module_exists('markdown')) { |
|
637 |
$filters = module_invoke('markdown', 'filter_info'); |
|
638 |
$md_info = $filters['filter_markdown']; |
|
639 |
|
|
640 |
if (function_exists($md_info['process callback'])) { |
|
641 |
$function = $md_info['process callback']; |
|
642 |
$output = '<div class="advanced-help-topic">' . filter_xss_admin($function($output, NULL)) . '</div>'; |
|
643 |
} |
|
644 |
else { |
|
645 |
$output = '<div class="advanced-help-topic"><pre class="readme">' . check_plain($output) . '</pre></div>'; |
|
646 |
} |
|
647 |
} |
|
648 |
else { |
|
649 |
$output = '<div class="advanced-help-topic"><pre class="readme">' . check_plain($output) . '</pre></div>'; |
|
650 |
} |
|
651 |
return $output; |
|
637 | 652 |
} |
638 | 653 |
|
639 | 654 |
// Make some exchanges. The strtr is because url() translates $ into %24 |
... | ... | |
714 | 729 |
$navigation = '<div class="help-navigation clear-block">'; |
715 | 730 |
|
716 | 731 |
if ($prev) { |
717 |
$navigation .= advanced_help_l('<< ' . $topics[$prev[0]][$prev[1]]['title'], "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
|
|
732 |
$navigation .= advanced_help_l('«« ' . $topics[$prev[0]][$prev[1]]['title'], "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
|
|
718 | 733 |
} |
719 | 734 |
if ($up) { |
720 | 735 |
$navigation .= advanced_help_l(t('Up'), $up, array('attributes' => array('class' => $prev ? 'help-up' : 'help-up-noleft'))); |
721 | 736 |
} |
722 | 737 |
if ($next) { |
723 |
$navigation .= advanced_help_l($topics[$next[0]][$next[1]]['title'] . ' >>', "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
|
|
738 |
$navigation .= advanced_help_l($topics[$next[0]][$next[1]]['title'] . ' »»', "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
|
|
724 | 739 |
} |
725 | 740 |
|
726 | 741 |
$navigation .= '</div>'; |
... | ... | |
735 | 750 |
|
736 | 751 |
$output = '<div class="advanced-help-topic">' . $output . '</div>'; |
737 | 752 |
drupal_alter('advanced_help_topic', $output, $popup); |
753 |
|
|
738 | 754 |
return $output; |
739 | 755 |
} |
740 | 756 |
} |
... | ... | |
783 | 799 |
$ini = array('topics' => array(), 'settings' => array()); |
784 | 800 |
|
785 | 801 |
$help_path = drupal_get_path('module', 'advanced_help') . '/modules'; |
786 |
foreach (module_list() as $module) { |
|
787 |
$module_path = drupal_get_path('module', $module); |
|
802 |
foreach (array_merge(module_list(), list_themes()) as $plugin) { |
|
803 |
$module = is_string($plugin) ? $plugin : $plugin->name; |
|
804 |
$module_path = drupal_get_path(is_string($plugin) ? 'module' : 'theme', $module); |
|
788 | 805 |
$info = array(); |
789 | 806 |
if (file_exists("$module_path/help/$module.help.ini")) { |
790 | 807 |
$path = "$module_path/help"; |
... | ... | |
797 | 814 |
elseif (!file_exists("$module_path/help")) { |
798 | 815 |
// Look for one or more README files. |
799 | 816 |
$files = file_scan_directory("./$module_path", |
800 |
'/^(README|readme).*\.(txt|TXT)$/', array('recurse' => FALSE));
|
|
817 |
'/^(readme).*\.(txt|md)$/i', array('recurse' => FALSE));
|
|
801 | 818 |
$path = "./$module_path"; |
802 | 819 |
foreach ($files as $name => $fileinfo) { |
803 | 820 |
$info[$fileinfo->filename] = array( |
... | ... | |
1075 | 1092 |
$css = drupal_add_css(); |
1076 | 1093 |
|
1077 | 1094 |
// Remove theme css. |
1078 |
foreach ($css as $media => $types) {
|
|
1079 |
if (isset($css[$media]['theme'])) {
|
|
1080 |
$css[$media]['theme'] = array();
|
|
1095 |
foreach ($css as $key => $value) {
|
|
1096 |
if ($value['group'] == CSS_THEME) {
|
|
1097 |
$exclude[$key] = FALSE;
|
|
1081 | 1098 |
} |
1082 | 1099 |
} |
1100 |
$css = array_diff_key($css, $exclude); |
|
1083 | 1101 |
|
1084 | 1102 |
$variables['styles'] = drupal_get_css($css); |
1085 | 1103 |
$variables['scripts'] = drupal_get_js(); |
drupal7/sites/all/modules/advanced_help/help-icon.css | ||
---|---|---|
2 | 2 |
.advanced-help-link { |
3 | 3 |
background: transparent url('help.png') no-repeat top left; |
4 | 4 |
background-position: 0px 0px; |
5 |
display: block; |
|
6 |
float: left; /* this is cheesy, I know */ |
|
5 |
display: inline-block; |
|
7 | 6 |
height: 12px; |
8 | 7 |
margin-top: 2px; |
9 | 8 |
padding: 0px; |
drupal7/sites/all/modules/advanced_help/help-popup.css | ||
---|---|---|
96 | 96 |
margin: 0.4em 0 0.4em .5em; /* LTR */ |
97 | 97 |
} |
98 | 98 |
|
99 |
|
|
100 | 99 |
#content { |
101 | 100 |
margin: .5em 1em 1em 1em; |
102 | 101 |
} |
drupal7/sites/all/modules/advanced_help/help.css | ||
---|---|---|
1 |
|
|
2 |
.advanced-help-topic code, |
|
3 | 1 |
.advanced-help-topic pre { |
4 | 2 |
background: #f1f1f1; |
5 |
border: 1px solid #444;
|
|
3 |
border: 1px solid #ccc;
|
|
6 | 4 |
display: block; |
7 | 5 |
margin: 1em; |
8 |
padding: .2em; |
|
6 |
padding: .4em; |
|
7 |
} |
|
8 |
|
|
9 |
.advanced-help-topic pre.readme { |
|
10 |
background: white; |
|
11 |
border: none; |
|
12 |
margin: 0em; |
|
13 |
padding: .4em; |
|
9 | 14 |
} |
10 | 15 |
|
11 | 16 |
.advanced-help-topic h3, |
... | ... | |
23 | 28 |
font-weight: normal; |
24 | 29 |
} |
25 | 30 |
|
31 |
.attribution { |
|
32 |
font-size: 0.8em; |
|
33 |
color: #aaa; |
|
34 |
} |
|
35 |
|
|
26 | 36 |
.help-left { |
27 | 37 |
display: block; |
28 | 38 |
float: left; /* LTR */ |
... | ... | |
34 | 44 |
display: block; |
35 | 45 |
float: left; /* LTR */ |
36 | 46 |
margin: 0 5%; |
37 |
width: 4%; |
|
47 |
text-align: center; |
|
48 |
width: 10%; |
|
38 | 49 |
} |
39 | 50 |
|
40 | 51 |
.help-up-noleft { |
... | ... | |
56 | 67 |
margin: .5em; |
57 | 68 |
} |
58 | 69 |
|
70 |
.help-block { |
|
71 |
display: block; |
|
72 |
clear: both; |
|
73 |
} |
|
74 |
|
|
75 |
.help-img-left { |
|
76 |
margin-right: 1.5em; |
|
77 |
border: solid 1px #ccc; |
|
78 |
} |
|
79 |
|
|
80 |
.ta-center { |
|
81 |
margin: 1em; |
|
82 |
text-align: center; |
|
83 |
} |
|
84 |
|
|
85 |
.help-img-center { |
|
86 |
margin-left: auto; |
|
87 |
margin-right: auto; |
|
88 |
border: solid 1px #ccc; |
|
89 |
} |
|
90 |
|
|
59 | 91 |
.help-navigation { |
60 | 92 |
border-top: 1px dotted #ccc; |
61 | 93 |
} |
drupal7/sites/all/modules/advanced_help/help/advanced_help.help.ini | ||
---|---|---|
1 |
[readme] |
|
2 |
title = README |
|
3 |
weight = -11 |
|
1 | 4 |
|
2 | 5 |
[using-advanced-help] |
3 | 6 |
title = Using advanced help |
... | ... | |
7 | 10 |
title = Translating advanced help |
8 | 11 |
|
9 | 12 |
[ini-file] |
10 |
title = Help .ini file format
|
|
11 |
line break = TRUE
|
|
13 |
title = Advanced help .ini file format
|
|
14 |
line break = FALSE
|
|
12 | 15 |
|
13 | 16 |
[why-advanced-help] |
14 | 17 |
title = Why advanced help? |
drupal7/sites/all/modules/advanced_help/help/ini-file.html | ||
---|---|---|
1 |
The advanced help configuration file is in simple .ini file format, divided into sections for each help file, plus an optional section for global settings that might be inherited for each help file. |
|
1 |
<p>The advanced help configuration file is in simple .ini file format. |
|
2 |
It has an optional section for global settings that might be inherited |
|
3 |
for each help file, followed by sections for each help file.</p> |
|
2 | 4 |
|
3 |
The first line of an advanced help ini file should be ;$Id $ which will be a comment providing the CVS identifier for the file. The ; indicates a comment character. Anything after the ; will be ignored. |
|
5 |
<p>Global settings may be put into a section named <code>[advanced help |
|
6 |
settings]</code>. This means that this name is reserved and it cannot |
|
7 |
be a help file in any module or theme. The following settings may be |
|
8 |
set in this section, with the default value (if any) in brackets.</p> |
|
4 | 9 |
|
5 |
Global settings may be put into a section named <strong>[advanced help settings]</strong> -- this means that this name is reserved and it cannot be a help file in any module. The following settings may be set in this section: |
|
6 | 10 |
<dl> |
7 |
<dt><strong>line break</strong></dt> |
|
8 |
<dd>If set to any value, the line break filter will be applied to all help files defined by this module, unless that help file specifically is set otherwise. By default, the line break filter is not applied; however, help files can be much easier to write with the line break filter on.</dd> |
|
9 |
<dt><strong>navigation</strong></dt> |
|
10 |
<dd>If set to true, the navigation will be displayed at the end of the help topic: previous topic, next topic, and child topics.</dd> |
|
11 |
<dt><strong>css</strong></dt> |
|
12 |
<dd>Specify a css file that will be used for all help files (unless overridden), including the .css extension. This .css file must reside in the help directory along with the .html files, and will not be affected by translation.</dd> |
|
13 |
<dt><strong>name</strong></dt> |
|
14 |
<dd>May be set to override the module name as displayed in both the module index as well as the navigation and breadcrumb trail. In general this does not need to be set, but a few modules may want to use a more friendly name than appears in the .info file.</dd> |
|
15 |
<dt><strong>index name</strong></dt> |
|
16 |
<dd>This may be set to change the name of the module in the module index. It overrides the 'name' setting above, as well as the module name in its .info file.</dd> |
|
17 |
<dt><strong>hide</strong></dt> |
|
18 |
<dd>This may be used to hide a module in the module index. This is particularly useful for modules who insert their help files into the hierarchy of another module, as might be done by modules that extend Views or CCK. By setting "hide = TRUE" the module will not appear as its own entry.</dd> |
|
11 |
<dt><code>line break</code> (FALSE)</dt> |
|
12 |
<dd>If set, the line break filter will be applied to all help files |
|
13 |
defined by this module or theme, unless that help file specifically is |
|
14 |
set otherwise. The line break converts line breaks |
|
15 |
into <code>br</code> and <code>p</code> tags automatically.</dd> |
|
16 |
|
|
17 |
<dt><code>navigation</code> (TRUE)</dt> |
|
18 |
<dd>If set, this navigation will be displayed at the end of the topic: |
|
19 |
<em>previous topic</em>, Up (parent), <em>next topic</em>.</dd> |
|
20 |
|
|
21 |
<dt><code>css</code></dt> |
|
22 |
<dd>Specify a css file that will be used for all help files (unless |
|
23 |
overridden), including the .css extension. This .css file must reside |
|
24 |
in the help directory along with the .html files, and will not be |
|
25 |
affected by translation.</dd> |
|
26 |
|
|
27 |
<dt><code>name</code></dt> |
|
28 |
<dd>May be set to override the module or theme name as displayed in |
|
29 |
both the module/theme index as well as the navigation and breadcrumb |
|
30 |
trail. Usually, this is not set, but for some projects you may want to |
|
31 |
use a more friendly name than appears in the project's .info file.</dd> |
|
32 |
|
|
33 |
<dt><code>index name</code></dt> |
|
34 |
<dd>This may be set to change the name of the module or theme in the |
|
35 |
module/theme index. It overrides the <code>name</code> setting above, |
|
36 |
as well as the project's name in its .info file.</dd> |
|
37 |
|
|
38 |
<dt><code>hide</code> (FALSE)</dt> |
|
39 |
<dd>This may be used to hide a module or theme in the module/theme |
|
40 |
index. This is particularly useful for modules who insert their help |
|
41 |
files into the hierarchy of another module or theme, as might be done |
|
42 |
by modules that extend <strong>Views</strong> or derived themes that |
|
43 |
extend base themes like <strong>Zen</strong>. By setting this to TRUE |
|
44 |
the project will not appear as its own entry.</dd> |
|
19 | 45 |
</dl> |
20 | 46 |
|
21 |
Each section after that will correspond to a single help file, and each one may have the following settings: |
|
47 |
<p>Each section after that will correspond to a single help file for a |
|
48 |
single topic. It starts with the topic name in square brackets |
|
49 |
(e.g. <code>[ini-file]</code>). The following settings may be set for |
|
50 |
each file/topic, with the default value (if any) in brackets.</p> |
|
51 |
|
|
22 | 52 |
<dl> |
23 |
<dt><strong>title</strong></dt> |
|
24 |
<dd>The title of the topic, presented to the user and used in links. If you have special characters in your title, be sure to enclose it in quotes.</dd> |
|
25 |
<dt><strong>file</strong></dt> |
|
26 |
<dd>The filename, without the .html extension, used for the topic. This is optional; if not specified, the topic name wil be the file name.</dd> |
|
27 |
<dt><strong>weight</strong></dt> |
|
28 |
<dd>The weight, used for sorting topics on the administration page. Defaults to 0 of unspecified. Items with the same weight are sorted alphabetically.</dd> |
|
29 |
<dt><strong>parent</strong></dt> |
|
30 |
<dd>The topic ID to use in a hierarchy; children will be listed beneath parents in the topic list, and will have the parent in their breadcrumb trail. You may parent this topic to another module's topic by using module%topic as the identifier. For example, 'views%display' will make this a child of the 'display' topic in the 'views' module.</dd> |
|
31 |
<dt><strong>line break</strong></dt> |
|
32 |
<dd>If set to true, linebreaks will be converted into br and p tags automatically. If unspecified, will default to off. Set to 0 to disable the filter if this has been turned on in the global settings.</dd> |
|
33 |
<dt><strong>css</strong></dt> |
|
34 |
<dd>Specify a css file that will be used for this file. This .css file must reside in the help directory along with the .html files. This will override any .css file added by the global system.</dd> |
|
35 |
<dt><strong>popup width</strong></dt> |
|
36 |
<dd>The width in pixels of the popup window. Defaults to 500 if unspecified.</dd> |
|
37 |
<dt><strong>popup height</strong></dt> |
|
38 |
<dd>The height in pixels of the popup window. Defaults to 500 if unspecified.</dd> |
|
53 |
<dt><code>title</code></dt> |
|
54 |
<dd>The title of the topic, presented to the user and used in |
|
55 |
links. If you have special characters in your title, be sure to |
|
56 |
enclose it in quotes. (This setting is currently not optional.)</dd> |
|
57 |
|
|
58 |
<dt><code>file</code> (topic name)</dt> |
|
59 |
<dd>The filename, without the .html extension, used for the file with |
|
60 |
the help text for the topic. This is optional; if not specified, the |
|
61 |
topic name wil be the file name.</dd> |
|
62 |
|
|
63 |
<dt><code>weight</code> (0)</dt> |
|
64 |
<dd>The weight, used for sorting topics on the administration |
|
65 |
page. The default is 0 (zero) if unspecified. Items with the same weight |
|
66 |
are sorted alphabetically.</dd> |
|
67 |
|
|
68 |
<dt><code>parent</code></dt> |
|
69 |
<dd>The topic ID to use in a hierarchy; children will be listed |
|
70 |
beneath parents in the topic list, and will have the parent in their |
|
71 |
breadcrumb trail. You may parent this topic to a topic in another |
|
72 |
module or theme by using <code>module%topic</code> |
|
73 |
or <code>theme%topic</code> as the identifier, |
|
74 |
where <code>module</code> or <code>theme</code> is the project's short |
|
75 |
name. For example if parent is set to, '<code>views%display</code>', |
|
76 |
the topic will be regarded as a child of the |
|
77 |
<code>display</code> topic in the <strong>Views</strong> module.</dd> |
|
78 |
|
|
79 |
<dt><code>line break</code> (FALSE)</dt> |
|
80 |
<dd>Set the line break filter for this topic. Set to FALSE to disable |
|
81 |
the line break filter if this has been turned on in the global |
|
82 |
settings.</dd> |
|
83 |
|
|
84 |
<dt><code>css</code></dt> |
|
85 |
<dd>Specify a css file that will be used for this file. This .css file |
|
86 |
must reside in the help directory along with the .html files. This |
|
87 |
will override any .css file added by the global settings.</dd> |
|
88 |
|
|
89 |
<dt><code>popup width</code> (500)</dt> |
|
90 |
<dd>The width in pixels of the popup window.</dd> |
|
91 |
|
|
92 |
<dt><code>popup height</code> (500)</dt> |
|
93 |
<dd>The height in pixels of the popup window.</dd> |
|
39 | 94 |
</dl> |
40 | 95 |
|
41 |
For example, here is a version of the <strong>advanced_help.help.ini</strong> file: |
|
96 |
<p>For example, here is a version of the <code>advanced_help.help.ini</code> file:</p> |
|
97 |
|
|
42 | 98 |
<pre> |
99 |
[readme] |
|
100 |
title = README |
|
101 |
weight = -11 |
|
102 |
|
|
43 | 103 |
[using-advanced-help] |
44 |
title = "Using advanced help"
|
|
104 |
title = Using advanced help
|
|
45 | 105 |
weight = -10 |
46 | 106 |
|
47 | 107 |
[translation] |
... | ... | |
49 | 109 |
|
50 | 110 |
[ini-file] |
51 | 111 |
title = Help .ini file format |
112 |
line break = FALSE |
|
113 |
|
|
114 |
[why-advanced-help] |
|
115 |
title = Why advanced help? |
|
52 | 116 |
line break = TRUE |
53 |
</pre> |
|
117 |
</pre> |
drupal7/sites/all/modules/advanced_help/help/readme.html | ||
---|---|---|
1 |
<h2 id="project-description">Synopsis</h2> |
|
2 |
|
|
3 |
<p>The <strong>Advanced help</strong> module provides a framework that allows |
|
4 |
module and theme developers integrate help texts in a Drupal site.</p> |
|
5 |
|
|
6 |
<p>These help texts are stored in ordinary <code>.html</code>-files |
|
7 |
that lives in the file system (as opposed to the database). These |
|
8 |
files are distributed from the project Drupal.org repo in the same |
|
9 |
package as the module or theme, and placed in a subdirectory named |
|
10 |
<code>help</code> in the project or theme directory. This means that |
|
11 |
the help texts can be easiely kept in sync with the project they |
|
12 |
provide help texts for, but also that read access to these files |
|
13 |
are not managed by any content access restrictions imposed by Drupal.</p> |
|
14 |
|
|
15 |
<p>The help texts can be marked up with standard HTML, but are |
|
16 |
rendered within your site's Drupal theming structure.</p> |
|
17 |
|
|
18 |
<p>If the module or theme author does not make use of the full |
|
19 |
<em>Advanced help</em> framework, but if there is a |
|
20 |
<code>README.md</code> or <code>README.txt</code> in the package, |
|
21 |
the content of that file will be shown instead.</p> |
|
22 |
|
|
23 |
<p>The help texts may appear in a popup or not as the module prefers. |
|
24 |
By taking away access to view the popups, a site can hide popups from |
|
25 |
users.</p> |
|
26 |
|
|
27 |
<p>The help texts can be placed in a hierarchy, allowing for top down |
|
28 |
navigation of help.</p> |
|
29 |
|
|
30 |
<p>The hierarchy is tied into Drupal's search system. If this is |
|
31 |
enabled, all help texts are fully indexed. This means that the entire |
|
32 |
contents of the advanced help set of pages can be searched for |
|
33 |
keywords.</p> |
|
34 |
|
|
35 |
<h2 id="use">Using the module</h2> |
|
36 |
|
|
37 |
<p>By itself, this module doesn't do much. The <strong>Advanced |
|
38 |
help</strong> assists other modules and themes in showing help texts. |
|
39 |
Nothing will show up until you enable at least one other module that |
|
40 |
makes use of the advanced help framework or comes with a file |
|
41 |
named <code>README.md</code> or <code>README.txt</code>. However, it |
|
42 |
comes with a small companion demo module named |
|
43 |
<strong>Advanced help example</strong> to demonstrate how it works. |
|
44 |
For more extensive example of use of the advanced help features, see |
|
45 |
the <strong>Views</strong> project.</p> |
|
46 |
|
|
47 |
<h2 id="project-recommended">Recommended modules</h2> |
|
48 |
|
|
49 |
<ul> |
|
50 |
<!-- |
|
51 |
<li><a href="https://www.drupal.org/project/markdown">Markdown filter</a>:<br> |
|
52 |
When this module is enabled, display of any <code>README.md</code> the |
|
53 |
module shows will be rendered with markdown.</li> |
|
54 |
--> |
|
55 |
<li><a href="https://www.drupal.org/project/attributions">Attributions</a>:<br> |
|
56 |
When this module is enabled, attributions of third party content used |
|
57 |
by the project (i.e. some text from Wikipedia) will be available in an |
|
58 |
attribution block and on an atribution page.</li> |
|
59 |
</ul> |
|
60 |
|
|
61 |
<h2 id="support-status">Support status</h2> |
|
62 |
|
|
63 |
<p>Reported bugs for the Drupal 7 branch will be fixed in a timely |
|
64 |
manner. Bugs in the issue queue for the Drupal 6 branch will only be |
|
65 |
fixed if accompanied with a patch, after the patch has been reviewed |
|
66 |
and tested by the community. No Drupal 8 version is currently under |
|
67 |
development. Post a message in |
|
68 |
the <a href="https://www.drupal.org/node/1928218">issue queue</a> if |
|
69 |
you're interested in managing a port of the project to to Drupal |
|
70 |
8. Older versions are no longer supported.</p> |
|
71 |
|
|
72 |
<p>Community support in the form of patches are very welcome for both |
|
73 |
Drupal 6 and Drupal 7 versions, and will be given priority. For QA, |
|
74 |
the project needs community support in the form of reviews of patches, |
|
75 |
development versions and releases.</p> |
|
76 |
|
|
77 |
<p>The primary goal of the module is to remain <strong>light-weight |
|
78 |
and simple</strong>. This means that not all feature requests will be |
|
79 |
implemented, even if they are a good idea. Feature requests |
|
80 |
accompanied by patches are more likely to make it into a release.</p> |
|
81 |
|
|
82 |
<p>The maintainer hopes that the community is willing to help out by |
|
83 |
answering & closing support requests.</p> |
|
84 |
|
|
85 |
<!-- |
|
86 |
<h2 id="project-problems">Known problems</h2> |
|
87 |
--> |
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
<h2 id="project-maintainers">Credits</h2> |
|
92 |
|
|
93 |
<ul> |
|
94 |
<li><a href="https://www.drupal.org/u/merlinofchaos"">merlinofchaos</a> (52 commits, original creator)</li> |
|
95 |
<li><a href="https://www.drupal.org/u/redndahead">redndahead</a> (8 commits)</li> |
|
96 |
<li><a href="https://www.drupal.org/u/dmitrig01">dmitrig01</a> (3 commits)</li> |
|
97 |
<li><a href="https://www.drupal.org/u/amitgoyal">amitgoyal </a> (5 commits)</li> |
|
98 |
<li><a href="https://www.drupal.org/u/gisle">gisle</a> (current maintainer)</li> |
|
99 |
</ul> |
drupal7/sites/all/modules/advanced_help/help/translation.html | ||
---|---|---|
1 |
<p>To translate advanced help, first create a <b>translations/help/$language</b> directory |
|
2 |
in the module directory. Then, copy the .ini file and all .html files from |
|
3 |
the help directory.</p> |
|
1 |
<p>To translate advanced help, first create a |
|
2 |
directory <code>translations/help/<em>language</em></code> in the |
|
3 |
module directory. Then, copy the .ini file and all the .html files |
|
4 |
from the help directory into this. If you need to alter an image to |
|
5 |
use it in a translation, you also put the altered image there.</p> |
|
4 | 6 |
|
5 |
<p>The .ini file only needs to keep the titles, and if there is a 'name' or 'index name' setting in the 'advanced help settings' portion, that should be retained. Any retained settings should be translated. The rest of the data in the .ini file may be discarded or ignored.</p> |
|
7 |
<p>The .ini file only needs to keep the titles, and if there is |
|
8 |
a <code>name</code> or <code>index name</code> setting in the |
|
9 |
'advanced help settings' portion, that should be retained. Any |
|
10 |
retained settings should be translated. The rest of the data in the |
|
11 |
.ini file may be discarded or ignored.</p> |
|
6 | 12 |
|
7 | 13 |
<p>Each file should then be translated in place.</p> |
8 | 14 |
|
9 |
<p>When translating a .html file, you will find that the <b>path</b> keyword will lead to the original directory. If you must translate items that are linked, such as images, use <b>trans_path</b> instead, which will lead to the translated directory. This will allow you to pick and choose which linked items, if any, will be translated.</p> |
|
15 |
<p>When translating a .html file, you will find that |
|
16 |
the <code>&path&</code> keyword will lead to the original |
|
17 |
directory. If you must translate items that are linked, such as images |
|
18 |
containing text, use <code>&trans_path&</code> instead, which |
|
19 |
will lead to the translated directory. This will allow you to pick and |
|
20 |
choose which linked items, if any, will be translated.</p> |
drupal7/sites/all/modules/advanced_help/help/using-advanced-help.html | ||
---|---|---|
1 |
<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. |
|
2 |
</p> |
|
1 |
<p>The <strong>Advanced help</strong> module provides a framework that |
|
2 |
allows module and theme developers integrate help texts in a Drupal |
|
3 |
site. Although the advanced help does not provide general help by |
|
4 |
itself, it provides a powerful and easy framework that modules and |
|
5 |
themes may use to provide their own help.</p> |
|
3 | 6 |
|
4 |
<p> |
|
5 |
Modules utilizing <em>Advanced help</em> should create a 'help' subdirectory inside their |
|
6 |
module's directory. Place the file MODULENAME.help.ini in this subdirectory, formatted |
|
7 |
similar to the following example: |
|
8 |
</p> |
|
7 |
<p>Modules and themes utilizing <strong>Advanced help</strong> should |
|
8 |
create a subdirectory named <code>help</code> inside their own main |
|
9 |
directory. Place the file |
|
10 |
<em>MODULENAME</em>.help.ini (resp. <em>THEMENAME</em>.help.ini) in this subdirectory. |
|
11 |
formatted similar to the following example:</p> |
|
12 |
|
|
13 |
<pre> |
|
14 |
[about-php] |
|
15 |
title = About PHP |
|
16 |
file = about-php |
|
17 |
weight = -10 |
|
18 |
|
|
19 |
[history] |
|
20 |
title = History of PHP |
|
21 |
parent = about-php |
|
22 |
|
|
23 |
[usage] |
|
24 |
title = Usage of PHP |
|
25 |
weight = 1 |
|
26 |
|
|
27 |
[security] |
|
28 |
title = Security of PHP |
|
29 |
weight = 2 |
|
30 |
|
|
31 |
[syntax] |
|
32 |
title = PHP syntax |
|
33 |
parent = usage |
|
34 |
</pre> |
|
35 |
|
|
36 |
<p>This file defines five help topics (inside the square brackets, and |
|
37 |
some settings for them. |
|
38 |
See: <a href="&topic:advanced_help/ini-file&">Advanced help .ini file format</a> for |
|
39 |
a list of defined settings.</p> |
|
40 |
|
|
41 |
|
|
42 |
<p>All topics are addressed by the module or theme providing the |
|
43 |
topic, and by the topic id. To produce a themed link to popup |
|
44 |
about a topic, use the a format similar to the following example:</p> |
|
45 |
|
|
46 |
<!-- D6 |
|
47 |
<pre> |
|
48 |
$output = theme('advanced_help_topic', 'help_example', 'about-php'); |
|
49 |
$output .= ' ' . t('Click the help icon!'); |
|
50 |
</pre> |
|
51 |
--> |
|
52 |
|
|
53 |
<!-- D7 --> |
|
54 |
<pre> |
|
55 |
$output = theme('advanced_help_topic', array( |
|
56 |
'module' => 'help_example', |
|
57 |
'topic' => 'about-php', |
|
58 |
)); |
|
59 |
$output .= ' ' . t('Click the help icon!'); |
|
60 |
</pre> |
|
61 |
|
|
62 |
<p>This produces the following output:</p> |
|
63 |
|
|
64 |
<pre> |
|
65 |
<a class="advanced-help-link" title="About PHP" |
|
66 |
onclick="var w=window.open(this.href, 'advanced_help_window', |
|
67 |
'width=500,height=500,scrollbars,resizable'); |
|
68 |
w.focus(); return false;" |
|
69 |
href="/help/help_example/about-php?popup=1"> |
|
70 |
<span>Help</span> |
|
71 |
</a> |
|
72 |
Click the help icon! |
|
73 |
</div> |
|
74 |
</pre> |
|
75 |
|
|
76 |
<p>This produces a clickable help icon like the one shown below:</p> |
|
77 |
|
|
78 |
<div class="ta-center"> |
|
79 |
<img class="help-img-center" alt="clickable icon" src="&path&click_icon.png" width="180" height="90" border="0" /> |
|
80 |
</div> |
|
81 |
|
|
82 |
<p>Inside your help file, you may link to other help topics using this format:</p> |
|
83 |
<pre> |
|
84 |
<a href="&topic:module/topic&">topic</a> |
|
85 |
</pre> |
|
86 |
<p>This format will ensure the popup status remains consistent when |
|
87 |
switching between links.</p> |
|
88 |
|
|
89 |
<p>To reference items within the help directory, such as images you |
|
90 |
wish to embed within the help text, use:</p> |
|
9 | 91 |
<pre> |
10 |
[buses] |
|
11 |
title = "How buses are tied into the system" |
|
12 |
file = buses |
|
92 |
<img src="&path&example.png"/> |
|
93 |
<img src="&trans_path&example.png"/> |
|
94 |
</pre> |
|
95 |
|
|
96 |
<p>The latter is to refer to a translated version of the image if it differs from the original.</p> |
|
13 | 97 |
|
14 |
[TOPIC_ID] |
|
15 |
title = "Title of topic". |
|
16 |
file = filename of topic, without the .html extension. |
|
17 |
weight = How important the topic is on the index page. |
|
18 |
parent = The optional topic parent to use in the breadcrumb, |
|
19 |
either topic or module%topic. |
|
98 |
<p>To reference any normal path in the site, use:</p> |
|
99 |
<pre> |
|
100 |
<a href="&base_url&admin/settings/site-configuration">anchor text</a> |
|
20 | 101 |
</pre> |
21 | 102 |
|
22 |
<p> |
|
23 |
All topics are addressed by the module providing the topic, and by the topic |
|
24 |
id. To embed links, use the following format: |
|
25 |
</p> |
|
26 |
<code> |
|
27 |
$output .= theme('advanced_help_topic', $module, $topic); |
|
28 |
</code> |
|
103 |
<p><strong>NOTE: </strong> In previous versions <strong>Advanced |
|
104 |
help</strong> did not require the &'s to be wrapped around |
|
105 |
<code>topic:</code>, <code>path</code>, and <code>base_url</code>. |
|
106 |
This is currently still supported, but may be removed in a future |
|
107 |
version. By adding the &'s these tokens are now not limited |
|
108 |
to <code>href=""</code> and <code>src=""</code> parameters.</p> |
|
109 |
|
|
110 |
<h2 id="access-control">Access control</h2> |
|
29 | 111 |
|
30 |
<p>Inside your help file, link to other topics using the format <strong><a href="&topic:module/topic&"></strong>. This |
|
31 |
format will ensure the popup status remains consistent when switching between links.</p> |
|
112 |
<p>When this module is installed, users with the |
|
113 |
<code>view advanced help index</code> |
|
114 |
permission can access the advanced help index by going to |
|
115 |
<em>Administer → Advanced Help</em> |
|
116 |
(<code>admin/advanced_help</code>). Additional permissions |
|
117 |
<code>view advanced help topic</code> and |
|
118 |
<code>view advanced help popup</code> |
|
119 |
enable users to access the actual help pages and popups.</p> |
|
32 | 120 |
|
33 |
<p>Use <strong><a href="&path&example.jpg"></strong> to reference items |
|
34 |
within the help directory, such as images you wish to embed within the help text.</p> |
|
121 |
<p>The help texts are stored as plain .html-files and can, unless |
|
122 |
protected, be accessed by anyone who knows their URL. To protect |
|
123 |
them, place the following four lines in a file named |
|
124 |
<code>.htaccess</code> in project's <code>help</code> directory:</p> |
|
35 | 125 |
|
36 |
<p>Use <strong><a href="&base_url&admin/settings/site-configuration"></strong> to reference any normal path in the site.</p> |
|
126 |
<pre> |
|
127 |
<Files *\.html> |
|
128 |
Order Allow,Deny |
|
129 |
Deny from all |
|
130 |
</Files> |
|
131 |
</pre> |
|
37 | 132 |
|
38 |
<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 click the "Run cron manually" link.</p> |
|
133 |
<p>It as the responsibility of the project author to make sure this |
|
134 |
type of protection is in place if the project's author has help files |
|
135 |
that merits protection from direct access.</p> |
|
39 | 136 |
|
40 |
<p>Example: <a href="&path&nowhere.jpg">Don't click this!</a></p> |
|
137 |
<p>See also this tracker in the project's issue queue: |
|
138 |
<a href="https://www.drupal.org/node/1980936">#1980936 Typing complete path to .html help files in module bypasses user permissions</a>.</p> |
|
41 | 139 |
|
42 |
<p>See: <a href="&topic:advanced_help/ini-file&">ini file format</a></p>
|
|
140 |
<h2 id="search">Search</h2>
|
|
43 | 141 |
|
44 |
<p><strong>NOTE: </strong> In previous versions Advanced Help did not require the &'s wrapped around the topic:, path:, and base_url: links. This |
|
45 |
is currently still supported, but may be removed in a future version. By adding the &'s these tokens are now not limited to href="" and src="" paramaters.</p> |
|
142 |
<p>If the core <strong>Search</strong> module is enabled, the contents |
|
143 |
of the advanced help framework will be indexed on cron. If you enable |
|
144 |
new modules or themes and wish to immediately index their help text, |
|
145 |
navigate to <em>Administration → Reports → Status report</em> and click the link |
|
146 |
“run cron manually”.</p> |
drupal7/sites/all/modules/advanced_help/help/why-advanced-help.html | ||
---|---|---|
1 |
The advanced help system was designed to replace the original Drupal help system, which has several flaws that make it hard to create new help, hard to maintain existing help, and particularly hard to access help.
|
|
1 |
The <strong>Advanced help</strong> framework was designed to replace the original Drupal help system, which has several flaws that make it hard to create new help, hard to maintain existing help, and particularly hard to access help.
|
|
2 | 2 |
|
3 | 3 |
The primary goal, then, is to increase the accessibility of help, meaning the ability of both the user and the help text author to access the needed tools to use, create, maintain and translate the help. |
4 | 4 |
|
5 |
This system is completely separate from Drupal's hook_help(). In Drupal 6, it actually co-exists with it; in the future, it is hoped that it will completely replace it allowing hook_help() to be deprecated and removed.
|
|
5 |
This system is completely separate from Drupal's <code>hook_help()</code>. In Drupal 6 and 7, it actually co-exists with it; in the future, it is hoped that it will completely replace it allowing <code>hook_help()</code> to be deprecated and removed.
|
|
6 | 6 |
|
7 |
Messages added to the top of a page are not really "help". Often these messages are an introduction to a form or a short blurb telling a user what to do with a particular page. The problem is, these messages are always there, they are easily ignored, and they come before the actual page. In general, when users are learning, they want to see the page first, then ask questions. The reverse order is much less conducive to actually teaching a user how to use something. By allowing help to be available on request, the system conforms more naturally to how most people work.
|
|
7 |
Messages added to the top of a page are not really “help”. Often these messages are an introduction to a form or a short blurb telling a user what to do with a particular page. The problem is, these messages are always there, they are easily ignored, and they come before the actual page. In general, when users are learning, they want to see the page first, then ask questions. The reverse order is much less conducive to actually teaching a user how to use something. By allowing help to be available on request, the system conforms more naturally to how most people work.
|
|
8 | 8 |
|
9 |
<h3><strong>Advanced help is organized by topic</strong></h3>
|
|
10 |
With the hook_help() method, help text is organized by URL path. This is fine if you have help text describing how to use a particular page or what a particular page does, but ultimately is limiting because manuals and documentation are usually grouped by topic, and those topics are determined by the material itself.
|
|
9 |
<h2>Advanced help is organized by topic</h2>
|
|
10 |
With the <code>hook_help()</code> method, help text is organized by URL path. This is fine if you have help text describing how to use a particular page or what a particular page does, but ultimately is limiting because manuals and documentation are usually grouped by topic, and those topics are determined by the material itself.
|
|
11 | 11 |
|
12 |
Advanced help allows the documentation author to organize topics as he or she sees fit; the only restriction, really, is that each individual chunk of text needs to stand on its own as a discrete topic.
|
|
12 |
<strong>Advanced help</strong> allows the documentation author to organize topics as he or she sees fit; the only restriction, really, is that each individual chunk of text needs to stand on its own as a discrete topic.
|
|
13 | 13 |
|
14 |
What's more, modules can insert their topics into another module's hierarchy. This would allow the Drupal core to create a task based help navigation system which allows modules insert topics into that navigation fluidly. This allows modules to continue to keep their systems separate, yet integrate into the main system.
|
|
14 |
What's more, modules and themes can insert their topics into another's hierarchy. This would allow the Drupal core to create a task based help navigation system which allows modules and themes to insert topics into that navigation fluidly. This allows modules and themes to continue to keep their systems separate, yet integrate into the main system.
|
|
15 | 15 |
|
16 |
<h3><strong>Advanced help topics are processed HTML in their own files</strong></h3>
|
|
17 |
This separation makes it easy to find and modify. Currently, everything is lumped together in hook_help() in PHP strings that are run through t(), and there is a fair amount of PHP code necessary in this system that actually gets in the way of writing good, explanatory text.
|
|
16 |
<h2>Advanced help topics are processed HTML in their own files</h2>
|
|
17 |
This separation makes it easy to find and modify. Currently, everything is lumped together in <code>hook_help()</code> in PHP strings that are run through <code>t()</code>, and there is a fair amount of PHP code necessary in this system that actually gets in the way of writing good, explanatory text.
|
|
18 | 18 |
|
19 | 19 |
In fact, requiring a documentation author to understand PHP at all is a detriment. The idea that documentation writers need to have PHP development as a skill seriously reduces the number of available contributors. HTML, on the other hand, is a much more common skill, is relatively easy to learn, and the amount of HTML needed to write documentation is only a little bit more than the HTML used in forum posts. |
20 | 20 |
|
21 |
Another benefit to not using PHP is that the files themselves are safe. They are unlikely to include malicious PHP code that could take over the server or do worse things. This means that these files can be used relatively easily on the drupal.org hardware so that a module's help files can be made immediately available without needing to download the module. It also means that descriptions of the module can be made on drupal.org that are version aware, can be corrected easily in CVS with patches, but can also be made available with the module so that drupal.org is not required.
|
|
21 |
Another benefit to not using PHP is that the files themselves are safe. They are filtered to escape malicious script code that could take over the server or do worse things. This means that these files can be used relatively easily on Drupal.org itself. It also means that descriptions of the project pulled from the project's help pages or README.txt or README.md can be made on the project's Drupal.org without the need to download the module or theme to look at the contents of these files. This also simplifies maintenance, as the files can be corrected easily by patches, which are updated by tyhe maintainer and pushed to git.
|
|
22 | 22 |
|
23 |
This also means that we could, if we wanted, package the drupal.org handbooks, or a subset of them, directly into a drupal distribution, or a drupal add-on, so that Drupal administrators can have Drupal help without needing to visit drupal.org. This can be valuable in locked down corporate environments and on planes. But more importantly, the handbooks can be made version aware much more easily than the current method on drupal.org.
|
|
23 |
By moving all docymentation into help files, we could, if we wanted, package the Drupal.org handbooks, or a subset of them, directly into a Drupal distribution, or a Drupal add-on, so that Drupal administrators can have Drupal help without needing to visit Drupal.org. This can be valuable in locked down corporate environments and on planes. But more importantly, the handbooks can be made version aware much more easily than the current method on Drupal.org.
|
|
24 | 24 |
|
25 |
The downside to this method is that these books can't easily be made dynamic. Though the use of alter hooks could allow a module to make modifications to the help as needed, doing this could make the help files less useful when you take them out of context. |
|
25 |
The downside to this method is that these books can't easily be made dynamic. Though the use of alter hooks could allow a module or theme to make modifications to the help as needed, doing this could make the help files less useful when you take them out of context.
|
|
26 | 26 |
|
27 |
<h3><strong>Advanced help files are translated as a file</strong></h3>
|
|
28 |
It is actually not easy to translate documents as strings, particularly when the language being used is very much unlike English. In fact, when translating a document, the organization of the sentences may change drastically. It is also a burden on the CPU to do this, as you are indexing on very long strings.
|
|
27 |
<h2>Advanced help files are translated as a file</h2>
|
|
28 |
It is actually not easy to translate documents as strings, particularly when the language being used is very much unlike English. In fact, when translating a document, the organization of the sentences may change drastically. It is also a burden on the CPU to do this, as you are indexing on very long strings. |
|
29 | 29 |
|
30 | 30 |
Translators have a much better time translating a document as a unit, because of the presence of the entire context. |
31 | 31 |
|
32 |
<h3><strong>Advanced help has its own navigation system</strong></h3>
|
|
33 |
By making use of a navigation system specified in a .ini file (which is not PHP code and therefore safe to use on *.drupal.org sites), the help can be structured like a book, which is typical of online manuals. This is familiar to users, can be organized (and re-organized) and allows a module to include significantly richer text without burdening the PHP code with having its help loaded unnecessarily.
|
|
32 |
<h2>Advanced help has its own navigation system</h2>
|
|
33 |
By making use of a navigation system specified in a .ini file (which is not PHP code and therefore safe to use), the help can be structured like a book, which is typical of online manuals. This is familiar to users, can be organized (and re-organized) and allows a module or theme to include significantly richer text without burdening the PHP code with having its help loaded unnecessarily.
|
|
34 | 34 |
|
35 | 35 |
This book can be navigated hierarchically as well, making it easy to keep related topics together. |
36 |
<h3><strong>Advanced help is indexed by the search engine</strong></h3>
|
|
36 |
<h2>Advanced help is indexed by the search engine</h2>
|
|
37 | 37 |
An important goal of this system was to add searchability to the help. By being able to enter keywords into the search box and find relevant topics, we come up with a system that resembles the kind of help that comes with many operating systems. This is very valuable when searching through manuals trying to find out how to do a particular thing. |
38 | 38 |
|
39 | 39 |
This search is specific to the help, meaning that the help will not be mixed in with the global node search. This can be considered both an advantage and a disadvantage. For the most part, this help system is meant to provide help to site administrators, and content searches should not find it. The disadvantage, of course, is when you want to use it for end user help, you will not be able to. |
40 | 40 |
|
41 |
<h3><strong>Inline help can be brought in via popups</strong></h3>
|
|
42 |
In addition to the manual-like hierarchical navigation, advanced help can also provide context-sensitive additional help through a popup. While popups are controversial, the argument for using them is that when getting help while on a form, <i>a popup will not throw away a user's data.</i> Browsers are not very friendly to input forms if they are not submitted, and navigating away from the form can be dangerous. There are various other solutions to this problem, but each one has a drawback. The drawbacks to popups are well known, but mostly it is the irritation of having new windows. When getting help, though, a popup is usually invited. Help should not interfere with what the operation the user is trying to complete. It differs greatly from the uninvited popup, which are usually ads or popups meant to prevent users from navigating away from a site.
|
|
41 |
<h2>Inline help can be brought in via popups</h2>
|
|
42 |
In addition to the manual-like hierarchical navigation, <strong>Advanced help</strong> can also provide context-sensitive additional help through a popup. While popups are controversial, the argument for using them is that when getting help while on a form, <i>a popup will not throw away a user's data.</i> Browsers are not very friendly to input forms if they are not submitted, and navigating away from the form can be dangerous. There are various other solutions to this problem, but each one has a drawback. The drawbacks to popups are well known, but mostly it is the irritation of having new windows. When getting help, though, a popup is usually invited. Help should not interfere with what the operation the user is trying to complete. It differs greatly from the uninvited popup, which are usually ads or popups meant to prevent users from navigating away from a site.
|
|
43 | 43 |
|
44 |
These popups can be added to a page with text links or icon links. |
|
44 |
Popups can be added to a page with plain text links or themed icon links. |
drupal7/sites/all/modules/advanced_help/help_example/help/about-php.html | ||
---|---|---|
1 |
<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>
|
|
1 |
<p><b>PHP</b> (<i>PHP: Hypertext Preprocessor</i>) is a computer <a href="http://en.wikipedia.org/wiki/Scripting_language" title="Scripting language">scripting language</a>, originally designed for producing <a href="http://en.wikipedia.org/wiki/Dynamic_web_page" title="Dynamic web page">dynamic web pages</a>. It is mainly used in <a href="http://en.wikipedia.org/wiki/Server-side_scripting" title="Server-side scripting">server-side scripting</a>, but can be used from a <a href="http://en.wikipedia.org/wiki/Command_line_interface"title="Command line interface">command line interface</a> or in <a href="http://en.wikipedia.org/wiki/Standalone" title="Standalone">standalone</a> <a href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface">graphical applications</a>.</p>
|
|
2 | 2 |
|
3 |
<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> |
|
3 |
<p>While PHP was originally created by <a |
|
4 |
href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" title="Rasmus |
|
5 |
Lerdorf">Rasmus Lerdorf</a> in 1994, the main implementation of PHP is |
|
6 |
now produced by The PHP Group and serves as the <a |
|
7 |
href="http://en.wikipedia.org/wiki/De_facto_standard" title="De facto |
|
8 |
standard"><i>de facto</i> standard</a> for PHP as there is |
|
9 |
no <a |
|
10 |
href="http://en.wikipedia.org/wiki/Formal_specification" title="Formal |
|
11 |
specification">formal specification</a>. Released under the <a |
|
12 |
href="http://en.wikipedia.org/wiki/PHP_License" title="PHP |
|
13 |
License">PHP License</a>, the <a |
|
14 |
href="http://en.wikipedia.org/wiki/Free_Software_Foundation" |
|
15 |
title="Free Software Foundation">Free Software Foundation</a> |
|
16 |
considers it to be <a |
|
17 |
href="http://en.wikipedia.org/wiki/Free_software" title="Free |
|
18 |
software">free software</a>.</p> |
|
4 | 19 |
|
5 |
<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> |
|
20 |
<p>PHP is a widely-used general-purpose scripting language that is |
|
21 |
especially suited for <a |
|
22 |
href="http://en.wikipedia.org/wiki/Web_development" title="Web |
|
23 |
development">web development</a> and can be embedded |
|
24 |
into <a href="http://en.wikipedia.org/wiki/HTML" |
|
25 |
title="HTML">HTML</a>. It generally runs on a <a |
|
26 |
href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web |
|
27 |
server</a>, taking PHP code as its input and |
|
28 |
creating <a |
|
29 |
href="http://en.wikipedia.org/wiki/Web_page" title="Web page">web |
|
30 |
pages</a> as output. It can be deployed on most web servers and on |
|
31 |
almost every <a |
|
32 |
href="http://en.wikipedia.org/wiki/Operating_system" title="Operating |
|
33 |
system">operating system</a> and <a |
|
34 |
href="http://en.wikipedia.org/wiki/Platform_%28computing%29" |
|
35 |
class="mw-redirect" title="Platform (computing)">platform</a> free of |
|
36 |
charge. PHP is installed on more than 20 million |
|
37 |
websites and 1 million <a |
|
38 |
href="http://en.wikipedia.org/wiki/Server_%28computing%29" |
|
39 |
title="Server (computing)">servers</a>, although the number of |
|
40 |
websites with PHP <a |
|
41 |
href="http://en.wikipedia.org/wiki/Installation_%28computer_programs%29" |
|
42 |
title="Installation (computer programs)">installed</a> has declined |
|
43 |
since August 2005. |
|
44 |
It is also the most popular <a |
|
45 |
href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" title="Apache |
|
46 |
HTTP Server">Apache</a> module among computers using Apache as a web |
|
47 |
server. |
|
48 |
The most recent major release of PHP was version 5.2.5 |
|
49 |
on <a href="http://en.wikipedia.org/wiki/November_8" |
|
50 |
title="November 8">November 8</a>, <a |
|
51 |
href="http://en.wikipedia.org/wiki/2007" |
|
52 |
title="2007">2007</a>.</p> |
|
53 |
|
|
54 |
<p class="attribution">This excerpt is adapted from <a href="http://en.wikipedia.org/wiki/PHP">Wikipedia: PHP</a>. It is used here under a <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons BY-SA 3.0</a> license.</p> |
drupal7/sites/all/modules/advanced_help/help_example/help/help_example.help.ini | ||
---|---|---|
1 | 1 |
[about-php] |
2 | 2 |
title = About PHP |
3 |
file = about-php |
|
4 | 3 |
weight = -10 |
5 | 4 |
|
6 | 5 |
[history] |
7 | 6 |
title = History of PHP |
8 |
file = history |
|
9 | 7 |
parent = about-php |
10 | 8 |
|
11 | 9 |
[usage] |
12 | 10 |
title = Usage of PHP |
13 |
file = usage |
|
14 | 11 |
weight = 1 |
15 | 12 |
|
16 | 13 |
[security] |
17 | 14 |
title = Security of PHP |
18 |
file = security |
|
19 | 15 |
weight = 2 |
20 | 16 |
|
21 | 17 |
[syntax] |
22 | 18 |
title = PHP syntax |
23 |
file = syntax |
|
24 | 19 |
parent = usage |
drupal7/sites/all/modules/advanced_help/help_example/help/history.html | ||
---|---|---|
1 | 1 |
<div class="help-box help-left"> |
2 | 2 |
<div class="thumbinner" style="width:182px;"><a href="http://en.wikipedia.org/wiki/Image:Lerdorf.jpg" class="image" title="Rasmus Lerdorf, who wrote the original Common Gateway Interface binaries"><img alt="Rasmus Lerdorf, who wrote the original Common Gateway Interface binaries" src="path:180px-Lerdorf.jpg" width="180" height="270" border="0" class="thumbimage" /></a> |
3 | 3 |
<div class="thumbcaption"> |
4 |
<div class="magnify"><a href="/wiki/Image:Lerdorf.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
|
5 |
<a href="/wiki/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a>, who wrote the original <a href="/wiki/Common_Gateway_Interface" title="Common Gateway Interface">Common Gateway Interface</a> binaries</div> |
|
4 |
<a href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a>, who wrote the original <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" title="Common Gateway Interface">Common Gateway Interface</a> binaries</div> |
|
6 | 5 |
</div> |
7 | 6 |
</div> |
8 | 7 |
|
9 |
|
|
10 |
<p>PHP, standing for Personal Home Page, began as a set of <a target="_blank" href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" title="Common Gateway Interface">Common Gateway Interface</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Binary_file" title="Binary file">binaries</a> written in the <a target="_blank" href="http://en.wikipedia.org/wiki/C_programming_language" class="mw-redirect" title="C programming language">C programming language</a> in 1994 by the <a target="_blank" href="http://en.wikipedia.org/wiki/Danish_people" title="Danish people">Danish</a>/<a target="_blank" href="http://en.wikipedia.org/wiki/Greenland" title="Greenland">Greenlandic</a> programmer <a target="_blank" href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a>. Lerdorf initially created these Personal Home Page Tools to replace a small set of <a target="_blank" href="http://en.wikipedia.org/wiki/Perl" title="Perl">Perl</a> scripts he had been using to maintain his <a target="_blank" href="http://en.wikipedia.org/wiki/Personal_homepage" class="mw-redirect" title="Personal homepage">personal homepage</a>. The tools were originally created to perform tasks such as displaying his <a target="_blank" href="http://en.wikipedia.org/wiki/R%C3%A9sum%C3%A9" title="Résumé">résumé</a> and recording how much <a target="_blank" href="http://en.wikipedia.org/wiki/Web_traffic" title="Web traffic">traffic</a> his page was receiving.<sup id="cite_ref-history_2-1" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> He combined these binaries with his Form Interpreter to create PHP/FI, which had more functionality. It included a larger <a target="_blank" href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C implementation</a> which could communicate with <a target="_blank" href="http://en.wikipedia.org/wiki/Database" title="Database">databases</a> and helped build simple, dynamic <a target="_blank" href="http://en.wikipedia.org/wiki/Web_application" title="Web application">web applications</a>. He released PHP publicly on <a target="_blank" href="http://en.wikipedia.org/wiki/June_8" title="June 8">June 8</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/1995" title="1995">1995</a> to speed up the finding of <a target="_blank" href="http://en.wikipedia.org/wiki/Software_bug" title="Software bug">bugs</a> and improving the code.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7" title="">[8]</a></sup> This release was named PHP version 2, and already had basic functionality that PHP has today. This includes Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.<sup id="cite_ref-history_2-2" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup></p> |
|
8 |
<p>PHP, standing for Personal Home Page, began as a set of <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface" title="Common Gateway Interface">Common Gateway Interface</a> <a href="http://en.wikipedia.org/wiki/Binary_file" title="Binary file">binaries</a> written in the <a href="http://en.wikipedia.org/wiki/C_programming_language" class="mw-redirect" title="C programming language">C programming language</a> in 1994 by the <a href="http://en.wikipedia.org/wiki/Danish_people" title="Danish people">Danish</a>/<a href="http://en.wikipedia.org/wiki/Greenland" title="Greenland">Greenlandic</a> programmer <a href="http://en.wikipedia.org/wiki/Rasmus_Lerdorf" title="Rasmus Lerdorf">Rasmus Lerdorf</a>. Lerdorf initially created these Personal Home Page Tools to replace a small set of <a href="http://en.wikipedia.org/wiki/Perl" title="Perl">Perl</a> scripts he had been using to maintain his <a href="http://en.wikipedia.org/wiki/Personal_homepage" class="mw-redirect" title="Personal homepage">personal homepage</a>. The tools were originally created to perform tasks such as displaying his <a href="http://en.wikipedia.org/wiki/R%C3%A9sum%C3%A9" title="Résumé">résumé</a> and recording how much <a href="http://en.wikipedia.org/wiki/Web_traffic" title="Web traffic">traffic</a> his page was receiving. He combined these binaries with his Form Interpreter to create PHP/FI, which had more functionality. It included a larger <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C implementation</a> which could communicate with <a href="http://en.wikipedia.org/wiki/Database" title="Database">databases</a> and helped build simple, dynamic <a href="http://en.wikipedia.org/wiki/Web_application" title="Web application">web applications</a>. He released PHP publicly on <a href="http://en.wikipedia.org/wiki/June_8" title="June 8">June 8</a>, <a href="http://en.wikipedia.org/wiki/1995" title="1995">1995</a> to speed up the finding of <a href="http://en.wikipedia.org/wiki/Software_bug" title="Software bug">bugs</a> and improving the code. This release was named PHP version 2, and already had basic functionality that PHP has today. This includes Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.</p> |
|
11 | 9 |
|
12 | 10 |
<div class="help-box help-right"> |
13 |
<div class="thumbinner" style="width:182px;"><a target="_blank" href="http://en.wikipedia.org/wiki/Image:Andi_Gutmans_1.jpg" class="image" title="Andi Gutmans, who, along with Zeev Suraski, rewrote the parser that formed PHP 3"><img alt="Andi Gutmans, who, along with Zeev Suraski, rewrote the parser that formed PHP 3" src="path:180px-Andi_Gutmans_1.jpg" width="180" height="244" border="0" class="thumbimage" /></a>
|
|
11 |
<div class="thumbinner" style="width:182px;"><a href="http://en.wikipedia.org/wiki/Image:Andi_Gutmans_1.jpg" class="image" title="Andi Gutmans, who, along with Zeev Suraski, rewrote the parser that formed PHP 3"><img alt="Andi Gutmans, who, along with Zeev Suraski, rewrote the parser that formed PHP 3" src="path:180px-Andi_Gutmans_1.jpg" width="180" height="244" border="0" class="thumbimage" /></a> |
|
14 | 12 |
<div class="thumbcaption"> |
15 |
<div class="magnify"><a target="_blank" href="http://en.wikipedia.org/wiki/Image:Andi_Gutmans_1.jpg" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
|
16 |
<a target="_blank" href="http://en.wikipedia.org/wiki/Andi_Gutmans" title="Andi Gutmans">Andi Gutmans</a>, who, along with <a target="_blank" href="http://en.wikipedia.org/wiki/Zeev_Suraski" title="Zeev Suraski">Zeev Suraski</a>, rewrote the <a target="_blank" href="http://en.wikipedia.org/wiki/Parser" class="mw-redirect" title="Parser">parser</a> that formed PHP 3</div> |
|
13 |
<a href="http://en.wikipedia.org/wiki/Andi_Gutmans" title="Andi Gutmans">Andi Gutmans</a>, who, along with <a href="http://en.wikipedia.org/wiki/Zeev_Suraski" title="Zeev Suraski">Zeev Suraski</a>, rewrote the <a href="http://en.wikipedia.org/wiki/Parsing#Parser" title="Parser">parser</a> that formed PHP 3</div> |
|
17 | 14 |
</div> |
18 | 15 |
</div> |
19 |
<p><a target="_blank" href="http://en.wikipedia.org/wiki/Zeev_Suraski" title="Zeev Suraski">Zeev Suraski</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Andi_Gutmans" title="Andi Gutmans">Andi Gutmans</a>, two <a target="_blank" href="http://en.wikipedia.org/wiki/Israelis" title="Israelis">Israeli</a> developers at the <a target="_blank" href="http://en.wikipedia.org/wiki/Technion_IIT" class="mw-redirect" title="Technion IIT">Technion IIT</a>, rewrote the <a target="_blank" href="http://en.wikipedia.org/wiki/Parser" class="mw-redirect" title="Parser">parser</a> in 1997 and formed the base of PHP 3, changing the language's name to the <a target="_blank" href="http://en.wikipedia.org/wiki/Recursive_initialism" class="mw-redirect" title="Recursive initialism">recursive initialism</a> <i>PHP: Hypertext Preprocessor</i>.<sup id="cite_ref-history_2-3" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> The development team officially released PHP/FI 2 in November 1997 after months of <a target="_blank" href="http://en.wikipedia.org/wiki/Development_stage#beta" class="mw-redirect" title="Development stage">beta</a> testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. Suraski and Gutmans then started a new <a target="_blank" href="http://en.wikipedia.org/wiki/Rewrite_%28programming%29" title="Rewrite (programming)">rewrite</a> of PHP's core, producing the <a target="_blank" href="http://en.wikipedia.org/wiki/Zend_Engine" title="Zend Engine">Zend Engine</a> in 1999.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8" title="">[9]</a></sup> They also founded <a target="_blank" href="http://en.wikipedia.org/wiki/Zend_Technologies" title="Zend Technologies">Zend Technologies</a> in <a target="_blank" href="http://en.wikipedia.org/wiki/Ramat_Gan" title="Ramat Gan">Ramat Gan</a>, Israel, which manages the development of PHP.<sup id="cite_ref-history_2-4" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup></p> |
|
16 |
<p><a href="http://en.wikipedia.org/wiki/Zeev_Suraski" title="Zeev Suraski">Zeev Suraski</a> and <a href="http://en.wikipedia.org/wiki/Andi_Gutmans" title="Andi Gutmans">Andi Gutmans</a>, two <a href="http://en.wikipedia.org/wiki/Israelis" title="Israelis">Israeli</a> developers at the <a href="http://en.wikipedia.org/wiki/Technion_IIT" class="mw-redirect" title="Technion IIT">Technion IIT</a>, rewrote the <a href="http://en.wikipedia.org/wiki/Parsing#Parser title="Parser">parser</a> in 1997 and formed the base of PHP 3, changing the language's name to the <a href="http://en.wikipedia.org/wiki/Recursive_initialism" class="mw-redirect" title="Recursive initialism">recursive initialism</a> <i>PHP: Hypertext Preprocessor</i>. The development team officially released PHP/FI 2 in November 1997 after months of <a href="http://en.wikipedia.org/wiki/Development_stage#beta" class="mw-redirect" title="Development stage">beta</a> testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. Suraski and Gutmans then started a new <a href="http://en.wikipedia.org/wiki/Rewrite_%28programming%29" title="Rewrite (programming)">rewrite</a> of PHP's core, producing the <a href="http://en.wikipedia.org/wiki/Zend_Engine" title="Zend Engine">Zend Engine</a> in 1999. They also founded <a href="http://en.wikipedia.org/wiki/Zend_Technologies" title="Zend Technologies">Zend Technologies</a> in <a href="http://en.wikipedia.org/wiki/Ramat_Gan" title="Ramat Gan">Ramat Gan</a>, Israel, which manages the development of PHP.</p> |
|
17 |
|
|
18 |
<p>On <a href="http://en.wikipedia.org/wiki/May_22" title="May 22">May 22</a>, <a href="http://en.wikipedia.org/wiki/2000" title="2000">2000</a>, PHP 4, powered by the Zend Engine 1.0, was released. On <a href="http://en.wikipedia.org/wiki/July_13" title="July 13">July 13</a>, <a href="http://en.wikipedia.org/wiki/2004" title="2004">2004</a>, PHP 5 was released and is powered by the new Zend Engine II. PHP 5 included new features such as improved support for <a href="http://en.wikipedia.org/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a>, the PHP Data Objects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of January 2008, this branch is up to version 4.4.8. PHP 4 will be supported by security updates until <a href="http://en.wikipedia.org/wiki/August_8" title="August 8">August 8</a>, <a href="http://en.wikipedia.org/wiki/2008" title="2008">2008</a>.</p> |
|
19 |
|
|
20 |
<p>PHP 5 is the only stable version still being developed. <a href="http://en.wikipedia.org/wiki/Late_static_binding" class="mw-redirect" title="Late static binding">Late static binding</a> has been missing from PHP and will be added in version 5.3. Development on PHP 4 ceased at the end of 2007, except for the critical security updates for PHP 4 already mentioned. PHP 6 is now under development and major changes include the removal of <code>register_globals</code>, <a href="http://en.wikipedia.org/wiki/Magic_quotes" title="Magic quotes">magic quotes</a>, and <a href="http://en.wikipedia.org/wiki/Safe_mode#Application_software_safe_mode" title="Safe mode">safe mode</a>. PHP does not have complete native support for <a href="http://en.wikipedia.org/Unicode" title="Unicode">Unicode</a> or multibyte strings; unicode support will be added in PHP 6. Many high profile open source projects ceased to support PHP 4 in new code as of <a href="http://en.wikipedia.org/wiki/February_5" title="February 5">February 5</a>, <a href="http://en.wikipedia.org/wiki/2008" title="2008">2008</a>, due to the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.</p> |
|
20 | 21 |
|
21 |
<p>On <a target="_blank" href="http://en.wikipedia.org/wiki/May_22" title="May 22">May 22</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/2000" title="2000">2000</a>, PHP 4, powered by the Zend Engine 1.0, was released.<sup id="cite_ref-history_2-5" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> On <a target="_blank" href="http://en.wikipedia.org/wiki/July_13" title="July 13">July 13</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/2004" title="2004">2004</a>, PHP 5 was released and is powered by the new Zend Engine II.<sup id="cite_ref-history_2-6" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> PHP 5 included new features such as improved support for <a target="_blank" href="http://en.wikipedia.org/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a>, the PHP Data Objects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9" title="">[10]</a></sup> The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of January 2008, this branch is up to version 4.4.8. PHP 4 will be supported by security updates until <a target="_blank" href="http://en.wikipedia.org/wiki/August_8" title="August 8">August 8</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/2008" title="2008">2008</a>.<sup id="cite_ref-2007_news_10-0" class="reference"><a href="#cite_note-2007_news-10" title="">[11]</a></sup></p>
|
|
22 |
<p class="attribution">This excerpt is adapted from <a href="http://en.wikipedia.org/wiki/PHP#History">Wikipedia: PHP - history</a>. It is used here under a <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons BY-SA 3.0</a> license.</p>
|
|
22 | 23 |
|
23 |
<p>PHP 5 is the only stable version still being developed. <a target="_blank" href="http://en.wikipedia.org/wiki/Late_static_binding" class="mw-redirect" title="Late static binding">Late static binding</a> has been missing from PHP and will be added in version 5.3.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11" title="">[12]</a></sup> <sup id="cite_ref-12" class="reference"><a href="#cite_note-12" title="">[13]</a></sup> Development on PHP 4 ceased at the end of 2007, except for the critical security updates for PHP 4 already mentioned.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13" title="">[14]</a></sup><sup id="cite_ref-2007_news_10-1" class="reference"><a href="#cite_note-2007_news-10" title="">[11]</a></sup> PHP 6 is now under development and major changes include the removal of <code>register_globals</code><sup id="cite_ref-14" class="reference"><a href="#cite_note-14" title="">[15]</a></sup>, <a target="_blank" href="http://en.wikipedia.org/wiki/Magic_quotes" title="Magic quotes">magic quotes</a>, and <a target="_blank" href="http://en.wikipedia.org/wiki/Safe_mode#Application_software_safe_mode" title="Safe mode">safe mode</a>.<sup id="cite_ref-2007_news_10-2" class="reference"><a href="#cite_note-2007_news-10" title="">[11]</a></sup><sup id="cite_ref-15" class="reference"><a href="#cite_note-15" title="">[16]</a></sup> PHP does not have complete native support for <a target="_blank" href="http://en.wikipedia.org/Unicode" title="Unicode">Unicode</a> or multibyte strings;<sup id="cite_ref-16" class="reference"><a href="#cite_note-16" title="">[17]</a></sup> unicode support will be added in PHP 6.<sup id="cite_ref-17" class="reference"><a href="#cite_note-17" title="">[18]</a></sup> Many high profile open source projects ceased to support PHP 4 in new code as of <a target="_blank" href="http://en.wikipedia.org/wiki/February_5" title="February 5">February 5</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/2008" title="2008">2008</a>, due to the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.<sup id="cite_ref-gophp5_18-0" class="reference"><a href="#cite_note-gophp5-18" title="">[19]</a></sup><sup id="cite_ref-19" class="reference"><a href="#cite_note-19" title="">[20]</a></sup></p> |
drupal7/sites/all/modules/advanced_help/help_example/help/security.html | ||
---|---|---|
1 |
<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> |
|
1 |
<p>PHP is a popular target of <a 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 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 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. 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. These result in <a href="http://en.wikipedia.org/wiki/Code_injection" title="Code injection">code injection</a>, <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" title="Cross-site scripting">cross-site scripting</a> and other <a 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> |
|
2 |
|
|
3 |
<p class="attribution">This excerpt is adapted from <a href="http://en.wikipedia.org/wiki/PHP#Security">Wikipedia: PHP - security</a>. It is used here under a <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons BY-SA 3.0</a> license.</p> |
|
4 |
|
drupal7/sites/all/modules/advanced_help/help_example/help/syntax.html | ||
---|---|---|
1 |
<h2> <span class="mw-headline">Syntax</span></h2> |
|
2 |
<div class="help-right"> |
|
3 |
<div class="thumbinner" style="width:182px;"><a target="_blank" href="http://en.wikipedia.org/wiki/Image:PHP_Hello_World_screenshot.png" class="image" title="Syntax-highlighted PHP code"><img alt="Syntax-highlighted PHP code" src="path:180px-PHP_Hello_World_screenshot.png" width="180" height="87" border="0" class="thumbimage" /></a> |
|
4 |
<div class="thumbcaption"> |
|
1 |
<h2>Syntax</h2> |
|
2 |
<p>PHP only parses code within its <a href="http://en.wikipedia.org/wiki/Delimiter" title="Delimiter">delimiters</a>. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are <span s><?php</span> and <span>?></span>, which are open and close delimiters respectively. <span><script language="php"></span> and <span></script></span> delimiters are also available. Short tags (<span><?</span> or <span><?=</span> and <span>?></span>) are also commonly used, but like ASP-style tags (<span><%</span> or <span><%=</span> and <span>%></span>), they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged. The purpose of these delimiters is to separate PHP code from non-PHP code, including HTML. Everything outside the delimiters is ignored by the parser and is passed through as output.</p> |
|
5 | 3 |
|
6 |
<div class="magnify"><a target="_blank" href="http://en.wikipedia.org/wiki/Image:PHP_Hello_World_screenshot.png" class="internal" title="Enlarge"><img src="/skins-1.5/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> |
|
7 |
<a target="_blank" href="http://en.wikipedia.org/wiki/Syntax-highlighted" class="mw-redirect" title="Syntax-highlighted">Syntax-highlighted</a> PHP code</div> |
|
8 |
</div> |
|
9 |
</div> |
|
10 |
<p>PHP only parses code within its <a target="_blank" href="http://en.wikipedia.org/wiki/Delimiter" title="Delimiter">delimiters</a>. Anything outside its delimiters is sent directly to the output and is not parsed by PHP. The most common delimiters are <span s><?php</span> and <span>?></span>, which are open and close delimiters respectively. <span><script language="php"></span> and <span></script></span> delimiters are also available. Short tags (<span><?</span> or <span><?=</span> and <span>?></span>) are also commonly used, but like ASP-style tags (<span><%</span> or <span><%=</span> and <span>%></span>), they are less portable as they can be disabled in the PHP configuration. For this reason, the use of short tags and ASP-style tags is discouraged.<sup id="cite_ref-basic_syntax_28-0" class="reference"><a href="#cite_note-basic_syntax-28" title="">[29]</a></sup> The purpose of these delimiters is to separate PHP code from non-PHP code, including HTML. Everything outside the delimiters is ignored by the parser and is passed through as output.<sup id="cite_ref-29" class="reference"><a href="#cite_note-29" title="">[30]</a></sup></p> |
|
11 |
|
|
12 |
<p>Variables are prefixed with a <a target="_blank" href="http://en.wikipedia.org/wiki/Dollar_sign" title="Dollar sign">dollar symbol</a> and a <a target="_blank" href="http://en.wikipedia.org/wiki/Primitive_type" title="Primitive type">type</a> does not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted (<span>""</span>) and <a target="_blank" href="http://en.wikipedia.org/wiki/Heredoc" class="mw-redirect" title="Heredoc">heredoc</a> strings allow the ability to embed the variable's value into the string.<sup id="cite_ref-30" class="reference"><a href="#cite_note-30" title="">[31]</a></sup> PHP treats <a target="_blank" href="http://en.wikipedia.org/wiki/Newline" title="Newline">newlines</a> as <a target="_blank" href="http://en.wikipedia.org/wiki/Whitespace_%28computer_science%29" title="Whitespace (computer science)">whitespace</a> in the manner of a <a target="_blank" href="http://en.wikipedia.org/wiki/Free-form_language" title="Free-form language">free-form language</a> (except when inside string quotes), and statements are terminated by a semicolon.<sup id="cite_ref-31" class="reference"><a href="#cite_note-31" title="">[32]</a></sup> PHP has three types of <a target="_blank" href="http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28syntax%29#Comments" title="Comparison of programming languages (syntax)">comment syntax</a>: <span>/* */</span> serves as block comments, and <span>//</span> as well as <span>#</span> are used for inline comments.<sup id="cite_ref-32" class="reference"><a href="#cite_note-32" title="">[33]</a></sup> To output text to the browser, either the <tt>print</tt> function or the <tt>echo</tt> function is used. Both functions are nearly identical; the major difference is that <tt>print</tt> is slower than <tt>echo</tt> because the former will return a status indicating if it was successful or not, whereas the latter does not return a status and only returns the text for output.<sup id="cite_ref-33" class="reference"><a href="#cite_note-33" title="">[34]</a></sup></p> |
|
4 |
<p>Variables are prefixed with a <a href="http://en.wikipedia.org/wiki/Dollar_sign" title="Dollar sign">dollar symbol</a> and a <a href="http://en.wikipedia.org/wiki/Primitive_type" title="Primitive type">type</a> does not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted (<span>""</span>) and <a href="http://en.wikipedia.org/wiki/Heredoc" class="mw-redirect" title="Heredoc">heredoc</a> strings allow the ability to embed the variable's value into the string. PHP treats <a href="http://en.wikipedia.org/wiki/Newline" title="Newline">newlines</a> as <a href="http://en.wikipedia.org/wiki/Whitespace_%28computer_science%29" title="Whitespace (computer science)">whitespace</a> in the manner of a <a href="http://en.wikipedia.org/wiki/Free-form_language" title="Free-form language">free-form language</a> (except when inside string quotes), and statements are terminated by a semicolon. PHP has three types of <a href="http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28syntax%29#Comments" title="Comparison of programming languages (syntax)">comment syntax</a>: <span>/* */</span> serves as block comments, and <span>//</span> as well as <span>#</span> are used for inline comments. To output text to the browser, either the <tt>print</tt> function or the <tt>echo</tt> function is used. Both functions are nearly identical; the major difference is that <tt>print</tt> is slower than <tt>echo</tt> because the former will return a status indicating if it was successful or not, whereas the latter does not return a status and only returns the text for output.</p> |
|
13 | 5 |
|
14 | 6 |
<p><a name="Data_types" id="Data_types"></a></p> |
15 | 7 |
<h3><span class="mw-headline">Data types</span></h3> |
16 |
<p>PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit <a target="_blank" href="http://en.wikipedia.org/wiki/Signed_number_representations" title="Signed number representations">signed</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Integer_%28computer_science%29" title="Integer (computer science)">integers</a>. Unsigned integers are converted to signed values in certain situations; this behavior is different from other programming languages.<sup id="cite_ref-34" class="reference"><a href="#cite_note-34" title="">[35]</a></sup> Integer variables can be assigned using decimal (positive and negative), <a target="_blank" href="http://en.wikipedia.org/wiki/Octal" title="Octal">octal</a>, and <a target="_blank" href="http://en.wikipedia.org/wiki/Hexadecimal" title="Hexadecimal">hexadecimal</a> notations. <a target="_blank" href="http://en.wikipedia.org/wiki/Real_numbers" class="mw-redirect" title="Real numbers">Real numbers</a> are also stored in a platform-specific range. They can be specified using <a target="_blank" href="http://en.wikipedia.org/wiki/Floating_point" title="Floating point">floating point</a> notation, or two forms of <a target="_blank" href="http://en.wikipedia.org/wiki/Scientific_notation" title="Scientific notation">scientific notation</a>.<sup id="cite_ref-types_35-0" class="reference"><a href="#cite_note-types-35" title="">[36]</a></sup> PHP has a native <a target="_blank" href="http://en.wikipedia.org/wiki/Boolean_datatype" title="Boolean datatype">Boolean</a> type that is similar to the native Boolean types in <a target="_blank" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29" title="Java (programming language)">Java</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++</a>. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++.<sup id="cite_ref-types_35-1" class="reference"><a href="#cite_note-types-35" title="">[36]</a></sup> The null data type represents a variable that has no value. The only value in the null data type is <i>NULL</i>.<sup id="cite_ref-types_35-2" class="reference"><a href="#cite_note-types-35" title="">[36]</a></sup> Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources.<sup id="cite_ref-types_35-3" class="reference"><a href="#cite_note-types-35" title="">[36]</a></sup> Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in <a target="_blank" href="http://en.wikipedia.org/wiki/Hash_table" title="Hash table">hashes</a> with both keys and values, and the two can be intermingled.<sup id="cite_ref-types_35-4" class="reference"><a href="#cite_note-types-35" title="">[36]</a></sup> PHP also supports <a target="_blank" href="http://en.wikipedia.org/wiki/String_%28computing%29" class="mw-redirect" title="String (computing)">strings</a>, which can be used with single quotes, double quotes, or <a target="_blank" href="http://en.wikipedia.org/wiki/Heredoc" class="mw-redirect" title="Heredoc">heredoc syntax</a>.<sup id="cite_ref-36" class="reference"><a href="#cite_note-36" title="">[37]</a></sup></p>
|
|
8 |
<p>PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit <a href="http://en.wikipedia.org/wiki/Signed_number_representations" title="Signed number representations">signed</a> <a href="http://en.wikipedia.org/wiki/Integer_%28computer_science%29" title="Integer (computer science)">integers</a>. Unsigned integers are converted to signed values in certain situations; this behavior is different from other programming languages. Integer variables can be assigned using decimal (positive and negative), <a href="http://en.wikipedia.org/wiki/Octal" title="Octal">octal</a>, and <a href="http://en.wikipedia.org/wiki/Hexadecimal" title="Hexadecimal">hexadecimal</a> notations. <a href="http://en.wikipedia.org/wiki/Real_numbers" class="mw-redirect" title="Real numbers">Real numbers</a> are also stored in a platform-specific range. They can be specified using <a href="http://en.wikipedia.org/wiki/Floating_point" title="Floating point">floating point</a> notation, or two forms of <a href="http://en.wikipedia.org/wiki/Scientific_notation" title="Scientific notation">scientific notation</a>. PHP has a native <a href="http://en.wikipedia.org/wiki/Boolean_datatype" title="Boolean datatype">Boolean</a> type that is similar to the native Boolean types in <a href="http://en.wikipedia.org/wiki/Java_%28programming_language%29" title="Java (programming language)">Java</a> and <a href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++</a>. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++. The null data type represents a variable that has no value. The only value in the null data type is <i>NULL</i>. Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources. Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in <a href="http://en.wikipedia.org/wiki/Hash_table" title="Hash table">hashes</a> with both keys and values, and the two can be intermingled. PHP also supports <a href="http://en.wikipedia.org/wiki/String_%28computing%29" class="mw-redirect" title="String (computing)">strings</a>, which can be used with single quotes, double quotes, or <a href="http://en.wikipedia.org/wiki/Heredoc" class="mw-redirect" title="Heredoc">heredoc syntax</a>.</p>
|
|
17 | 9 |
|
18 | 10 |
<p><a name="Functions" id="Functions"></a></p> |
19 | 11 |
<h3><span class="mw-headline">Functions</span></h3> |
20 |
<p>PHP has hundreds of base functions and thousands more from extensions. Functions are not <a target="_blank" href="http://en.wikipedia.org/wiki/First-class_function" title="First-class function">first-class functions</a> and can only be referenced by their name. <sup id="cite_ref-functions_37-0" class="reference"><a href="#cite_note-functions-37" title="">[38]</a></sup> User-defined functions can be created at any time without being prototyped.<sup id="cite_ref-functions_37-1" class="reference"><a href="#cite_note-functions-37" title="">[38]</a></sup> Functions can be defined inside code blocks, permitting a <a target="_blank" href="http://en.wikipedia.org/wiki/Dynamic_dispatch" title="Dynamic dispatch">run-time decision</a> as to whether or not a function should be defined. Function calls must use parentheses, with the exception of zero argument class <a target="_blank" href="http://en.wikipedia.org/wiki/Constructor_%28computer_science%29" title="Constructor (computer science)">constructor</a> functions called with the PHP <span>new</span> operator, where parentheses are optional. PHP supports quasi-<a target="_blank" href="http://en.wikipedia.org/wiki/Anonymous_function" title="Anonymous function">anonymous functions</a> through the <span>create_function()</span> function, although they are not true anonymous functions because anonymous functions are nameless, but functions can only be referenced by name, or indirectly through a variable <span>$function_name();</span>, in PHP.<sup id="cite_ref-functions_37-2" class="reference"><a href="#cite_note-functions-37" title="">[38]</a></sup></p>
|
|
12 |
<p>PHP has hundreds of base functions and thousands more from extensions. Functions are not <a href="http://en.wikipedia.org/wiki/First-class_function" title="First-class function">first-class functions</a> and can only be referenced by their name. User-defined functions can be created at any time without being prototyped. Functions can be defined inside code blocks, permitting a <a href="http://en.wikipedia.org/wiki/Dynamic_dispatch" title="Dynamic dispatch">run-time decision</a> as to whether or not a function should be defined. Function calls must use parentheses, with the exception of zero argument class <a href="http://en.wikipedia.org/wiki/Constructor_%28computer_science%29" title="Constructor (computer science)">constructor</a> functions called with the PHP <span>new</span> operator, where parentheses are optional. PHP supports quasi-<a href="http://en.wikipedia.org/wiki/Anonymous_function" title="Anonymous function">anonymous functions</a> through the <span>create_function()</span> function, although they are not true anonymous functions because anonymous functions are nameless, but functions can only be referenced by name, or indirectly through a variable <span>$function_name();</span>, in PHP.</p>
|
|
21 | 13 |
|
22 | 14 |
<p><a name="Objects" id="Objects"></a></p> |
23 | 15 |
<h3><span class="mw-headline">Objects</span></h3> |
24 |
<p>Basic <a target="_blank" href="http://en.wikipedia.org/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a> functionality was added in PHP 3.<sup id="cite_ref-history_2-10" class="reference"><a href="#cite_note-history-2" title="">[3]</a></sup> Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance.<sup id="cite_ref-php_5_objects_38-0" class="reference"><a href="#cite_note-php_5_objects-38" title="">[39]</a></sup> In previous versions of PHP, objects were handled like <a target="_blank" href="http://en.wikipedia.org/wiki/Primitive_type" title="Primitive type">primitive types</a>.<sup id="cite_ref-php_5_objects_38-1" class="reference"><a href="#cite_note-php_5_objects-38" title="">[39]</a></sup> The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by <a target="_blank" href="http://en.wikipedia.org/wiki/Smart_pointer#Handles" title="Smart pointer">handle</a>, and not by value. PHP 5 introduced private and protected <a target="_blank" href="http://en.wikipedia.org/wiki/Member_variable" class="mw-redirect" title="Member variable">member variables</a> and methods, along with <a target="_blank" href="http://en.wikipedia.org/wiki/Abstract_type" title="Abstract type">abstract classes</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Final_type" class="mw-redirect" title="Final type">final classes</a> as well as <a target="_blank" href="http://en.wikipedia.org/wiki/Abstract_method" class="mw-redirect" title="Abstract method">abstract methods</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Final_method" class="mw-redirect" title="Final method">final methods</a>. It also introduced a standard way of declaring <a target="_blank" href="http://en.wikipedia.org/wiki/Constructor_%28computer_science%29" title="Constructor (computer science)">constructors</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Destructor_%28computer_science%29" title="Destructor (computer science)">destructors</a>, similar to that of other object-oriented languages such as <a target="_blank" href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++</a>, and a standard <a target="_blank" href="http://en.wikipedia.org/wiki/Exception_handling" title="Exception handling">exception handling</a> model. Furthermore, PHP 5 added <a target="_blank" href="http://en.wikipedia.org/wiki/Interfaces" class="mw-redirect" title="Interfaces">interfaces</a> and allowed for multiple interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. <a target="_blank" href="http://en.wikipedia.org/wiki/Object" title="Object">Objects</a> implementing <a target="_blank" href="http://en.wikipedia.org/wiki/ArrayAccess" class="mw-redirect" title="ArrayAccess">ArrayAccess</a> can be used with array syntax and <a target="_blank" href="http://en.wikipedia.org/wiki/Object" title="Object">objects</a> implementing <a target="_blank" href="http://en.wikipedia.org/wiki/Iterator" title="Iterator">Iterator</a> or <a target="_blank" href="http://en.wikipedia.org/wiki/IteratorAggregate" class="mw-redirect" title="IteratorAggregate">IteratorAggregate</a> can be used with the <span>foreach</span> language construct. There is no <a target="_blank" href="http://en.wikipedia.org/wiki/Virtual_table" class="mw-redirect" title="Virtual table">virtual table</a> feature in the engine, so <a target="_blank" href="http://en.wikipedia.org/wiki/Static_variable" title="Static variable">static variables</a> are bound with a name instead of a reference at compile time.<sup id="cite_ref-zend_engine_2_39-0" class="reference"><a href="#cite_note-zend_engine_2-39" title="">[40]</a></sup></p>
|
|
16 |
<p>Basic <a href="http://en.wikipedia.org/wiki/Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a> functionality was added in PHP 3. Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance. In previous versions of PHP, objects were handled like <a href="http://en.wikipedia.org/wiki/Primitive_type" title="Primitive type">primitive types</a>. The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by <a href="http://en.wikipedia.org/wiki/Smart_pointer#Handles" title="Smart pointer">handle</a>, and not by value. PHP 5 introduced private and protected <a href="http://en.wikipedia.org/wiki/Member_variable" class="mw-redirect" title="Member variable">member variables</a> and methods, along with <a href="http://en.wikipedia.org/wiki/Abstract_type" title="Abstract type">abstract classes</a> and <a href="http://en.wikipedia.org/wiki/Final_type" class="mw-redirect" title="Final type">final classes</a> as well as <a href="http://en.wikipedia.org/wiki/Abstract_method" class="mw-redirect" title="Abstract method">abstract methods</a> and <a href="http://en.wikipedia.org/wiki/Final_method" class="mw-redirect" title="Final method">final methods</a>. It also introduced a standard way of declaring <a href="http://en.wikipedia.org/wiki/Constructor_%28computer_science%29" title="Constructor (computer science)">constructors</a> and <a href="http://en.wikipedia.org/wiki/Destructor_%28computer_science%29" title="Destructor (computer science)">destructors</a>, similar to that of other object-oriented languages such as <a href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++</a>, and a standard <a href="http://en.wikipedia.org/wiki/Exception_handling" title="Exception handling">exception handling</a> model. Furthermore, PHP 5 added <a href="http://en.wikipedia.org/wiki/Interfaces" class="mw-redirect" title="Interfaces">interfaces</a> and allowed for multiple interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. <a href="http://en.wikipedia.org/wiki/Object" title="Object">Objects</a> implementing <a href="http://en.wikipedia.org/wiki/ArrayAccess" class="mw-redirect" title="ArrayAccess">ArrayAccess</a> can be used with array syntax and <a href="http://en.wikipedia.org/wiki/Object" title="Object">objects</a> implementing <a href="http://en.wikipedia.org/wiki/Iterator" title="Iterator">Iterator</a> or <a href="http://en.wikipedia.org/wiki/IteratorAggregate" class="mw-redirect" title="IteratorAggregate">IteratorAggregate</a> can be used with the <span>foreach</span> language construct. There is no <a href="http://en.wikipedia.org/wiki/Virtual_table" class="mw-redirect" title="Virtual table">virtual table</a> feature in the engine, so <a href="http://en.wikipedia.org/wiki/Static_variable" title="Static variable">static variables</a> are bound with a name instead of a reference at compile time.</p>
|
|
25 | 17 |
|
26 |
<p>If the developer creates a copy of an object using the reserved word <i>clone</i>, the Zend engine will check if a <tt>__clone()</tt> method has been defined or not. If not, it will call a default <tt>__clone()</tt> which will copy the object's properties. If a <tt>__clone()</tt> method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value <a href="http://en.wiktionary.org/wiki/replica" class="extiw" title="wikt:replica">replica</a> of the source object and only override properties that need to be changed.<sup id="cite_ref-40" class="reference"><a href="#cite_note-40" title="">[41]</a></sup></p>
|
|
18 |
<p>If the developer creates a copy of an object using the reserved word <i>clone</i>, the Zend engine will check if a <tt>__clone()</tt> method has been defined or not. If not, it will call a default <tt>__clone()</tt> which will copy the object's properties. If a <tt>__clone()</tt> method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value <a href="http://en.wiktionary.org/wiki/replica" class="extiw" title="wikt:replica">replica</a> of the source object and only override properties that need to be changed.</p> |
|
27 | 19 |
|
28 | 20 |
<p><a name="Resources" id="Resources"></a></p> |
29 | 21 |
<h2> <span class="mw-headline">Resources</span></h2> |
30 |
<p>PHP includes <a target="_blank" href="http://en.wikipedia.org/wiki/List_of_PHP_libraries" title="List of PHP libraries">free and open source libraries</a> with the core build. PHP is a fundamentally <a target="_blank" href="http://en.wikipedia.org/wiki/Internet" title="Internet">Internet</a>-aware system with modules built in for accessing <a target="_blank" href="http://en.wikipedia.org/wiki/File_transfer_protocol" class="mw-redirect" title="File transfer protocol">FTP</a> servers, many database servers, embedded SQL libraries such as embedded <a target="_blank" href="http://en.wikipedia.org/wiki/MySQL" title="MySQL">MySQL</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/SQLite" title="SQLite">SQLite</a>, <a target="_blank" href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol" title="Lightweight Directory Access Protocol">LDAP</a> servers, and others. Many functions familiar to C programmers such as those in the <tt><a target="_blank" href="http://en.wikipedia.org/wiki/Stdio.h" title="Stdio.h">stdio</a></tt> family are available in the standard PHP build.<sup id="cite_ref-41" class="reference"><a href="#cite_note-41" title="">[42]</a></sup> PHP has traditionally used features such as "<a target="_blank" href="http://en.wikipedia.org/wiki/Magic_quotes" title="Magic quotes">magic_quotes_gpc</a>" and "magic_quotes_runtime" which attempt to escape apostrophes (') and quotes (") in strings in the assumption that they will be used in databases, to prevent <a target="_blank" href="http://en.wikipedia.org/wiki/SQL_injection" title="SQL injection">SQL injection</a> attacks. This leads to confusion over which data is escaped and which is not, and to problems when data is not in fact used as input to a database and when the escaping used is not completely correct.<sup id="cite_ref-42" class="reference"><a href="#cite_note-42" title="">[43]</a></sup> To make code portable between servers which do and do not use magic quotes, developers can preface their code with a script to reverse the effect of magic quotes when it is applied.<sup id="cite_ref-43" class="reference"><a href="#cite_note-43" title="">[44]</a></sup></p> |
|
22 |
<p>PHP includes <a href="http://en.wikipedia.org/wiki/List_of_PHP_libraries" title="List of PHP libraries">free and open source libraries</a> with the core build. PHP is a fundamentally <a href="http://en.wikipedia.org/wiki/Internet" title="Internet">Internet</a>-aware system with modules built in for accessing <a href="http://en.wikipedia.org/wiki/File_transfer_protocol" class="mw-redirect" title="File transfer protocol">FTP</a> servers, many database servers, embedded SQL libraries such as embedded <a href="http://en.wikipedia.org/wiki/MySQL" title="MySQL">MySQL</a> and <a href="http://en.wikipedia.org/wiki/SQLite" title="SQLite">SQLite</a>, <a href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol" title="Lightweight Directory Access Protocol">LDAP</a> servers, and others. Many functions familiar to C programmers such as those in the <tt><a href="http://en.wikipedia.org/wiki/Stdio.h" title="Stdio.h">stdio</a></tt> family are available in the standard PHP build. PHP has traditionally used features such as "<a href="http://en.wikipedia.org/wiki/Magic_quotes" title="Magic quotes">magic_quotes_gpc</a>" and "magic_quotes_runtime" which attempt to escape apostrophes (') and quotes (") in strings in the assumption that they will be used in databases, to prevent <a href="http://en.wikipedia.org/wiki/SQL_injection" title="SQL injection">SQL injection</a> attacks. This leads to confusion over which data is escaped and which is not, and to problems when data is not in fact used as input to a database and when the escaping used is not completely correct. To make code portable between servers which do and do not use magic quotes, developers can preface their code with a script to reverse the effect of magic quotes when it is applied.</p> |
|
23 |
|
|
24 |
<p>PHP allows developers to write <a href="http://en.wikipedia.org/wiki/Extension_%28computing%29" class="mw-redirect" title="Extension (computing)">extensions</a> in <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a> to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the <a href="http://en.wikipedia.org/wiki/Windows_API" title="Windows API">Windows API</a>, process management on <a href="http://en.wikipedia.org/wiki/Unix-like" title="Unix-like">Unix-like</a> <a href="http://en.wikipedia.org/wiki/Operating_system" title="Operating system">operating systems</a>, multibyte strings (<a href="http://en.wikipedia.org/wiki/Unispan" title="Unispan">Unispan</a>), <a href="http://en.wikipedia.org/wiki/CURL" title="CURL">cURL</a>, and several popular <a href="http://en.wikipedia.org/wiki/Compression_formats" class="mw-redirect" title="Compression formats">compression formats</a>. Some more unusual features include integration with <a href="http://en.wikipedia.org/wiki/Internet_relay_chat" class="mw-redirect" title="Internet relay chat">Internet relay chat</a>, dynamic generation of images and <a href="http://en.wikipedia.org/wiki/Adobe_Flash" title="Adobe Flash">Adobe Flash</a> content, and even <a href="http://en.wikipedia.org/wiki/Speech_synthesis" title="Speech synthesis">speech synthesis</a>. The <a href="http://en.wikipedia.org/wiki/PHP_Extension_Community_Library" class="mw-redirect" title="PHP Extension Community Library">PHP Extension Community Library</a> (PECL) project is a repository for extensions to the PHP language.</p> |
|
25 |
|
|
26 |
<p>As with many scripting languages, PHP scripts are normally kept as human-readable source code, even on production web servers. While this allows flexibility, releasing scripts in source form is undesirable for commercial software developers, and can raise issues with security of web servers; as an example, if a hacker acquires control of a server, database passwords may be quickly discovered, and undesirable changes to scripts may be made that remain undiscovered indefinitely. Various encoding tools are available for PHP to offer code protection.</p> |
|
27 |
<p>span optimizers improve the quality of the compiled code by reducing its size and making changes that can reduce the execution time and improve performance. The nature of the PHP <a href="http://en.wikipedia.org/wiki/Compiler" title="Compiler">compiler</a> is such that there are often opportunities for <a href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29" title="Optimization (computer science)">span optimization</a>, and an example of a code optimizer is the <a href="http://en.wikipedia.org/wiki/PHP_accelerator#Zend_Optimizer" title="PHP accelerator">Zend Optimizer</a> PHP extension.</p> |
|
28 |
|
|
29 |
<p><a href="http://en.wikipedia.org/wiki/PHP_accelerator" title="PHP accelerator">PHP accelerators</a> can offer significant performance gains by <a href="http://en.wikipedia.org/wiki/Caching" class="mw-redirect" title="Caching">caching</a> the compiled form of a PHP script in <a href="http://en.wikipedia.org/wiki/Shared_memory" title="Shared memory">shared memory</a> to avoid the overhead of <a href="http://en.wikipedia.org/wiki/Parsing" title="Parsing">parsing</a> and <a href="http://en.wikipedia.org/wiki/Compiling" class="mw-redirect" title="Compiling">compiling</a> the code every time the script runs. They may also perform <a href="http://en.wikipedia.org/wiki/span_optimization" class="mw-redirect" title="span optimization">span optimization</a> to provide increased execution performance.</p> |
|
31 | 30 |
|
32 |
<p>PHP allows developers to write <a target="_blank" href="http://en.wikipedia.org/wiki/Extension_%28computing%29" class="mw-redirect" title="Extension (computing)">extensions</a> in <a target="_blank" href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a> to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the <a target="_blank" href="http://en.wikipedia.org/wiki/Windows_API" title="Windows API">Windows API</a>, process management on <a target="_blank" href="http://en.wikipedia.org/wiki/Unix-like" title="Unix-like">Unix-like</a> <a target="_blank" href="http://en.wikipedia.org/wiki/Operating_system" title="Operating system">operating systems</a>, multibyte strings (<a target="_blank" href="http://en.wikipedia.org/wiki/Unispan" title="Unispan">Unispan</a>), <a target="_blank" href="http://en.wikipedia.org/wiki/CURL" title="CURL">cURL</a>, and several popular <a target="_blank" href="http://en.wikipedia.org/wiki/Compression_formats" class="mw-redirect" title="Compression formats">compression formats</a>. Some more unusual features include integration with <a target="_blank" href="http://en.wikipedia.org/wiki/Internet_relay_chat" class="mw-redirect" title="Internet relay chat">Internet relay chat</a>, dynamic generation of images and <a target="_blank" href="http://en.wikipedia.org/wiki/Adobe_Flash" title="Adobe Flash">Adobe Flash</a> content, and even <a target="_blank" href="http://en.wikipedia.org/wiki/Speech_synthesis" title="Speech synthesis">speech synthesis</a>. The <a target="_blank" href="http://en.wikipedia.org/wiki/PHP_Extension_Community_Library" class="mw-redirect" title="PHP Extension Community Library">PHP Extension Community Library</a> (PECL) project is a repository for extensions to the PHP language.<sup id="cite_ref-44" class="reference"><a href="#cite_note-44" title="">[45]</a></sup></p>
|
|
31 |
<p class="attribution">This excerpt is adapted from <a href="http://en.wikipedia.org/wiki/PHP#Syntax">Wikipedia: PHP - syntax</a>. It is used here under a <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons BY-SA 3.0</a> license.</p>
|
|
33 | 32 |
|
34 |
<p>As with many scripting languages, PHP scripts are normally kept as human-readable source code, even on production web servers.<sup id="cite_ref-45" class="reference"><a href="#cite_note-45" title="">[46]</a></sup> While this allows flexibility, releasing scripts in source form is undesirable for commercial software developers, and can raise issues with security of web servers; as an example, if a hacker acquires control of a server, database passwords may be quickly discovered, and undesirable changes to scripts may be made that remain undiscovered indefinitely. Various encoding tools are available for PHP to offer code protection.<sup class="noprint Template-Fact"><span title="This claim needs references to reliable sources since March 2008" style="white-space: nowrap;">[<i><a target="_blank" href="http://en.wikipedia.org/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed">citation needed</a></i>]</span></sup></p> |
|
35 |
<p>span optimizers improve the quality of the compiled code by reducing its size and making changes that can reduce the execution time and improve performance. The nature of the PHP <a target="_blank" href="http://en.wikipedia.org/wiki/Compiler" title="Compiler">compiler</a> is such that there are often opportunities for <a target="_blank" href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29" title="Optimization (computer science)">span optimization</a><sup id="cite_ref-46" class="reference"><a href="#cite_note-46" title="">[47]</a></sup>, and an example of a code optimizer is the <a target="_blank" href="http://en.wikipedia.org/wiki/PHP_accelerator#Zend_Optimizer" title="PHP accelerator">Zend Optimizer</a> PHP extension.<sup id="cite_ref-47" class="reference"><a href="#cite_note-47" title="">[48]</a></sup></p> |
|
36 | 33 |
|
37 |
<p><a target="_blank" href="http://en.wikipedia.org/wiki/PHP_accelerator" title="PHP accelerator">PHP accelerators</a> can offer significant performance gains by <a target="_blank" href="http://en.wikipedia.org/wiki/Caching" class="mw-redirect" title="Caching">caching</a> the compiled form of a PHP script in <a target="_blank" href="http://en.wikipedia.org/wiki/Shared_memory" title="Shared memory">shared memory</a> to avoid the overhead of <a target="_blank" href="http://en.wikipedia.org/wiki/Parsing" title="Parsing">parsing</a> and <a target="_blank" href="http://en.wikipedia.org/wiki/Compiling" class="mw-redirect" title="Compiling">compiling</a> the code every time the script runs. They may also perform <a target="_blank" href="http://en.wikipedia.org/wiki/span_optimization" class="mw-redirect" title="span optimization">span optimization</a> to provide increased execution performance.<sup class="noprint Template-Fact"><span title="This claim needs references to reliable sources since March 2008" style="white-space: nowrap;">[<i><a target="_blank" href="http://en.wikipedia.org/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed">citation needed</a></i>]</span></sup></p> |
|
38 | 34 |
|
drupal7/sites/all/modules/advanced_help/help_example/help/usage.html | ||
---|---|---|
1 |
<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>
|
|
1 |
<p>PHP is a general-purpose scripting language that is especially suited for <a 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 href="http://en.wikipedia.org/wiki/Java_%28programming_language%29" title="Java (programming language)">Java</a>, <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a>, and <a href="http://en.wikipedia.org/wiki/Visual_Basic" title="Visual Basic">Visual Basic</a>. PHP generally runs on a <a href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web server</a>, taking PHP code as its input and creating <a href="http://en.wikipedia.org/wiki/Web_page" title="Web page">web pages</a> as output. It can also be used for <a href="http://en.wikipedia.org/wiki/Command-line" class="mw-redirect" title="Command-line">command-line</a> scripting and <a href="http://en.wikipedia.org/wiki/Client-side" title="Client-side">client-side</a> <a href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface">GUI</a> applications. PHP can be deployed on most <a href="http://en.wikipedia.org/wiki/Web_server" title="Web server">web servers</a>, many <a href="http://en.wikipedia.org/wiki/Operating_system" title="Operating system">operating systems</a> and <a href="http://en.wikipedia.org/wiki/Platform_%28computing%29" class="mw-redirect" title="Platform (computing)">platforms</a>, and can be used with many <a 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.</p>
|
|
2 | 2 |
|
3 |
<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>
|
|
3 |
<p>PHP primarily acts as a <a href="http://en.wikipedia.org/wiki/Filter_%28software%29" title="Filter (software)">filter</a>, 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 href="http://en.wikipedia.org/wiki/Parser" class="mw-redirect" title="Parser">parser</a> <a href="http://en.wikipedia.org/wiki/Compiler" title="Compiler">compiles</a> input to produce <a href="http://en.wikipedia.org/wiki/Bytecode" title="Bytecode">bytecode</a> for processing by the <a href="http://en.wikipedia.org/wiki/Zend_Engine" title="Zend Engine">Zend Engine</a>, giving improved performance over its <a href="http://en.wikipedia.org/wiki/Interpreter_%28computing%29" title="Interpreter (computing)">interpreter</a> predecessor.</p>
|
|
4 | 4 |
|
5 |
<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>
|
|
5 |
<p>Originally designed to create dynamic web pages, PHP's principal focus is <a href="http://en.wikipedia.org/wiki/Server-side_scripting" title="Server-side scripting">server-side scripting</a>, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a <a href="http://en.wikipedia.org/wiki/Client_%28computing%29" title="Client (computing)">client</a>, such as <a href="http://en.wikipedia.org/wiki/Microsoft" title="Microsoft">Microsoft</a>'s <a href="http://en.wikipedia.org/wiki/ASP.NET" title="ASP.NET">ASP.NET</a> system, <a href="http://en.wikipedia.org/wiki/Sun_Microsystems" title="Sun Microsystems">Sun Microsystems</a>' <a href="http://en.wikipedia.org/wiki/JavaServer_Pages" title="JavaServer Pages">JavaServer Pages</a>, and <a href="http://en.wikipedia.org/wiki/Mod_perl" title="Mod perl">mod_perl</a>. PHP has also attracted the development of many <a href="http://en.wikipedia.org/wiki/Software_framework" title="Software framework">frameworks</a> that provide building blocks and a design structure to promote <a href="http://en.wikipedia.org/wiki/Rapid_application_development" title="Rapid application development">rapid application development</a> (RAD). Some of these include <a href="http://en.wikipedia.org/wiki/CakePHP" title="CakePHP">CakePHP</a>, <a href="http://en.wikipedia.org/wiki/PRADO" title="PRADO">PRADO</a>, <a href="http://en.wikipedia.org/wiki/Symfony" title="Symfony">Symfony</a> and <a href="http://en.wikipedia.org/wiki/Zend_Framework" title="Zend Framework">Zend Framework</a>, offering features similar to other <a href="http://en.wikipedia.org/wiki/List_of_web_application_frameworks" title="List of web application frameworks">web application frameworks</a>.</p>
|
|
6 | 6 |
|
7 |
<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>
|
|
7 |
<p>The <a 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 href="http://en.wikipedia.org/wiki/Linux" title="Linux">Linux</a>, <a href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" title="Apache HTTP Server">Apache</a> and <a href="http://en.wikipedia.org/wiki/MySQL" title="MySQL">MySQL</a>, although the <i>P</i> can also refer to <a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29" title="Python (programming language)">Python</a> or <a href="http://en.wikipedia.org/wiki/Perl" title="Perl">Perl</a>.</p>
|
|
8 | 8 |
|
9 |
<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> |
|
9 |
<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.</p> |
|
10 |
|
|
11 |
<p class="attribution">This excerpt is adapted from <a href="http://en.wikipedia.org/wiki/PHP#Use">Wikipedia: PHP - use</a>. It is used here under a <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons BY-SA 3.0</a> license.</p> |
drupal7/sites/all/modules/advanced_help/help_example/help_example.info | ||
---|---|---|
3 | 3 |
core = 7.x |
4 | 4 |
dependencies[] = advanced_help |
5 | 5 |
|
6 |
; Information added by Drupal.org packaging script on 2013-12-12 |
|
7 |
version = "7.x-1.1" |
|
6 |
attributions[wikipedia_adaption][type] = 'asset' |
|
7 |
attributions[wikipedia_adaption][weight] = -10 |
|
8 |
attributions[wikipedia_adaption][exception] = '#2460769' |
|
9 |
attributions[wikipedia_adaption][title] = 'About PHP, History of PHP, Usage of PHP, PHP Syntax, Security of PHP' |
|
10 |
attributions[wikipedia_adaption][license_url] = 'http://creativecommons.org/licenses/by-sa/3.0/' |
|
11 |
attributions[wikipedia_adaption][org_title] = 'PHP (Wikipedia)' |
|
12 |
attributions[wikipedia_adaption][org_author] = 'multiple Wikipedia contributors' |
|
13 |
attributions[wikipedia_adaption][org_author_url] = 'http://en.wikipedia.org/w/index.php?title=PHP&action=history' |
|
14 |
attributions[wikipedia_adaption][org_work_url] = 'http://en.wikipedia.org/wiki/PHP' |
|
15 |
attributions[wikipedia_adaption][org_license] = 'Creative Commons BY-SA 3.0' |
|
16 |
attributions[wikipedia_adaption][org_license_url] = 'http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License' |
|
17 |
|
|
18 |
attributions[lerdorf][type] = 'asset' |
|
19 |
attributions[lerdorf][exception] = '#2460769' |
|
20 |
attributions[lerdorf][author] = 'Jud Dagnall' |
|
21 |
attributions[lerdorf][work_url] = 'http://en.wikipedia.org/wiki/File:Lerdorf.jpg' |
|
22 |
attributions[lerdorf][title] = 'Lerdorf' |
|
23 |
attributions[lerdorf][license] = 'Creative Commons BY-SA 3.0' |
|
24 |
attributions[lerdorf][license_url] = 'http://creativecommons.org/licenses/by-sa/3.0/deed.en' |
|
25 |
|
|
26 |
attributions[gutmans][type] = 'asset' |
|
27 |
attributions[gutmans][exception] = '#2460769' |
|
28 |
attributions[gutmans][author] = 'Jim Winstead' |
|
29 |
attributions[gutmans][author_url] = 'https://www.flickr.com/people/81342178@N00' |
|
30 |
attributions[gutmans][work_url] = 'http://en.wikipedia.org/wiki/File:Andi_Gutmans_1.jpg' |
|
31 |
attributions[gutmans][title] = 'Andi Gutmans' |
|
32 |
attributions[gutmans][license] = 'Creative Commons BY 2.0' |
|
33 |
attributions[gutmans][license_url] = 'http://creativecommons.org/licenses/by/2.0/deed.en' |
|
34 |
|
|
35 |
; Information added by Drupal.org packaging script on 2015-03-27 |
|
36 |
version = "7.x-1.2" |
|
8 | 37 |
core = "7.x" |
9 | 38 |
project = "advanced_help" |
10 |
datestamp = "1386871727"
|
|
39 |
datestamp = "1427460482"
|
|
11 | 40 |
|
drupal7/sites/all/modules/advanced_help/help_example/help_example.module | ||
---|---|---|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
/** |
22 |
* Help topic index.
|
|
22 |
* Topic index callback.
|
|
23 | 23 |
*/ |
24 | 24 |
function help_example_index_page() { |
25 | 25 |
$output = theme('advanced_help_topic', array( |
drupal7/sites/all/modules/captcha/captcha.admin.inc | ||
---|---|---|
64 | 64 |
); |
65 | 65 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'] = array(); |
66 | 66 |
$captcha_type_options = _captcha_available_challenge_types(); |
67 |
$result = db_select('captcha_points', 'cp')->fields('cp')->orderBy('form_id')->execute();
|
|
68 |
foreach ($result as $captcha_point) {
|
|
69 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = array();
|
|
70 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['form_id'] = array(
|
|
67 |
$captcha_points = captcha_get_captcha_points();
|
|
68 |
foreach ($captcha_points as $captcha_point) {
|
|
69 |
$elem = array();
|
|
70 |
$elem['form_id'] = array(
|
|
71 | 71 |
'#markup' => $captcha_point->form_id, |
72 | 72 |
); |
73 | 73 |
// Select widget for CAPTCHA type. |
... | ... | |
80 | 80 |
else { |
81 | 81 |
$captcha_type = 'none'; |
82 | 82 |
} |
83 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['captcha_type'] = array(
|
|
83 |
$elem['captcha_type'] = array(
|
|
84 | 84 |
'#type' => 'select', |
85 | 85 |
'#default_value' => $captcha_type, |
86 | 86 |
'#options' => $captcha_type_options, |
87 | 87 |
); |
88 |
// Additional operations. |
|
89 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array( |
|
90 |
'#markup' => implode(", ", array( |
|
91 |
l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"), |
|
92 |
)), |
|
93 |
); |
|
88 |
$ops = array(); |
|
89 |
if (module_exists('ctools') && $captcha_point->export_type & EXPORT_IN_CODE) { |
|
90 |
if ($captcha_point->export_type & EXPORT_IN_DATABASE) { |
|
91 |
$ops[] = l(t('revert'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"); |
|
92 |
} |
|
93 |
// TODO Disable exported points. |
|
94 |
} |
|
95 |
else { |
|
96 |
$ops[] = l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"); |
|
97 |
} |
|
98 |
$elem['operations'] = array('#markup' => implode(", ", $ops)); |
|
99 |
|
|
100 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = $elem; |
|
94 | 101 |
} |
95 | 102 |
|
96 | 103 |
// Form items for new form_id. |
... | ... | |
281 | 288 |
|
282 | 289 |
// Process CAPTCHA points. |
283 | 290 |
if (isset($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'])) { |
291 |
// Load existing data. |
|
292 |
$captcha_points = captcha_get_captcha_points(); |
|
284 | 293 |
foreach ($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'] as $captcha_point_form_id => $data) { |
294 |
// If this is an in-code captcha point and its settings are unchanged, |
|
295 |
// don't save to the database. |
|
296 |
if (module_exists('ctools') && isset($captcha_points[$captcha_point_form_id])) { |
|
297 |
// Parse module and captcha_type from submitted values. |
|
298 |
if (is_string($data['captcha_type']) && substr_count($data['captcha_type'], '/') == 1) { |
|
299 |
list($module, $captcha_type) = explode('/', $data['captcha_type']); |
|
300 |
} |
|
301 |
else { |
|
302 |
$module = ''; |
|
303 |
$captcha_type = $data['captcha_type']; |
|
304 |
} |
|
305 |
|
|
306 |
$point = $captcha_points[$captcha_point_form_id]; |
|
307 |
if ($point->export_type & EXPORT_IN_CODE && !($point->export_type & EXPORT_IN_DATABASE) && $point->module == $module && $point->captcha_type == $captcha_type) { |
|
308 |
continue; |
|
309 |
} |
|
310 |
} |
|
285 | 311 |
captcha_set_form_id_setting($captcha_point_form_id, $data['captcha_type']); |
286 | 312 |
} |
287 | 313 |
} |
drupal7/sites/all/modules/captcha/captcha.inc | ||
---|---|---|
83 | 83 |
*/ |
84 | 84 |
function captcha_get_form_id_setting($form_id, $symbolic = FALSE) { |
85 | 85 |
// Fetch setting from database. |
86 |
$result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id", array(':form_id' => $form_id)); |
|
87 |
$captcha_point = $result->fetchObject(); |
|
86 |
if (module_exists('ctools')) { |
|
87 |
ctools_include('export'); |
|
88 |
$object = ctools_export_load_object('captcha_points', 'names', array($form_id)); |
|
89 |
$captcha_point = array_pop($object); |
|
90 |
} |
|
91 |
else { |
|
92 |
$result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id", |
|
93 |
array(':form_id' => $form_id)); |
|
94 |
$captcha_point = $result->fetchObject(); |
|
95 |
} |
|
88 | 96 |
|
89 | 97 |
// If no setting is available in database for the given form, |
90 | 98 |
// but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway. |
... | ... | |
115 | 123 |
return $captcha_point; |
116 | 124 |
} |
117 | 125 |
|
126 |
/** |
|
127 |
* Helper function to load all captcha points. |
|
128 |
* |
|
129 |
* @return array of all captcha_points |
|
130 |
*/ |
|
131 |
function captcha_get_captcha_points() { |
|
132 |
if (module_exists('ctools')) { |
|
133 |
ctools_include('export'); |
|
134 |
$captcha_points = ctools_export_load_object('captcha_points', 'all'); |
|
135 |
} |
|
136 |
else { |
|
137 |
$captcha_points = array(); |
|
138 |
$result = db_select('captcha_points', 'cp')->fields('cp')->orderBy('form_id')->execute(); |
|
139 |
foreach ($result as $captcha_point) { |
|
140 |
$captcha_points[] = $captcha_point; |
|
141 |
} |
|
142 |
} |
|
143 |
return $captcha_points; |
|
144 |
} |
|
145 |
|
|
118 | 146 |
/** |
119 | 147 |
* Helper function for generating a new CAPTCHA session. |
120 | 148 |
* |
drupal7/sites/all/modules/captcha/captcha.info | ||
---|---|---|
10 | 10 |
files[] = captcha.install |
11 | 11 |
files[] = captcha.test |
12 | 12 |
|
13 |
; Information added by Drupal.org packaging script on 2014-11-29
|
|
14 |
version = "7.x-1.2"
|
|
13 |
; Information added by Drupal.org packaging script on 2015-03-27
|
|
14 |
version = "7.x-1.3"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "captcha" |
17 |
datestamp = "1417219372"
|
|
17 |
datestamp = "1427464219"
|
|
18 | 18 |
|
drupal7/sites/all/modules/captcha/captcha.install | ||
---|---|---|
12 | 12 |
// Table for positions and types of the challenges. |
13 | 13 |
$schema['captcha_points'] = array( |
14 | 14 |
'description' => 'This table describes which challenges should be added to which forms.', |
15 |
'export' => array( |
|
16 |
'key' => 'form_id', |
|
17 |
'identifier' => 'captcha', |
|
18 |
'default hook' => 'captcha_default_points', // Function hook name. |
|
19 |
'status' => 'mark_status', |
|
20 |
'api' => array( |
|
21 |
'owner' => 'captcha', |
|
22 |
'api' => 'captcha', // Base name for api include files. |
|
23 |
'minimum_version' => 1, |
|
24 |
'current_version' => 1, |
|
25 |
), |
|
26 |
), |
|
15 | 27 |
'fields' => array( |
16 | 28 |
'form_id' => array( |
17 | 29 |
'description' => 'The form_id of the form to add a CAPTCHA to.', |
... | ... | |
134 | 146 |
*/ |
135 | 147 |
function captcha_install() { |
136 | 148 |
$t = get_t(); |
137 |
// Insert some default CAPTCHA points. |
|
138 |
$form_ids = array( |
|
139 |
'contact_site_form', 'contact_personal_form', |
|
140 |
'user_register_form', 'user_pass', 'user_login', 'user_login_block', |
|
141 |
'forum_node_form', |
|
142 |
); |
|
143 |
// Add form_ids of all currently known node types too. |
|
144 |
foreach (node_type_get_names() as $type => $name) { |
|
145 |
$form_ids[] = 'comment_node_' . $type . '_form'; |
|
146 |
} |
|
147 |
foreach ($form_ids as $form_id) { |
|
148 |
db_insert('captcha_points') |
|
149 |
->fields(array( |
|
150 |
'form_id' => $form_id, |
|
151 |
'module' => NULL, |
|
152 |
'captcha_type' => NULL, |
|
153 |
)) |
|
154 |
->execute(); |
|
155 |
} |
|
156 | 149 |
|
157 | 150 |
// Be friendly to your users: what to do after install? |
158 | 151 |
drupal_set_message($t('You can now <a href="!captcha_admin">configure the CAPTCHA module</a> for your site.', |
drupal7/sites/all/modules/captcha/captcha.module | ||
---|---|---|
303 | 303 |
return $element; |
304 | 304 |
} |
305 | 305 |
|
306 |
/** |
|
307 |
* Implementation of hook_captcha_default_points_alter(). |
|
308 |
* |
|
309 |
* Provide some default captchas only if defaults are not already |
|
310 |
* provided by other modules. |
|
311 |
*/ |
|
312 |
function captcha_captcha_default_points_alter(&$items) { |
|
313 |
$modules = array( |
|
314 |
'comment' => array( |
|
315 |
), |
|
316 |
'contact' => array( |
|
317 |
'contact_site_form', |
|
318 |
'contact_personal_form' |
|
319 |
), |
|
320 |
'forum' => array( |
|
321 |
'forum_node_form', |
|
322 |
), |
|
323 |
'user' => array( |
|
324 |
'user_register_form', |
|
325 |
'user_pass', |
|
326 |
'user_login', |
|
327 |
'user_login_block', |
|
328 |
), |
|
329 |
); |
|
330 |
// Add comment form_ids of all currently known node types. |
|
331 |
foreach (node_type_get_names() as $type => $name) { |
|
332 |
$modules['comment'][] = 'comment_node_' . $type . '_form'; |
|
333 |
} |
|
334 |
|
|
335 |
foreach ($modules as $module => $form_ids) { |
|
336 |
// Only give defaults if the module exists. |
|
337 |
if (module_exists($module)) { |
|
338 |
foreach ($form_ids as $form_id) { |
|
339 |
// Ensure a default has not been provided already. |
|
340 |
if (!isset($items[$form_id])) { |
|
341 |
$captcha = new stdClass; |
|
342 |
$captcha->disabled = FALSE; |
|
343 |
$captcha->api_version = 1; |
|
344 |
$captcha->form_id = $form_id; |
|
345 |
$captcha->module = ''; |
|
346 |
$captcha->captcha_type = 'default'; |
|
347 |
$items[$form_id] = $captcha; |
|
348 |
} |
|
349 |
} |
|
350 |
} |
|
351 |
} |
|
352 |
} |
|
353 |
|
|
306 | 354 |
/** |
307 | 355 |
* Theme function for a CAPTCHA element. |
308 | 356 |
* |
... | ... | |
438 | 486 |
$form['caching']['captcha'] = array( |
439 | 487 |
'#type' => 'item', |
440 | 488 |
'#title' => t('CAPTCHA'), |
441 |
'#markup' => t('!icon The CAPTCHA module will disable the caching of pages that contain a CAPTCHA element.', array( |
|
442 |
'!icon' => '<span class="icon">' . $icon . '</span>') |
|
489 |
'#markup' => t( |
|
490 |
'!icon The CAPTCHA module will disable the caching of pages that contain a CAPTCHA element.', |
|
491 |
array( |
|
492 |
'!icon' => '<span class="icon">' . $icon . '</span>' |
|
493 |
) |
|
443 | 494 |
), |
444 | 495 |
'#attributes' => array('class' => array('warning')), |
445 | 496 |
); |
... | ... | |
512 | 563 |
} |
513 | 564 |
|
514 | 565 |
/** |
515 |
* Helper function for getting the posted CAPTCHA info (posted form_id and CAPTCHA sessions ID) from a form in case it is posted. |
|
566 |
* Helper function for getting the posted CAPTCHA info (posted form_id and |
|
567 |
* CAPTCHA sessions ID) from a form in case it is posted. |
|
516 | 568 |
* |
517 | 569 |
* This function hides the form processing mess for several use cases an |
518 | 570 |
* browser bug workarounds. |
... | ... | |
556 | 608 |
// we should be extra cautious and filter this data. |
557 | 609 |
$posted_form_id = isset($form_state['input']['form_id']) ? preg_replace("/[^a-z0-9_]/", "", (string) $form_state['input']['form_id']) : NULL; |
558 | 610 |
$posted_captcha_sid = isset($form_state['input']['captcha_sid']) ? (int) $form_state['input']['captcha_sid'] : NULL; |
559 |
$posted_captcha_token = isset($form_state['input']['captcha_token']) ? preg_replace("/[^a-zA-Z0-9]/", "", (string) $form_state['input']['captcha_token']) : NULL;
|
|
611 |
$posted_captcha_token = !empty($form_state['input']['captcha_token']) ? preg_replace("/[^a-zA-Z0-9]/", "", (string) $form_state['input']['captcha_token']) : NULL;
|
|
560 | 612 |
|
561 | 613 |
if ($posted_form_id == $this_form_id) { |
562 | 614 |
// Check if the posted CAPTCHA token is valid for the posted CAPTCHA |
... | ... | |
571 | 623 |
"SELECT token FROM {captcha_sessions} WHERE csid = :csid", |
572 | 624 |
array(':csid' => $posted_captcha_sid) |
573 | 625 |
)->fetchField(); |
626 |
|
|
574 | 627 |
if ($expected_captcha_token !== $posted_captcha_token) { |
575 | 628 |
drupal_set_message(t('CAPTCHA session reuse attack detected.'), 'error'); |
576 | 629 |
// Invalidate the CAPTCHA session. |
577 | 630 |
$posted_captcha_sid = NULL; |
578 | 631 |
} |
632 |
|
|
579 | 633 |
// Invalidate CAPTCHA token to avoid reuse. |
580 | 634 |
db_update('captcha_sessions') |
581 | 635 |
->fields(array('token' => NULL)) |
582 |
->condition('csid', $posted_captcha_sid); |
|
636 |
->condition('csid', $posted_captcha_sid) |
|
637 |
->execute(); |
|
583 | 638 |
} |
584 | 639 |
} |
585 | 640 |
else { |
... | ... | |
600 | 655 |
* files). |
601 | 656 |
*/ |
602 | 657 |
function captcha_validate($element, &$form_state) { |
658 |
// If disable captcha mode is enabled, bypass captcha validation. |
|
659 |
if (variable_get('disable_captcha', FALSE)) { |
|
660 |
return; |
|
661 |
} |
|
603 | 662 |
|
604 | 663 |
$captcha_info = $form_state['captcha_info']; |
605 | 664 |
$form_id = $captcha_info['this_form_id']; |
drupal7/sites/all/modules/captcha/captcha_api.txt | ||
---|---|---|
215 | 215 |
- in the 'my_fancy_form' form inside the container $form['items']['buttons'], |
216 | 216 |
just before the element $form['items']['buttons']['sacebutton']. |
217 | 217 |
- in the 'another_form' form at the toplevel of the form, with a weight 34. |
218 |
|
drupal7/sites/all/modules/captcha/image_captcha/fonts/README.txt | ||
---|---|---|
1 |
|
|
2 | 1 |
It possible to put your own fonts for the Image CAPTCHA in this folder. |
3 | 2 |
However, this is not the recommended way, as they can get lost easily during |
4 | 3 |
a module update. The recommended way to provide your own fonts is putting them |
5 | 4 |
in the files directory of your Drupal setup or, just like with contributed |
6 | 5 |
modules and themes, in the "libraries" folders sites/all/libraries/fonts |
7 |
or sites/<site>/libraries/fonts. |
|
6 |
or sites/<site>/libraries/fonts. |
drupal7/sites/all/modules/captcha/image_captcha/image_captcha.css | ||
---|---|---|
27 | 27 |
.image_captcha_admin_fonts_selection img { |
28 | 28 |
vertical-align: middle; |
29 | 29 |
} |
30 |
|
drupal7/sites/all/modules/captcha/image_captcha/image_captcha.info | ||
---|---|---|
1 | 1 |
name = "Image CAPTCHA" |
2 |
description = "Provides an image based CAPTCHA." |
|
2 |
description = "Provides an image based CAPTCHA challenge."
|
|
3 | 3 |
package = "Spam control" |
4 | 4 |
dependencies[] = captcha |
5 | 5 |
core = 7.x |
... | ... | |
10 | 10 |
files[] = image_captcha.admin.inc |
11 | 11 |
files[] = image_captcha.user.inc |
12 | 12 |
|
13 |
; Information added by Drupal.org packaging script on 2014-11-29
|
|
14 |
version = "7.x-1.2"
|
|
13 |
; Information added by Drupal.org packaging script on 2015-03-27
|
|
14 |
version = "7.x-1.3"
|
|
15 | 15 |
core = "7.x" |
16 | 16 |
project = "captcha" |
17 |
datestamp = "1417219372"
|
|
17 |
datestamp = "1427464219"
|
|
18 | 18 |
|
drupal7/sites/all/modules/captcha/image_captcha/image_captcha.module | ||
---|---|---|
246 | 246 |
); |
247 | 247 |
$img_src = check_url(url("image_captcha", $options)); |
248 | 248 |
list($width, $height) = _image_captcha_image_size($code); |
Formats disponibles : Unified diff
Weekly update of contrib modules