function load_from_file($ext_filename)
 {
     $source = WC_Makepot::get_first_lines($ext_filename);
     $pot = '';
     foreach ($this->headers as $header) {
         $string = WC_Makepot::get_addon_header($header, $source);
         if (!$string) {
             continue;
         }
         $args = array('singular' => $string, 'extracted_comments' => $header . ' of the plugin/theme');
         $entry = new Translation_Entry($args);
         $pot .= "\n" . PO::export_entry($entry) . "\n";
     }
     return $pot;
 }
Beispiel #2
0
/**
 * Web interface for generating the WooCommerce POT files
 *
 * @since 2.0
 * @package WooCommerce
 * @author Geert De Deckere
 */
/**
 * Note: this file is locked by default since it should not be publicly accessible
 * on a live website. You can unlock it by temporarily removing the following line.
 */
exit('Locked');
// Load the makepot generator
require './makepot.php';
$makepot = new WC_Makepot();
// Regeneration requested
if (!empty($_GET['generate'])) {
    // Generate woocommerce and woocommerce-admin POT files
    $results = array();
    foreach ($makepot->projects as $name => $project) {
        $results[$name] = $makepot->generate_pot($name);
    }
}
// Load WooCommerce POT-files info
$pot_files = array();
foreach ($makepot->projects as $name => $project) {
    $pot_files[$name] = array('file' => $project['file'], 'file_exists' => file_exists($project['file']), 'is_readable' => is_readable($project['file']), 'is_writable' => is_writable($project['file']), 'filemtime' => is_readable($project['file']) ? filemtime($project['file']) : false, 'filesize' => is_readable($project['file']) ? filesize($project['file']) : false);
}
?>
<!DOCTYPE html>
Beispiel #3
0
 * @author Geert De Deckere
 */
/**
 * Note: this file is locked by default since it should not be publicly accessible
 * on a live website. You can unlock it by temporarily removing the following line.
 */
exit('Locked');
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__));
if (isset($_SERVER['SHELL'])) {
    $is_shell = True;
} else {
    $is_shell = False;
}
// Load the makepot generator
require 'makepot.php';
$makepot = new WC_Makepot();
// Regeneration requested
if (isset($_GET) and !empty($_GET['generate']) || isset($argc, $argv) && $argc == 2 && $argv[1] == "generate") {
    // Generate woocommerce and woocommerce-admin POT files
    $results = array();
    foreach ($makepot->projects as $name => $project) {
        $results[$name] = $makepot->generate_pot($name);
    }
}
// Load WooCommerce POT-files info
$pot_files = array();
foreach ($makepot->projects as $name => $project) {
    $pot_files[$name] = array('file' => $project['file'], 'file_exists' => file_exists($project['file']), 'is_readable' => is_readable($project['file']), 'is_writable' => is_writable($project['file']), 'filemtime' => is_readable($project['file']) ? filemtime($project['file']) : false, 'filesize' => is_readable($project['file']) ? filesize($project['file']) : false);
}
if ($is_shell) {
    printf("WooCommerce %s POT Generator\n\n", $makepot->woocommerce_version());