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


PHP Sobi::FixPath方法代码示例

本文整理汇总了PHP中Sobi::FixPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::FixPath方法的具体用法?PHP Sobi::FixPath怎么用?PHP Sobi::FixPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sobi的用法示例。


在下文中一共展示了Sobi::FixPath方法的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: __callStatic

 public static function __callStatic($name, $args)
 {
     if (defined('SOBIPRO_ADM')) {
         return call_user_func_array(array('self', '_' . $name), $args);
     } else {
         static $className = false;
         if (!$className) {
             $package = Sobi::Reg('current_template');
             if (SPFs::exists(Sobi::FixPath($package . '/input.php'))) {
                 $path = Sobi::FixPath($package . '/input.php');
                 ob_start();
                 $content = file_get_contents($path);
                 $class = array();
                 preg_match('/\\s*(class)\\s+(\\w+)/', $content, $class);
                 if (isset($class[2])) {
                     $className = $class[2];
                 } else {
                     Sobi::Error('Custom Input Class', SPLang::e('Cannot determine class name in file %s.', str_replace(SOBI_ROOT, null, $path)), SPC::WARNING, 0);
                     return false;
                 }
                 require_once $path;
             } else {
                 $className = true;
             }
         }
         if (is_string($className) && method_exists($className, $name)) {
             return call_user_func_array(array($className, $name), $args);
         } else {
             return call_user_func_array(array('self', '_' . $name), $args);
         }
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:32,代码来源:input.php

示例3: install

 public function install()
 {
     $id = $this->xGetString('id');
     $name = $this->xGetString('name');
     if (SPLoader::dirPath('usr.templates.' . $id) && !SPRequest::bool('force')) {
         throw new SPException(SPLang::e('TEMPLATE_INST_DUPLICATE', $name) . ' ' . Sobi::Txt('FORCE_TPL_UPDATE', Sobi::Url(array('task' => 'extensions.install', 'force' => 1, 'root' => basename($this->root) . '/' . basename($this->xmlFile)))));
     }
     $requirements = $this->xGetChilds('requirements/*');
     if ($requirements && $requirements instanceof DOMNodeList) {
         SPFactory::Instance('services.installers.requirements')->check($requirements);
     }
     $language = $this->xGetChilds('language/file');
     $folder = @$this->xGetChilds('language/@folder')->item(0)->nodeValue;
     if ($language && $language instanceof DOMNodeList && $language->length) {
         $langFiles = array();
         foreach ($language as $file) {
             $adm = false;
             if ($file->attributes->getNamedItem('admin')) {
                 $adm = $file->attributes->getNamedItem('admin')->nodeValue == 'true' ? true : false;
             }
             $langFiles[$file->attributes->getNamedItem('lang')->nodeValue][] = array('path' => Sobi::FixPath("{$this->root}/{$folder}/" . trim($file->nodeValue)), 'name' => $file->nodeValue, 'adm' => $adm);
         }
         SPFactory::CmsHelper()->installLang($langFiles, false, true);
     }
     $path = SPLoader::dirPath('usr.templates.' . $id, 'front', false);
     if (SPRequest::bool('force')) {
         /** @var $from SPDirectory */
         $from = SPFactory::Instance('base.fs.directory', $this->root);
         $from->moveFiles($path);
     } else {
         if (!SPFs::move($this->root, $path)) {
             throw new SPException(SPLang::e('CANNOT_MOVE_DIRECTORY', $this->root, $path));
         }
     }
     if (!SPRequest::bool('force')) {
         $section = $this->xGetChilds('install');
         if ($section instanceof DOMNodeList && $section->length) {
             $this->section($id);
         }
     }
     //05 Oct 2015 Kishore
     $exec = $this->xGetString('exec');
     if ($exec && SPFs::exists($path . DS . $exec)) {
         include_once "{$path}/{$exec}";
     }
     /** @var $dir SPDirectory */
     $dir =& SPFactory::Instance('base.fs.directory', $path);
     $zip = array_keys($dir->searchFile('.zip', false));
     if (count($zip)) {
         foreach ($zip as $file) {
             SPFs::delete($file);
         }
     }
     Sobi::Trigger('After', 'InstallTemplate', array($id));
     $dir =& SPFactory::Instance('base.fs.directory', SPLoader::dirPath('tmp.install'));
     $dir->deleteFiles();
     return Sobi::Txt('TP.TEMPLATE_HAS_BEEN_INSTALLED', array('template' => $name));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:58,代码来源:template.php

示例4: __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

示例5: moveFiles

 /**
  * Move files from directory to given path
  * @param string $target - target path
  * @return array
  */
 public function moveFiles($target)
 {
     $this->iterator();
     $log = array();
     foreach ($this->_dirIterator as $child) {
         if (!$child->isDot() && !SPFs::exists(Sobi::FixPath($target . DS . $child->getFileName()))) {
             if (SPFs::move($child->getPathname(), Sobi::FixPath($target . DS . $child->getFileName()))) {
                 $log[] = Sobi::FixPath($target . DS . $child->getFileName());
             }
         }
     }
     return $log;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:18,代码来源:directory.php

示例6: edit

 /**
  */
 private function edit()
 {
     $pid = $this->get('category.parent');
     $path = null;
     if (!$pid) {
         $pid = SPRequest::int('pid');
     }
     $this->assign($pid, 'parent');
     $id = $this->get('category.id');
     if ($id) {
         $this->addHidden($id, 'category.id');
     }
     if (!strstr($this->get('category.icon'), 'font')) {
         if ($this->get('category.icon') && SPFs::exists(Sobi::Cfg('images.category_icons') . '/' . $this->get('category.icon'))) {
             $i = Sobi::FixPath(Sobi::Cfg('images.category_icons_live') . $this->get('category.icon'));
             $this->assign($i, 'category_icon');
         } else {
             $i = Sobi::FixPath(Sobi::Cfg('images.category_icons_live') . Sobi::Cfg('icons.default_selector_image', 'image.png'));
             $this->assign($i, 'category_icon');
         }
     }
     //		else {
     //			$i = SPLang::clean( $this->get( 'category.icon' ) );
     //			$this->assign( $i, 'category_icon' );
     //		}
     /* if editing - get the full path. Otherwise get the path of the parent element */
     $id = $id ? $id : $pid;
     if ($this->get('category.id')) {
         $path = $this->parentPath($id);
         $parentCat = $this->parentPath($id, false, true);
     } else {
         $path = $this->parentPath(SPRequest::sid());
         $parentCat = $this->parentPath(SPRequest::sid(), false, true, 1);
     }
     $this->assign($path, 'parent_path');
     $this->assign($parentCat, 'parent_cat');
     if (SPRequest::sid()) {
         $this->assign(Sobi::Url(array('task' => 'category.chooser', 'sid' => SPRequest::sid(), 'out' => 'html'), true), 'cat_chooser_url');
     } elseif (SPRequest::int('pid')) {
         $this->assign(Sobi::Url(array('task' => 'category.chooser', 'pid' => SPRequest::int('pid'), 'out' => 'html'), true), 'cat_chooser_url');
     }
     $this->assign(Sobi::Url(array('task' => 'category.icon', 'out' => 'html'), true), 'icon_chooser_url');
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:45,代码来源:category.php

示例7: cachedView

 public function cachedView($xml, $template, $cacheId, $config = array())
 {
     $this->_xml = $xml;
     Sobi::Trigger('Start', ucfirst(__FUNCTION__), array(&$this->_xml));
     $templatePackage = SPLoader::translateDirPath(Sobi::Cfg('section.template'), 'templates');
     $templateOverride = SPRequest::cmd('sptpl');
     if ($templateOverride) {
         if (strstr($templateOverride, '.')) {
             $templateOverride = str_replace('.', '/', $templateOverride);
         }
         $template = $templateOverride . '.xsl';
     }
     if (file_exists(Sobi::FixPath($templatePackage . '/' . $template))) {
         $template = Sobi::FixPath($templatePackage . '/' . $template);
     } else {
         $type = SPFactory::db()->select('oType', 'spdb_object', array('id' => SPRequest::sid()))->loadResult();
         $template = $templatePackage . '/' . $type . '/' . $template;
     }
     SPFactory::registry()->set('current_template', $templatePackage);
     $this->_templatePath = $templatePackage;
     $this->_template = str_replace('.xsl', null, $template);
     $ini = array();
     if (count($config)) {
         foreach ($config as $file) {
             $file = parse_ini_file($file, true);
             foreach ($file as $section => $keys) {
                 if (isset($ini[$section])) {
                     $ini[$section] = array_merge($ini[$section], $keys);
                 } else {
                     $ini[$section] = $keys;
                 }
             }
         }
     }
     $this->setConfig($ini, SPRequest::task('get'));
     $this->parseXml();
     $this->validateData($cacheId);
     Sobi::Trigger('After', ucfirst(__FUNCTION__), array(&$this->_xml));
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:39,代码来源:cache.php

示例8: addHead

 /**
  * @param array $head
  * @return bool
  */
 public function addHead($head)
 {
     if (strlen(SPRequest::cmd('format')) && SPRequest::cmd('format') != 'html') {
         return true;
     }
     /** @var JDocument $document */
     $document = JFactory::getDocument();
     $c = 0;
     if (count($head)) {
         $document->addCustomTag("\n\t<!--  SobiPro Head Tags Output  -->\n");
         $document->addCustomTag("\n\t<script type=\"text/javascript\">/*\n<![CDATA[*/ \n\tvar SobiProUrl = '" . Sobi::FixPath(self::Url(array('task' => '%task%'), true, false, true)) . "'; \n\tvar SobiProSection = " . (Sobi::Section() ? Sobi::Section() : 0) . "; \n\tvar SPLiveSite = '" . Sobi::Cfg('live_site') . "'; \n/*]]>*/\n</script>\n");
         if (defined('SOBI_ADM_PATH')) {
             $document->addCustomTag("\n\t<script type=\"text/javascript\">/* <![CDATA[ */ \n\tvar SobiProAdmUrl = '" . Sobi::FixPath(Sobi::Cfg('live_site') . SOBI_ADM_FOLDER . '/' . self::Url(array('task' => '%task%'), true, false)) . "'; \n/* ]]> */</script>\n");
         }
         foreach ($head as $type => $code) {
             switch ($type) {
                 default:
                     if (count($code)) {
                         foreach ($code as $html) {
                             ++$c;
                             $document->addCustomTag($html);
                         }
                     }
                     break;
                 case 'robots':
                 case 'author':
                     $document->setMetaData($type, implode(', ', $code));
                     //						$document->setHeadData( array( $type => implode( ', ', $code ) ) );
                     break;
                 case 'keywords':
                     $metaKeys = trim(implode(', ', $code));
                     if (Sobi::Cfg('meta.keys_append', true)) {
                         $metaKeys .= Sobi::Cfg('string.meta_keys_separator', ',') . $document->getMetaData('keywords');
                     }
                     $metaKeys = explode(Sobi::Cfg('string.meta_keys_separator', ','), $metaKeys);
                     if (count($metaKeys)) {
                         $metaKeys = array_unique($metaKeys);
                         foreach ($metaKeys as $i => $p) {
                             if (strlen(trim($p))) {
                                 $metaKeys[$i] = trim($p);
                             } else {
                                 unset($metaKeys[$i]);
                             }
                         }
                         $metaKeys = implode(', ', $metaKeys);
                     } else {
                         $metaKeys = null;
                     }
                     $document->setMetadata('keywords', $metaKeys);
                     break;
                 case 'description':
                     $metaDesc = implode(Sobi::Cfg('string.meta_desc_separator', ' '), $code);
                     if (strlen($metaDesc)) {
                         if (Sobi::Cfg('meta.desc_append', true)) {
                             $metaDesc .= $this->getMetaDescription($document);
                         }
                         $metaDesc = explode(' ', $metaDesc);
                         if (count($metaDesc)) {
                             foreach ($metaDesc as $i => $p) {
                                 if (strlen(trim($p))) {
                                     $metaDesc[$i] = trim($p);
                                 } else {
                                     unset($metaDesc[$i]);
                                 }
                             }
                             $metaDesc = implode(' ', $metaDesc);
                         } else {
                             $metaDesc = null;
                         }
                         $document->setDescription($metaDesc);
                     }
                     break;
             }
         }
         $jsUrl = Sobi::FixPath(self::Url(array('task' => 'txt.js', 'format' => 'json'), true, false, false));
         $document->addCustomTag("\n\t<script type=\"text/javascript\" src=\"" . str_replace('&', '&amp;', $jsUrl) . "\"></script>\n");
         $c++;
         $document->addCustomTag("\n\t<!--  SobiPro ({$c}) Head Tags Output -->\n");
         // we would like to set our own canonical please :P
         // https://groups.google.com/forum/?fromgroups=#!topic/joomla-dev-cms/sF3-JBQspQU
         if (count($document->_links)) {
             foreach ($document->_links as $index => $link) {
                 if ($link['relation'] == 'canonical') {
                     unset($document->_links[$index]);
                 }
             }
         }
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:93,代码来源:mainframe.php

示例9: travelTpl

 /**
  * @param $dir SPDirectoryIterator
  * @param $nodes string
  * @param $current int
  * @param $count
  * @param bool $package
  * @return void
  */
 private function travelTpl($dir, &$nodes, $current, &$count, $package = false)
 {
     $ls = Sobi::FixPath(Sobi::Cfg('img_folder_live') . '/tree');
     static $root = null;
     if (!$root) {
         $root = new SPFile(SOBI_PATH);
     }
     $exceptions = array('config.xml', 'config.json');
     foreach ($dir as $file) {
         $task = null;
         $fileName = $file->getFilename();
         if (in_array($fileName, $exceptions)) {
             continue;
         }
         if ($file->isDot()) {
             continue;
         }
         $count++;
         if ($file->isDir()) {
             if ($current == 0 || $package) {
                 if (strstr($file->getPathname(), $root->getPathname())) {
                     $filePath = str_replace($root->getPathname() . '/usr/templates/', null, $file->getPathname());
                 } else {
                     $filePath = 'cms:' . str_replace(SOBI_ROOT . '/', null, $file->getPathname());
                 }
                 $filePath = str_replace('/', '.', $filePath);
                 $insertTask = Sobi::Url(array('task' => 'template.info', 'template' => $filePath));
                 $nodes .= "spTpl.add( {$count}, {$current},'{$fileName}','', '', '', '{$ls}/imgfolder.gif', '{$ls}/imgfolder.gif' );\n";
                 if (!Sobi::Section()) {
                     $count2 = $count * -100;
                     $fileName = Sobi::Txt('TP.INFO');
                     $nodes .= "spTpl.add( {$count2}, {$count},'{$fileName}','{$insertTask}', '', '', '{$ls}/info.png' );\n";
                     if (file_exists($file->getPathname() . "/config.xml")) {
                         $fileName = Sobi::Txt('TP.SETTINGS');
                         $count2--;
                         $insertTask = Sobi::Url(array('task' => 'template.settings', 'template' => $filePath));
                         $nodes .= "spTpl.add( {$count2}, {$count},'{$fileName}','{$insertTask}', '', '', '{$ls}/settings.png' );\n";
                     }
                 }
             } else {
                 $nodes .= "spTpl.add( {$count}, {$current},'{$fileName}','');\n";
             }
             $this->travelTpl(new SPDirectoryIterator($file->getPathname()), $nodes, $count, $count);
         } else {
             $ext = SPFs::getExt($fileName);
             if (in_array($ext, array('htaccess', 'zip')) || $fileName == 'index.html') {
                 continue;
             }
             switch (strtolower($ext)) {
                 case 'php':
                     $ico = $ls . '/php.png';
                     break;
                 case 'xml':
                     $ico = $ls . '/xml.png';
                     break;
                 case 'xsl':
                     $ico = $ls . '/xsl.png';
                     break;
                 case 'css':
                     $ico = $ls . '/css.png';
                     break;
                 case 'jpg':
                 case 'jpeg':
                 case 'png':
                 case 'bmp':
                 case 'gif':
                     $ico = $ls . '/img.png';
                     $task = 'javascript:void(0);';
                     break;
                 case 'ini':
                     $ico = $ls . '/ini.png';
                     break;
                 case 'less':
                     $ico = $ls . '/less.png';
                     break;
                 case 'js':
                     $ico = $ls . '/js.png';
                     break;
                 default:
                     $ico = $ls . '/page.gif';
             }
             if (!$task) {
                 if (strstr($file->getPathname(), $root->getPathname())) {
                     $filePath = str_replace($root->getPathname() . '/usr/templates/', null, $file->getPathname());
                 } else {
                     $filePath = 'cms:' . str_replace(SOBI_ROOT . DS, null, $file->getPathname());
                 }
                 $filePath = str_replace('/', '.', $filePath);
                 if (Sobi::Section()) {
                     $task = Sobi::Url(array('task' => 'template.edit', 'file' => $filePath, 'sid' => Sobi::Section()));
                 } else {
                     $task = Sobi::Url(array('task' => 'template.edit', 'file' => $filePath));
//.........这里部分代码省略.........
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:101,代码来源:config.php

示例10: parseResponse

 protected function parseResponse($response)
 {
     if (!strlen($response)) {
         return 204;
     }
     $links = array();
     if (strlen($response) && strstr($response, 'SobiPro')) {
         // we need to limit the "explode" to two pieces only because otherwise
         // if the separator is used somewhere in the <body> it will be split into more pieces
         list($header, $response) = explode("\r\n\r\n", $response, 2);
         $header = explode("\n", $header);
         $SobiPro = false;
         foreach ($header as $line) {
             if (strstr($line, 'SobiPro')) {
                 $line = explode(':', $line);
                 if (trim($line[0]) == 'SobiPro') {
                     $sid = trim($line[1]);
                     if ($sid != Sobi::Section()) {
                         return 412;
                     } else {
                         $SobiPro = true;
                     }
                 }
             }
         }
         if (!$SobiPro) {
             return 412;
         }
         preg_match_all('/href=[\'"]?([^\'" >]+)/', $response, $links, PREG_PATTERN_ORDER);
         if (isset($links[1]) && $links[1]) {
             $liveSite = Sobi::Cfg('live_site');
             $host = Sobi::Cfg('live_site_root');
             $links = array_unique($links[1]);
             foreach ($links as $index => $link) {
                 $link = trim($link);
                 $http = preg_match('/http[s]?:\\/\\/.*/i', $link);
                 if (!strlen($link)) {
                     unset($links[$index]);
                 } elseif (strstr($link, '#')) {
                     $link = explode('#', $link);
                     if (strlen($link[0])) {
                         $links[$index] = Sobi::FixPath($host . '/' . $link[0]);
                     } else {
                         unset($links[$index]);
                     }
                 } elseif ($http && !strstr($link, $liveSite)) {
                     unset($links[$index]);
                 } elseif (!$http) {
                     $links[$index] = Sobi::FixPath($host . '/' . $link);
                 }
             }
         }
         return $links;
     } else {
         return 501;
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:57,代码来源:crawler.php

示例11: remove

 public function remove()
 {
     $pid = $this->xGetString('id');
     $function = $this->xGetString('uninstall');
     if ($function) {
         $obj = explode(':', $function);
         $function = $obj[1];
         $obj = $obj[0];
         return SPFactory::Instance($obj)->{$function}($this->definition);
     }
     $permissions = $this->xGetChilds('installLog/permissions/*');
     if ($permissions && $permissions instanceof DOMNodeList) {
         $permsCtrl =& SPFactory::Instance('ctrl.adm.acl');
         for ($i = 0; $i < $permissions->length; $i++) {
             $perm = explode('.', $permissions->item($i)->nodeValue);
             $permsCtrl->removePermission($perm[0], $perm[1], $perm[2]);
         }
     }
     /** it doesn't make much sense that way - a backup is ok but this action is called uninstall and not revert */
     //		$mods = $this->xGetChilds( 'installLog/modified/*' );
     //		if ( $mods && ( $mods instanceof DOMNodeList ) ) {
     //			$this->revert( $mods );
     //		}
     $files = $this->xGetChilds('installLog/files/*');
     if ($files && $files instanceof DOMNodeList) {
         for ($i = 0; $i < $files->length; $i++) {
             $file = $files->item($i)->nodeValue;
             if (!strstr($file, SOBI_ROOT)) {
                 $file = Sobi::FixPath(SOBI_ROOT . "/{$file}");
             }
             if (SPFs::exists($file)) {
                 SPFs::delete($file);
             }
         }
     }
     $actions = $this->xGetChilds('installLog/actions/*');
     if ($actions && $actions instanceof DOMNodeList) {
         for ($i = 0; $i < $actions->length; $i++) {
             try {
                 SPFactory::db()->delete('spdb_plugin_task', array('pid' => $pid, 'onAction' => $actions->item($i)->nodeValue));
             } catch (SPException $x) {
                 Sobi::Error('installer', SPLang::e('Cannot remove plugin task "%s". Db query failed. Error: %s', $actions->item($i)->nodeValue, $x->getMessage()), SPC::WARNING, 0);
             }
         }
         if ($this->xGetString('type') == 'payment') {
             try {
                 SPFactory::db()->delete('spdb_plugin_task', array('pid' => $pid, 'onAction' => 'PaymentMethodView'));
             } catch (SPException $x) {
                 Sobi::Error('installer', SPLang::e('Cannot remove plugin task "PaymentMethodView". Db query failed. Error: %s', $x->getMessage()), SPC::WARNING, 0);
             }
         }
     }
     $field = $this->xdef->query("/{$this->type}/fieldType[@typeId]");
     if ($field && $field->length) {
         try {
             SPFactory::db()->delete('spdb_field_types', array('tid' => $field->item(0)->getAttribute('typeId')));
         } catch (SPException $x) {
             Sobi::Error('installer', SPLang::e('CANNOT_REMOVE_FIELD_DB_ERR', $field->item(0)->getAttribute('typeId'), $x->getMessage()), SPC::WARNING, 0);
         }
     }
     $tables = $this->xGetChilds('installLog/sql/tables/*');
     if ($tables && $tables instanceof DOMNodeList) {
         for ($i = 0; $i < $tables->length; $i++) {
             try {
                 SPFactory::db()->drop($tables->item($i)->nodeValue);
             } catch (SPException $x) {
                 Sobi::Error('installer', SPLang::e('CANNOT_DROP_TABLE', $tables->item($i)->nodeValue, $x->getMessage()), SPC::WARNING, 0);
             }
         }
     }
     $inserts = $this->xGetChilds('installLog/sql/queries/*');
     if ($inserts && $inserts instanceof DOMNodeList) {
         for ($i = 0; $i < $inserts->length; $i++) {
             $table = $inserts->item($i)->attributes->getNamedItem('table')->nodeValue;
             $where = array();
             $cols = $inserts->item($i)->childNodes;
             if ($cols->length) {
                 for ($j = 0; $j < $cols->length; $j++) {
                     $where[$cols->item($j)->nodeName] = $cols->item($j)->nodeValue;
                 }
             }
             try {
                 SPFactory::db()->delete($table, $where, 1);
             } catch (SPException $x) {
                 Sobi::Error('installer', SPLang::e('CANNOT_DELETE_DB_ENTRIES', $table, $x->getMessage()), SPC::WARNING, 0);
             }
         }
     }
     $type = strlen($this->xGetString('type')) ? $this->xGetString('type') : ($this->xGetString('fieldType') ? 'field' : null);
     switch ($type) {
         default:
         case 'SobiProApp':
         case 'plugin':
             $t = Sobi::Txt('EX.PLUGIN_TYPE');
             break;
         case 'field':
             $t = Sobi::Txt('EX.FIELD_TYPE');
             break;
         case 'payment':
             $t = Sobi::Txt('EX.PAYMENT_METHOD_TYPE');
//.........这里部分代码省略.........
开发者ID:pelloq1,项目名称:SobiPro,代码行数:101,代码来源:sobiproapp.php

示例12: _cssFiles

 private function _cssFiles()
 {
     if (Sobi::Cfg('cache.include_css_files', false) && !defined('SOBIPRO_ADM')) {
         if (count($this->_cache['css'])) {
             /* * create the right checksum */
             $check = array('section' => Sobi::Section());
             foreach ($this->_cache['css'] as $file) {
                 if (file_exists($file)) {
                     $check[$file] = filemtime($file);
                 }
             }
             $check = md5(serialize($check));
             if (!SPFs::exists(SOBI_PATH . "/var/css/{$check}.css")) {
                 $cssContent = "\n/* Created at: " . date(SPFactory::config()->key('date.log_format', 'D M j G:i:s T Y')) . " */\n";
                 foreach ($this->_cache['css'] as $file) {
                     $fName = str_replace(Sobi::FixPath(SOBI_ROOT), null, $file);
                     $cssContent .= "\n/**  \n========\nFile: {$fName}\n========\n*/\n";
                     $fc = SPFs::read($file);
                     preg_match_all('/[^\\(]*url\\(([^\\)]*)/', $fc, $matches);
                     // we have to replace url relative path
                     $fPath = str_replace(Sobi::FixPath(SOBI_ROOT . '/'), SPFactory::config()->get('live_site'), $file);
                     $fPath = str_replace('\\', '/', $fPath);
                     $fPath = explode('/', $fPath);
                     if (count($matches[1])) {
                         foreach ($matches[1] as $url) {
                             // if it is already absolute - skip or from root
                             if (preg_match('|http(s)?://|', $url) || preg_match('|url\\(["\\s]*/|', $url)) {
                                 continue;
                             } elseif (strpos($url, '/') === 0) {
                                 continue;
                             }
                             $c = preg_match_all('|\\.\\./|', $url, $c) + 1;
                             $tempFile = array_reverse($fPath);
                             for ($i = 0; $i < $c; $i++) {
                                 unset($tempFile[$i]);
                             }
                             $rPath = Sobi::FixPath(implode('/', array_reverse($tempFile)));
                             if ($c > 1) {
                                 //WHY?!!
                                 //$realUrl = Sobi::FixPath( str_replace( '..', $rPath, $url ) );
                                 $realUrl = Sobi::FixPath($rPath . '/' . str_replace('../', null, $url));
                             } else {
                                 $realUrl = Sobi::FixPath($rPath . '/' . $url);
                             }
                             $realUrl = str_replace(array('"', "'", ' '), null, $realUrl);
                             $fc = str_replace($url, $realUrl, $fc);
                         }
                     }
                     // and add to content
                     $cssContent .= $fc;
                 }
                 SPFs::write(SOBI_PATH . "/var/css/{$check}.css", $cssContent);
             }
             $cfile = SPLoader::CssFile('front.var.css.' . $check, false, true, true);
             $this->cssFiles[++$this->count] = "<link rel=\"stylesheet\" href=\"{$cfile}\" type=\"text/css\" />";
         }
     }
     return $this->cssFiles;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:59,代码来源:header.php

示例13: cleanDir

 protected function cleanDir($dir, $ext, $force = false)
 {
     if ($dir) {
         $js = scandir($dir);
         if (count($js)) {
             foreach ($js as $file) {
                 if ($file != '.' && $file != '..' && is_file(Sobi::FixPath("{$dir}/{$file}")) && (SPFs::getExt($file) == $ext || $ext == -1) && ($force || time() - filemtime(Sobi::FixPath("{$dir}/{$file}")) > 60 * 60 * 24 * 7)) {
                     SPFs::delete(Sobi::FixPath("{$dir}/{$file}"));
                 }
             }
         }
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:13,代码来源:cache.php

示例14: mkdir

 /**
  * @param string $path
  * @param int $mode
  * @throws SPException
  * @return bool
  */
 public static function mkdir($path, $mode = 0755)
 {
     $path = Sobi::FixPath($path);
     if (!JFolder::create($path, $mode)) {
         throw new SPException(SPLang::e('CANNOT_CREATE_DIR', str_replace(SOBI_ROOT, null, $path)));
     } else {
         return true;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:15,代码来源:fs.php

示例15: createScript

 /**
  */
 private function createScript($lastNode, $childs, $matrix, $head)
 {
     $params = array();
     $params['ID'] = $this->_id;
     $params['LAST_NODE'] = (string) $lastNode;
     $params['IMAGES_ARR'] = null;
     $params['IMAGES_MATRIX'] = $matrix;
     foreach ($this->_images as $img => $loc) {
         $params['IMAGES_ARR'] .= "\n{$this->_id}_stmImgs[ '{$img}' ] = '{$loc}';";
     }
     $params['URL'] = Sobi::Url(array('task' => $this->_task, 'sid' => $this->_sid, 'out' => 'xml', 'expand' => '__JS__', 'pid' => '__JS2__'), true, false);
     $params['URL'] = str_replace('__JS__', '" + ' . $this->_id . '_stmcid + "', $params['URL']);
     $params['URL'] = str_replace('__JS2__', '" + ' . $this->_id . '_stmPid + "', $params['URL']);
     $params['FAIL_MSG'] = Sobi::Txt('AJAX_FAIL');
     $params['TAG'] = $this->_tag;
     $params['SPINNER'] = Sobi::FixPath(Sobi::Cfg('img_folder_live') . '/adm/spinner.gif');
     Sobi::Trigger('SigsiuTree', ucfirst(__FUNCTION__), array(&$params));
     $head->addJsVarFile('tree', md5(count($childs, COUNT_RECURSIVE) . $this->_id . $this->_sid . $this->_task . serialize($params)), $params);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:21,代码来源:tree.php


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