当前位置: 首页>>代码示例>>PHP>>正文


PHP Sobi类代码示例

本文整理汇总了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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:34,代码来源:archive.php

示例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;
    }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:users.php

示例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'));
             }
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:29,代码来源:category.php

示例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);
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:25,代码来源:file.php

示例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();
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:31,代码来源:front.php

示例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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:8,代码来源:txt.php

示例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);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:14,代码来源:installer.php

示例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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:9,代码来源:string.php

示例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'));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:13,代码来源:directory_iterator.php

示例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');
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:11,代码来源:entry.php

示例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();
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:9,代码来源:bank_transfer.php

示例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;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:11,代码来源:field.php

示例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);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:11,代码来源:info.php

示例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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:11,代码来源:users.php

示例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;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:user.php


注:本文中的Sobi类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。