/** * Ensure the shared library files are up to date * * @param string $plugin */ function dolibs($plugin) { setcd("wp-content", "plugins/{$plugin}"); if (is_dir("libs")) { setcd("wp-content", "plugins/{$plugin}/libs"); docontinue("in libs dir plugins/{$plugin}/libs"); oik_require("libs/oik-libs.php", "oik-libs"); oik_libs_compare($plugin); } cd2plugins(); }
/** * Create the readme.md file from the readme.txt file * * Use t2m ( php txt2md.php ) to convert the readme.txt file into a README.md file * The README.md file is used in GitHub * * @param string $plugin */ function doreadmemd($theme) { $cwd = getcwd(); echo __FUNCTION__ . $cwd; echo PHP_EOL; setcd("wp-content", "themes/{$theme}"); docontinue("in theme dir"); $return_var = null; $cmd = "t2m > README.md"; echo $cmd; $lastline = exec($cmd, $output, $return_var); echo $return_var; //setcd( "wp-content", "plugins" ); cd2themes(); }
/** * Extract shortcodes from a text string * * First we break the string down into chunks of HTML * then we process the shortcodes within the HTML * or the shortcodes in plain text * Ignoring sections where we don't expect to see shortcodes * * * @param string $text a text field * @return array of shortcodes, may be an empty array */ function schunt_codes_from_text($text) { $codes = array(); if ($this->schunt($text)) { $text_array = wp_html_split($text); //print_r( $text_array ); foreach ($text_array as $text) { if ($this->skip($text)) { continue; } if ($this->schunt($text)) { $bits = explode("[", $text); //print_r( $bits ); array_shift($bits); foreach ($bits as $bit) { if ($this->skip($bit)) { continue; } if (strlen($bit) > 0) { $bit = strtr($bit, "/]", " "); $bit = rtrim($bit); $sc = explode(" ", $bit); $code = $sc[0]; //echo "Code: $code" . PHP_EOL; $invalid = preg_match('@[<>&/\\[\\]\\x00-\\x20=]@', $code); if ($invalid) { echo "Invalid shortcode detected? {$code}" . PHP_EOL; echo $bit . PHP_EOL; echo PHP_EOL; echo $text . PHP_EOL; //gobang(); docontinue(); //oikb_get_response(); } else { //echo "Code: $code looks like a good un" . PHP_EOL; $codes[$code] = $code; $this->found_codes[$code] = $code; $this->check_code_skip($code); } } } } } } //print_r( $codes ); //gobang(); return $codes; }