Created
November 16, 2012 09:35
-
-
Save markmarijnissen/4085923 to your computer and use it in GitHub Desktop.
Wordpress: Which mo-files are loaded?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Plugin Name: Mo-Files | |
Description: Which Mo-Files are loaded? | |
*/ | |
function translation_scan($mo_file,$domain) { | |
global $TRANSLATION_FILES; | |
$TRANSLATION_FILES .= "<tr><td>$domain</td><td>$mo_file</td></tr>"; | |
return $mo_file; | |
} | |
add_filter( 'load_textdomain_mofile', 'translation_scan' , 11, 2 ); | |
function after_textdomain() { | |
global $TRANSLATION_FILES; | |
$TRANSLATION_FILES = "<h1>Which mo-files are loaded?</h1><table><tr><th>Domain</th><th>Mo-file</th></tr>$TRANSLATION_FILES</table>"; | |
if(is_home() || is_front_page()) | |
$TRANSLATION_FILES .= '<br/><br/>Scanned on ' . strftime('%Y-%m-%d / %H:%M:%S') . " at '" . get_the_title() . "'"; | |
file_put_contents(dirname(__FILE__)."/translation.html",$TRANSLATION_FILES); | |
} | |
add_action('wp_head','after_textdomain'); | |
function translation_scan_admin_menu() { | |
add_options_page('Mo-Files','Mo-Files','manage_options','translation-files','translation_files'); | |
} | |
add_action("admin_menu","translation_scan_admin_menu"); | |
function translation_files() { | |
echo file_get_contents(dirname(__FILE__)."/translation.html"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment