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


PHP waFiles::listdir方法代码示例

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


在下文中一共展示了waFiles::listdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $path = $this->getConfig()->getConfigPath('data/welcome/', false);
     if (file_exists($path)) {
         $files = waFiles::listdir($path, false);
         $this->types = shopTypeModel::getTemplates();
         foreach ($files as $file) {
             if (preg_match('/^country_([a-z]{3})\\.php$/', $file, $matches)) {
                 $this->countries[$matches[1]] = $matches[1];
             }
         }
     }
     $locale_path = $path . 'locale/' . $this->getUser()->getLocale() . '.php';
     if (file_exists($locale_path)) {
         $this->translate = (include $locale_path);
         if (!is_array($this->translate)) {
             $this->translate = array();
         }
     }
     if (waRequest::post()) {
         $app_settings_model = new waAppSettingsModel();
         $app_settings_model->del('shop', 'welcome');
         $this->setup();
     } else {
         $this->overview();
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:shopBackendWelcome.action.php

示例2: flushCache

 protected function flushCache()
 {
     $config = wa()->getConfig();
     $path_cache = $config->getPath('cache');
     waFiles::protect($path_cache);
     $caches = array();
     $paths = waFiles::listdir($path_cache);
     foreach ($paths as $path) {
         #skip long action & data path
         if ($path != 'temp') {
             $path = $path_cache . '/' . $path;
             if (is_dir($path)) {
                 $caches[] = $path;
             }
         }
     }
     $root_path = $config->getRootPath();
     $errors = array();
     foreach ($caches as $path) {
         try {
             waFiles::delete($path);
         } catch (Exception $ex) {
             $errors[] = str_replace($root_path . DIRECTORY_SEPARATOR, '', $ex->getMessage());
             waFiles::delete($path, true);
         }
     }
     waFiles::protect($path_cache);
     return $errors;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:29,代码来源:webasystCreateCliController.class.php

示例3: enumerate

 /**
  * Список доступных плагинов
  * @param $options array
  * @return array
  */
 public static function enumerate($options = array(), $type = null)
 {
     $plugins = array();
     foreach (waFiles::listdir(self::getPath($type)) as $id) {
         if ($info = self::info($id, $options = array(), $type)) {
             $plugins[$id] = $info;
         }
     }
     return $plugins;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:15,代码来源:waSystemPlugin.class.php

示例4: execute

 public function execute()
 {
     $path = dirname(__FILE__);
     $files = waFiles::listdir($path);
     print "available CLI actions:\n";
     $callback = create_function('$m', 'return strtolower($m[1]);');
     $actions = array();
     foreach ($files as $file) {
         if (preg_match('/^webasyst(\\w+)\\.cli\\.php$/', $file, $matches)) {
             $action = preg_replace_callback('/^([\\w]{1})/', $callback, $matches[1]);
             $actions[] = $action;
         }
     }
     asort($actions);
     print implode("\n", $actions);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:16,代码来源:webasystHelp.cli.php

示例5: execute

 public function execute()
 {
     try {
         $message = array();
         $settings = waRequest::get('setting');
         if ($settings) {
             $model = new waAppSettingsModel();
             $changed = false;
             foreach ((array) $settings as $setting) {
                 if (in_array($setting, array('auth_form_background'))) {
                     $images_path = wa()->getDataPath(null, true, 'webasyst');
                     if ($images = waFiles::listdir($images_path)) {
                         foreach ($images as $image) {
                             if (is_file($images_path . '/' . $image) && !preg_match('@\\.(jpe?g|png|gif|bmp)$@', $image)) {
                                 waFiles::delete($images_path . "/" . $image);
                             }
                         }
                         $message[] = _w('Image deleted');
                     }
                 } else {
                     $changed = true;
                 }
                 $model->del('webasyst', $setting);
             }
             if ($changed) {
                 $message[] = _w('Settings saved');
             }
         }
         $params = array('module' => 'settings', 'msg' => installerMessage::getInstance()->raiseMessage(implode(', ', $message)));
         $this->redirect($params);
     } catch (waException $ex) {
         $msg = installerMessage::getInstance()->raiseMessage($ex->getMessage(), installerMessage::R_FAIL);
         $params = array('module' => 'settings', 'msg' => $msg);
         $this->redirect($params);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:36,代码来源:installerSettingsRemove.action.php

示例6: flushCache

 public static function flushCache($apps = array())
 {
     $path_cache = waConfig::get('wa_path_cache');
     waFiles::protect($path_cache);
     $caches = array();
     $paths = waFiles::listdir($path_cache);
     foreach ($paths as $path) {
         #skip long action & data path
         if ($path != 'temp') {
             $path = $path_cache . '/' . $path;
             if (is_dir($path)) {
                 $caches[] = $path;
             }
         }
     }
     if ($apps) {
         $app_path = waConfig::get('wa_path_apps');
         foreach ($apps as $app) {
             if (!empty($app['installed'])) {
                 $caches[] = $app_path . '/' . $app['slug'] . '/js/compiled';
             }
         }
     }
     $caches[] = $path_cache . '/temp';
     $root_path = wa()->getConfig()->getRootPath();
     $errors = array();
     foreach ($caches as $path) {
         try {
             waFiles::delete($path);
         } catch (Exception $ex) {
             $errors[] = str_replace($root_path . DIRECTORY_SEPARATOR, '', $ex->getMessage());
             waFiles::delete($path, true);
         }
     }
     return $errors;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:36,代码来源:installerHelper.class.php

示例7: event

 /**
  * Trigger event with given $name from current active application.
  *
  * @param  string    $name        Event name.
  * @param  mixed     $params      Parameters passed to event handlers.
  * @param  string[]  $array_keys  Array of expected template items for UI events.
  * @return  array  app_id or plugin_id => data returned from handler (unless null is returned)
  */
 public function event($name, &$params = null, $array_keys = null)
 {
     $result = array();
     if (is_array($name)) {
         $event_app_id = $name[0];
         $event_system = self::getInstance($event_app_id);
         $name = $name[1];
     } else {
         $event_app_id = $this->getConfig()->getApplication();
         $event_system = $this;
     }
     $event_prefix = wa($event_app_id)->getConfig()->getPrefix();
     if (!isset(self::$handlers['apps'])) {
         self::$handlers['apps'] = array();
         $cache_file = $this->config->getPath('cache', 'config/handlers');
         if (!waSystemConfig::isDebug() && file_exists($cache_file)) {
             self::$handlers['apps'] = (include $cache_file);
         }
         if (!self::$handlers['apps'] || !is_array(self::$handlers['apps'])) {
             $apps = $this->getApps();
             $path = $this->getConfig()->getPath('apps');
             foreach ($apps as $app_id => $app_info) {
                 $files = waFiles::listdir($path . '/' . $app_id . '/lib/handlers/');
                 foreach ($files as $file) {
                     if (substr($file, -12) == '.handler.php') {
                         $file = explode('.', substr($file, 0, -12), 2);
                         self::$handlers['apps'][$file[0]][$file[1]][] = $app_id;
                     }
                 }
             }
             if (!waSystemConfig::isDebug()) {
                 waUtils::varExportToFile(self::$handlers['apps'], $cache_file);
             }
         }
     }
     if (!isset(self::$handlers['plugins'][$event_app_id])) {
         self::$handlers['plugins'][$event_app_id] = array();
         $plugins = $event_system->getConfig()->getPlugins();
         foreach ($plugins as $plugin_id => $plugin) {
             if (!empty($plugin['handlers'])) {
                 foreach ($plugin['handlers'] as $handler_event => $handler_method) {
                     self::$handlers['plugins'][$event_app_id][$handler_event][$plugin_id] = $handler_method;
                 }
             }
         }
     }
     if (isset(self::$handlers['apps'][$event_app_id][$name])) {
         $path = $this->getConfig()->getPath('apps');
         foreach (self::$handlers['apps'][$event_app_id][$name] as $app_id) {
             $file_path = $path . '/' . $app_id . '/lib/handlers/' . $event_prefix . "." . $name . ".handler.php";
             if (!file_exists($file_path)) {
                 continue;
             }
             wa($app_id);
             include_once $file_path;
             $class_name = $name;
             if (strpos($name, '.') !== false) {
                 $class_name = strtok($class_name, '.') . ucfirst(strtok(''));
             }
             $class_name = $app_id . ucfirst($event_prefix) . ucfirst($class_name) . "Handler";
             /**
              * @var $handler waEventHandler
              */
             $handler = new $class_name();
             try {
                 $r = $handler->execute($params);
                 if ($r !== null) {
                     $result[$app_id] = $r;
                 }
             } catch (Exception $e) {
                 waLog::log('Event handling error in ' . $file_path . ': ' . $e->getMessage());
             }
         }
     }
     if (isset(self::$handlers['plugins'][$event_app_id][$name])) {
         $plugins = $event_system->getConfig()->getPlugins();
         foreach (self::$handlers['plugins'][$event_app_id][$name] as $plugin_id => $method) {
             if (!isset($plugins[$plugin_id])) {
                 continue;
             }
             $plugin = $plugins[$plugin_id];
             self::pushActivePlugin($plugin_id, $event_prefix);
             $class_name = $event_app_id . ucfirst($plugin_id) . 'Plugin';
             try {
                 $class = new $class_name($plugin);
                 // Load plugin locale if it exists
                 $locale_path = $this->getAppPath('plugins/' . $plugin_id . '/locale', $event_app_id);
                 if (is_dir($locale_path)) {
                     waLocale::load($this->getLocale(), $locale_path, self::getActiveLocaleDomain(), false);
                 }
                 if (method_exists($class, $method) && null !== ($r = $class->{$method}($params))) {
                     if ($array_keys && is_array($r)) {
//.........这里部分代码省略.........
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:101,代码来源:waSystem.class.php

示例8: getWidgets

 public function getWidgets()
 {
     if ($this->widgets === null) {
         $locale = wa()->getLocale();
         $file = waConfig::get('wa_path_cache') . "/apps/" . $this->application . '/config/widgets.' . $locale . '.php';
         if (!file_exists($file) || SystemConfig::isDebug()) {
             $this->widgets = array();
             if ($this->application == 'webasyst') {
                 $path = $this->getRootPath() . '/wa-widgets';
             } else {
                 $path = $this->getAppPath('widgets');
             }
             foreach (waFiles::listdir($path) as $widget_id) {
                 $widget_dir = $this->getWidgetPath($widget_id);
                 $widget_config = $widget_dir . "/lib/config/widget.php";
                 if (!is_dir($widget_dir) || !file_exists($widget_config)) {
                     continue;
                 }
                 $widget_info = (include $widget_config);
                 $widget_info['has_settings'] = file_exists($this->getWidgetPath($widget_id) . "/lib/config/settings.php");
                 waSystem::pushActivePlugin($widget_id, $this->application == 'webasyst' ? 'widget' : $this->application . '_widget');
                 // Load widget locale if it exists
                 if ($this->application == 'webasyst') {
                     $locale_path = waConfig::get('wa_path_widgets') . '/' . $widget_id . '/locale';
                 } else {
                     $locale_path = wa()->getAppPath('widgets/' . $widget_id . '/locale', $this->application);
                 }
                 if (is_dir($locale_path)) {
                     waLocale::load($locale, $locale_path, wa()->getActiveLocaleDomain(), false);
                 }
                 $widget_info['name'] = _wp($widget_info['name']);
                 if (isset($plugin_info['title'])) {
                     $widget_info['title'] = _wp($widget_info['title']);
                 }
                 if (isset($widget_info['description'])) {
                     $widget_info['description'] = _wp($widget_info['description']);
                 }
                 if (isset($widget_info['size'])) {
                     $sizes = array();
                     foreach ((array) $widget_info['size'] as $s) {
                         $sizes[] = explode('x', $s);
                     }
                     $widget_info['sizes'] = $sizes;
                 } else {
                     $widget_info['sizes'] = array(array(1, 1));
                 }
                 waSystem::popActivePlugin();
                 $widget_info['widget'] = $widget_id;
                 $widget_info['app_id'] = $this->application;
                 if (isset($widget_info['img'])) {
                     if ($this->application == 'webasyst') {
                         $widget_info['img'] = 'wa-widgets/' . $widget_id . '/' . $widget_info['img'];
                     } else {
                         $widget_info['img'] = 'wa-apps/' . $this->application . '/widgets/' . $widget_id . '/' . $widget_info['img'];
                     }
                 }
                 $this->widgets[$widget_id] = $widget_info;
             }
             if (!SystemConfig::isDebug()) {
                 waUtils::varExportToFile($this->widgets, $file);
             } else {
                 waFiles::delete($file);
             }
         } else {
             $this->widgets = (include $file);
         }
     }
     return $this->widgets;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:69,代码来源:waAppConfig.class.php

示例9: update

 public function update($only_if_not_modified = true)
 {
     if (!$this->path_custom || $this->type != self::OVERRIDDEN) {
         return true;
     }
     $files = $this->getFiles();
     $modified = array();
     foreach ($files as $f_id => $f) {
         if (!empty($f['modified'])) {
             $modified[] = $f_id;
             break;
         }
     }
     if ($only_if_not_modified && $modified) {
         return false;
     }
     $img_files = array();
     foreach ($this->getSettings() as $s) {
         if (ifset($s['control_type']) == 'image' && !empty($s['value'])) {
             $img_files[] = $s['value'];
         }
     }
     $source_path = $this->path_original;
     $target_path = $this->path_custom;
     $list_files = waFiles::listdir($source_path);
     $skip_pattern = '/\\.(files\\.md5|cvs|svn|git|php\\d*)$/';
     foreach ($list_files as $f) {
         // ignore files
         if ($f !== 'build.php') {
             foreach ((array) $skip_pattern as $pattern) {
                 if (preg_match($pattern, $f)) {
                     continue 2;
                 }
             }
         }
         // ignore image settings and modified
         if ($f == 'theme.xml' || in_array($f, $img_files) || in_array($f, $modified)) {
             continue;
         }
         try {
             waFiles::copy($source_path . '/' . $f, $target_path . '/' . $f);
         } catch (waException $e) {
         }
     }
     if ($this->type == self::OVERRIDDEN) {
         $theme_original = new waTheme($this->id, $this->app_id, self::ORIGINAL);
         $this->version = $theme_original->version;
         foreach ($theme_original->getFiles(true) as $f_id => $f) {
             if (empty($files[$f_id])) {
                 $this->setFiles(array($f_id => $f));
             }
         }
         foreach ($theme_original->getSettings('full') as $var => $s) {
             if (!isset($this->info['settings'][$var])) {
                 $this->info['settings'][$var] = $s;
                 $this->settings[$var]['value'] = ifset($s['value'], '');
                 $this->changed['settings'][$var] = true;
             } else {
                 $old_s = $this->info['settings'][$var];
                 if (ifset($old_s['control_type']) != ifset($s['control_type']) || ifset($old_s['options']) != ifset($s['options'])) {
                     $s['value'] = ifset($old_s['value'], '');
                     $this->info['settings'][$var] = $s;
                     $this->settings[$var]['value'] = $s['value'];
                     $this->changed['settings'][$var] = true;
                 }
             }
         }
         $this->save();
     }
     return true;
 }
开发者ID:quadrodesign,项目名称:webasyst-framework,代码行数:71,代码来源:waTheme.class.php

示例10: getTemplates

 /**
  * @return array
  */
 public static function getTemplates()
 {
     static $types = null;
     if ($types === null) {
         $types = array();
         $path = wa('shop')->getConfig()->getConfigPath('data/welcome/', false);
         if (file_exists($path)) {
             $files = waFiles::listdir($path, false);
             foreach ($files as $file) {
                 if (preg_match('/^type_([a-z]\\w+)\\.php$/', $file, $matches)) {
                     $types[$matches[1]] = (include $path . $file);
                 }
             }
         }
         $locale_path = $path . 'locale/' . wa()->getUser()->getLocale() . '.php';
         if (file_exists($locale_path)) {
             self::$translate = (include $locale_path);
             if (!is_array(self::$translate)) {
                 self::$translate = array();
             }
         }
         if (!empty($types)) {
             foreach ($types as $id => &$type) {
                 $name = ifempty($type['name'], $id);
                 $type['name'] = ifempty(self::$translate[$name], $name);
                 $type += array('icon' => '', 'description' => '');
             }
         }
     }
     return $types;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:shopType.model.php

示例11: getAll

 /**
  * @param bool $type
  * @param bool $enabled_only
  * @return array|null
  * @throws waException
  */
 public static function getAll($type = false, $enabled_only = true)
 {
     $locale_config = waSystem::getInstance()->getConfigPath() . '/locale.php';
     if (file_exists($locale_config)) {
         $enabled_locales = (include $locale_config);
         $ttl = time() - filemtime($locale_config);
     } else {
         $enabled_locales = array('en_US', 'ru_RU');
         $ttl = 86400;
     }
     $cache = new waSystemCache('config/locale', $ttl);
     if ($cache->isCached()) {
         $data = $cache->get();
     } else {
         $data = array();
         foreach ($enabled_locales as $locale) {
             if ($info = self::getInfo($locale)) {
                 $data[$locale] = $info;
             }
         }
         $files = waFiles::listdir(dirname(__FILE__) . "/data/");
         foreach ($files as $file) {
             if (preg_match('/^([a-zA-Z_]+)\\.php$/', $file, $matches)) {
                 $locale = $matches[1];
                 if (!isset($data[$locale]) && ($info = self::getInfo($locale))) {
                     $data[$locale] = $info;
                 }
             }
         }
         $cache->set($data);
     }
     if ($enabled_only) {
         $result = array();
         foreach ($enabled_locales as $locale) {
             if (isset($data[$locale])) {
                 $result[$locale] = $data[$locale];
             }
         }
         $data = $result;
     }
     if ($type === true) {
         $type = 'all';
     }
     switch ($type) {
         case 'name_region':
             foreach ($data as &$d) {
                 $d = $d['name'] . " (" . $d['region'] . ')';
             }
             asort($data);
             break;
         case 'name':
             foreach ($data as &$d) {
                 $d = $d['name'];
             }
             asort($data);
             break;
         case false:
             return array_keys($data);
         default:
             return $data;
     }
     return $data;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:69,代码来源:waLocale.class.php

示例12: getClasses

 public function getClasses()
 {
     $cache_file = waConfig::get('wa_path_cache') . '/apps/' . $this->application . '/config/autoload.php';
     if (self::isDebug() || !file_exists($cache_file)) {
         waFiles::create(waConfig::get('wa_path_cache') . '/apps/' . $this->application . '/config');
         $paths = array($this->getAppPath() . '/lib/');
         $all_plugins = waFiles::listdir($this->getAppPath() . '/plugins');
         foreach ($all_plugins as $plugin_id) {
             $path = $this->getPluginPath($plugin_id) . '/lib/';
             if (file_exists($path)) {
                 $paths[] = $path;
             }
         }
         if (file_exists($this->getAppPath() . '/api')) {
             $v = waRequest::request('v', 1, 'int');
             if (file_exists($this->getAppPath() . '/api/v' . $v)) {
                 $paths[] = $this->getAppPath() . '/api/v' . $v . '/';
             }
         }
         $result = array();
         $length = strlen($this->getRootPath());
         foreach ($paths as $path) {
             $files = $this->getPHPFiles($path);
             foreach ($files as $file) {
                 $class = $this->getClassByFilename(basename($file));
                 if ($class) {
                     $result[$class] = substr($file, $length + 1);
                 }
             }
         }
         if (!self::isDebug()) {
             waUtils::varExportToFile($result, $cache_file);
         } else {
             waFiles::delete($cache_file);
         }
         return $result;
     }
     return include $cache_file;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:39,代码来源:waAppConfig.class.php

示例13: reset

    private function reset()
    {
        /**
         * @event reset
         *
         * Notify plugins about reset all settings
         *
         * @param void
         * @return void
         */
        wa()->event('reset');
        //XXX hardcode
        $tables = array('shop_page', 'shop_page_params', 'shop_category', 'shop_category_params', 'shop_category_products', 'shop_category_routes', 'shop_product', 'shop_product_params', 'shop_product_features', 'shop_product_features_selectable', 'shop_product_images', 'shop_product_pages', 'shop_product_related', 'shop_product_reviews', 'shop_product_services', 'shop_product_skus', 'shop_product_stocks', 'shop_product_stocks_log', 'shop_search_index', 'shop_search_word', 'shop_tag', 'shop_product_tags', 'shop_set', 'shop_set_products', 'shop_stock', 'shop_feature', 'shop_feature_values_dimension', 'shop_feature_values_double', 'shop_feature_values_text', 'shop_feature_values_varchar', 'shop_feature_values_color', 'shop_feature_values_range', 'shop_type', 'shop_type_features', 'shop_type_services', 'shop_type_upselling', 'shop_service', 'shop_service_variants', 'shop_currency', 'shop_customer', 'shop_cart_items', 'shop_order', 'shop_order_items', 'shop_order_log', 'shop_order_log_params', 'shop_order_params', 'shop_affiliate_transaction', 'shop_checkout_flow', 'shop_notification', 'shop_notification_params', 'shop_coupon', 'shop_discount_by_sum', 'shop_tax', 'shop_tax_regions', 'shop_tax_zip_codes', 'shop_affiliate_transaction', 'shop_importexport');
        $model = new waModel();
        foreach ($tables as $table) {
            $exist = false;
            try {
                $model->query(sprintf("SELECT * FROM `%s` WHERE 0", $table));
                $exist = true;
                $model->query(sprintf("TRUNCATE `%s`", $table));
            } catch (waDbException $ex) {
                if ($exist) {
                    throw $ex;
                }
            }
        }
        $sqls = array();
        $sqls[] = 'UPDATE`shop_type` SET`count` = 0';
        $sqls[] = 'UPDATE`shop_set` SET`count` = 0';
        foreach ($sqls as $sql) {
            $model->query($sql);
        }
        $ccm = new waContactCategoryModel();
        $ccm->deleteByField('app_id', 'shop');
        $app_settings_model = new waAppSettingsModel();
        $currency_model = new shopCurrencyModel();
        $currency_model->insert(array('code' => 'USD', 'rate' => 1.0, 'sort' => 1), 2);
        $app_settings_model->set('shop', 'currency', 'USD');
        $app_settings_model->set('shop', 'use_product_currency', true);
        $paths = array();
        $paths[] = wa()->getDataPath('products', false, 'shop');
        $paths[] = wa()->getDataPath('products', true, 'shop');
        $paths[] = wa()->getTempPath();
        $config_path = wa()->getConfigPath('shop');
        foreach (waFiles::listdir($config_path, true) as $path) {
            if (!in_array($path, array('plugins.php', '..', '.'))) {
                $paths[] = $config_path . '/' . $path;
            }
        }
        $paths[] = wa()->getCachePath(null, 'shop');
        foreach ($paths as $path) {
            waFiles::delete($path, true);
        }
        $path = wa()->getDataPath('products', true, 'shop');
        waFiles::write($path . '/thumb.php', '<?php
$file = realpath(dirname(__FILE__)."/../../../../")."/wa-apps/shop/lib/config/data/thumb.php";

if (file_exists($file)) {
    include($file);
} else {
    header("HTTP/1.0 404 Not Found");
}
');
        waFiles::copy($this->getConfig()->getAppPath('lib/config/data/.htaccess'), $path . '/.htaccess');
        echo json_encode(array('result' => 'ok', 'redirect' => '?action=welcome'));
        exit;
    }
开发者ID:Lazary,项目名称:webasyst,代码行数:67,代码来源:shopSettingsReset.action.php

示例14: initPath

 private function initPath()
 {
     $type = preg_replace('@s$@', '', $this->type);
     switch ($type) {
         case 'app':
             $namespace = $this->app_id;
             $this->path = wa()->getConfig()->getAppsPath($this->app_id, null);
             break;
         case 'plugin':
         case 'theme':
             $namespace = $this->app_id . ucfirst($this->extension_id);
             $this->path = wa()->getConfig()->getAppsPath($this->app_id, $this->type . '/' . $this->extension_id);
             break;
         case 'shipping':
         case 'payment':
             $namespace = $this->extension_id . ucfirst($this->type);
             $this->path = wa()->getConfig()->getPath('plugins') . '/' . $this->type . '/' . $this->extension_id;
             break;
         case 'sms':
             $namespace = $this->extension_id . strtoupper($this->type);
             $this->path = wa()->getConfig()->getPath('plugins') . '/' . $this->type . '/' . $this->extension_id;
             break;
         default:
             throw new waException('');
     }
     if (!file_exists($this->path) || !is_dir($this->path)) {
         throw new waException('Invalid SLUG: path not found');
     }
     $this->type = $type;
     $this->folder = $this->extension_id ? $this->extension_id : $this->app_id;
     $this->archive_path = $this->path . '/' . $this->folder . '.tar.gz';
     $this->config = $this->getItemConfig($this->type);
     $this->files = waFiles::listdir($this->path, true);
     sort($this->files);
     $blacklist = array();
     if ($this->type == 'app') {
         $blacklist['@^plugins/.+@'] = 'application\'s plugins';
         if (true) {
             $blacklist['@^themes/(?!default).+@'] = 'application\'s themes';
         }
     }
     waRequest::setParam(array('namespace' => $namespace, 'prefix' => isset($this->config['prefix']) ? $this->config['prefix'] : null, 'type' => $this->type, 'app' => $this->app_id, 'app_id' => $this->app_id, 'extension' => $this->extension_id));
     return $this->filter($this->files, $blacklist);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:44,代码来源:webasystCompress.cli.php

示例15: listDir

 private static function listDir($dir, $recursive = false)
 {
     $result = waFiles::listdir($dir, $recursive);
     $result = array_filter($result, create_function('$item', 'return basename($item) != ".htaccess";'));
     return $result;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:6,代码来源:logsHelper.class.php


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