本文整理匯總了PHP中Komento::getJSON方法的典型用法代碼示例。如果您正苦於以下問題:PHP Komento::getJSON方法的具體用法?PHP Komento::getJSON怎麽用?PHP Komento::getJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Komento
的用法示例。
在下文中一共展示了Komento::getJSON方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
public function save($data)
{
$component = $data['component'];
$component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component);
$component = JString::strtolower(JString::trim($component));
unset($data['component']);
$config = Komento::getTable('Configs');
$config->load($component);
$config->component = $component;
$json = Komento::getJSON();
$config->params = $json->encode($data);
$result = $config->store();
// Save it
if (!$result) {
return false;
}
return true;
}
示例2: getAclObject
public function getAclObject( $cid = 0, $type = 'usergroup', $component = 'com_content' )
{
$sql = Komento::getSql();
$sql->select( '#__komento_acl' )
->column( 'rules' )
->where( 'cid', $cid )
->where( 'type', $type )
->where( 'component', $component )
->order( 'id' );
$result = $sql->loadResult();
if( empty( $result ) )
{
return false;
}
$json = Komento::getJSON();
$result = $json->decode( $result );
return $result;
}
示例3: getEmptySet
public static function getEmptySet( $flat = false )
{
static $acl = null;
if( empty( $acl ) )
{
$rulesFile = KOMENTO_ADMIN_ROOT . DIRECTORY_SEPARATOR . 'acl.json';
if( !JFile::exists( $rulesFile ) )
{
return false;
}
$contents = JFile::read( $rulesFile );
$json = Komento::getJSON();
$acl = $json->decode( $contents );
}
if( $flat === false )
{
return $acl;
}
$data = new stdClass();
foreach( $acl as $section => $rules )
{
foreach( $rules as $key => $value )
{
$data->$key = $value;
}
}
return $data;
}
示例4: save
public function save($data)
{
$component = $data['target_component'];
unset($data['target_component']);
$cid = $data['target_id'];
unset($data['target_id']);
$type = $data['target_type'];
unset($data['target_type']);
Komento::import('helper', 'acl');
$defaultset = KomentoACLHelper::getEmptySet(true);
foreach ($defaultset as $key => $value) {
if (isset($data[$key])) {
$defaultset->{$key} = $data[$key] ? true : false;
}
}
$table = Komento::getTable('Acl');
$table->compositeLoad($cid, $type, $component);
$json = Komento::getJSON();
$table->rules = $json->encode($defaultset);
return $table->store();
}