• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP KService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setConfig

 /**
  * Configurator
  *
  * @param KConfig $config Property Configuration 
  * 
  * @return void
  */
 public function setConfig(KConfig $config)
 {
     $identifier = $config->description->getRepository()->getIdentifier();
     if ($config->parent) {
         $this->_parent = KService::getIdentifier($config->parent);
         //adopt the child application
         if (!$this->_parent->application) {
             $this->_parent->application = $identifier->application;
         }
     }
     parent::setConfig($config);
     if ($config->child) {
         if (strpos($config->child, '.') === false) {
             $identifier = clone $this->_parent;
             $identifier->name = $config->child;
             $config->child = $identifier;
         }
         $this->_child = KService::getIdentifier($config->child);
         //adopt the parent application
         if (!$this->_child->application) {
             $this->_child->application = $identifier->application;
         }
     }
     $this->_parent_key = $config->parent_key;
     if (is_array($config->query)) {
         $config->query = new KConfig($config->query);
     }
     $this->_query_filters = $config->query;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:36,代码来源:property.php


示例2: _beforeDispatch

 protected function _beforeDispatch(KCommandContext $context)
 {
     if ($this->getRequest()->container === 'docman-files') {
         KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.file')));
         KService::setConfig('com://admin/files.controller.folder', array('behaviors' => array('com://admin/docman.controller.behavior.folder')));
         KService::setAlias('com://admin/files.model.containers', 'com://admin/docman.model.containers');
         KService::setAlias('com://site/files.model.containers', 'com://admin/docman.model.containers');
     }
     // Use our own ACL instead of com_files'
     KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/docman.controller.behavior.executable');
     if ($this->getRequest()->routed) {
         $app = JFactory::getApplication();
         $behavior = 'com://admin/docman.controller.behavior.cacheable';
         // If the upload_folder parameter is set, we change the container path so results are different
         if ($app->isSite() && $app->getMenu()->getActive()->params->get('upload_folder')) {
             $behavior = $this->getService($behavior, array('only_clear' => true));
         }
         foreach (array('file', 'folder', 'node', 'thumbnail') as $name) {
             KService::setConfig('com://admin/files.controller.' . $name, array('behaviors' => array($behavior)));
         }
         if (!in_array($this->getRequest()->container, array('docman-files', 'docman-icons', 'docman-images'))) {
             $this->getRequest()->container = 'docman-files';
         }
         if ($this->getRequest()->container === 'docman-icons') {
             KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.icon')));
         }
         // Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249
         JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true));
         $context->result = $this->getService('com://admin/files.dispatcher', array('request' => array('container' => $this->getRequest()->container)))->dispatch();
         return false;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:32,代码来源:routable.php


示例3: onContentSearch

 public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     if ($text) {
         $rows = array();
         $rowset = KService::get('com://admin/kutafuta.model.terms')->type($phrase)->search($text)->getList();
         foreach ($rowset as $row) {
             // We have table and row.
             // Row is always multiple but we check non the less.
             $parts = explode('_', $row->table);
             $data = KService::get('com://site/' . $parts[0] . '.model.' . KInflector::pluralize($parts[1]))->id($row->row)->getItem();
             if (empty($data->id)) {
                 continue;
             }
             $result = new stdClass();
             $result->title = $data->title;
             $result->metadesc = $data->meta_description;
             $result->metakey = $data->meta_keywords;
             $result->created = $data->created_on;
             $result->text = $data->introtext . $data->fulltext;
             $result->href = 'index.php?option=com_' . $parts[0] . '&view=' . KInflector::singularize($parts[1]) . '&id=' . $row->row;
             $rows[] = $result;
         }
         return $rows;
     }
 }
开发者ID:kedweber,项目名称:com_kutafuta,代码行数:25,代码来源:kutafuta.php


示例4: __construct

 /** 
  * Constructor.
  * 
  * @param mixed $dispatcher A dispatcher
  * @param array $config     An optional KConfig object with configuration options.
  * 
  * @return void
  */
 public function __construct($dispatcher = null, $config = array())
 {
     $config = new KConfig($config);
     parent::__construct($config);
     $this->_name = $config->name;
     KService::get('plg:contentfilter.chain')->addFilter($this);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:15,代码来源:abstract.php


示例5: updateIndex

 /**
  * @param KCommandContext $context
  */
 public function updateIndex(KCommandContext $context)
 {
     $filter = KService::get('koowa:filter.string');
     $table = $context->data->getTable()->getName();
     $row = $context->data->id;
     $this->_beforeTableDelete($context);
     if ($context->data->enabled) {
         if ($context->data->isTranslatable()) {
             if (!$context->data->translated && !$context->data->original) {
                 return;
             }
         }
         // Saving the title.
         $this->getService('com://admin/kutafuta.database.row.term')->setData(array('table' => $table, 'row' => $row, 'value' => $context->data->title, 'lang' => substr(JFactory::getLanguage()->getTag(), 0, 2)))->save();
         // Saving the elements of elementable, only if the value is a string.
         if ($context->data->isElementable()) {
             foreach ($context->data->getElements() as $key => $value) {
                 $val = $context->data->{$value->slug};
                 if ($filter->validate(strip_tags($val)) && !empty($val) && !is_numeric($val)) {
                     $this->getService('com://admin/kutafuta.database.row.term')->setData(array('table' => $table, 'row' => $row, 'value' => trim(strip_tags($val)), 'lang' => substr(JFactory::getLanguage()->getTag(), 0, 2)))->save();
                 }
             }
         }
     }
 }
开发者ID:kedweber,项目名称:com_kutafuta,代码行数:28,代码来源:searchable.php


示例6: onAuthenticate

 /**
  * Authenticates a user using oauth_token,oauth_secret
  *
  * 
  * @param   array   $credentials Array holding the user credentials
  * @param   array   $options     Array of extra options
  * @param   object  $response    Authentication response object
  * @return  boolean
  * @since 1.5
  */
 public function onAuthenticate(&$credentials, $options, &$response)
 {
     if (isset($credentials['username']) && isset($credentials['password'])) {
         return;
     }
     if (isset($credentials['oauth_token']) && isset($credentials['oauth_handler'])) {
         try {
             extract($credentials, EXTR_SKIP);
             //if oatuh secret not set then set it to null
             if (empty($oauth_secret)) {
                 $oauth_secret = '';
             }
             //lets get the api
             $api = ComConnectHelperApi::getApi($oauth_handler);
             $api->setToken($oauth_token, $oauth_secret);
             //if we can get the logged in user then
             //the user is authenticated
             if ($profile_id = $api->getUser()->id) {
                 //lets find a valid sesison
                 //lets be strict and make sure all the values match
                 $session = KService::get('repos://site/connect.session')->find(array('owner.type' => 'com:people.domain.entity.person', 'profileId' => $profile_id, 'tokenKey' => $oauth_token, 'api' => $oauth_handler));
                 if ($session) {
                     $response->status = JAUTHENTICATE_STATUS_SUCCESS;
                     $response->username = $session->owner->username;
                     $response->password = ' ';
                     $response->fullname = ' ';
                 }
             }
         } catch (Exception $e) {
             //ignore any exception
         }
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:43,代码来源:connect.php


示例7: __construct

 /**
  * Creates a custom form element.
  *
  * @param mixed $parent
  */
 public function __construct($parent = null)
 {
     parent::__construct($parent);
     $this->_template = KService::get('com:base.template.default');
     $this->_template->addFilter(array('shorttag', 'alias'));
     $this->_template->getFilter('alias')->append(array('@route(' => 'JRoute::_(', '@html(\'' => '$this->renderHelper(\'com:base.template.helper.html.'));
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:12,代码来源:custom.php


示例8: filter

 /**
  * Filter a value.
  *
  * @param string The text to filter
  *
  * @return string
  */
 public function filter($text)
 {
     preg_match_all('/(pages|topics|photos|todos|notes)\\/([0-9]+)[-]?/', $text, $matches);
     $ids = $matches[2];
     foreach ($ids as $id) {
         $id = (int) $id;
         $medium = KService::get('repos:medium.medium')->getQuery()->disableChain()->id($id)->fetch();
         if (isset($medium->id) && $medium->authorize('access')) {
             if ($medium->getRepository()->hasBehavior('portraitable')) {
                 $caption = htmlspecialchars($medium->title, ENT_QUOTES, 'UTF-8');
                 $pattern = '/((?<!=\\")[http]+[s]?:\\/\\/[^<>\\s]+)\\/photos\\/' . $medium->id . '[-\\w\\-]*/';
                 $text = preg_replace($pattern, '<a data-trigger="MediaViewer" href="' . $medium->getPortraitURL('original') . '" title="' . $caption . '" >' . '<img alt="' . $caption . '" src="' . $medium->getPortraitURL('medium') . '" />' . '</a> ', $text);
             } else {
                 $pattern = '/((?<!=\\")[http]+[s]?:\\/\\/[^<>\\s]+)\\/pages\\/' . $medium->id . '[-\\w\\-]*/';
                 $template = '<div class="alert alert-block alert-success">';
                 if ($medium->title) {
                     $template .= '<h4><a href="' . JRoute::_($medium->getURL()) . '">' . $medium->title . '</a></h4>';
                 }
                 if ($medium->excerpt) {
                     $template .= '<p>' . $medium->excerpt . '</p>';
                 }
                 $template .= '</div>';
                 $text = preg_replace($pattern, $template, $text);
             }
         }
     }
     return $text;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:35,代码来源:medium.php


示例9: up

 /**
  * Called when migrating up
  */
 public function up()
 {
     $timeThen = microtime(true);
     //converting the old boards as hashtags
     $boards = dbfetch('SELECT `id`, `alias` FROM #__anahita_nodes WHERE `type` LIKE \'%com:topics.domain.entity.board\' ');
     foreach ($boards as $board) {
         $terms = explode('-', $board['alias']);
         foreach ($terms as $index => $value) {
             if (strlen($value) < 3) {
                 unset($terms[$index]);
             }
         }
         $topics = KService::get('com://site/topics.domain.entity.topic')->getRepository()->getQuery()->disableChain()->where('parent_id = ' . $board['id'])->fetchSet();
         foreach ($topics as $topic) {
             foreach ($terms as $term) {
                 if (strlen($term) > 3) {
                     dboutput($term . ', ');
                     $topic->set('description', $topic->description . ' #' . trim($term))->addHashtag($term)->save();
                 }
             }
         }
     }
     dbexec('UPDATE #__anahita_nodes SET `parent_id` = 0 WHERE `type` LIKE \'%com:topics.domain.entity.topic\'');
     dbexec('DELETE FROM #__anahita_nodes WHERE `type` LIKE \'%com:topics.domain.entity.board\'');
     dbexec('DELETE FROM #__anahita_edges WHERE `node_b_type` LIKE \'%com:topics.domain.entity.board\'');
     dbexec('DROP TABLE #__topics_boards');
     $timeDiff = microtime(true) - $timeThen;
     dboutput("TIME: ({$timeDiff})" . "\n");
 }
开发者ID:walteraries,项目名称:anahita,代码行数:32,代码来源:2.php


示例10: plgSearchEvents

function plgSearchEvents($text, $phrase = '', $ordering = '', $areas = null)
{
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchEventsAreas()))) {
            return array();
        }
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'events');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $events = KService::get('com://admin/calendar.model.events')->sort('tbl.start_date')->direction('ASC')->limit($limit)->search($text)->getList();
    $return = array();
    foreach ($events as $event) {
        if (searchHelper::checkNoHTML($event, $text, array('title', 'description'))) {
            $event->text = $event->description;
            $event->origin = 'events';
            $event->href = 'index.php?option=com_calendar&view=event&id=' . $event->id . '&slug=' . $event->slug;
            $event->section = JText::_('Events');
            $return[] = $event->getData();
        }
    }
    return $return;
}
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:29,代码来源:events.php


示例11: getInput

    protected function getInput()
    {
        // Load the modal behavior script.
        JHtml::_('behavior.modal', 'a.modal');
        // Build the script.
        $script = array();
        $script[] = '	function jSelectArticle_' . $this->id . '(id, title, catid, object) {';
        $script[] = '		document.id("' . $this->id . '_id").value = id;';
        $script[] = '		document.id("' . $this->id . '_name").value = title;';
        $script[] = '		SqueezeBox.close();';
        $script[] = '	}';
        // Add the script to the document head.
        JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
        // Setup variables for display.
        $html = array();
        $link = 'index.php?option=com_articles&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_' . $this->id;
        $title = KService::get('com://site/articles.model.articles')->id($this->value)->getItem()->title;
        $html[] = '<span class="input-append">';
        $html[] = '<input type="text" class="inoutbox input=medium" id="' . $this->id . '_name" value="' . $title . '" readonly="readonly" disabled="disabled" size="40" placeholder="' . JText::_('COM_ARTICLES_SELECT_AN_ITEM') . '" /><a class="btn btn-primary modal" href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-list icon-white"></i>
' . JText::_('Select') . '</a>';
        // The active article id field.
        if (0 == (int) $this->value) {
            $value = '';
        } else {
            $value = (int) $this->value;
        }
        // class='required' for client side validation
        $class = '';
        if ($this->required) {
            $class = ' class="required modal-value"';
        }
        $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
        return implode("\n", $html);
    }
开发者ID:kedweber,项目名称:com_articles,代码行数:34,代码来源:article.php


示例12: up

 /**
  * Called when migrating up.
  */
 public function up()
 {
     $timeThen = microtime(true);
     dbexec('DELETE FROM #__nodes WHERE `type` LIKE \'%ComBaseDomainEntityComment%\' AND `parent_type` = \'com:todos.domain.entity.milestone\' ');
     dbexec('DELETE FROM #__nodes WHERE `type` LIKE \'%com:todos.domain.entity.milestone\' ');
     dbexec('DELETE FROM #__edges WHERE `node_b_type` LIKE \'%com:todos.domain.entity.milestone\' ');
     dbexec('DROP TABLE #__todos_milestones');
     //clearing todolists from the data
     $todolists = dbfetch('SELECT `id`, `parent_id`, `alias` FROM #__nodes WHERE `type` LIKE \'%com:todos.domain.entity.todolist\' ');
     foreach ($todolists as $todolist) {
         $terms = explode('-', $todolist['alias']);
         foreach ($terms as $index => $value) {
             if (strlen($value) < 3) {
                 unset($terms[$index]);
             }
         }
         $todos = KService::get('com://site/todos.domain.entity.todo')->getRepository()->getQuery()->disableChain()->where('parent_id = ' . $todolist['id'])->fetchSet();
         foreach ($todos as $todo) {
             foreach ($terms as $term) {
                 if (strlen($term) > 3) {
                     dboutput($term . ', ');
                     $todo->set('parent_id', 0)->set('description', $todo->description . ' #' . trim($term))->addHashtag($term)->save();
                 }
             }
         }
     }
     dbexec('DELETE FROM #__nodes WHERE `type` LIKE \'%com:todos.domain.entity.todolist\' ');
     //clear stories
     dbexec('DELETE FROM #__nodes WHERE `story_object_type` = \'com:todos.domain.entity.todolist\' OR `story_object_type` = \'com:todos.domain.entity.milestone\' ');
     dbexec('DROP TABLE #__todos_todolists');
     $timeDiff = microtime(true) - $timeThen;
     dboutput("TIME: ({$timeDiff})" . "\n");
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:36,代码来源:2.php


示例13: fetchElement

 function fetchElement($name, $value, &$node = null, $control_name = null)
 {
     $el_name = $control_name ? $control_name . '[' . $name . ']' : $name;
     JHtml::_('behavior.modal');
     $html = KService::get('com://admin/fileman.template.helper.modal')->select(array('name' => $el_name, 'id' => 'fileman-file-link-name', 'value' => $value, 'link' => JRoute::_('index.php?option=com_fileman&view=files&layout=select&tmpl=component')));
     return $html;
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:7,代码来源:file.php


示例14: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     $key_field = $node->attributes('key_field');
     $attribs = array();
     $el_name = $control_name . '[' . $name . ']';
     return KService::get('com://admin/news.template.helper.listbox')->category(array('name' => $el_name, 'value' => $key_field ? $key_field : 'id', 'deselect' => true, 'showroot' => false, 'selected' => $value, 'attribs' => $attribs));
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:7,代码来源:categories.php


示例15: _actionCopy

 /**
  * @param KCommandContext $context
  */
 public function _actionCopy(KCommandContext $context)
 {
     foreach (KRequest::get('get.id', 'raw') as $item_id) {
         $this->count = 1;
         $items = array();
         $languages = JLanguageHelper::getLanguages();
         $model_identifier = clone $context->caller->getIdentifier();
         $model_identifier->path = array('model');
         $model_identifier->name = KInflector::pluralize($model_identifier->name);
         $isTranslatable = KService::get($model_identifier)->getTable()->hasBehavior('translatable');
         if ($isTranslatable) {
             foreach ($languages as $language) {
                 JFactory::getLanguage()->setLanguage($language->lang_code);
                 $item = $this->getService($model_identifier)->id($item_id)->getItem();
                 if ($item->original) {
                     $this->original_language = $language->lang_code;
                     $original = $item;
                 } else {
                     $items[$language->lang_code] = $item;
                 }
             }
         }
         JFactory::getLanguage()->setLanguage($this->original_language);
         $id = $this->_copyOriginal($original);
         if ($isTranslatable) {
             $this->_updateLanguages($id, $items);
         }
     }
 }
开发者ID:kedweber,项目名称:com_moyo,代码行数:32,代码来源:copyable.php


示例16: plgSearchArticles

function plgSearchArticles($text, $phrase = '', $ordering = '', $areas = null)
{
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchArticlesAreas()))) {
            return array();
        }
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'articles');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $articles = KService::get('com://admin/news.model.articles')->sort('tbl.created_on')->direction('DESC')->limit($limit)->search($text)->getList();
    $return = array();
    foreach ($articles as $article) {
        if (searchHelper::checkNoHTML($article, $text, array('title', 'text'))) {
            $article->origin = 'articles';
            $article->href = 'index.php?option=com_news&view=article&id=' . $article->id . '&slug=' . $article->slug;
            $article->section = $article->category_title;
            $return[] = $article->getData();
        }
    }
    return $return;
}
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:28,代码来源:articles.php


示例17: __construct

 public function __construct($subject, $config = array())
 {
     // Turn off E_STRICT errors for now
     error_reporting(error_reporting() & ~E_STRICT);
     // Check if database type is MySQLi
     if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
         if (JFactory::getApplication()->getName() === 'administrator') {
             $string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi';
             $link = JRoute::_('index.php?option=com_config');
             $error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.';
             JError::raiseWarning(0, sprintf(JText::_($error), $string, $link));
         }
         return;
     }
     // Set pcre.backtrack_limit to a larger value
     // See: https://bugs.php.net/bug.php?id=40846
     if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) {
         @ini_set('pcre.backtrack_limit', 1000000);
     }
     //Set constants
     define('KDEBUG', JDEBUG);
     //Set path definitions
     define('JPATH_FILES', JPATH_ROOT);
     define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images');
     //Set exception handler
     set_exception_handler(array($this, 'exceptionHandler'));
     // Koowa : setup
     require_once JPATH_LIBRARIES . '/koowa/koowa.php';
     Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false));
     KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
     KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
     KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module'));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
     KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component'));
     KServiceIdentifier::setApplication('site', JPATH_SITE);
     KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
     KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
     KService::setAlias('translator', 'com:default.translator');
     //Setup the request
     if (JFactory::getApplication()->getName() !== 'site') {
         KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
     }
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true);
     //Bugfix : Set offset accoording to user's timezone
     if (!JFactory::getUser()->guest) {
         if ($offset = JFactory::getUser()->getParam('timezone')) {
             if (version_compare(JVERSION, '3.0', '>=')) {
                 JFactory::getConfig()->set('offset', $offset);
             } else {
                 JFactory::getConfig()->setValue('config.offset', $offset);
             }
         }
     }
     // Load language files for the framework
     KService::get('com:default.translator')->loadLanguageFiles();
     parent::__construct($subject, $config);
 }
开发者ID:Roma48,项目名称:mayak,代码行数:59,代码来源:koowa.php


示例18: _actionBrowse

 public function _actionBrowse($context)
 {
     //     $session = Kservice::get('com://site/people.controller.session');
     //     $viewer = get_viewer();
     //     $session = JFactory::getSession();
     $this->categories = KService::get('repos://site/forums.category')->getQuery()->order('ordering')->fetchSet();
     parent::_actionBrowse($context);
 }
开发者ID:NicholasJohn16,项目名称:forums,代码行数:8,代码来源:forum.php


示例19: display

 function display($tpl = null)
 {
     global $option;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $client = JRequest::getWord('client', 'site');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     JArrayHelper::toInteger($cid, array(0));
     $lists = array();
     $row =& JTable::getInstance('plugin');
     // load the row from the db table
     $row->load($cid[0]);
     // fail if checked out not by 'me'
     if ($row->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The plugin'), $row->title);
         $this->setRedirect('index.php?option=' . $option . '&client=' . $client, $msg, 'error');
         return false;
     }
     if ($client == 'admin') {
         $where = "client_id='1'";
     } else {
         $where = "client_id='0'";
     }
     // get list of groups
     if ($row->access == 99 || $row->client_id == 1) {
         $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
     } else {
         // build the html select list for the group access
         $lists['access'] = JHTML::_('list.accesslevel', $row);
     }
     if ($cid[0]) {
         $row->checkout($user->get('id'));
         if ($row->ordering > -10000 && $row->ordering < 10000) {
             // build the html select list for ordering
             $query = 'SELECT ordering AS value, name AS text' . ' FROM #__plugins' . ' WHERE folder = ' . $db->Quote($row->folder) . ' AND published > 0' . ' AND ' . $where . ' AND ordering > -10000' . ' AND ordering < 10000' . ' ORDER BY ordering';
             $order = JHTML::_('list.genericordering', $query);
             $lists['ordering'] = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
         } else {
             $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />' . JText::_('This plugin cannot be reordered');
         }
         $lang =& JFactory::getLanguage();
         $lang->load('plg_' . trim($row->folder) . '_' . trim($row->element), JPATH_ADMINISTRATOR);
         $data = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . DS . 'plugins' . DS . $row->folder . DS . $row->element . '.xml');
         $row->description = $data['description'];
     } else {
         $row->folder = '';
         $row->ordering = 999;
         $row->published = 1;
         $row->description = '';
     }
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
     $params = KService::get('com://admin/base.template.helper.form')->getParameters(array('path' => JApplicationHelper::getPath('plg_xml', $row->folder . DS . $row->element), 'data' => $row->params));
     //$params = new JParameter( $row->params, , 'plugin' );
     $this->assignRef('lists', $lists);
     $this->assignRef('plugin', $row);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:58,代码来源:view.html.php


示例20: up

 /**
  * Called when migrating up
  */
 public function up()
 {
     $timeThen = microtime(true);
     //some legacy cleanup
     $legacyTables = array('categories', 'content', 'content_frontpage', 'core_log_items', 'migration_backlinks', 'migrations', 'sections', 'stats_agents', 'tagmeta', 'core_log_searches');
     foreach ($legacyTables as $legacyTable) {
         dbexec('DROP TABLE IF EXISTS #__' . $legacyTable);
     }
     //delete a legacy record
     dbexec('DELETE FROM #__components WHERE `option` = \'com_mailto\' ');
     //add the hashtag contentfilter
     dbexec('INSERT INTO #__plugins (name,element,folder,iscore) VALUES (\'Hashtag\', \'hashtag\',\'contentfilter\',1)');
     //create the fields required for creating hashtag nodes
     dbexec('ALTER TABLE #__anahita_nodes DROP COLUMN `tag_count`');
     dbexec('ALTER TABLE #__anahita_nodes DROP COLUMN `tag_ids`');
     //install the hashtag related extensions
     dbexec('INSERT INTO #__components (`name`,`link`,`option`,`iscore`,`enabled`) VALUES (\'Hashtags\',\'option=com_hashtags\',\'com_hashtags\',1,1)');
     $ids = array();
     //fetch only the nodes that contain something that resembels a hashtag
     $query_regexp = 'body REGEXP \'#([^0-9_\\s\\W].{2,})\'';
     dboutput("\nActors' Hashtags\n");
     //extracting hashtag terms from actors
     $ids = dbfetch('SELECT id FROM #__anahita_nodes WHERE type LIKE \'ComActorsDomainEntityActor%\' AND ' . $query_regexp);
     foreach ($ids as $id) {
         $entity = KService::get('com://site/actors.domain.entity.actor')->getRepository()->getQuery()->disableChain()->fetch($id);
         $hashtagTerms = $this->extractHashtagTerms($entity->description);
         foreach ($hashtagTerms as $term) {
             dboutput($term . ', ');
             $entity->addHashtag($term)->save();
         }
     }
     dboutput("\nComments' hashtags\n");
     //extracting hashtag terms from comments
     $ids = dbfetch('SELECT id FROM #__anahita_nodes WHERE type LIKE \'ComBaseDomainEntityComment%\' AND ' . $query_regexp);
     foreach ($ids as $id) {
         $entity = KService::get('com://site/base.domain.entity.comment')->getRepository()->getQuery()->disableChain()->fetch($id);
         $hashtagTerms = $this->extractHashtagTerms($entity->body);
         foreach ($hashtagTerms as $term) {
             dboutput($term . ', ');
             $entity->addHashtag($term)->save();
         }
     }
     dboutput("\nMedia's Hashtags\n");
     //extracting hashtag terms from mediums: notes, topics, pages, and todos
     $query = 'SELECT id FROM #__anahita_nodes WHERE ' . $query_regexp . ' AND ( ' . 'type LIKE \'%com:notes.domain.entity.note\' ' . 'OR type LIKE \'%com:topics.domain.entity.topic\' ' . 'OR type LIKE \'%com:photos.domain.entity.photo\' ' . 'OR type LIKE \'%com:photos.domain.entity.set\' ' . 'OR type LIKE \'%com:pages.domain.entity.page\' ' . 'OR type LIKE \'%com:todos.domain.entity.todo\' ' . ' ) ';
     $ids = dbfetch($query);
     foreach ($ids as $id) {
         $entity = KService::get('com://site/medium.domain.entity.medium')->getRepository()->getQuery()->disableChain()->fetch($id);
         $hashtagTerms = $this->extractHashtagTerms($entity->description);
         foreach ($hashtagTerms as $term) {
             dboutput($term . ', ');
             $entity->addHashtag($term)->save();
         }
     }
     dbexec('UPDATE #__plugins SET published = 1 WHERE element = \'hashtag\'');
     $timeDiff = microtime(true) - $timeThen;
     dboutput("TIME: ({$timeDiff})" . "\n");
 }
开发者ID:walteraries,项目名称:anahita,代码行数:61,代码来源:5.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP KServiceInterface类代码示例发布时间:2022-05-23
下一篇:
PHP KSSystem类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap