本文整理汇总了PHP中Sobi类的典型用法代码示例。如果您正苦于以下问题:PHP Sobi类的具体用法?PHP Sobi怎么用?PHP Sobi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sobi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract
/**
* @param string $to - path where the archive should be extracted to
* @return bool
*/
public function extract($to)
{
$r = false;
$ext = SPFs::getExt($this->_filename);
switch ($ext) {
case 'zip':
$zip = new ZipArchive();
if ($zip->open($this->_filename) === true) {
SPException::catchErrors(SPC::WARNING);
try {
$zip->extractTo($to);
$zip->close();
$r = true;
} catch (SPException $x) {
$t = Sobi::FixPath(Sobi::Cfg('fs.temp') . DS . md5(microtime()));
SPFs::mkdir($t, 0777);
$dir = SPFactory::Instance('base.fs.directory', $t);
if ($zip->extractTo($t)) {
$zip->close();
$dir->moveFiles($to);
$r = true;
}
SPFs::delete($dir->getPathname());
}
SPException::catchErrors(0);
}
break;
}
return $r;
}
示例2: getGroupsField
public static function getGroupsField()
{
$db =& JFactory::getDbo();
$db->setQuery('
SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level
FROM #__usergroups AS a
LEFT JOIN `#__usergroups` AS b ON a.lft > b.lft AND a.rgt < b.rgt
GROUP BY a.id
ORDER BY a.lft ASC');
$options = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
$gids = array();
foreach ($options as $k => $v) {
$gids[] = get_object_vars($v);
}
$gids[0] = array('value' => 0, 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'level' => 0);
return $gids;
}
示例3: save
public function save(&$attr)
{
parent::save($attr);
if ($attr['method'] == 'fixed') {
if (!$attr['fixedCid']) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
} else {
$cids = explode(',', $attr['fixedCid']);
if (count($cids)) {
foreach ($cids as $cid) {
$catId = (int) $cid;
if (!$catId) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
}
if ($catId == Sobi::Section()) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID', $cid));
} else {
$parents = SPFactory::config()->getParentPath($catId);
if (!isset($parents[0]) || $parents[0] != Sobi::Section()) {
throw new SPException(SPLang::e('FIELD_FIXED_CID_INVALID_SECTION', $catId));
}
}
}
} else {
throw new SPException(SPLang::e('FIELD_FIXED_CID_MISSING'));
}
}
}
}
示例4: upload
protected function upload()
{
$ident = SPRequest::cmd('ident', null, 'post');
$data = SPRequest::file($ident, 'tmp_name');
$secret = md5(Sobi::Cfg('secret'));
if ($data) {
$properties = SPRequest::file($ident);
$fileName = md5(SPRequest::file($ident, 'name') . time() . $secret);
$path = SPLoader::dirPath("tmp.files.{$secret}", 'front', false) . '/' . $fileName;
/** @var $file SPFile */
$file = SPFactory::Instance('base.fs.file');
if (!$file->upload($data, $path)) {
$this->message(array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE'), 'id' => ''));
}
$path = $file->getPathname();
$type = $this->check($path);
$properties['tmp_name'] = $path;
SPFs::write($path . '.var', SPConfig::serialize($properties));
$response = array('type' => 'success', 'text' => Sobi::Txt('FILE_UPLOADED', $properties['name'], $type), 'id' => 'file://' . $fileName, 'data' => array('name' => $properties['name'], 'type' => $properties['type'], 'size' => $properties['size']));
} else {
$response = array('type' => 'error', 'text' => SPLang::e('CANNOT_UPLOAD_FILE_NO_DATA'), 'id' => '');
}
// $field = SPRequest::cmd( 'field', null );
$this->message($response);
}
示例5: display
/**
*
*/
public function display()
{
$sections =& $this->get('sections');
$_sections = array();
if (count($sections)) {
foreach ($sections as $section) {
$name = $section->get('name');
$id = $section->get('id');
$url = Sobi::Url(array('sid' => $id));
$_section = array();
$_section['id'] = $id;
$_section['nid'] = $section->get('nid');
$_section['name'] = "<a href=\"{$url}\">{$name}</a>";
// $_section[ 'entries_counter' ] = $section->countChilds( 'entry' );
// $_section[ 'categories_counter' ] = $section->countChilds( 'category' );
// $_section[ 'state' ] = SPLists::state( $section );
// $_section[ 'checkbox' ] = SPLists::checkedOut( $section, 'sid' );
$_section['createdTime'] = $section->get('createdTime');
$_section['metaDesc'] = $section->get('metaDesc');
$_section['metaKey'] = $section->get('metaKey');
$_section['description'] = $section->get('description');
$_section['url'] = $url;
$_sections[] = $_section;
}
}
$this->set($_sections, 'sections');
parent::display();
}
示例6: translate
protected function translate()
{
$term = Sobi::Txt(SPRequest::cmd('term'));
Sobi::Trigger('Translate', 'Text', array(&$term));
SPFactory::mainframe()->cleanBuffer()->customHeader();
echo json_encode(array('translation' => $term));
exit;
}
示例7: __construct
/**
* @param string $definition
* @param string $type
* @return SPInstaller
*/
public function __construct($definition, $type = null)
{
$this->type = $type;
$this->xmlFile = $definition;
$this->definition = new DOMDocument(Sobi::Cfg('xml.version', '1.0'), Sobi::Cfg('xml.encoding', 'UTF-8'));
$this->definition->load($this->xmlFile);
$this->xdef = new DOMXPath($this->definition);
$this->root = dirname($this->xmlFile);
}
示例8: __call
public function __call($method, $params)
{
if (function_exists($method)) {
$this->string = $method($this->string);
} else {
Sobi::Error('String', "Function {$method} does not exist!", SPC::WARNING);
}
return $this;
}
示例9: __construct
/**
* @param string $dir - path
* @return SPDirectoryIterator
*/
public function __construct($dir)
{
$Dir = scandir($dir);
$this->_dir = new ArrayObject();
foreach ($Dir as $file) {
$this->append(new SPFile(Sobi::FixPath($dir . '/' . $file)));
}
$this->uasort(array($this, '_spSort'));
}
示例10: edit
/**
*/
private function edit()
{
$id = $this->get('entry.id');
if ($id) {
$this->addHidden($id, 'entry.id');
}
$sid = SPRequest::int('pid') ? SPRequest::int('pid') : SPRequest::sid();
$this->assign(Sobi::Url(array('task' => 'category.chooser', 'sid' => $sid, 'out' => 'html', 'multiple' => 1), true), 'cat_chooser_url');
}
示例11: screen
private function screen()
{
$bankData = SPLang::getValue('bankdata', 'application', Sobi::Section());
if (!strlen($bankData)) {
SPLang::getValue('bankdata', 'application');
}
$tile = Sobi::Txt('APP.BANK_TRANSFER_NAME');
$this->getView('bank_transfer')->assign($tile, 'title')->assign($bankData, 'bankdata')->determineTemplate('extensions', 'bank-transfer')->display();
}
示例12: execute
public function execute()
{
$method = explode('.', $this->_task);
$this->nid = 'field_' . $method[0];
$method = 'Proxy' . ucfirst($method[1]);
$this->fid = SPFactory::db()->select('fid', 'spdb_field', array('nid' => $this->nid, 'section' => Sobi::Section()))->loadResult();
$this->field = SPFactory::Model('field');
$this->field->init($this->fid);
$this->field->{$method}();
return true;
}
示例13: save
public function save(&$attr)
{
$data = array('key' => $this->nid . '-viewInfo', 'value' => $attr['viewInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$data = array('key' => $this->nid . '-entryInfo', 'value' => $attr['entryInfo'], 'type' => 'field_information', 'fid' => $this->fid, 'id' => Sobi::Section(), 'section' => Sobi::Section());
SPLang::saveValues($data);
$attr['required'] = 0;
$attr['fee'] = 0;
$attr['isFree'] = 1;
parent::save($attr);
}
示例14: getGroupsField
public static function getGroupsField()
{
$acl =& JFactory::getACL();
$g = $acl->get_group_children_tree(null, 'USERS', false);
$gids = array();
foreach ($g as $k => $v) {
$gids[] = get_object_vars($v);
}
array_unshift($gids, array('value' => '0', 'text' => Sobi::Txt('ACL.REG_VISITOR'), 'disable' => null));
return $gids;
}
示例15: search
protected function search()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
// $selected = SPRequest::int( 'selected', 0 );
$ssid = SPRequest::base64('ssid');
$query = SPRequest::string('q', null);
$session = SPFactory::user()->getUserState('userSelector', null, array());
$setting = $session[$ssid];
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLim = Sobi::Cfg('user_selector.entries_limit', 18);
$eLimStart = ($site - 1) * $eLim;
$params = array();
if ($query) {
$q = '%' . $query . '%';
$params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
}
try {
$count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
$data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
} catch (SPException $x) {
echo $x->getMessage();
exit;
}
$response = array('sites' => ceil($count / $eLim), 'site' => $site);
if (count($data)) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $setting['format'], $replacements);
$placeholders = array();
if (isset($replacements[0]) && count($replacements[0])) {
foreach ($replacements[0] as $placeholder) {
$placeholders[] = str_replace('%', null, $placeholder);
}
}
if (count($replacements)) {
foreach ($data as $index => $user) {
$txt = $setting['format'];
foreach ($placeholders as $attribute) {
if (isset($user[$attribute])) {
$txt = str_replace('%' . $attribute, $user[$attribute], $txt);
}
}
$data[$index]['text'] = $txt;
}
}
$response['users'] = $data;
}
SPFactory::mainframe()->cleanBuffer();
echo json_encode($response);
exit;
}