loco-translate
Last commit date
languages
12 years ago
lib
12 years ago
php
12 years ago
pub
12 years ago
tpl
12 years ago
loco.php
12 years ago
readme.txt
12 years ago
loco.php
47 lines
| 1 | <?php |
| 2 | /* |
| 3 | Plugin Name: Loco Translate |
| 4 | Plugin URI: http://wordpress.org/extend/plugins/loco-translate |
| 5 | Description: Translate Wordpress plugins and themes directly in your browser |
| 6 | Author: Tim Whitlock |
| 7 | Version: 1.4 |
| 8 | Author URI: http://localise.biz/help/wordpress/translate-plugin |
| 9 | */ |
| 10 | |
| 11 | |
| 12 | |
| 13 | /** |
| 14 | * Include a component from lib subdirectory |
| 15 | * @param string $subpath e.g. "loco-admin" |
| 16 | * @return mixed value from last included file |
| 17 | */ |
| 18 | function loco_require(){ |
| 19 | static $dir; |
| 20 | isset($dir) or $dir = dirname(__FILE__); |
| 21 | $ret = ''; |
| 22 | foreach( func_get_args() as $subpath ){ |
| 23 | $ret = require_once $dir.'/lib/'.$subpath.'.php'; |
| 24 | } |
| 25 | return $ret; |
| 26 | } |
| 27 | |
| 28 | |
| 29 | |
| 30 | // Inialize admin screen |
| 31 | if( is_admin() ){ |
| 32 | loco_require('loco-boot','loco-admin'); |
| 33 | } |
| 34 | |
| 35 | // else fire up theme functionality for admins |
| 36 | else { |
| 37 | add_action( 'after_setup_theme', 'loco_after_setup_theme' ); |
| 38 | function loco_after_setup_theme(){ |
| 39 | if( is_user_logged_in() ){ |
| 40 | loco_require('loco-boot'); |
| 41 | if( current_user_can(Loco::CAPABILITY) ){ |
| 42 | // @todo font end functionality |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 |