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


PHP wa函数代码示例

本文整理汇总了PHP中wa函数的典型用法代码示例。如果您正苦于以下问题:PHP wa函数的具体用法?PHP wa怎么用?PHP wa使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute

 /**
  * @param int[] $params Deleted contact_id
  * @see waEventHandler::execute()
  * @return void
  */
 public function execute(&$params)
 {
     $contact_ids = $params;
     $photo_model = new photosPhotoModel();
     $photo_model->updateByField(array('contact_id' => $contact_ids), array('contact_id' => 0));
     wa()->event(array('photos', 'contacts_delete'), $params);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:12,代码来源:contacts.delete.handler.php

示例2: save

 public function save(waRequestFile $file, $data)
 {
     // check image
     if (!($image = $file->waImage())) {
         throw new waException(_w('Incorrect image'));
     }
     $plugin = wa()->getPlugin('publicgallery');
     $min_size = $plugin->getSettings('min_size');
     if ($min_size && ($image->height < $min_size || $image->width < $min_size)) {
         throw new waException(sprintf(_w("Image is too small. Minimum image size is %d px"), $min_size));
     }
     $max_size = $plugin->getSettings('max_size');
     if ($max_size && ($image->height > $max_size || $image->width > $max_size)) {
         throw new waException(sprintf(_w("Image is too big. Maximum image size is %d px"), $max_size));
     }
     $id = $this->model->add($file, $data);
     if (!$id) {
         throw new waException(_w("Save error"));
     }
     $tag = $plugin->getSettings('assign_tag');
     if ($tag) {
         $photos_tag_model = new photosPhotoTagsModel();
         $photos_tag_model->set($id, $tag);
     }
     return array('name' => $file->name, 'type' => $file->type, 'size' => $file->size);
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:26,代码来源:photosPublicgalleryPluginFrontendImageUpload.controller.php

示例3: getLink

 public static function getLink($photo, $album = null)
 {
     static $wa = null;
     $wa = $wa ? $wa : wa();
     $link = null;
     if (is_null($album)) {
         $link = $wa->getRouteUrl('photos/frontend/photo', array('url' => $photo['url'] . (isset($photo['status']) && $photo['status'] <= 0 ? ':' . $photo['hash'] : '')), true);
     } else {
         if (is_array($album)) {
             $link = $wa->getRouteUrl('photos/frontend/photo', array('url' => $album['full_url'] . '/' . $photo['url']), true);
         } else {
             $hash = $album;
             if (substr($hash, 0, 1) == '#') {
                 $hash = substr($hash, 1);
             }
             $hash = trim($hash, '/');
             $hash = explode('/', $hash);
             $params = array('url' => $photo['url']);
             if (count($hash) >= 2) {
                 $params[$hash[0]] = $hash[1];
             } else {
                 if (count($hash) == 1) {
                     $params[$hash[0]] = $hash[0];
                 }
             }
             $link = $wa->getRouteUrl('photos/frontend/photo', $params, true);
         }
     }
     return $link ? rtrim($link, '/') . '/' : null;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:30,代码来源:photosFrontendPhoto.class.php

示例4: execute

 public function execute()
 {
     $query = trim(waRequest::post('q'), ' /');
     $hash = '/search/' . $query;
     $collection = new photosCollection($hash);
     if ($query == 'rate>0') {
         $collection->orderBy('p.rate DESC, p.id');
     }
     $this->template = 'templates/actions/photo/PhotoList.html';
     $count = $this->getConfig()->getOption('photos_per_page');
     $photos = $collection->getPhotos("*,thumb,thumb_crop,thumb_middle,thumb_big,tags,edit_rights", 0, $count);
     $photos = photosCollection::extendPhotos($photos);
     $frontend_link = $query == 'rate>0' ? photosCollection::getFrontendLink('favorites', false) : photosCollection::getFrontendLink($hash, false);
     /**
      * @event search_frontend_link
      * @param string $query
      * @return array of bool|string if false - default frontend_link isn't overridden, if string - override default frontend link
      */
     $res = wa()->event('search_frontend_link', $query);
     foreach ($res as $r) {
         if (is_string($r)) {
             $frontend_link = $r;
             break;
         }
     }
     $config = $this->getConfig();
     $this->view->assign('sidebar_width', $config->getSidebarWidth());
     $this->view->assign('big_size', $config->getSize('big'));
     $this->view->assign('frontend_link', $frontend_link);
     $this->view->assign('photos', $photos);
     $this->view->assign('title', $query == 'rate>0' ? _w('Rated') : $collection->getTitle());
     $this->view->assign('total_count', $collection->count());
     $this->view->assign('sort_method', $query == 'rate>0' ? 'rate' : 'upload_datetime');
     $this->view->assign('hash', $hash);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:35,代码来源:photosSearchPhotos.action.php

示例5: onCount

 public function onCount()
 {
     return;
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     if (!isset($settings['count']) || $settings['count'] == 0) {
         return null;
     }
     if (!isset($settings['count_ts'])) {
         $settings_model->set('wacab', 'count_ts', time());
         return null;
     }
     if (!isset($settings['timeout'])) {
         $settings['timeout'] = 60;
     }
     if (time() - $settings['count_ts'] < $settings['timeout'] * 60) {
         return null;
     }
     $auth = new wacabWaauth();
     $new = new wacabGetpayment();
     $ps = $new->getPayment($auth);
     if (isset($settings['new_count'])) {
         $newcount = $settings['new_count'] + $ps;
     } else {
         $newcount = 0;
     }
     $settings_model->set('wacab', 'new_count', $newcount);
     $settings['count_ts'] = time();
     unset($auth);
     if ($newcount == 0) {
         return null;
     } else {
         return array('count' => $newcount, 'url' => wa()->getUrl(true) . 'wacab/#/transactions/');
     }
 }
开发者ID:Alexkurd,项目名称:wacab,代码行数:35,代码来源:wacabConfig.class.php

示例6: execute

 public function execute()
 {
     $this->setLayout(new guestbook2BackendLayout());
     // Creating a model instance for retrieving data from the database
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Retrieving all guestbook records from the database
     // Получаем все записи гостевой книги из БД
     $records = $model->getRecords(0, 0);
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = $r['contact_name'];
             // getting the contact photo URL
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         }
     }
     unset($r);
     // Passing records to the template
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // Passing the frontend URL to the template
     // Передаём в шаблон УРЛ фронтенда
     $this->view->assign('url', wa()->getRouteUrl($this->getAppId(), true));
     // Passing user's record deletion access rights value to the template
     // Access rights are defined in config file lib/config/guestbookRightConfig.class.php
     // Передаём в шаблон права пользователя на удаление записей из гостевой книги
     // Права описаны в конфиге lib/config/guestbookRightConfig.class.php
     $this->view->assign('rights_delete', $this->getRights('delete'));
     // If user is an admin of the Contacts app then show links to Contacts
     // Если пользователь админ приложения контакты, то показывать ссылки на контакты
     $this->view->assign('rights_contacts', $this->getUser()->isAdmin('contacts'));
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:33,代码来源:guestbook2Backend.action.php

示例7: execute

 public function execute()
 {
     $name = basename(waRequest::get('file', 'export.csv'));
     $profile = waRequest::get('profile', 0, waRequest::TYPE_INT);
     $file = wa()->getTempPath('csv/download/' . $profile . '/' . $name);
     waFiles::readFile($file, $name);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:shopCsvProductdownload.controller.php

示例8: settingsAction

 public function settingsAction()
 {
     $plugin_id = waRequest::get('id', null);
     $plugins_count = 0;
     $vars = array();
     if ($plugin_id) {
         $plugins = $this->getConfig()->getPlugins();
         $plugins_count = count($plugins);
         if (isset($plugins[$plugin_id])) {
             /**
              * @var shopPlugin $plugin
              */
             $plugin = waSystem::getInstance()->getPlugin($plugin_id, true);
             $namespace = wa()->getApp() . '_' . $plugin_id;
             $params = array();
             $params['id'] = $plugin_id;
             $params['namespace'] = $namespace;
             $params['title_wrapper'] = '%s';
             $params['description_wrapper'] = '<br><span class="hint">%s</span>';
             $params['control_wrapper'] = '<div class="name">%s</div><div class="value">%s %s</div>';
             $settings_controls = $plugin->getControls($params);
             $this->getResponse()->setTitle(_w(sprintf('Plugin %s settings', $plugin->getName())));
             $vars['plugin_info'] = $plugins[$plugin_id];
             $vars['plugin_id'] = $plugin_id;
             $vars['settings_controls'] = $settings_controls;
         }
         waSystem::popActivePlugin();
     }
     $template = $this->getTemplatePath('settings');
     $vars['plugins_count'] = $plugins_count;
     $this->display($vars, $template);
 }
开发者ID:Rupreht,项目名称:webasyst-framework,代码行数:32,代码来源:waPlugins.actions.php

示例9: execute

 public function execute()
 {
     $order_id = waRequest::request('order_id', 0, 'int');
     $id = waRequest::request('id', 0, 'int');
     $to = waRequest::request('to');
     $nm = new shopNotificationModel();
     $n = $nm->getById($id);
     if (!$n) {
         $this->errors = sprintf_wp('%s entry not found', _w('Notification'));
         return;
     }
     $om = new shopOrderModel();
     $o = $om->getById($order_id);
     if (!$o) {
         $this->errors = _w('Order not found');
         return;
     }
     shopHelper::workupOrders($o, true);
     $opm = new shopOrderParamsModel();
     $o['params'] = $opm->get($order_id);
     try {
         $contact = $o['contact_id'] ? new shopCustomer($o['contact_id']) : wa()->getUser();
         $contact->getName();
     } catch (Exception $e) {
         $contact = new shopCustomer(wa()->getUser()->getId());
     }
     $cm = new shopCustomerModel();
     $customer = $cm->getById($contact->getId());
     if (!$customer) {
         $customer = $cm->getEmptyRow();
     }
     $workflow = new shopWorkflow();
     // send notifications
     shopNotifications::sendOne($id, array('order' => $o, 'customer' => $contact, 'status' => $workflow->getStateById($o['state_id'])->getName()), $to);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:35,代码来源:shopSettingsNotificationsTest.controller.php

示例10: execute

 public function execute()
 {
     $lazy = !is_null(waRequest::get('lazy'));
     if (!$lazy) {
         $this->setLayout(new photosDefaultFrontendLayout());
     } else {
         $this->setTemplate('FrontendPhotos');
     }
     $photos_per_page = wa('photos')->getConfig()->getOption('photos_per_page');
     $limit = $photos_per_page;
     $page = 1;
     if ($lazy) {
         $offset = max(0, waRequest::get('offset', 0, waRequest::TYPE_INT));
     } else {
         $page = max(1, waRequest::get('page', 1, waRequest::TYPE_INT));
         $offset = ($page - 1) * $photos_per_page;
     }
     $c = new photosCollection('publicgallery/myphotos');
     $photos = $c->getPhotos('*', $offset, $limit);
     $photos = photosCollection::extendPhotos($photos);
     $v = wa()->getVersion();
     wa('photos')->getResponse()->addJs('js/lazy.load.js?v=' . $v, true);
     wa('photos')->getResponse()->addJs('js/frontend.photos.js?v=' . $v, true);
     $storage = wa()->getStorage();
     $current_auth = $storage->read('auth_user_data');
     $current_auth_source = $current_auth ? $current_auth['source'] : null;
     $this->view->assign('current_auth', $current_auth, true);
     $adapters = wa()->getAuthAdapters();
     $total_count = $c->count();
     $this->view->assign(array('photos' => $photos, 'page' => $page, 'offset' => $offset, 'photos_per_page' => $photos_per_page, 'total_photos_count' => $total_count, 'lazy_load' => $lazy, 'image_upload_url' => wa()->getRouteUrl('photos/frontend/imageUpload'), 'pages_count' => floor($total_count / $photos_per_page) + 1, 'current_auth_source' => $current_auth_source, 'adapters' => $adapters));
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:31,代码来源:photosPublicgalleryPluginFrontendMyphotos.action.php

示例11: postView

 public function postView()
 {
     $url = wa()->getAppStaticUrl() . $this->getUrl('css/troll.css', true);
     $content = array();
     $content['head'] = "<link href=\"{$url}\" rel=\"stylesheet\" type=\"text/css\">";
     return $content;
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:7,代码来源:blogTroll.plugin.php

示例12: execute

 public function execute()
 {
     // only allowed to global admin
     if (!wa()->getUser()->getRights('webasyst', 'backend')) {
         throw new waRightsException('Access denied.');
     }
     $collection = new contactsCollection('users/all');
     $group = null;
     $memberIds = array();
     if ($id = waRequest::get('id')) {
         $group_model = new waGroupModel();
         $group = $group_model->getById($id);
     }
     if ($group) {
         $user_groups_model = new waUserGroupsModel();
         $memberIds = $user_groups_model->getContactIds($id);
     }
     $users = $collection->getContacts('id,name');
     // array(id => array(id=>...,name=>...))
     $members = array();
     foreach ($memberIds as $mid) {
         if (isset($users[$mid])) {
             $members[$mid] = $users[$mid];
             unset($users[$mid]);
         }
     }
     usort($members, array($this, '_cmp'));
     usort($users, array($this, '_cmp'));
     $this->view->assign('group', $group);
     $this->view->assign('notIncluded', $users);
     $this->view->assign('members', $members);
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:32,代码来源:contactsGroupsEditor.action.php

示例13: execute

 public function execute()
 {
     $model_settings = new waAppSettingsModel();
     $settings = $model_settings->get($key = array('shop', 'deliveryshop'));
     $model = new waModel();
     $domains = $model->query("SELECT * FROM site_domain")->fetchAll();
     $prices = $model->query("SELECT * FROM shop_deliveryshop_delivery")->fetchAll('domain');
     foreach ($domains as $d) {
         $tab = explode('.', $d['name']);
         $info[$d['name']]['tab_name'] = $tab[0];
         $template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka' . $d['id'] . '.html', false, 'shop', true);
         $change_tpl[$d['name']] = true;
         if (!file_exists($template_path)) {
             $template_path = wa()->getAppPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', 'shop');
             $change_tpl[$d['name']] = false;
         }
         $template_content[$d['name']] = file_get_contents($template_path);
         unset($template_path);
     }
     $this->view->assign('info', $info);
     $this->view->assign('prices', $prices);
     $this->view->assign('change_tpl', $change_tpl);
     $this->view->assign('template', $template_content);
     $this->view->assign('settings', $settings);
 }
开发者ID:quadrodesign,项目名称:deliveryshop,代码行数:25,代码来源:shopDeliveryshopPluginSettings.action.php

示例14: getAppAlbums

 public static function getAppAlbums($force_app_ids = array())
 {
     $photo_model = new photosPhotoModel();
     $apps = wa()->getApps();
     $result = array();
     $counts = $photo_model->countAllByApp();
     $counts += array_fill_keys((array) $force_app_ids, 0);
     $force_app_ids = array_fill_keys((array) $force_app_ids, true);
     foreach ($counts as $app_id => $count) {
         // Check that app exists and check access rights, unless app is forced to be present in the result
         if (empty($force_app_ids[$app_id])) {
             if ($count <= 0 || empty($apps[$app_id]) || !wa()->getUser()->getRights($app_id, 'backend')) {
                 continue;
             }
         }
         if (!empty($apps[$app_id])) {
             $name = $apps[$app_id]['name'];
             if (!empty($apps[$app_id]['icon'][16])) {
                 $icon = $apps[$app_id]['icon'][16];
             } else {
                 $icon = reset($apps[$app_id]['icon']);
             }
         } else {
             $name = $app_id;
             $icon = $apps['photos']['icon'][16];
         }
         if ($icon) {
             $icon = wa()->getConfig()->getRootUrl() . $icon;
         }
         $result[$app_id] = array('id' => $app_id, 'name' => $name, 'count' => $count, 'icon' => $icon);
     }
     return $result;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:33,代码来源:photosDefault.layout.php

示例15: getInfo

 public function getInfo()
 {
     $path = wa()->getConfig()->getPath('plugins') . '/sms/' . $this->getId();
     $info = (include $path . '/lib/config/plugin.php');
     $info['icon'] = wa()->getRootUrl() . 'wa-plugins/sms/' . $this->getId() . '/' . $info['icon'];
     return $info;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:7,代码来源:waSMSAdapter.class.php


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