本文整理汇总了PHP中j函数的典型用法代码示例。如果您正苦于以下问题:PHP j函数的具体用法?PHP j怎么用?PHP j使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了j函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Controller
*/
public function process()
{
if (!Phpfox::isUser()) {
exit;
}
$aImage = Phpfox_File::instance()->load('image', array('jpg', 'gif', 'png'));
if ($aImage === false) {
return j('#js_image_error')->show();
}
$aParts = explode('x', $this->request()->get('ad_size'));
if ($sFileName = Phpfox_File::instance()->upload('image', Phpfox::getParam('ad.dir_image'), Phpfox::getUserId() . uniqid())) {
Phpfox_Image::instance()->createThumbnail(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''), Phpfox::getParam('ad.dir_image') . sprintf($sFileName, '_thumb'), Phpfox::getParam('ad.multi_ad') ? 100 : $aParts[0] / 3, Phpfox::getParam('ad.multi_ad') ? 72 : $aParts[1] - 20);
Phpfox_File::instance()->unlink(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
rename(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, '_thumb'), Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
// http://www.phpfox.com/tracker/view/14922/ -> If CDN, the unlink function above deletes the image!!
if (Phpfox::getParam('core.allow_cdn')) {
Phpfox::getLib('cdn')->put(Phpfox::getParam('ad.dir_image') . sprintf($sFileName, ''));
}
return ['run' => '$(\'.js_ad_image\').html(\'<a href="#ad-link"><img src="' . Phpfox::getParam('ad.url_image') . sprintf($sFileName, '') . '" alt="" /></a>\').show(); window.parent.$(\'#js_image_holder_message\').hide(); window.parent.$(\'#js_image_holder_link\').show(); window.parent.$(\'#js_image_id\').val(\'' . sprintf($sFileName, '') . '\');'];
}
exit;
}
示例2: fail
{
$a1 = "old string";
$a2 = "old string";
echo "about to include included_var_overwrite.php\n";
include "included_var_overwrite.php";
if ($a1 == "old value" or $a2 == "my old value") {
fail(__FILE__, __LINE__, "var overwrite within class");
}
}
}
$h = new H();
var_dump($h);
$h = $h->g();
var_dump($h);
# the included file using varaibles from this file
$i1 = "some value";
$i2 = "another value";
echo "about to include included_use_existing_vars.php\n";
include "included_use_existing_vars.php";
# the included file using functions from this file
echo "about to include included_use_vars_in_function.php\n";
include "included_use_vars_in_function.php";
$j = j(1, 2);
var_dump($j);
# the included file using classes from this file
echo "about to include included_use_vars_in_classes.php\n";
include "included_use_vars_in_classes.php";
$k = new K();
var_dump($k);
$k = $k->kk();
var_dump($k);
示例3: a
<?php
a('b');
?>
<?php
echo C . D::e('f' . $g);
$h = i();
j();
/* comments */
示例4: j
<?php
'a' . ($b['c'] == 'd' ? "e{$f}g{$h['i']}" . j('k') . "l" . m('n') . "o" : "p{$q}r{$s['t']}u" . ($v['w'] != X ? "y" . z('aa') . "'ab" : "ac" . ad('ae') . "af") . "ag" . ah('ai') . "aj") . "ak";
示例5: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Read', function ($Call) {
if (preg_match('/<\\?xml/', $Call['Value'])) {
return jd(j(simplexml_load_string($Call['Value'], null, LIBXML_NOCDATA), JSON_NUMERIC_CHECK), true);
} else {
return jd(j(simplexml_load_string('<root>' . $Call['Value'] . '</root>'), JSON_NUMERIC_CHECK), true);
}
});
示例6: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Open', function ($Call) {
return F::Run('IO.Storage.Redis', 'Open', $Call);
});
setFn('Read', function ($Call) {
F::Log('Pull: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
if (($Result = $Call['Link']->lPop($Call['Scope'] . $Call['Queue'])) !== false) {
return [jd($Result, true)];
} else {
return null;
}
});
setFn('Write', function ($Call) {
F::Log('Push: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
return $Call['Link']->rPush($Call['Scope'] . $Call['Queue'], j($Call['Data']));
});
setFn('Count', function ($Call) {
F::Log('Count: ' . $Call['Scope'] . $Call['Queue'], LOG_INFO, 'Administrator');
return $Call['Link']->lLen($Call['Scope'] . $Call['Queue']);
});
示例7: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description:
* @package Codeine
* @version 8.x
*/
setFn('Read', function ($Call) {
$Result = jd($Call['Value'], true);
if (json_last_error() > 0) {
F::Log('JSON: ' . json_last_error_msg(), LOG_ERR);
F::Log($Call['Value'], LOG_ERR);
}
return $Result;
});
setFn('Write', function ($Call) {
return j($Call['Value'], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
});
setFn('Write.Call', function ($Call) {
$Call['Value'] = j($Call['Value']);
return $Call;
});
示例8: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
if ($Call['Case']['Result']['Actual'] == $Call['Case']['Assert']['Equal']) {
$Decision = true;
} else {
$Call['Failure'] = true;
$Decision = false;
F::Log(j($Call['Case']['Result']['Actual']) . ' is not equal ' . j($Call['Case']['Assert']['Equal']), LOG_WARNING, 'Developer');
}
return $Decision;
});
示例9: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Make', function ($Call) {
$Data = [];
if (count($Call['Value']) > 0) {
foreach ($Call['Value'] as $K => $V) {
if ($K > 0) {
$Data[] = [$Call['Name'] => $V];
}
}
}
$Call['Data'] = j($Data, JSON_UNESCAPED_UNICODE);
return $Call;
});
示例10: insert
function insert($p_value, $p_prefix)
{
$sql = "insert into document_type(dt_value,dt_prefix) values (\$1,\$2)";
try {
if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0) {
throw new Exception('Nom en double');
}
if (strlen(trim($p_value)) > 0) {
$this->db->exec_sql($sql, array($p_value, $p_prefix));
}
} catch (Exception $e) {
alert(j(_("Impossible d'ajouter [{$p_value}] ") . $e->getMessage()));
}
}
示例11: j
<?php
$a = $_GET['b'] ?? 'c';
$d = E::f($g) ?? $h;
$i = j('l') ?? l;
示例12: setFn
return true;
});
setFn('Execute', function ($Call) {
F::Log($Call['Command'], LOG_INFO);
return $Call['Link']->execute($Call['Command']);
});
setFn('Count', function ($Call) {
$Call['Scope'] = strtr($Call['Scope'], '.', '_');
if (isset($Call['Where']) and $Call['Where'] !== null) {
$Call = F::Apply(null, 'Where', $Call);
if (isset($Call['Distinct']) && $Call['Distinct']) {
F::Log('db.*' . $Call['Scope'] . '*.distinct(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator');
$Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0], $Call['Where']);
return count($Data);
} else {
F::Log('db.*' . $Call['Scope'] . '*.count(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator');
$Cursor = $Call['Link']->{$Call}['Scope']->count($Call['Where']);
}
} else {
if (isset($Call['Distinct']) && $Call['Distinct']) {
F::Log('db.*' . $Call['Scope'] . '*.distinct()', LOG_INFO, 'Administrator');
$Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0]);
return count($Data);
} else {
F::Log('db.*' . $Call['Scope'] . '*.count()', LOG_INFO, 'Administrator');
$Cursor = $Call['Link']->{$Call}['Scope']->count();
}
}
if ($Cursor) {
return $Cursor;
} else {
示例13: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Process', function ($Call) {
if (isset($Call['Node']['Unique']) && $Call['Node']['Unique'] && isset($Call['Data'][$Call['Name']])) {
if ($Call['Name'] !== 'ID') {
$Where = [$Call['Name'] => $Call['Data'][$Call['Name']], 'ID' => ['$ne' => $Call['Data']['ID']]];
$Limit = 0;
} else {
if ($Call['Purpose'] == 'Create') {
$Limit = 0;
} else {
$Limit = 1;
}
$Where = ['ID' => $Call['Data']['ID']];
}
F::Log('Checking unique *' . $Call['Name'] . '* value *' . $Call['Data'][$Call['Name']] . '* (' . $Call['Purpose'] . ')', LOG_INFO);
$Count = F::Run('Entity', 'Count', ['Entity' => $Call['Entity'], 'Where' => $Where]);
if ($Count > $Limit) {
F::Log('Non-unique (' . $Count . '/' . $Limit . ') ' . $Call['Name'] . ' value: ' . j($Call['Data'][$Call['Name']]) . ' ', LOG_ERR);
return 'Unique';
}
}
return true;
});
示例14: j
}
}
if (!isset($Rule['Weight'])) {
$Rule['Weight'] = $Call['Weight'];
}
if ($Rule['Weight'] >= $Call['Weight']) {
if (isset($Rule['Run']) && F::Diff($Rule['Run'], $Call) === null) {
if (!isset($Rule['Expression']) || F::Live($Rule['Expression'], $Call)) {
F::Log('Rule ' . $Name . ' applied', LOG_DEBUG, 'Security');
$Call['Decision'] = $Rule['Decision'];
$Call['Weight'] = $Rule['Weight'];
$Call['Rule'] = $Name;
}
} else {
if (isset($Rule['Debug'])) {
F::Log('Diff ' . $Name . ' (Rule, Call)' . j(F::Diff($Rule['Run'], $Call)), LOG_INFO, 'Security');
}
}
if (isset($Call['Service']) && isset($Rule['Run']['Service']) && isset($Rule['Run']['Method']) && isset($Rule['Message'])) {
if ($Call['Service'] == $Rule['Run']['Service'] && $Call['Method'] == $Rule['Run']['Method']) {
$Call['Message'] = $Rule['Message'];
}
}
}
}
} else {
F::Log('No rules loaded', LOG_WARNING);
}
if (isset($Call['Rule'])) {
F::Log('Rule *' . $Call['Rule'] . '* decision *' . $Call['Decision'] . '* with weight ' . $Call['Weight'], LOG_INFO, 'Security');
}
示例15: fopen
if (isset($_REQUEST['plugin_code'])) {
if (LOGINPUT) {
$file_loginput = fopen($_ENV['TMP'] . '/scenario-' . $_SERVER['REQUEST_TIME'] . '.php', 'a+');
fwrite($file_loginput, "<?php \n");
fwrite($file_loginput, '//@description:' . $_REQUEST['plugin_code'] . "\n");
fwrite($file_loginput, '$_GET=' . var_export($_GET, true));
fwrite($file_loginput, ";\n");
fwrite($file_loginput, '$_POST=' . var_export($_POST, true));
fwrite($file_loginput, ";\n");
fwrite($file_loginput, '$_POST[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput, "\n");
fwrite($file_loginput, '$_GET[\'gDossier\']=$gDossierLogInput;');
fwrite($file_loginput, "\n");
fwrite($file_loginput, ' $_REQUEST=array_merge($_GET,$_POST);');
fwrite($file_loginput, "\n");
fwrite($file_loginput, "include '" . basename(__FILE__) . "';\n");
fclose($file_loginput);
}
$ext = new Extension($cn);
if ($ext->search($_REQUEST['plugin_code']) != -1) {
/* security */
if (!isset($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0) {
exit;
}
/* call the ajax script */
require_once NOALYSS_PLUGIN . DIRECTORY_SEPARATOR . dirname(trim($ext->getp('me_file'))) . DIRECTORY_SEPARATOR . 'ajax.php';
} else {
alert(j(_("Cette extension n'existe pas ")));
exit;
}
}