/** * Parse the ReadMe URL * * @since 2.4 * @link https://github.com/markjaquith/WordPress-Plugin-Readme-Parser/tree/WordPress.org WordPress_Readme_Parser package * @uses WordPress_Readme_Parser::parse_readme() * @param string $url URL of the readme.txt file * @return array Processed readme.txt */ function _edd_sl_readme_parse($url = '') { if (!class_exists('Automattic_Readme')) { include_once EDD_SL_PLUGIN_DIR . 'includes/parse-readme.php'; } $request = wp_remote_get($url, array('timeout' => 15, 'sslverify' => false, 'sslcertificates' => NULL)); if (!empty($request) && !is_wp_error($request)) { $body = $request['body']; $Parser = new Automattic_Readme(); return $Parser->parse_readme_contents($request['body']); } return false; }
public function update_changelog($new_dir) { if (file_exists(trailingslashit($new_dir) . 'readme.txt')) { if (!class_exists('Automattic_Readme')) { include_once EDD_GIT_PLUGIN_DIR . 'includes/parse-readme.php'; } $Parser = new Automattic_Readme(); $content = $Parser->parse_readme(trailingslashit($new_dir) . 'readme.txt'); if (isset($content['sections']['changelog'])) { $changelog = wp_kses_post($content['sections']['changelog']); update_post_meta($this->instance->download_id, '_edd_sl_changelog', $changelog); $this->instance->changelog = $changelog; } } }
<?php /** Template version: 1.0.0 */ ?> <?php include CUAR_PLUGIN_DIR . '/libs/automattic/parse-readme.php'; $parser = new Automattic_Readme(); $readme = $parser->parse_readme(CUAR_PLUGIN_DIR . '/readme.txt'); echo $readme['sections']['changelog'];
} function balanceTags($url) { return $url; } function wp_kses($url) { return $url; } if (!isset($_GET['file'])) { $_GET['file'] = 'index'; } $file = htmlspecialchars($_GET['file']) . '.text'; if (validate_file($file) > 0) { die('Invalid file specified'); } if (!file_exists($file)) { die('4oh4 — File not found'); } require_once 'markdown.php'; require_once 'parse-readme.php'; $readme = new Automattic_Readme(); $contents = (object) $readme->parse_readme_contents(file_get_contents('http://svn.wp-plugins.org/really-simple-comment-validation/trunk/readme.txt')); echo '<h1>' . $contents->name . '</h1>'; echo '<div id="content">' . $contents->sections['description'] . '</div>'; //var_dump(); /* require_once('header.php'); echo Markdown(file_get_contents($file)); require_once('footer.php'); */
$url = wp_kses_no_null(stripslashes($_POST['readme_url'])); $url = clean_url($url); if (strtolower(substr($url, -10, 10)) != 'readme.txt') { readme_validator_head('Validator Error!'); die('URL must end in <code>readme.txt</code>!'); } if (!($readme_contents = file_get_contents($url))) { readme_validator_head('Validator Error!'); die('Invalid readme.txt URL'); } $r = new Automattic_Readme(); $readme = $r->parse_readme_contents($readme_contents); validate_readme($readme); } elseif ($_POST['text']) { $readme_contents = stripslashes($_POST['readme_contents']); $r = new Automattic_Readme(); $readme = $r->parse_readme_contents($readme_contents); validate_readme($readme); } else { readme_validator_head('WordPress/BBPress Plugin readme.txt Validator'); ?> <p>Enter the URL to your <code>readme.txt</code>:</p> <form method="post" action=""> <input type="hidden" name="url" value="1" /> <p>http://<input type="text" name="readme_url" size="70" /> <input type="submit" value="Validate!" /></p> </form> <p>... or paste your <code>readme.txt</code> here:</p> <?php } ?>