本文整理汇总了PHP中SPFactory类的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory类的具体用法?PHP SPFactory怎么用?PHP SPFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SPFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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));
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:25,代码来源:payment.php
示例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']);
}
}
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:31,代码来源:cron.php
示例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');
}
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:10,代码来源:mainframe.php
示例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();
}
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:7,代码来源:spHeader.php
示例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'));
}
}
}
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:29,代码来源:category.php
示例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 . '") } );');
}
开发者ID:pelloq1,项目名称:SobiPro,代码行数:34,代码来源:template.php
示例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');
}
开发者ID:pelloq1,项目名称:SobiPro,代码行数:16,代码来源:tabs.php
示例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;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:12,代码来源:progress.php
示例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;
}
开发者ID:pelloq1,项目名称:SobiPro,代码行数:11,代码来源:field.php
示例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);
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:17,代码来源:helper.php
示例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));
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:listing.php
示例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();
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:13,代码来源:paypal.php
示例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');
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:13,代码来源:installer.php
示例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;
}
开发者ID:pelloq1,项目名称:SobiPro,代码行数:15,代码来源:menu.php
示例16: __construct
public function __construct()
{
$cfg = SPFactory::config();
$this->setSender(array($cfg->get('mail.mailfrom'), $cfg->get('mail.fromname')));
switch ($cfg->get('mail.mailer')) {
case 'smtp':
$this->useSMTP((int) ($cfg->get('mail.smtpauth') != 0), $cfg->get('mail.smtphost'), $cfg->get('mail.smtpuser'), $cfg->get('mail.smtppass'), $cfg->get('mail.smtpsecure'), $cfg->get('mail.smtpport'));
break;
case 'sendmail':
$this->IsSendmail();
break;
default:
$this->IsMail();
break;
}
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:16,代码来源:mail.php
示例17: save
protected function save()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
$data = SPRequest::string('bankdata', null, true);
$data = array('key' => 'bankdata', 'value' => $data, 'type' => 'application', 'id' => Sobi::Section(), 'section' => Sobi::Section());
try {
SPLang::saveValues($data);
} catch (SPException $x) {
$message = SPLang::e('DB_REPORTS_ERR', $x->getMessage());
Sobi::Error('SPPaymentBt', $message, SPC::WARNING, 0, __LINE__, __FILE__);
$this->response(Sobi::Back(), $message, false, 'error');
}
$this->response(Sobi::Back(), Sobi::Txt('MSG.ALL_CHANGES_SAVED'), false, 'success');
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:16,代码来源:bank_transfer.php
示例18: js
protected function js()
{
$lang = SPLang::jsLang(true);
if (count($lang)) {
foreach ($lang as $term => $text) {
unset($lang[$term]);
$term = str_replace('SP.JS_', null, $term);
$lang[$term] = $text;
}
}
if (!SPRequest::int('deb')) {
SPFactory::mainframe()->cleanBuffer();
header('Content-type: text/javascript');
}
echo 'SobiPro.setLang( ' . json_encode($lang) . ' );';
exit;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:17,代码来源:txt.php
示例19: PaymentMethodView
/**
* This function have to add own string into the given array
* Basically: $methods[ $this->id ] = "Some String To Output";
* Optionally the value can be also SobiPro Arr2XML array.
* Check the documentation for more information
* @param array $methods
* @param SPEntry $entry
* @param array $payment
* @param bool $message
* @return void
*/
public function PaymentMethodView(&$methods, $entry, &$payment, $message = false)
{
$data = SPFactory::registry()->loadDBSection('paypal_' . Sobi::Section())->get('paypal_' . Sobi::Section());
if (!count($data)) {
$data = SPFactory::registry()->loadDBSection('paypal')->get('paypal');
}
$cfg = SPLoader::loadIniFile('etc.paypal');
$rp = $cfg['general']['replace'];
$to = $cfg['general']['replace'] == ',' ? '.' : ',';
$amount = str_replace($rp, $to, $payment['summary']['sum_brutto']);
$values = array('entry' => $entry, 'amount' => preg_replace('/[^0-9\\.,]/', null, $amount), 'ppurl' => SPLang::replacePlaceHolders($data['ppurl']['value'], $entry), 'ppemail' => SPLang::replacePlaceHolders($data['ppemail']['value'], $entry), 'pprurl' => SPLang::replacePlaceHolders($data['pprurl']['value'], $entry), 'ppcc' => SPLang::replacePlaceHolders($data['ppcc']['value'], $entry));
$expl = SPLang::replacePlaceHolders(SPLang::getValue('ppexpl', 'plugin', Sobi::Section()), $values);
$subject = SPLang::replacePlaceHolders(SPLang::getValue('ppsubject', 'plugin', Sobi::Section()), $values);
$values['expl'] = $expl;
$values['subject'] = $subject;
$values['ip'] = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
$methods[$this->id] = array('content' => $message ? $this->raw($cfg, $values) : $this->content($cfg, $values), 'title' => Sobi::Txt('APP.PPP.PAY_TITLE'));
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:29,代码来源:init.php
示例20: validate
public function validate()
{
$type = $this->type == 'SobiProApp' ? 'application' : $this->type;
$schemaDef = SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd');
if (!SPFs::exists($schemaDef) || time() - filemtime($schemaDef) > 60 * 60 * 24 * 7) {
$connection = SPFactory::Instance('services.remote');
$def = "https://xml.sigsiu.net/SobiPro/{$type}.xsd";
$connection->setOptions(array('url' => $def, 'connecttimeout' => 10, 'header' => false, 'returntransfer' => true, 'ssl_verifypeer' => false, 'ssl_verifyhost' => 2));
$schema =& SPFactory::Instance('base.fs.file', SPLoader::path('lib.services.installers.schemas.' . $type, 'front', false, 'xsd'));
$file = $connection->exec();
if (!strlen($file)) {
throw new SPException(SPLang::e('CANNOT_ACCESS_SCHEMA_DEF', $def));
}
$schema->content($file);
$schema->save();
$schemaDef = $schema->filename();
}
if (!$this->definition->schemaValidate($schemaDef)) {
throw new SPException(SPLang::e('CANNOT_VALIDATE_SCHEMA_DEF_AT', str_replace(SOBI_ROOT . DS, null, $this->xmlFile), $def));
}
}
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:21,代码来源:installer.php
注:本文中的SPFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论