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

PHP entity类代码示例

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

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



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

示例1: init

 function init($args = array())
 {
     parent::init($args);
     $site = new entity($this->site_id);
     if (!empty($this->params['sites'])) {
         $this->child_sites = array();
         foreach ($this->params['sites'] as $unique_name) {
             if ($id = id_of($unique_name)) {
                 $e = new entity($id);
                 if ($e->get_value('type') == id_of('site') && ($site->get_value('site_state') != 'Live' || $e->get_value('site_state') == 'Live')) {
                     $this->child_sites[$id] = $e;
                 }
             }
         }
     } else {
         $es = new entity_selector();
         $es->description = 'Getting child sites of this site';
         $es->add_type(id_of('site'));
         $es->add_left_relationship($this->site_id, relationship_id_of('parent_site'));
         $es->set_order('entity.name');
         if ($site->get_value('site_state') == 'Live') {
             $es->add_relation('site_state="Live"');
         }
         $this->child_sites = $es->run_one();
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:child_sites.php


示例2: show_feed_link

 function show_feed_link()
 {
     $type = new entity(id_of('event_type'));
     if ($type->get_value('feed_url_string')) {
         echo '<div class="feedInfo"><a href="/' . REASON_GLOBAL_FEEDS_PATH . '/' . $type->get_value('feed_url_string') . '" title="RSS feed for this site\'s events">xml</a></div>';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:events_instancewide.php


示例3: get_plasmature_element_parameters

 /**
  * Get the appropriate parameters to pass to the plasmature element
  * @param integer $site_id The Reason id of the site in which this editor is being invoked
  * @param integer $user_id The Reason id of the current user (0 if user is anonymous or not in the Reason user store)
  * @return array plasmature parameters 
  */
 function get_plasmature_element_parameters($site_id, $user_id = 0)
 {
     $params = array();
     // site id
     $params['site_id'] = $site_id;
     // paths
     $params['paths'] = $this->_get_paths($site_id);
     // default widgets
     $site = new entity($site_id);
     if ($site->get_value('loki_default')) {
         $map = $this->_get_options_map();
         if (array_key_exists($site->get_value('loki_default'), $map)) {
             $params['widgets'] = $map[$site->get_value('loki_default')]['maps_to'];
         } else {
             $params['widgets'] = $site->get_value('loki_default');
         }
     } else {
         $params['widgets'] = 'default';
     }
     // user is admin
     if (!empty($user_id) && (user_is_a($user_id, id_of('admin_role')) || user_is_a($user_id, id_of('power_user_role')))) {
         $params['widgets'] .= ' +source +debug';
     } else {
         $params['widgets'] .= ' -source -debug';
     }
     if (defined('REASON_DEFAULT_ALLOWED_TAGS')) {
         $params['allowable_tags'] = explode(',', str_replace(array('><', '<', '>'), array(',', '', ''), REASON_DEFAULT_ALLOWED_TAGS));
     }
     if (defined('REASON_LOKI_CRASH_REPORT_URI') && REASON_LOKI_CRASH_REPORT_URI != '') {
         $params['crash_report_uri'] = REASON_LOKI_CRASH_REPORT_URI;
     }
     return $params;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:39,代码来源:loki_2.php


示例4: thor_build_display_values

	function thor_build_display_values()
	{
		$form = new entity($this->form_id);
		$form->get_values();
		if ($form->get_value('type') != id_of('form'))
		{
			trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
		}
		else
		{
			$form_xml_obj = new XMLParser($form->get_value('thor_content'));
			$form_xml_obj->Parse();
			$display_values = array();
			foreach ($form_xml_obj->document->tagChildren as $k=>$v)
			{
				$tagname = is_object($v) ? $v->tagName : '';
				if (method_exists($this, '_build_display_'.$tagname))
				{
					$build_function = '_build_display_'.$tagname;
					$display_values = array_merge($display_values, $this->$build_function($v));
				}
			}
		}
		foreach ($this->extra_fields as $field_name)
		{
			$display_values[$field_name]['label'] = prettify_string($field_name);
			$display_values[$field_name]['type'] = 'text';
		}
		$this->_display_values = (isset($display_values)) ? $display_values : array();
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:30,代码来源:thor_viewer.php


示例5: transform

 /**
  * Transforms an object (usuario) to a string (id).
  *
  * @param  entity|null $entity
  * @return string
  */
 public function transform($entity)
 {
     if (null === $entity) {
         return $this->id;
     }
     return $entity->getId();
 }
开发者ID:usinapim,项目名称:SiMOR-backend,代码行数:13,代码来源:ObjectToIdTransformer.php


示例6: init

 function init($args = array())
 {
     parent::init($args);
     $root_id = $this->parent->pages->root_node();
     $this_page_id = $this->cur_page->id();
     // check to see if this is a home page -- don't even query for siblings
     if ($root_id != $this_page_id) {
         $parent_id = $this->parent->pages->parent($this->cur_page->id());
         if (!empty($parent_id)) {
             $sibling_ids = $this->parent->pages->children($parent_id);
             if (!empty($sibling_ids)) {
                 foreach ($sibling_ids as $sibling_id) {
                     if ($sibling_id != $root_id) {
                         $page = new entity($sibling_id);
                         if ($this->params['show_only_pages_in_nav'] && $page->get_value('nav_display') != 'Yes') {
                             continue;
                         }
                         if (isset($this->params['show_external_links']) && !$this->params['show_external_links'] && $page->get_value('url')) {
                             continue;
                         }
                         $this->siblings[$sibling_id] = $page;
                     }
                 }
             }
             $this->parent_page = new entity($parent_id);
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:siblings.php


示例7: get_pages_needing_change

 function get_pages_needing_change()
 {
     if (!isset($this->pages_needing_change)) {
         $es = new entity_selector();
         $es->add_type(id_of('minisite_page'));
         $es->enable_multivalue_results();
         $es->limit_tables('page_node');
         $es->limit_fields('custom_page');
         $es->add_relation('page_node.custom_page = "blurb"');
         $es->add_left_relationship_field('minisite_page_to_text_blurb', 'entity', 'id', 'blurb_id');
         $result = $es->run_one();
         foreach ($result as $k => $page) {
             $blurbs = is_array($page->get_value('blurb_id')) ? $page->get_value('blurb_id') : array($page->get_value('blurb_id'));
             foreach ($blurbs as $blurb_id) {
                 $blurb = new entity($blurb_id);
                 $content = $blurb->get_value('content');
                 $demoted_content = demote_headings($content, 1);
                 if ($content == $demoted_content) {
                     $pages_needing_page_type_change[$k] = $k;
                 }
             }
         }
         $this->pages_needing_change = isset($pages_needing_page_type_change) ? array_keys($pages_needing_page_type_change) : false;
     }
     return $this->pages_needing_change;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:blurb_page_type_change.php


示例8: set_audience_id

 function set_audience_id($aud_id)
 {
     $aud = new entity($aud_id);
     if ($aud->get_values()) {
         $this->audiences[$aud_id] = $aud;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:events.php


示例9: init

 function init()
 {
     if (!empty($this->admin_page->id)) {
         $temp = new entity($this->admin_page->id, false);
         if ($temp->get_value('new') && $temp->get_value('state') == 'Pending' && !$temp->get_value('name') && reason_user_has_privs($this->admin_page->user_id, 'delete_pending')) {
             reason_expunge_entity($this->admin_page->id, $this->admin_page->user_id);
         }
     }
     if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_id'])) {
         $old_vars = array();
         foreach ($this->admin_page->request as $key => $val) {
             if (substr($key, 0, strlen(CM_VAR_PREFIX)) == CM_VAR_PREFIX) {
                 $old_vars[substr($key, strlen(CM_VAR_PREFIX))] = $val;
                 $old_vars[$key] = '';
             }
         }
         foreach ($this->admin_page->default_args as $arg) {
             if (!isset($old_vars[$arg])) {
                 $old_vars[$arg] = '';
             }
         }
         $link = $this->admin_page->make_link($old_vars);
     } else {
         $link = $this->admin_page->make_link(array('id' => '', 'site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'cur_module' => 'Lister'));
     }
     header('Location: ' . unhtmlentities($link));
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:cancel.php


示例10: run

 /**
  * Run the upgrader
  *
  * @return string HTML report
  */
 public function run()
 {
     $ret = '';
     $e = new entity(id_of('css'));
     if (!$e->get_value('custom_content_handler')) {
         reason_update_entity($e->id(), $this->user_id(), array('custom_content_handler' => 'css.php'));
         $ret .= '<p>The CSS type has been assigned a content manager.</p>' . "\n";
     }
     $tables = get_entity_tables_by_type(id_of('css'), false);
     $has_meta = in_array('meta', $tables);
     $has_url = in_array('url', $tables);
     if ($has_meta || $has_url) {
         set_time_limit(3600);
         if ($has_meta) {
             $ret .= $this->_move_table_fields('meta');
         }
         if ($has_url) {
             $ret .= $this->_move_table_fields('url');
         }
     }
     if (empty($ret)) {
         $ret .= '<p>This upgrade has already been run. There is nothing to do.</p>';
     }
     return $ret;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:css_data_structure.php


示例11: get_feed_as_text

function get_feed_as_text($params)
{
    if (!empty($params['type_id'])) {
        $type = new entity($params['type_id']);
        if (!empty($params['feed'])) {
            $feed_file = $params['feed'];
        } elseif ($type->get_value('custom_feed')) {
            $feed_file = str_replace('.php', '', $type->get_value('custom_feed'));
        } else {
            $feed_file = 'default';
            // otherwise use default feed script
        }
        reason_include_once('feeds/' . $feed_file . '.php');
        $feed_class = $GLOBALS['_feed_class_names'][$feed_file];
        if (!empty($params['site_id'])) {
            $site = new entity($params['site_id']);
            $feed = new $feed_class($type, $site);
        } else {
            $feed = new $feed_class($type);
        }
        $feed->set_request_vars($params);
        ob_start();
        $feed->run(false);
        $feed_text = ob_get_contents();
        ob_end_clean();
        if (!empty($feed_text)) {
            return $feed_text;
        }
    }
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:feed_utils.php


示例12: checkPermissions

 function checkPermissions()
 {
     // first, make sure user is logged in
     $username = reason_check_authentication();
     if (!$username) {
         $this->error("this page requires authentication");
     } else {
         // next, figure out the form id
         $matches = array();
         $res = preg_match("/form_(\\d*)/", $this->table, $matches);
         if (count($matches) != 2) {
             $this->error("invalid table name");
         } else {
             $formId = $matches[1];
             // now that we've got the form id, find out what site it belongs to
             $form = new entity($formId);
             $site = $form->get_owner();
             // and finally, make sure the logged in user has access to the site, and is an admin
             $hasSiteAccess = reason_username_has_access_to_site($username, $site->id());
             // $isAdmin = user_is_a(get_user_id($username), id_of("admin_role"));
             // return $hasSiteAccess && $isAdmin;
             return $hasSiteAccess;
         }
     }
     return false;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:getFormFile.php


示例13: show_entity_data

 function show_entity_data($entity)
 {
     //echo '<h4>Entity data:</h4>';
     $entity_type = new entity($entity->get_value('type'));
     echo '<p><strong>Type</strong>: ' . $entity_type->get_value('name') . '</p>';
     $owner = $entity->get_owner();
     if (is_object($owner)) {
         echo '<p><strong>Owner site</strong>: ' . $owner->get_value('name') . ' (ID: ' . $this->get_id_markup($owner->id()) . ')</p>' . "\n";
     } else {
         echo '<p>No owner site (orphan entity)</p>' . "\n";
     }
     echo '<table class="entityInfoDataTable">' . "\n";
     echo '<tr>' . "\n";
     echo '<th>Attribute</th>' . "\n";
     echo '<th>Value</th>' . "\n";
     echo '</tr>' . "\n";
     $id_markup_keys = array('type', 'last_edited_by', 'created_by');
     foreach ($entity->get_values() as $key => $value) {
         echo '<tr>' . "\n";
         echo '<td>' . $key . '</td>' . "\n";
         if (in_array($key, $id_markup_keys)) {
             echo '<td>' . $this->get_id_markup($value) . '</td>' . "\n";
         } else {
             echo '<td>' . $value . '</td>' . "\n";
         }
         echo '</tr>' . "\n";
     }
     echo '</table>' . "\n";
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:entity_info.php


示例14: make_link

 function make_link($id)
 {
     $asset = $this->items[$id];
     $owner_id = $asset->get_value('owner_id');
     $owner_site = new entity($owner_id);
     return 'http://' . REASON_HOST . $owner_site->get_value('base_url') . MINISITE_ASSETS_DIRECTORY_NAME . '/' . $asset->get_value('file_name');
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:editor_links_for_asset.php


示例15: init

 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['event_id'])) {
         $event = new entity($this->admin_page->request['event_id']);
         $this->admin_page->title = 'Sorting Registration Slots of "' . $event->get_value('name') . '"';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:registration_slot.php


示例16: init

 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['parent_id'])) {
         $x = new entity($this->admin_page->request['parent_id']);
         $this->admin_page->title = 'Sorting Children of "' . $x->get_value('name') . '"';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:page.php


示例17: get_blog_content_from_id

function get_blog_content_from_id($id)
{
    $post = new entity($id);
    if ($post->get_value('content')) {
        return $post->get_value('content');
    } else {
        return get_blog_description_from_id($id);
    }
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:blog_posts.php


示例18: pre_show_all_items

 function pre_show_all_items()
 {
     if ($this->top_link_site_id == $this->site_id) {
         $this->link = $this->top_link_site_id = '';
     } elseif (!empty($this->top_link_site_id) && empty($this->link)) {
         $site = new entity($this->top_link_site_id);
         $this->link = '<a href="' . $site->get_value('base_url') . '">' . $site->get_value('name') . " Home" . '</a>';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:9,代码来源:link_at_top.php


示例19: init

 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['parent_id'])) {
         $x = new entity($this->admin_page->request['parent_id']);
         $this->admin_page->title = 'Sorting Children of "' . $x->get_value('name') . '"';
     } elseif (!$this->is_new()) {
         $this->admin_page->title = 'Sorting Top Level Policies';
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:10,代码来源:policy.php


示例20: run_form

 /**
  * Set up and run the actual form used to import the images
  */
 function run_form()
 {
     $f = new $this->image_import_form_class_name();
     $user = new entity($this->admin_page->user_id);
     $f->username = $user->get_value('name');
     $f->user_id = $this->admin_page->user_id;
     $f->site_id = $this->admin_page->site_id;
     $f->add_element('cancel_text', 'comment', array('text' => '<a href="' . $this->admin_page->make_link(array('cur_module' => 'Lister', 'id' => '')) . '">Cancel batch import</a>'));
     $f->run();
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:13,代码来源:image_import.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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