function do_file($file)
{
    $content = @file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches);
    for ($i = 0; $i < count($matches[0]); $i++) {
        // TODO: add line number
        echo "/* {$file} */\n";
        // credit: Mike van Lammeren 2005-02-14
        $content = $matches[3][$i];
        if (!preg_match('/formatmatters\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            $replace = array('@ *[\\n\\r]+@' => ' ');
            $content = preg_replace(array_keys($replace), array_values($replace), $content);
        }
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            echo 'ngettext("' . fs($content) . '","' . fs($match[1]) . '",x);' . "\n";
        } else {
            echo 'gettext("' . fs($content) . '");' . "\n";
        }
        echo "\n";
    }
}
Example #2
0
function do_file($file)
{
    global $xpaths;
    try {
        $content = file_get_contents($file);
        if (!$content) {
            return;
        }
        $xml = new SimpleXMLElement($content);
        if (!$xml) {
            return;
        }
        foreach ($xpaths as $xpath) {
            $nodes = $xml->xpath($xpath);
            foreach ($nodes as $node) {
                $fs = fs($node);
                if ($fs) {
                    print 'gettext("' . fs($node) . '");' . "\n";
                }
            }
        }
    } catch (Exception $e) {
        return;
    }
}
Example #3
0
function do_file($file)
{
    $content = @file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches);
    for ($i = 0; $i < count($matches[0]); $i++) {
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            print 'ngettext("' . fs($matches[3][$i]) . '","' . fs($match[1]) . '",x);' . "\n";
        } else {
            print 'gettext("' . fs($matches[3][$i]) . '");' . "\n";
        }
    }
}
Example #4
0
function do_file($file)
{
    $content = @file_get_contents($file);
    if (empty($content)) {
        return;
    }
    preg_match_all("@(title=\"(.*?)\")|(>(.*?)<\\/item>)@", $content, $matches);
    for ($i = 0; $i < count($matches[0]); $i++) {
        $string = $matches[2][$i] ? $matches[2][$i] : $matches[4][$i];
        if ($string != '') {
            echo "/* {$file} */\n";
            //
            echo 'gettext("' . fs($string) . '");' . "\n";
        }
        echo "\n";
    }
}
Example #5
0
function do_file($file)
{
    $content = @file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches);
    for ($i = 0; $i < count($matches[0]); $i++) {
        // TODO: add line number
        echo "/* {$file} */\n";
        // credit: Mike van Lammeren 2005-02-14
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            print 'ngettext("' . fs($matches[3][$i]) . '","' . fs($match[1]) . '",x);' . "\n";
        } else {
            print 'gettext("' . fs($matches[3][$i]) . '");' . "\n";
        }
    }
}
function do_file($file)
{
    $content = @file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches);
    for ($i = 0; $i < count($matches[0]); $i++) {
        $output = array();
        $output[] = "#: {$file}";
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            $output[] = 'msgid "' . fs($matches[3][$i]) . '"';
            $output[] = 'msgid_plural "' . fs($match[1]) . '"';
            $output[] = 'msgstr[0] ""';
            $output[] = 'msgstr[1] ""';
        } else {
            $output[] = 'msgid "' . fs($matches[3][$i]) . '"';
            $output[] = 'msgstr ""';
        }
        print implode("\n", $output) . "\n\n";
    }
}
Example #7
0
function do_file($file)
{
    $pi = pathinfo($file);
    $content = file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    /*
    preg_match_all(
    		"/{$ldq}\s*({$cmd})\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\/\\1{$rdq}/",
    		$content,
    		$matches
    );
    */
    //	echo "asdasd";
    if ($pi['extension'] == 'php') {
        $regExp = "\\\$this->i18n->_\\([\\'\"](.*)[\\'\"]\\)";
    } else {
        $regExp = "{\\\$i18n->_\\([\\'\"]([^']*)[\\'\"]\\)}";
    }
    preg_match_all("/" . $regExp . "/", $content, $matches);
    //if($matches)
    //	print_r($matches);
    //echo $regExp."\n";
    for ($i = 0; $i < count($matches[0]); $i++) {
        // TODO: add line number
        //echo "/* $file */\n"; // credit: Mike van Lammeren 2005-02-14
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i], $match)) {
            //echo 'ngettext("'.fs($matches[3][$i]).'","'.fs($match[1]).'",x);'."\n";
        } else {
            echo 'gettext("' . fs($matches[1][$i]) . '");' . "\n";
        }
        //echo "\n";
    }
}
function do_file($outfile, $file)
{
    $content = file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}+([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches, PREG_OFFSET_CAPTURE);
    $result_msgctxt = array();
    //msgctxt -> msgid based content
    $result_msgid = array();
    //only msgid based content
    for ($i = 0; $i < count($matches[0]); $i++) {
        $msg_ctxt = null;
        $plural = null;
        if (preg_match('/context\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i][0], $match)) {
            $msg_ctxt = $match[1];
        }
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i][0], $match)) {
            $msgid = $matches[3][$i][0];
            $plural = $match[1];
        } else {
            $msgid = $matches[3][$i][0];
        }
        if ($msg_ctxt && empty($result_msgctxt[$msg_ctxt])) {
            $result_msgctxt[$msg_ctxt] = array();
        }
        if ($msg_ctxt && empty($result_msgctxt[$msg_ctxt][$msgid])) {
            $result_msgctxt[$msg_ctxt][$msgid] = array();
        } elseif (empty($result_msgid[$msgid])) {
            $result_msgid[$msgid] = array();
        }
        if ($plural) {
            if ($msg_ctxt) {
                $result_msgctxt[$msg_ctxt][$msgid]['plural'] = $plural;
            } else {
                $result_msgid[$msgid]['plural'] = $plural;
            }
        }
        $lineno = lineno_from_offset($content, $matches[2][$i][1]);
        if ($msg_ctxt) {
            $result_msgctxt[$msg_ctxt][$msgid]['lineno'][] = "{$file}:{$lineno}";
        } else {
            $result_msgid[$msgid]['lineno'][] = "{$file}:{$lineno}";
        }
    }
    ob_start();
    echo MSGID_HEADER;
    foreach ($result_msgctxt as $msgctxt => $data_msgid) {
        foreach ($data_msgid as $msgid => $data) {
            echo "#: ", join(' ', $data['lineno']), "\n";
            echo 'msgctxt "' . fs($msgctxt) . '"', "\n";
            echo 'msgid "' . fs($msgid) . '"', "\n";
            if (isset($data['plural'])) {
                echo 'msgid_plural "' . fs($data['plural']) . '"', "\n";
                echo 'msgstr[0] ""', "\n";
                echo 'msgstr[1] ""', "\n";
            } else {
                echo 'msgstr ""', "\n";
            }
            echo "\n";
        }
    }
    //without msgctxt
    foreach ($result_msgid as $msgid => $data) {
        echo "#: ", join(' ', $data['lineno']), "\n";
        echo 'msgid "' . fs($msgid) . '"', "\n";
        if (isset($data['plural'])) {
            echo 'msgid_plural "' . fs($data['plural']) . '"', "\n";
            echo 'msgstr[0] ""', "\n";
            echo 'msgstr[1] ""', "\n";
        } else {
            echo 'msgstr ""', "\n";
        }
        echo "\n";
    }
    $out = ob_get_contents();
    ob_end_clean();
    msgmerge($outfile, $out);
}
Example #9
0
    if (defined('WP_FS__DEV_MODE') && WP_FS__DEV_MODE) {
        ?>
						<th></th>
					<?php 
    }
    ?>
				</tr>
				</thead>
				<tbody>
				<?php 
    foreach ($addons_to_show as $addon_id) {
        ?>
					<?php 
        $addon = $fs->get_addon($addon_id);
        $is_addon_activated = $fs->is_addon_activated($addon->slug);
        $fs_addon = $is_addon_activated ? fs($addon->slug) : false;
        ?>
					<tr>
						<td>
							<?php 
        echo $addon->title;
        ?>
						</td>
						<?php 
        if ($is_addon_activated) {
            ?>
							<?php 
            // Add-on Installed
            ?>
							<?php 
            $addon_site = $fs_addon->get_site();
Example #10
0
function do_file($outfile, $file)
{
    $content = file_get_contents($file);
    if (empty($content)) {
        return;
    }
    global $ldq, $rdq, $cmd;
    preg_match_all("/{$ldq}\\s*({$cmd})\\s*([^{$rdq}]*){$rdq}+([^{$ldq}]*){$ldq}\\/\\1{$rdq}/", $content, $matches, PREG_OFFSET_CAPTURE);
    $msgids = array();
    $msgids_plural = array();
    for ($i = 0; $i < count($matches[0]); $i++) {
        if (preg_match('/plural\\s*=\\s*["\']?\\s*(.[^\\"\']*)\\s*["\']?/', $matches[2][$i][0], $match)) {
            $msgid = $matches[3][$i][0];
            $msgids_plural[$msgid] = $match[1];
        } else {
            $msgid = $matches[3][$i][0];
        }
        $lineno = lineno_from_offset($content, $matches[2][$i][1]);
        $msgids[$msgid][] = "{$file}:{$lineno}";
    }
    ob_start();
    echo MSGID_HEADER;
    foreach ($msgids as $msgid => $files) {
        echo "#: ", join(' ', $files), "\n";
        if (isset($msgids_plural[$msgid])) {
            echo 'msgid "' . fs($msgid) . '"', "\n";
            echo 'msgid_plural "' . fs($msgids_plural[$msgid]) . '"', "\n";
            echo 'msgstr[0] ""', "\n";
            echo 'msgstr[1] ""', "\n";
        } else {
            echo 'msgid "' . fs($msgid) . '"', "\n";
            echo 'msgstr ""', "\n";
        }
        echo "\n";
    }
    $out = ob_get_contents();
    ob_end_clean();
    msgmerge($outfile, $out);
}
<?php

$slug = $VARS['slug'];
$fs = fs($slug);
?>

<div class="wrap">
	<h2 class="nav-tab-wrapper">
		<a href="<?php 
echo $fs->get_account_url();
?>
" class="nav-tab nav-tab-active"><?php 
_e('Account', WP_FS__SLUG);
?>
</a>
		<a href="<?php 
echo fs_get_admin_plugin_url('addons');
?>
" class="nav-tab"><?php 
_e('Add Ons', WP_FS__SLUG);
?>
</a>
		<?php 
if (!$fs->_rw_execute_over()) {
    ?>
			<a href="<?php 
    echo $fs->get_upgrade_url();
    ?>
" class="nav-tab"><?php 
    _e('Upgrade', WP_FS__SLUG);
    ?>
Example #12
0
function fs_ui_action_link($slug, $page, $action, $title, $params = array())
{
    ?>
<a class="" href="<?php 
    echo wp_nonce_url(fs($slug)->_get_admin_page_url($page, array_merge($params, array('fs_action' => $action))), $action);
    ?>
"><?php 
    echo $title;
    ?>
</a><?php 
}
Example #13
0
$query = implode(" AND ", $query);
$items = q("select * from productos where " . $query . " order by nombre");
if ($items) {
    //$out .= '<h3><a href="#">Contenidos</a></h3>';
    foreach ($items as $item) {
        $foto = array();
        $img = a("select nombre, tabla from files where item_id = " . $item['id'] . " AND tipo = 'imagenes' and tabla = 'productos' order by orden");
        $phpt = new PhpT();
        $phpt->fileName = $img['nombre'];
        $phpt->fileTitle = $item['nombre'];
        $phpt->params = array('w' => 37, 'h' => 37, 'zc' => 1);
        $phpt->folder = $img['tabla'];
        $highlight1 = new highlight(cortar($item['nombre'], 40), $_POST['termino']);
        $hiTitulo = $highlight1->output_text;
        $hiTituloWords = $highlight1->output_words;
        $hiTituloWords = fs($hiTituloWords, ' ', '');
        $highlight2 = new highlight(cortar($item['resumen'], 80, array('ending' => '...', 'exact' => true, 'html' => false)), $_POST['termino']);
        $hiResumen = $highlight2->output_text;
        $foto[] = '<li class="foto">';
        if ($img) {
            $foto[] = '<a href="producto.php?id=' . $item['id'] . '&words=' . $hiTituloWords . '" title="' . $item['nombre'] . '">';
            $foto[] = $phpt->getImgHtml();
            $foto[] = '</a></li>';
        }
        $foto[] = '</li>';
        $out[] = '<ul>';
        $out[] = join("\n", $foto);
        $out[] = '<li class="data"><strong><a href="producto.php?id=' . $item['id'] . '&words=' . $hiTituloWords . '" title="' . $item['nombre'] . '">' . $hiTitulo . '</a></strong><br />';
        $out[] = $hiResumen . '</li>';
        $out[] = '</ul>';
    }
Example #14
0
 /**
  * @param string $slug
  * @param string $developer_id
  * @param string $public_key
  * @param array $options
  *
  * @return Freemius
  */
 function fs_init($slug, $developer_id, $public_key, array $options)
 {
     $fs = fs($slug);
     $fs->init($developer_id, $public_key, $options);
     return $fs;
 }