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

PHP KRequest类代码示例

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

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



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

示例1: image

 /**
  * Renders the html markup for the user avatar
  *
  * @author Stian Didriksen <[email protected]>
  * @return string
  */
 public function image($config = array())
 {
     $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams();
     $prepend = KFactory::get('lib.joomla.application')->isAdmin() ? KRequest::root() . '/' : '';
     $config = new KConfig($config);
     $config->append(array('id' => KFactory::get('admin::com.ninjaboard.model.people')->getMe()->id, 'thumbnail' => 'large', 'class' => 'avatar', 'link' => 'person', 'type' => 'css'));
     $person = KFactory::tmp('admin::com.ninjaboard.model.people')->id($config->id)->getItem();
     $avatar_on = new DateTime($person->avatar_on);
     $cache = (int) $avatar_on->format('U');
     $config->append(array('avatarurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=avatar&id=' . $config->id . '&thumbnail=' . $config->thumbnail . '&cache=' . $cache), 'profileurl' => $prepend . JRoute::_('&option=com_ninjaboard&view=person&id=' . $config->id)));
     $attribs = array('class' => $config->class, 'href' => $config->profileurl);
     $height = $params['avatar_settings'][$config->thumbnail . '_thumbnail_height'];
     $width = $params['avatar_settings'][$config->thumbnail . '_thumbnail_width'];
     ///* @TODO Following is the <img /> version, likely going to be deprecated
     if ($config->type == 'tag') {
         $attribs['src'] = $config->avatarurl;
         $attribs['height'] = $height;
         $attribs['width'] = $width;
         unset($attribs['href']);
         $html = '<img ' . KHelperArray::toString($attribs) . ' />';
     } else {
         $style = 'background-image: url(' . $config->avatarurl . '); ';
         $style .= 'height: ' . $height . 'px; ';
         $style .= 'width: ' . $width . 'px;';
         $attribs['style'] = $style;
         $html = '<a ' . KHelperArray::toString($attribs) . '></a>';
     }
     return $html;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:35,代码来源:avatar.php


示例2: _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


示例3: _actionEdit

 public function _actionEdit(KCommandContext $context)
 {
     $data = $context->data;
     $model = $this->getModel();
     $table = $model->getTable();
     $query = KFactory::tmp('lib.koowa.database.query');
     $ids = array();
     foreach ($data['group'] as $joomla => $ninjaboard) {
         $ids[] = $joomla;
     }
     $table->getDatabase()->execute('TRUNCATE TABLE `#__ninjaboard_joomla_user_group_maps`');
     foreach ($ids as $id) {
         $table->getDatabase()->execute('INSERT INTO `#__ninjaboard_joomla_user_group_maps` (`joomla_gid`, `ninjaboard_gid`) VALUES (' . $id . ', ' . (int) $data['group'][$id] . ')');
         //$table->insert(array('joomla_gid' => $id, 'ninjaboard_gid' => $data['group'][$id]));
     }
     $tmpl = false;
     if (KRequest::get('post.tmpl', 'cmd') == 'component') {
         $tmpl = '&tmpl=component';
     }
     $this->_redirect = 'index.php?option=com_ninjaboard&view=joomlausergroupmaps' . $tmpl;
     if ($tmpl) {
         $this->_redirect_message = '<script type="text/javascript">window.parent.document.getElementById("sbox-btn-close").fireEvent("click")</script>';
     }
     // @TODO this is a temporary workaround, find out why the proper way, using setRedirect(), stopped working.
     echo $this->_redirect_message;
     //$this->setRedirect('view=joomlausergroupmaps'.$tmpl, $tmpl ? '<script type="text/javascript">window.parent.document.getElementById("sbox-btn-close").fireEvent("click")</script>' : null);
     return $this->getModel()->getList();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:28,代码来源:joomlausergroupmap.php


示例4: _actionAdd

 /**
  * Method to upload and Add a photo.
  *
  * @param KCommandContext $context
  */
 protected function _actionAdd($context)
 {
     $data = $context->data;
     $file = KRequest::get('files.file', 'raw');
     $content = @file_get_contents($file['tmp_name']);
     $filesize = strlen($content);
     $uploadlimit = $this->_max_upload_limit * 1024 * 1024;
     $exif = function_exists('exif_read_data') ? @exif_read_data($file['tmp_name']) : array();
     if ($filesize == 0) {
         throw new LibBaseControllerExceptionBadRequest('File is missing');
         return;
     }
     if ($filesize > $uploadlimit) {
         throw new LibBaseControllerExceptionBadRequest('Exceed maximum size');
         return;
     }
     $orientation = 0;
     if (!empty($exif) && isset($exif['Orientation'])) {
         $orientation = $exif['Orientation'];
     }
     $data['portrait'] = array('data' => $content, 'rotation' => $orientation, 'mimetype' => isset($file['type']) ? $file['type'] : null);
     $photo = $this->actor->photos->addNew($data);
     $photo->setExifData($exif);
     $photo->save();
     $this->setItem($photo);
     $this->getResponse()->status = KHttpResponse::CREATED;
     if ($photo->body && preg_match('/\\S/', $photo->body)) {
         $context->append(array('story' => array('body' => $photo->body)));
     }
     return $photo;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:36,代码来源:photo.php


示例5: _initialize

 /**
  * Initializes the configuration for the object
  * 
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   array   Configuration settings
  */
 protected function _initialize(KConfig $config)
 {
     $language = JFactory::getLanguage();
     $settings = array('directionality' => $language->isRTL() ? 'rtl' : 'ltr', 'editor_selector' => 'editable', 'mode' => 'specific_textareas', 'skin' => 'nooku', 'theme' => 'advanced', 'inline_styles' => true, 'gecko_spellcheck' => true, 'entity_encoding' => 'raw', 'extended_valid_elements' => '', 'invalid_elements' => 'script,applet,iframe', 'relative_urls' => true, 'remove_script_host' => false, 'document_base_url' => KRequest::root(), 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_source_editor_height' => '550', 'height' => '550', 'width' => '100%', 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_resizing' => false, 'theme_advanced_resize_horizontal' => false, 'theme_advanced_path' => true, 'dialog_type' => 'modal', 'language' => substr($language->getTag(), 0, strpos($language->getTag(), '-')), 'theme_advanced_buttons1' => implode(',', array('bold', 'italic', 'strikethrough', 'underline', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'link', 'unlink', '|', 'spellchecker', 'fullscreen', 'image', 'readmore', 'article', '|', 'advanced')), 'theme_advanced_buttons2' => implode(',', array('formatselect', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo')), 'theme_advanced_buttons3' => '', 'theme_advanced_buttons4' => '');
     $config->append(array('layout' => 'default', 'media_url' => KRequest::root() . '/media'))->append(array('codemirror' => true, 'codemirrorOptions' => array('stylesheet' => array($config->media_url . '/com_editors/codemirror/css/xmlcolors.css', $config->media_url . '/com_editors/codemirror/css/jscolors.css', $config->media_url . '/com_editors/codemirror/css/csscolors.css', $config->media_url . '/com_editors/css/codemirror.css'), 'path' => $config->media_url . '/com_editors/codemirror/js/'), 'editor_settings' => $settings));
     parent::_initialize($config);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:14,代码来源:html.php


示例6: __construct

 public function __construct(KConfigInterface $config)
 {
     parent::__construct($config);
     if (KRequest::type() == 'AJAX' && KRequest::method() == 'POST') {
         $this->unregisterCallback('after.dispatch', array($this, 'forward'));
     }
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:7,代码来源:dispatcher.php


示例7: _actionApply

 protected function _actionApply(KCommandContext $context)
 {
     $data = $context->caller->execute('edit', $context);
     $url = clone KRequest::url();
     $this->setRedirect($url);
     return $data;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:7,代码来源:editable.php


示例8: uploadAvatar

 /**
  * Upload the users avatar
  * 
  * @param	KCommandContext	A command context object
  * @return 	void
  */
 public function uploadAvatar(KCommandContext $context)
 {
     $avatar = KRequest::get('files.avatar', 'raw');
     if (!$avatar['name']) {
         return;
     }
     //Prepare MediaHelper
     JLoader::register('MediaHelper', JPATH_ROOT . '/components/com_media/helpers/media.php');
     // is it an image
     if (!MediaHelper::isImage($avatar['name'])) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because it's not an image."), $avatar['name']));
         return;
     }
     // are we allowed to upload this filetype
     if (!MediaHelper::canUpload($avatar, $error)) {
         JError::raiseWarning(21, sprintf(JText::_("%s failed to upload because %s"), $avatar['name'], lcfirst($error)));
         return;
     }
     // @todo put in some max file size checks
     $path = 'images/com_portfolio/avatars/' . $context->data->user_id . '/';
     $ext = JFile::getExt($avatar['name']);
     $name = JFile::makeSafe($this->getService('koowa:filter.slug')->sanitize($context->data->title) . '.' . $ext);
     JFile::upload($avatar['tmp_name'], JPATH_ROOT . '/' . $path . $name);
     $context->data->avatar = $path . $name;
 }
开发者ID:ravenlife,项目名称:Portfolio,代码行数:31,代码来源:person.php


示例9: login

 /**
  * Logs in a user.
  *
  * @param array $user     The user as an array
  * @param bool  $remember Flag to whether remember the user or not
  *
  * @return bool
  */
 public function login(array $user, $remember = false)
 {
     $session =& JFactory::getSession();
     // we fork the session to prevent session fixation issues
     $session->fork();
     JFactory::getApplication()->_createSession($session->getId());
     // Import the user plugin group
     JPluginHelper::importPlugin('user');
     $options = array();
     $results = JFactory::getApplication()->triggerEvent('onLoginUser', array($user, $options));
     foreach ($results as $result) {
         if ($result instanceof JException || $result instanceof Exception || $result === false) {
             return false;
         }
     }
     //if remember is true, create a remember cookie that contains the ecrypted username and password
     if ($remember) {
         // Set the remember me cookie if enabled
         jimport('joomla.utilities.simplecrypt');
         jimport('joomla.utilities.utility');
         $key = JUtility::getHash(KRequest::get('server.HTTP_USER_AGENT', 'raw'));
         if ($key) {
             $crypt = new JSimpleCrypt($key);
             $cookie = $crypt->encrypt(serialize(array('username' => $user['username'], 'password' => $user['password'])));
             $lifetime = time() + 365 * 24 * 3600;
             setcookie(JUtility::getHash('JLOGIN_REMEMBER'), $cookie, $lifetime, '/');
         }
     }
     return true;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:38,代码来源:person.php


示例10: display

 public function display()
 {
     $this->assign('params', KFactory::get('admin::com.ninjaboard.model.settings')->getParams());
     $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe();
     $this->showtopics = false;
     if (isset($this->params['view_settings']['displayed_elements']) && $me->topic_permissions > 0) {
         if (in_array('showtopics', $this->params['view_settings']['displayed_elements'])) {
             $this->showtopics = true;
             //$state		= KFactory::get($this->getModel())->getState();
             /*$this->limit	= KRequest::get('get.limit', 'int', 10);
             		$this->offset	= KRequest::get('get.offset', 'int', 0);
             		$topicsmodel	= KFactory::tmp('site::com.ninjaboard.model.topics')
             							->limit($this->limit)
             							->offset($this->offset)
             							->sort('last_post_date')
             							->direction('desc');
             		$this->total	= $topicsmodel->getTotal();
             		$this->length	= KFactory::tmp('site::com.ninjaboard.model.topics')->getTotal();
             		
             		$this->assign('pagination', 
             			KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))
             				->pagination($this->total, $this->offset, $this->limit, 4)
             		);*/
             $this->limit = KRequest::get('get.limit', 'int', 10);
             $this->offset = KRequest::get('get.offset', 'int', 0);
             $this->total = KFactory::get('site::com.ninjaboard.model.topics')->getTotal();
             $this->assign('topics', KFactory::get('site::com.ninjaboard.controller.topic')->setView(KFactory::get('site::com.ninjaboard.view.topics.html'))->direction('desc')->sort('last_post_on')->limit($this->limit)->offset($this->offset)->layout('list')->display());
             $this->assign('pagination', KFactory::get('site::com.ninjaboard.template.helper.paginator', array('name' => 'topics'))->pagination($this->total, $this->offset, $this->limit, 4, false));
         }
     }
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:32,代码来源:html.php


示例11: beforeAdd

 public function beforeAdd(KCommandContext $context)
 {
     if (!$context->data->file) {
         $context->data->file = KRequest::get('files.file.tmp_name', 'raw');
         $context->data->path = KRequest::get('files.file.name', 'koowa:filter.filename');
     }
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:7,代码来源:file.php


示例12: setPermissions

 /**
  * Generic function for setting the permissions
  *
  * @return void
  */
 public function setPermissions($context)
 {
     //Temp fix
     if (KInflector::isPlural(KRequest::get('get.view', 'cmd')) || KRequest::type() == 'AJAX') {
         return;
     }
     $model = KFactory::get($this->getModel());
     $table = KFactory::tmp(KFactory::get(KFactory::get('admin::com.ninja.helper.access')->models->assets)->getTable());
     $query = $table->getDatabase()->getQuery();
     $item = $model->getItem();
     $identifier = $this->getIdentifier();
     $id = $identifier->type . '_' . $identifier->package . '.' . $identifier->name . '.' . $item->id . '.';
     $permissions = (array) KRequest::get('post.permissions', 'int');
     $editable = KRequest::get('post.editpermissions', 'boolean', false);
     if (!$permissions && $editable) {
         $query->where('tbl.name', 'LIKE', $id . '%');
         $table->select($query)->delete();
     }
     $safe = array();
     $query = $table->getDatabase()->getQuery()->where('name', 'like', $id . '%');
     foreach ((array) KRequest::get('post.params.permissions', 'raw') as $group => $other) {
         $safe[] = $id . $group;
     }
     if ($safe) {
         $query->where('name', 'not in', $safe);
     }
     $table->select($query, KDatabase::FETCH_ROWSET)->delete();
     foreach ($permissions as $usergroup => $rules) {
         foreach ($rules as $name => $permission) {
             KFactory::tmp(KFactory::get('admin::com.ninja.helper.access')->models->assets)->name($id . $usergroup . '.' . $name)->getItem()->setData(array('name' => $id . $usergroup . '.' . $name, 'level' => $permission))->save();
         }
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:38,代码来源:forum.php


示例13: _initialize

 protected function _initialize(KConfig $config)
 {  
     //Force the view to prevent a redirect
     KRequest::set('get.view', 'results');
      
     parent::_initialize($config);
 }
开发者ID:raeldc,项目名称:com_learn,代码行数:7,代码来源:dispatcher.php


示例14: render

 public function render()
 {
     $name = $this->getName();
     $img = KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', '/32/' . $name . '.png');
     if ($img) {
         KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.css', '.toolbar .icon-32-' . $name . ' { background-image: url(' . $img . '); }');
     }
     $text = JText::_($this->_options['text']);
     $view = KRequest::get('get.view', 'cmd');
     $link = ' href="' . JRoute::_($this->getLink()) . '"';
     $html = array();
     // Sanitize the url since we can't trust the server var
     $url = KFactory::get('lib.koowa.filter.url')->sanitize($this->getLink());
     // Create the URI object
     $uri = KFactory::tmp('lib.koowa.http.uri', array('uri' => $url));
     $query = $uri->getQuery(1);
     $html[] = '<td class="button" id="' . $this->getId() . '">';
     $active = $view == KInflector::variablize(KInflector::pluralize($query['view'])) || $view == KInflector::variablize(KInflector::singularize($query['view']));
     $hide = !KInflector::isPlural($view);
     if ($active || $hide || !$this->modal) {
         $html[] = '<a class="toolbar inactive">';
     } else {
         $html[] = '<a' . $link . ' onclick="' . $this->getOnClick() . '" class="toolbar">';
     }
     $html[] = '<span class="' . $this->getClass() . '" title="' . $text . '">';
     $html[] = '</span>';
     $html[] = $text;
     if (!$active && !$hide || $this->modal) {
         $html[] = '</a>';
     } else {
         $html[] = '</a>';
     }
     $html[] = '</td>';
     return implode(PHP_EOL, $html);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:35,代码来源:link.php


示例15: onBeforeDispatcherDispatch

 public function onBeforeDispatcherDispatch(KEvent $event)
 {
     $application = JFactory::getApplication();
     if ($application->getName() != 'site') {
         return;
     }
     //var_dump($_SERVER); exit();
     // check if SSO header is set
     $personnumber = KRequest::get('server.HTTP_P_SSO_IDENTIFIER', 'alnum');
     if (empty($personnumber) || !preg_match('/P\\d+/is', $personnumber)) {
         // TODO set proper http response
         throw new KException('Access not allowed');
     }
     // check if user is already logged in
     $user = JFactory::getUser();
     // make sure personnumber is still the same
     if (!$user->guest && $user->username != $personnumber) {
         $application->logout();
         $application->redirect(KRequest::url());
     }
     if ($user->guest) {
         $credentials = array('username' => $personnumber, 'password' => $personnumber);
         $result = $application->login($credentials, array());
         if (JError::isError($result)) {
             // TODO set proper http response
             throw new KException($result->getError());
         } else {
             $application->redirect('index.php');
         }
     }
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:31,代码来源:sso.php


示例16: display

 public function display()
 {
     $items = $this->getModel()->getList();
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
     $xml .= '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
     $xml .= '<channel>';
     $xml .= '<title>Posts RSS feed</title>';
     $xml .= '<description>RSS description</description>';
     $xml .= '<generator>' . JURI::base() . '</generator>';
     foreach ($items as $item) {
         $xml .= '<item>';
         $xml .= '<title>' . htmlspecialchars($item->title) . '</title>';
         $xml .= '<link>' . $root . JRoute::_('index.php?option=com_ninjaboard&view=topic&id=' . $item->ninjaboard_topic_id . '&post=' . $item->id . '#p' . $item->id) . '</link>';
         $xml .= '<description>' . htmlspecialchars(KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->text))) . '</description>';
         $xml .= '<guid isPermaLink="false">' . $item->uuid . '</guid>';
         $xml .= '<media:title>' . htmlspecialchars($item->title) . '</media:title> ';
         $xml .= '<media:content url="' . $root . JRoute::_('index.php?option=com_ninjaboard&view=avatar&id=' . $item->created_by . '&format=file') . '"/>';
         $xml .= '</item>';
     }
     $xml .= '</channel>';
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:25,代码来源:rss.php


示例17: getOnClick

 public function getOnClick()
 {
     $id = KRequest::get('get.id', 'int');
     $token = JUtility::getToken();
     $json = "{method:'post', url:'index.php?option=com_create&view=component&id={$id}', formelem:'adminForm', params:{action:'generate', _token:'{$token}'}}";
     return 'new KForm(' . $json . ').submit();';
 }
开发者ID:rpijpers,项目名称:Create,代码行数:7,代码来源:generate.php


示例18: display

    public function display()
    {
        // Display the toolbar
        $toolbar = $this->_createToolbar()->reset();
        $this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false)));
        KFactory::get('admin::com.ninja.helper.default')->css('/' . $this->getIdentifier()->application . '.' . $this->getName() . '.css');
        KFactory::get('admin::com.ninja.helper.default')->js('/raphael.js');
        KFactory::get('admin::com.ninja.helper.default')->js('/Mapper.js');
        $acl = JFactory::getACL();
        //die('<pre>'.print_r(get_class_methods($acl), true).'</pre>');
        $acltree = (array) $acl->get_group_children_tree(null, 'USERS', false);
        array_unshift($acltree, (object) array('value' => 0, 'text' => 'Unregistered', 'disabled' => false));
        $this->acltree = $acltree;
        $this->usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->getList();
        $maps = array();
        foreach (KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->getList() as $map) {
            $maps[$map->id] = $map->ninjaboard_gid;
        }
        $this->maps = $maps;
        $display = parent::display();
        if (KRequest::type() == 'AJAX') {
            echo '<script type="text/javascript">
			' . $this->_document->_script['text/javascript'] . '
			</script>';
        }
        return $display;
    }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:27,代码来源:html.php


示例19: translations

 public function translations($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('row' => null, 'table' => ''));
     // First for our knowledge we get the original language (if exists.)
     $original = $this->_getOriginalLanguage($config->row, $config->table);
     $html = '<style src="media://com_translations/css/translations.css" />';
     $view = KInflector::singularize(KRequest::get('get.view', 'string'));
     foreach ($this->_getLanguages() as $language) {
         $relation = $this->_getLanguage($config, $language->lang_code);
         if ($language->lang_code == $original->iso_code) {
             $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-info">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
         } else {
             if ($relation->translated) {
                 $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-success">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
             } else {
                 if (strtotime('+ 2 weeks', strtotime($original->created_on)) > strtotime(date('d-m-Y H:i:s'))) {
                     $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-warning">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                 } else {
                     if (strtotime('+ 2 weeks', strtotime($original->created_on)) < strtotime(date('d-m-Y H:i:s'))) {
                         $html .= ' <a href="' . $this->getTemplate()->getView()->createRoute('view=' . $view . '&id=' . $config->row . '&backendlanguage=' . $language->lang_code) . '"><div class="badge badge-important">' . strtoupper(substr($language->lang_code, 0, 2)) . '</a></div>';
                     }
                 }
             }
         }
     }
     return $html;
 }
开发者ID:kedweber,项目名称:com_translations,代码行数:28,代码来源:language.php


示例20: display

 public function display()
 {
     $targets = KFactory::tmp('site::com.stream.model.targets')->getList()->getData();
     $thing = reset($targets);
     $string = substr($thing['title'], 3);
     $option = strtolower(substr($string, 0, stripos($string, 'controller')));
     $view = strtolower(substr($string, stripos($string, 'controller') + 10));
     $model = KInflector::pluralize($view);
     $list = KFactory::tmp('site::com.' . $option . '.model.' . $model)->getList()->getData();
     $array = array();
     foreach ($list as $item) {
         $array[] = $item['id'];
     }
     //Get the list of posts
     $activities = KFactory::get($this->getModel())->set('parent_target_id', KRequest::get('get.parent_target_id', 'int'))->getList();
     $myactivities = array();
     foreach (@$activities as $activity) {
         if (!in_array($activity->parent_target_id, $array)) {
             continue;
         } else {
             $myactivities[] = $activity;
         }
     }
     $this->assign('myactivities', $myactivities);
     $this->assign('pagination', KFactory::get($this->getModel())->getState()->pagination);
     return parent::display();
 }
开发者ID:raeldc,项目名称:com_stream,代码行数:27,代码来源:html.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP KSSystem类代码示例发布时间:2022-05-23
下一篇:
PHP KObjectConfig类代码示例发布时间: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