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


PHP xPDOSimpleObject::get方法代码示例

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


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

示例1: get

 /**
  * Overrides xPDOObject::get to handle when retrieving the properties field
  * for an Element.
  *
  * {@inheritdoc}
  */
 public function get($k, $format = null, $formatTemplate = null)
 {
     $value = parent::get($k, $format, $formatTemplate);
     /* automatically translate lexicon descriptions */
     if ($k == 'properties' && !empty($value) && is_array($value) && is_object($this->xpdo) && $this->xpdo instanceof modX && $this->xpdo->lexicon) {
         foreach ($value as &$property) {
             if (!empty($property['lexicon'])) {
                 if (strpos($property['lexicon'], ':') !== false) {
                     $this->xpdo->lexicon->load('en:' . $property['lexicon']);
                 } else {
                     $this->xpdo->lexicon->load('en:core:' . $property['lexicon']);
                 }
                 $this->xpdo->lexicon->load($property['lexicon']);
             }
             $property['desc_trans'] = $this->xpdo->lexicon($property['desc']);
             $property['area'] = !empty($property['area']) ? $property['area'] : '';
             if (!empty($property['options'])) {
                 foreach ($property['options'] as &$option) {
                     if (empty($option['text']) && !empty($option['name'])) {
                         $option['text'] = $option['name'];
                         unset($option['name']);
                     }
                     if (empty($option['value']) && !empty($option[0])) {
                         $option['value'] = $option[0];
                         unset($option[0]);
                     }
                     $option['name'] = $this->xpdo->lexicon($option['text']);
                 }
             }
         }
     }
     return $value;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:39,代码来源:modpropertyset.class.php

示例2: get

 public function get($k, $format = null, $formatTemplate = null)
 {
     if ($k == 'badge') {
         $v = $this->getBadge();
     } else {
         $v = parent::get($k, $format, $formatTemplate);
     }
     return $v;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:9,代码来源:disusergroupprofile.class.php

示例3: getImageUrl

 public function getImageUrl($image = '')
 {
     if (empty($image)) {
         $image = parent::get('image');
     }
     if (!empty($image) && ($source = parent::get('source'))) {
         /** @var modMediaSource $source */
         if ($source = $this->xpdo->getObject('sources.modMediaSource', $source)) {
             $source->initialize();
             //$image = $source->getObjectUrl($image);
             $image = $source->getBasePath($image) . $image;
         }
     }
     return $image;
 }
开发者ID:suasti,项目名称:BannerY,代码行数:15,代码来源:byad.class.php

示例4: get

 /**
  * Overrides xPDOObject::get() to replace path settings.
  *
  * {@inheritdoc}
  */
 public function get($k, $format = null, $formatTemplate = null)
 {
     $result = parent::get($k, $format, $formatTemplate);
     if ($k === 'path' && strpos($result, '{') !== false) {
         $replacements = array();
         foreach ($this->xpdo->config as $key => $value) {
             $_pos = strrpos($key, '_');
             if ($_pos > 0 && substr($key, $_pos + 1) === 'path') {
                 $replacements['{' . $key . '}'] = $value;
             }
         }
         $result = str_replace(array_keys($replacements), array_values($replacements), $result);
     }
     return $result;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:20,代码来源:modworkspace.class.php

示例5: get

 public function get($k, $format = null, $formatTemplate = null)
 {
     switch ($k) {
         case 'thumbnail':
             $value = $this->getPhpThumbUrl();
             if (empty($format)) {
                 $format = array();
             }
             $format['src'] = $this->xpdo->getOption('gallery.thumbs_prepend_site_url', null, false) ? $this->getSiteUrl() : '';
             $format['src'] .= $this->xpdo->getOption('gallery.files_url') . $this->get('filename');
             $url = $value . '&' . http_build_query($format, '', '&');
             if ($this->xpdo->getOption('xhtml_urls', null, false)) {
                 $value = str_replace('&', '&', $url);
                 $value = str_replace('&', '&', $value);
             } else {
                 $value = $url;
             }
             break;
         case 'image':
             if (empty($format)) {
                 $format = array();
             }
             $format['src'] = $this->xpdo->getOption('gallery.thumbs_prepend_site_url', null, false) ? $this->getSiteUrl() : '';
             $format['src'] .= $this->xpdo->getOption('gallery.files_url') . $this->get('filename');
             $value = $this->getPhpThumbUrl() . '&' . http_build_query($format, '', '&');
             $value = $this->xpdo->getOption('xhtml_urls', null, false) ? str_replace('&', '&', $value) : $value;
             break;
         case 'absoluteImage':
             $value = $this->getSiteUrl() . $this->xpdo->getOption('gallery.files_url') . $this->get('filename');
             break;
         case 'relativeImage':
             $value = ltrim($this->xpdo->getOption('gallery.files_url') . $this->get('filename'), '/');
             break;
         case 'filesize':
             $filename = $this->xpdo->getOption('gallery.files_path') . $this->get('filename');
             $value = @filesize($filename);
             $value = $this->formatFileSize($value);
             break;
         case 'image_path':
             $value = $this->xpdo->getOption('gallery.files_path') . $this->get('filename');
             break;
         default:
             $value = parent::get($k, $format, $formatTemplate);
             break;
     }
     return $value;
 }
开发者ID:hansek,项目名称:Gallery,代码行数:47,代码来源:galitem.class.php

示例6: save

 /**
  * @param null $cacheFlag
  *
  * @return bool
  */
 public function save($cacheFlag = null)
 {
     $save = parent::save($cacheFlag);
     $tags = parent::get('tags');
     if (is_array($tags)) {
         $id = $this->get('id');
         $table = $this->xpdo->getTableName('msResourceFileTag');
         $this->xpdo->exec("DELETE FROM {$table} WHERE `file_id` = {$id};");
         if (!empty($tags)) {
             $values = array();
             foreach ($tags as $tag) {
                 $tag = trim($tag);
                 if (!empty($tag)) {
                     $values[] = '(' . $id . ',"' . $tag . '")';
                 }
             }
             if (!empty($values)) {
                 $this->xpdo->exec("INSERT INTO {$table} (`file_id`,`tag`) VALUES " . implode(',', $values));
             }
         }
     }
     return $save;
 }
开发者ID:arkadiy-vl,项目名称:ms2Gallery,代码行数:28,代码来源:msresourcefile.class.php

示例7: get

 public function get($k, $format = null, $formatTemplate = null)
 {
     switch ($k) {
         case 'thumbnail':
             $value = $this->getPhpThumbUrl();
             if (empty($format)) {
                 $format = array();
             }
             $filename = $this->get('filename');
             if ($this->get('absolute_filename')) {
                 $format['src'] = $filename;
             } else {
                 $format['src'] = $this->getSiteUrl();
                 $format['src'] .= $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $filename;
             }
             $ms = $this->getMediaSource();
             if ($ms->getBaseUrl() != '/') {
                 $format['src'] = $ms->getBaseUrl() . $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $filename;
             }
             $url = $value . '&' . http_build_query($format, '', '&');
             if ($this->xpdo->getOption('xhtml_urls', null, false)) {
                 $value = str_replace('&', '&', $url);
                 $value = str_replace('&', '&', $value);
             } else {
                 $value = $url;
             }
             break;
         case 'image':
             if (empty($format)) {
                 $format = array();
             }
             $filename = $this->get('filename');
             if ($this->get('absolute_filename')) {
                 $format['src'] = $filename;
             } else {
                 $format['src'] = $this->getSiteUrl();
                 $format['src'] .= $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $filename;
             }
             $ms = $this->getMediaSource();
             if ($ms->getBaseUrl() != '/') {
                 $format['src'] = $ms->getBaseUrl() . $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $filename;
             }
             $value = $this->getPhpThumbUrl() . '&' . http_build_query($format, '', '&');
             $value = $this->xpdo->getOption('xhtml_urls', null, false) ? str_replace('&', '&', $value) : $value;
             break;
         case 'absoluteImage':
             $siteUrl = $this->getSiteUrl();
             $value = $siteUrl . $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $this->get('filename');
             // $ms = $this->getMediaSource();
             // if($ms->getBaseUrl() != '/') {
             //     $value = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename;
             // }
             break;
         case 'relativeImage':
             $baseUrl = $this->getOption('base_url');
             $path = $this->xpdo->call('galAlbum', 'getFilesUrl', array(&$this->xpdo)) . $this->get('filename');
             if ($baseUrl == '/') {
                 $value = ltrim($path, '/');
             } else {
                 $value = str_replace($baseUrl, '', $path);
             }
             // $ms = $this->getMediaSource(); // for absolute + relative the link NEEDS the http:// domain
             // if($ms->getBaseUrl() != '/') {
             //     $value = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$baseUrl;
             // }
             break;
         case 'filesize':
             $filename = $this->xpdo->call('galAlbum', 'getFilesPath', array(&$this->xpdo)) . $this->get('filename');
             $value = @filesize($filename);
             $value = $this->formatFileSize($value);
             break;
         case 'image_path':
             $value = $this->xpdo->call('galAlbum', 'getFilesPath', array(&$this->xpdo)) . $this->get('filename');
             break;
         case 'base_url':
             $ms = $this->getMediaSource();
             $value = '';
             if ($ms->getBaseUrl() != '/') {
                 $value = $ms->getBaseUrl();
             }
             break;
         default:
             $value = parent::get($k, $format, $formatTemplate);
             break;
     }
     return $value;
 }
开发者ID:Piterden,项目名称:modx_testfloor,代码行数:87,代码来源:galitem.class.php

示例8: get

 /**
  * Overrides xPDOObject::get to provide formatting for certain fields
  *
  * @param string $k
  * @param string $format
  * @param string $formatTemplate
  * @return mixed|string
  */
 public function get($k, $format = '', $formatTemplate = '')
 {
     $v = parent::get($k, $format, $formatTemplate);
     if ($this->xpdo->context->key != 'mgr') {
         switch ($k) {
             case 'gender_formatted':
                 switch ($this->get('gender')) {
                     case 'm':
                         $v = $this->xpdo->lexicon('discuss.male');
                         break;
                     case 'f':
                         $v = $this->xpdo->lexicon('discuss.female');
                         break;
                     default:
                         $v = '';
                         break;
                 }
                 break;
             case 'age':
                 $v = strtotime($this->get('birthdate'));
                 $v = floor((time() - $v) / 60 / 60 / 24 / 365);
                 $v = !empty($v) ? $v : '';
                 break;
             case 'ip':
                 if (!$this->xpdo->hasPermission('discuss.track_ip')) {
                     $v = '';
                 }
                 break;
             case 'last_active':
                 if (!$this->get('show_online') && !$this->isAdmin()) {
                     $v = '';
                 } elseif (!empty($v) && $v != '-001-11-30 00:00:00') {
                     $v = strftime($this->xpdo->discuss->dateFormat, strtotime($v));
                 } else {
                     $v = '';
                 }
                 break;
             case 'email':
                 if (!$this->get('show_email') && !$this->isAdmin()) {
                     $v = '';
                 }
                 break;
             case 'name':
                 if ($this->get('use_display_name')) {
                     $v = $this->get('display_name');
                 }
                 if (empty($v)) {
                     $v = $this->get('username');
                 }
                 break;
             case 'posts_formatted':
                 $v = $this->get('posts');
                 $v = number_format($v);
                 break;
         }
     }
     return $v;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:66,代码来源:disuser.class.php

示例9: get

 /**
  * Always ensure that the title strips any HTML/MODX tags
  * @param string $k
  * @param string|null $format
  * @param string|null $formatTemplate
  * @return mixed
  */
 public function get($k, $format = null, $formatTemplate = null)
 {
     $v = parent::get($k, $format, $formatTemplate);
     switch ($k) {
         case 'title':
             $v = html_entity_decode($v);
             $v = $this->xpdo->discuss->stripAllTags($v);
             $v = strip_tags($v, '<span>');
             $v = preg_replace('@\\[\\[(.[^\\[\\[]*?)\\]\\]@si', '', $v);
             break;
         default:
             break;
     }
     return $v;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:22,代码来源:disthread.class.php

示例10: getWeight

 public function getWeight($data = array())
 {
     $weight = parent::get('weight');
     if (!empty($this->xpdo->getWeight)) {
         return $weight;
     }
     $this->xpdo->getWeight = true;
     if (empty($data)) {
         $data = $this->toArray();
     }
     /** @var miniShop2 $miniShop2 */
     $miniShop2 = $this->xpdo->getService('minishop2');
     $params = array('product' => $this, 'data' => $data, 'weight' => $weight);
     $response = $miniShop2->invokeEvent('msOnGetProductWeight', $params);
     if ($response['success']) {
         $weight = $params['weight'] = $response['data']['weight'];
     }
     /* @var modSnippet $snippet */
     // Deprecated. Leaved for backward compatibility.
     if ($setting = $this->xpdo->getOption('ms2_weight_snippet', null, false, true)) {
         if ($snippet = $this->xpdo->getObject('modSnippet', array('name' => $setting))) {
             $snippet->setCacheable(false);
             $weight = $snippet->process($params);
         }
     }
     //--
     $this->xpdo->getWeight = false;
     return $weight;
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:29,代码来源:msproductdata.class.php

示例11: get

 /**
  * Always ensure that the title strips any HTML/MODX tags
  * @param string $k
  * @param string|null $format
  * @param string|null $formatTemplate
  * @return mixed
  */
 public function get($k, $format = null, $formatTemplate = null)
 {
     $v = parent::get($k, $format, $formatTemplate);
     switch ($k) {
         case 'title':
             $v = htmlspecialchars($v, ENT_QUOTES, 'UTF-8');
             break;
         default:
             break;
     }
     return $v;
 }
开发者ID:oneismore,项目名称:Discuss,代码行数:19,代码来源:dispost.class.php


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