Beispiel #1
0
                            <li><?php 
    Loco::h(Loco::_n('1 language', '%u languages', $n), $n);
    ?>
 
                            </li><?php 
    if ($mtime) {
        ?>
 
                            <li class="loco-mtime">
                                <small>
                                    <?php 
        Loco::h(Loco::_x('Updated', 'Modified time'));
        ?>
 
                                    <?php 
        Loco::h(LocoAdmin::format_datetime($mtime));
        ?>
 
                                </small>
                            </li><?php 
    }
    ?>
 
                        </ul>
                    </td>
                    <td>
                        <ul>
                            <li class="loco-add">
                                <?php 
    echo LocoAdmin::msginit_link($package, $domain);
    ?>
Beispiel #2
0
        if (!is_dir($podir) || !is_writable($podir)) {
            throw new Exception(sprintf(Loco::__('Web server cannot create files in the "%s" directory. Fix file permissions or use the download function.'), basename($podir)));
        }
    }
}
// Undo magic quotes if enabled
if (get_magic_quotes_gpc()) {
    $po = stripslashes($po);
}
// attempt to write PO file
$bytes = file_put_contents($path, $po);
if (false === $bytes) {
    throw new Exception(sprintf(Loco::__('%s file is not writable by the web server. Fix file permissions or download and copy to "%s/%s".'), $ftype, $dname, $fname));
}
// primary action ok
$response = array('bytes' => $bytes, 'filename' => basename($path), 'modified' => LocoAdmin::format_datetime(filemtime($path)));
// flush package from cache, so it's regenerated next list view with new stats
$package->uncache();
// attempt to write MO file also, but may fail for numerous reasons.
while (!$ispot) {
    try {
        // check target MO path before compiling
        $mopath = preg_replace('/\\.po$/', '.mo', $path);
        if (!file_exists($mopath) && !is_writable(dirname($mopath))) {
            throw new Exception(Loco::__('Cannot create MO file'));
        } else {
            if (file_exists($mopath) && !is_writable($mopath)) {
                throw new Exception(Loco::__('Cannot overwrite MO file'));
            }
        }
        // attempt to compile MO direct to file via shell