1<?php 2 3use phpweb\I18n\Languages; 4 5$_SERVER['BASE_PAGE'] = 'download-docs.php'; 6include_once __DIR__ . '/include/prepend.inc'; 7 8if (!empty($_GET['active_langs'])) { 9 echo serialize(Languages::ACTIVE_ONLINE_LANGUAGES); 10 exit; 11} 12 13$SIDEBAR_DATA = ' 14<div class="panel"> 15 <div class="headline">Online documentation</div> 16 <div class="body"> 17 <p> 18 You can read the 19 <a href="/docs.php">documentation online</a> 20 in various languages. The Documentation HOWTO, 21 and archive manuals are also available 22 from our <a href="/docs.php">documentation page</a>. 23 </p> 24 </div> 25</div> 26 27<div class="panel"> 28 <div class="headline">Other formats</div> 29 <div class="body"> 30 <p> 31 The manual is also available via *nix style man pages. To 32 install and use: 33 </p> 34 <ul class="toc"> 35 <li>Install: <code>pear install doc.php.net/pman</code></li> 36 <li>Upgrade: <code>pear upgrade doc.php.net/pman</code></li> 37 <li>Example usage: <code>pman strlen</code></li> 38 </ul> 39 </div> 40</div> 41'; 42 43site_header("Download documentation", ["current" => "docs"]); 44 45// Format to look for 46$formats = [ 47 "Single HTML file" => "html.gz", 48 "Many HTML files" => "tar.gz", 49 "HTML Help file" => "chm", 50 "HTML Help file (with user notes)" => "chm", 51]; 52?> 53 54<h1>Download documentation</h1> 55 56<p> 57 The PHP manual is available in a selection of languages and 58 formats. Pick a language and format from the table below to start 59 downloading. 60</p> 61 62<h2>Notes to read before you download</h2> 63 64<ul> 65 <li> 66 The English version should be considered the most accurate, since 67 translations are based on that version. Most of the translations 68 are not complete, and contain English parts. 69 </li> 70 <li> 71 If you are looking for PHP 5 documentation, please read 72 <a href="/manual/php5.php">this explanation</a>. 73 </li> 74 <li> 75 If you are looking for PHP 4 documentation, please read 76 <a href="/manual/php4.php">this explanation</a>. 77 </li> 78</ul> 79 80<p class="warn"> 81 If you are using Windows XP SP2 or later and you are going to download the 82 documentation in CHM format, you <strong>need</strong> to "unblock" 83 the file after downloading it by right-clicking on it in Windows Explorer and 84 selecting the "Properties" menu item, then clicking on the 85 "Unblock" button (on Windows Vista this is within the 86 "Security" options). Failure to unblock the documentation file may 87 result in error messages including "Navigation to the webpage was 88 canceled" due to Windows security restrictions. 89</p> 90 91<?php 92$files = []; $found_formats = []; 93$filepath = $filename = ''; 94 95// Go through all possible manual languages 96foreach (Languages::LANGUAGES as $langcode => $language) { 97 if (isset(Languages::INACTIVE_ONLINE_LANGUAGES[$langcode]) && $MYSITE !== 'http://docs.php.net/') { 98 continue; 99 } 100 101 // Go through all possible manual formats 102 foreach ($formats as $formatname => $extension) { 103 104 $filepath = $_SERVER['DOCUMENT_ROOT'] . '/distributions/manual/'; 105 if ($formatname === 'HTML Help file (with user notes)') { 106 $filename = "php_enhanced_$langcode.$extension"; 107 } else { 108 $filename = "php_manual_$langcode.$extension"; 109 } 110 111 $filepath .= $filename; 112 113 // File named after the language and format exists 114 if (file_exists($filepath)) { 115 116 // Mirror selection download URL 117 $link_to = "/distributions/manual/$filename"; 118 119 // Try to get size and changed date 120 $size = @filesize($filepath); 121 $changed = @filemtime($filepath); 122 123 // Size available, collect information 124 if ($size !== false) { 125 $files[$langcode][$formatname] = [ 126 $link_to, 127 (int) ($size / 1024), 128 date("j M Y", $changed), 129 $extension, 130 ]; 131 $found_formats[$formatname] = 1; 132 } 133 } 134 } 135} 136/* {{{ FIXME: Special handling for the extended html help format since it doesn't follow the "naming rules" 137 * (mostly copy&paste from the loop above) 138 * Feb 20, 2009: Commenting this out as we currently don't build or work on it 139 140$formats['<a href="/docs-echm.php">Extended HTML Help</a>'] = "zip"; // Add a link to the xchm docs in the table header 141$actual_file = $_SERVER['DOCUMENT_ROOT'] . "/distributions/manual/php_manual_chm.zip"; 142if (file_exists($actual_file)) { 143 $link_to = "/get/php_manual_chm.zip/from/a/mirror"; 144 $size = @filesize($actual_file); 145 $changed = @filemtime($actual_file); 146 if ($size !== FALSE) { 147 $files["en"]["zip"] = array( 148 $link_to, 149 (int) ($size/1024), 150 date("j M Y", $changed), 151 "zip" 152 ); 153 $found_formats["xchm"] = "zip"; 154 } 155} 156}}} */ 157 158if (count($found_formats) == 0) { 159 echo "<p class=\"tip\">This site has no documentation files for download.</p>"; 160} else { 161 162 echo '<table border="0" cellpadding="4" cellspacing="2" class="standard">' . "\n" . 163 "<tr>\n <th> </th>\n"; 164 165 // Print out the name of the formats 166 foreach ($formats as $formatname => $extension) { 167 if (!isset($found_formats[$formatname])) { continue; } 168 echo " <th valign=\"bottom\">$formatname</th>\n"; 169 } 170 171 echo " </tr>\n"; 172 173 foreach ($files as $langcode => $lang_files) { 174 175 // See if current language is the preferred one 176 if ($langcode == $LANG) { $preflang = true; } 177 else { $preflang = false; } 178 179 // Highlight manual in preferred language 180 if ($preflang) { 181 $cellclass = ' class="highlight"'; 182 } else { 183 $cellclass = ""; 184 } 185 186 echo "<tr>\n<th class=\"subl\">" . Languages::LANGUAGES[$langcode] . "</th>\n"; 187 188 foreach ($formats as $formatname => $extension) { 189 190 // Skip if no file found 191 if (!isset($found_formats[$formatname])) { continue; } 192 193 echo "<td align=\"center\"$cellclass>"; 194 if (!isset($lang_files[$formatname])) { 195 echo " "; 196 } else { 197 198 $fileinfo = $lang_files[$formatname]; 199 echo "<a href=\"$fileinfo[0]\""; 200 201 // Only print out tooltip, if explicit information is not printed 202 if (!isset($_GET['sizes']) && !$preflang) { 203 echo " title=\" Size: $fileinfo[1]Kb -- Date: $fileinfo[2]\""; 204 } 205 206 // End link tag 207 echo ">$fileinfo[3]</a>"; 208 209 // Sizes required to be printed out (URL parameter or preferred language) 210 if (isset($_GET['sizes']) || $preflang) { 211 echo "<br><small>Size: $fileinfo[1]Kb<br>Date: $fileinfo[2]</small>"; 212 } 213 } 214 215 // End table cell 216 echo "</td>\n"; 217 218 } 219 220 // End table row 221 echo "</tr>\n"; 222 } 223 echo "</table>\n"; 224} 225?> 226 227<?php site_footer(['sidebar' => $SIDEBAR_DATA]); 228