本文整理汇总了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();
}