本文整理汇总了PHP中SPFactory类的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory类的具体用法?PHP SPFactory怎么用?PHP SPFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SPFactory类的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: save
private function save()
{
$data = $this->get('pdata');
if (!$data) {
$data = SPFactory::payment()->summary();
}
$methods = SPFactory::payment()->getMethods($this->get('entry'), $data);
$visitor = $this->get('visitor');
$xml = $this->payment();
if (count($methods)) {
$xml['payment_methods'] = array();
foreach ($methods as $mid => $mout) {
$params = array();
if (is_array($mout)) {
$params = $mout;
$mout = $mout['content'];
unset($params['content']);
}
$xml['payment_methods'][$mid] = array('_complex' => 1, '_xml' => 1, '_data' => $mout, '_attributes' => $params);
}
}
$xml['visitor'] = $this->visitorArray($visitor);
$this->_attr = $xml;
Sobi::Trigger('PaymentView', ucfirst(__FUNCTION__), array(&$this->_attr));
}
示例3: crawlSobiSection
protected function crawlSobiSection($sid)
{
$done = false;
$task = $this->cleanCache ? 'crawler.restart' : 'crawler.init';
$connection = SPFactory::Instance('services.remote');
while (!$done && time() - $this->start < $this->timeLimit) {
$url = $this->liveURL . "/index.php?option=com_sobipro&task={$task}&sid={$sid}&format=raw&tmpl=component&timeLimit={$this->loopTimeLimit}&fullFormat=1";
list($content, $response) = $this->SpConnect($connection, $url);
$task = 'crawler';
if ($response['http_code'] == 303) {
preg_match('/Location: (http.*)/', $content, $newUrl);
list($content, $response) = $this->SpConnect($connection, $newUrl[1]);
}
if ($response['http_code'] == 200) {
$content = substr($content, $response['header_size']);
$data = json_decode($content);
$done = $data->status == 'done';
$this->SpOut('');
$this->SpOut('============');
$this->SpOut("[ " . date(DATE_RFC2822) . " ] {$data->message}");
$this->SpOut('============');
foreach ($data->data as $row) {
$u = strip_tags($row->url);
$this->SpOut("{$u}\t{$row->count}\t{$row->code}\t{$row->time}");
}
} else {
$done = true;
$this->out('[ERROR] Invalid return code: ' . $response['http_code']);
}
}
}
示例4: getBasicCfg
/**
* Gets basic data from the CMS (e.g Joomla) and stores in the #SPConfig instance
*/
public function getBasicCfg()
{
parent::getBasicCfg();
if (defined('SOBIPRO_ADM')) {
SPFactory::config()->change('adm_img_folder_live', Sobi::FixPath(JURI::root() . '/' . SOBI_ADM_FOLDER . '/templates/' . JFactory::getApplication()->getTemplate() . '/images/admin'), 'general');
}
}
示例5: onBeforeCompileHead
public function onBeforeCompileHead()
{
// if the class exists it means something initialised it so we can send the header
if (class_exists('SPFactory')) {
SPFactory::header()->sendHeader();
}
}
示例6: 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'));
}
}
}
}
示例7: edit
private function edit()
{
$jsFiles = array('codemirror.codemirror');
$ext = $this->get('file_ext');
$mode = null;
switch (strtolower($ext)) {
case 'xsl':
case 'xml':
$jsFiles[] = 'codemirror.mode.xml.xml';
break;
case 'less':
$jsFiles[] = 'codemirror.mode.less.less';
break;
case 'css':
$jsFiles[] = 'codemirror.mode.css.css';
break;
case 'js':
$jsFiles[] = 'codemirror.mode.javascript.javascript';
break;
case 'php':
$jsFiles[] = 'codemirror.mode.clike.clike';
$jsFiles[] = 'codemirror.mode.php.php';
$jsFiles[] = 'codemirror.mode.htmlmixed.htmlmixed';
$jsFiles[] = 'codemirror.mode.xml.xml';
$jsFiles[] = 'codemirror.mode.javascript.javascript';
$jsFiles[] = 'codemirror.mode.css.css';
$mode = 'application/x-httpd-php';
break;
case 'ini':
$jsFiles[] = 'codemirror.mode.properties.properties';
break;
}
SPFactory::header()->addJsFile($jsFiles)->addCssFile('codemirror.codemirror')->addJsCode('SobiPro.jQuery( document ).ready( function () { SPInitTplEditor( "' . $mode . '") } );');
}
示例8: __construct
/**
* @param bool $useCookies
* @param string $cssFile - separate CSS file
* @param string $prefix
* @return sobiTabs
* @deprecated
*/
public function __construct($useCookies = true, $cssFile = 'tabs', $prefix = null)
{
$this->useCookies = $useCookies ? 1 : 0;
$this->prefix = $prefix;
if ($cssFile) {
SPFactory::header()->addCssFile($cssFile);
}
SPFactory::header()->addJsFile('tabs');
}
示例9: execute
/**
*/
public function execute()
{
SPFactory::mainframe()->cleanBuffer()->customHeader();
if (SPFs::exists($this->file)) {
echo SPFs::read($this->file);
} else {
echo json_encode(array('progress' => 0, 'message' => '', 'interval' => 100, 'type' => ''));
}
exit;
}
示例10: 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;
}
示例11: minCmsVersion
/**
* Return min or recommend Joomla! version
* @param $recommended
* @return array
*/
public static function minCmsVersion($recommended = false)
{
$updater = JUpdater::getInstance();
$updater->findUpdates(700, 0);
$version = SPFactory::db()->select('version', '#__updates', array('extension_id' => 700))->loadResult();
$recommendedVersion = array('major' => 3, 'minor' => 2, 'build' => 3);
if ($version) {
$version = explode('.', $version);
$recommendedVersion = array('major' => $version[0], 'minor' => $version[1], 'build' => $version[2]);
}
return $recommended ? $recommendedVersion : array('major' => 3, 'minor' => 2, 'build' => 0);
}
示例12: view
private function view()
{
$type = $this->key('template_type', 'xslt');
if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) {
$type = 'php';
}
if ($type == 'xslt') {
$visitor = $this->get('visitor');
$current = $this->get('section');
$categories = $this->get('categories');
$entries = $this->get('entries');
$data = array();
$data['id'] = $current->get('id');
$data['section'] = array('_complex' => 1, '_data' => Sobi::Section(true), '_attributes' => array('id' => Sobi::Section(), 'lang' => Sobi::Lang(false)));
$data['name'] = array('_complex' => 1, '_data' => $this->get('listing_name'), '_attributes' => array('lang' => Sobi::Lang(false)));
if (Sobi::Cfg('category.show_desc')) {
$desc = $current->get('description');
if (Sobi::Cfg('category.parse_desc')) {
Sobi::Trigger('prepare', 'Content', array(&$desc, $current));
}
$data['description'] = array('_complex' => 1, '_cdata' => 1, '_data' => $desc, '_attributes' => array('lang' => Sobi::Lang(false)));
}
$data['meta'] = array('description' => $current->get('metaDesc'), 'keys' => $this->metaKeys($current), 'author' => $current->get('metaAuthor'), 'robots' => $current->get('metaRobots'));
$data['entries_in_line'] = $this->get('$eInLine');
$data['categories_in_line'] = $this->get('$cInLine');
$this->menu($data);
$this->alphaMenu($data);
$data['visitor'] = $this->visitorArray($visitor);
if (count($categories)) {
foreach ($categories as $category) {
if (is_numeric($category)) {
$category = SPFactory::Category($category);
}
$data['categories'][] = array('_complex' => 1, '_attributes' => array('id' => $category->get('id'), 'nid' => $category->get('nid')), '_data' => $this->category($category));
unset($category);
}
}
if (count($entries)) {
$this->loadNonStaticData($entries);
$manager = Sobi::Can('entry', 'edit', '*', Sobi::Section()) ? true : false;
foreach ($entries as $eid) {
$en = $this->entry($eid, $manager);
$data['entries'][] = array('_complex' => 1, '_attributes' => array('id' => $en['id']), '_data' => $en);
}
$this->navigation($data);
}
$this->_attr = $data;
}
// general listing trigger
Sobi::Trigger('Listing', ucfirst(__FUNCTION__), array(&$this->_attr));
// specific lisitng trigger
Sobi::Trigger($this->_type, ucfirst(__FUNCTION__), array(&$this->_attr));
}
示例13: screen
private function screen()
{
$data = SPFactory::registry()->loadDBSection('paypal_' . Sobi::Section())->get('paypal_' . Sobi::Section());
if (!count($data)) {
$data = SPFactory::registry()->loadDBSection('paypal')->get('paypal');
}
$ppexpl = SPLang::getValue('ppexpl', 'application', Sobi::Section());
$ppsubj = SPLang::getValue('ppsubject', 'application', Sobi::Section());
if (!strlen($ppsubj)) {
$ppsubj = SPLang::getValue('ppsubject', 'application');
}
$this->getView('paypal')->assign($tile, 'title')->assign($data['ppurl']['value'], 'ppurl')->assign($data['ppemail']['value'], 'ppemail')->assign($data['pprurl']['value'], 'pprurl')->assign($data['ppcc']['value'], 'ppcc')->assign($ppexpl, 'ppexpl')->assign($ppsubj, 'ppsubject')->determineTemplate('extensions', 'paypal')->display();
}
示例14: remove
public function remove($def)
{
$eid = $def->getElementsByTagName('id')->item(0)->nodeValue;
$name = $def->getElementsByTagName('name')->item(0)->nodeValue;
$type = $def->getElementsByTagName('type')->item(0)->nodeValue;
$id = SPFactory::db()->select('extension_id', '#__extensions', array('type' => $type, 'element' => $eid))->loadResult();
jimport('joomla.installer.installer');
if (JInstaller::getInstance()->uninstall($type, $id)) {
SPFactory::db()->delete('spdb_plugins', array('pid' => $eid, 'type' => $type), 1);
return Sobi::Txt('CMS_EXT_REMOVED', $name);
}
return array('msg' => Sobi::Txt('CMS_EXT_NOT_REMOVED', $name), 'msgtype' => 'error');
}
示例15: addSection
public function addSection($name, $section)
{
Sobi::Trigger('addSection', 'SPAdmSiteMenu', array($name, $section));
if ($name == 'AMN.APPS_HEAD' || $name == 'AMN.APPS_SECTION_HEAD') {
$p = SPFactory::Controller('extensions', true);
$links = $p->appsMenu();
if (is_array($links)) {
$section = array_merge($section, $links);
}
} elseif ($name == 'AMN.APPS_SECTION_TPL' && Sobi::Section() && Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE)) {
$p = SPFactory::Controller('template', true);
$this->_custom[$name]['after'][] = $p->getTemplateTree(Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE));
}
$this->_sections[$name] =& $section;
}