PluginProbe
CryptX / 3.3.2
CryptX v3.3.2
4.2.1 4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 All 93 releases
cryptx / include / admin_changelog.php

admin_changelog.php in CryptX 3.3.2, at include/admin_changelog.php

50 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CryptX option page "Changelog"-Tab
4 */
5 function rw_cryptx_settings_tab_content_changelog() {
6 global $cryptX_var, $rw_cryptx_active_tab;
7 if ( 'changelog' != $rw_cryptx_active_tab )
8 return;
9
10 /**
11 * the following code is quick and dirty to parse the changelog content of the readme.txt file
12 */
13 $file_contents = @implode('', @file(CRYPTX_DIR_PATH . '/readme.txt'));
14 $file_contents = str_replace(array("\r\n", "\r"), "\n", $file_contents);
15 $file_contents = trim($file_contents);
16 // split $file_content into sections
17 $_sections = preg_split('/^[\s]*==[\s]*(.+?)[\s]*==/m', $file_contents, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
18 $sections = array();
19 for ( $i=1; $i <= count($_sections); $i +=2 ) {
20 $_sections[$i] = $_sections[$i];
21 $title = $_sections[$i-1];
22 $sections[str_replace(' ', '_', strtolower($title))] = array('title' => $title, 'content' => $_sections[$i]);
23 }
24 // split changelog section into single version entries
25 $_changelogs = preg_split('/^[\s]*=[\s]*(.+?)[\s]*=/m', $sections['changelog']['content'], -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
26 $entries = array();
27 for ( $i=1; $i <= count($_changelogs); $i +=2 ) {
28 $_changelogs[$i] = $_changelogs[$i];
29 $version = $_changelogs[$i-1];
30 $entries[str_replace(' ', '_', strtolower($version))] = array('version' => $version, 'content' => $_changelogs[$i]);
31 }
32 // rearrange version entries as html
33 $changelogs = array();
34 foreach($entries as $entry) {
35 $content = $entry['content'];
36 $content = ltrim( $content, "\n");
37 $content = str_replace("* ", "<li>", $content);
38 $content = str_replace("\n", " </li>\n", $content);
39 $changelogs[]= array('version' => "<dt>".$entry['version']."</dt>", 'content' => "<dd><ul>".$content."</ul></dd>");
40 }
41 unset( $file_contents, $_sections, $sections, $_changelogs, $entries);
42 ?>
43 <h4><?php _e( "Changelog",'cryptx' ); ?></h4>
44 <?php
45 foreach($changelogs as $log) {
46 echo "<dl>".implode("",$log)."</dl>";
47 }
48 unset( $changelogs );
49 }
50 add_action( 'rw_cryptx_settings_content', 'rw_cryptx_settings_tab_content_changelog' );