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


PHP elgg_get_site_entity函数代码示例

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


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

示例1: ckeditor_extended_get_inline_object

/**
 * Returns the object based on the id
 *
 * @param string  $id     id of the object to find
 * @param boolean $create should the object be created if id is missing
 *
 * @return /ElggObject|false
 */
function ckeditor_extended_get_inline_object($id, $create = false)
{
    static $cached = [];
    if (empty($id)) {
        return false;
    }
    $prefix = elgg_extract(0, explode('_', $id));
    if (!array_key_exists($prefix, $cached)) {
        $cached[$prefix] = [];
        // preload entities
        $entities = elgg_get_entities(['type' => 'object', 'subtype' => 'ckeditor_inline', 'limit' => false, 'joins' => 'JOIN ' . elgg_get_config('dbprefix') . "objects_entity oe ON oe.guid = e.guid", 'wheres' => "oe.title LIKE '{$prefix}%'"]);
        foreach ($entities as $entity) {
            $cached[$prefix][$entity->title] = $entity;
        }
    }
    if (array_key_exists($id, $cached[$prefix])) {
        return $cached[$prefix][$id];
    }
    if (!$create) {
        return false;
    }
    $object = new \ElggObject();
    $object->subtype = 'ckeditor_inline';
    $object->title = $id;
    $object->owner_guid = elgg_get_site_entity()->guid;
    $object->container_guid = elgg_get_site_entity()->guid;
    $object->access_id = ACCESS_PUBLIC;
    $cached[$prefix][$id] = $object;
    return $object;
}
开发者ID:coldtrick,项目名称:ckeditor_extended,代码行数:38,代码来源:functions.php

示例2: prepare

 /**
  * Prepares notification elements
  * @return \stdClass
  */
 public function prepare()
 {
     $object_type = $this->getObjectType();
     $object_link = elgg_view('output/url', array('text' => $this->object->getDisplayName(), 'href' => elgg_http_add_url_query_elements($this->object->getURL(), array('active_tab' => 'comments'))));
     if ($this->author->guid == $this->object->owner_guid) {
         $object_summary_title = elgg_echo('interactions:ownership:own', array($object_type), $this->language);
     } else {
         if ($this->recipient->guid == $this->object->owner_guid) {
             $object_summary_title = elgg_echo('interactions:ownership:your', array($object_type), $this->language);
         } else {
             $object_owner = $this->object->getOwnerEntity() ?: elgg_get_site_entity();
             $object_summary_title = elgg_echo('interactions:ownership:owner', array($object_owner->getDisplayName(), $object_type), $this->language);
         }
     }
     if ($this->object instanceof Comment) {
         $object_full_title = $object_summary_title;
     } else {
         $object_full_title = $object_summary_title . ' ' . $object_link;
     }
     if ($this->root->guid !== $this->object->guid) {
         $root_link = elgg_view('output/url', array('text' => $this->root->getDisplayName(), 'href' => elgg_http_add_url_query_elements($this->root->getURL(), array('active_tab' => 'comments'))));
         $object_full_title .= ' ' . elgg_echo('interactions:comment:in_thread', array($root_link));
     }
     $author_link = elgg_view('output/url', array('text' => $this->author->name, 'href' => $this->author->getURL()));
     $object_summary_link = elgg_view('output/url', array('text' => $object_summary_title, 'href' => elgg_http_add_url_query_elements($this->object->getURL(), array('active_tab' => 'comments'))));
     $action_type = $this->getActionType();
     $notification = new \stdClass();
     $notification->summary = elgg_echo('interactions:response:email:subject', array($author_link, $action_type, $object_summary_link), $this->language);
     $notification->subject = strip_tags($notification->summary);
     $notification->body = elgg_echo('interactions:response:email:body', array($author_link, $action_type, $object_full_title, $this->getComment(), $this->comment->getURL(), $this->root->getURL(), $this->author->getDisplayName(), $this->author->getURL()), $this->language);
     return $notification;
 }
开发者ID:hypejunction,项目名称:hypeinteractions,代码行数:36,代码来源:NotificationFormatter.php

示例3: getRegisterApp

 public function getRegisterApp()
 {
     $user = elgg_get_logged_in_user_entity();
     $site = elgg_get_site_entity();
     $response = array('BaseUrl' => $site->url, 'Name' => $site->name, 'User' => $user->username, 'LogoUrl' => $site->url . 'mod/pleiobox/_graphics/icon.png', 'BackColor' => '#005dac', 'FontColor' => '#999999', 'pin_cert' => '', 'APIKeys' => array(array('Name' => 'LocalBox iOS', 'Key' => 'testclient', 'Secret' => 'testpass'), array('Name' => 'Localbox Android', 'Key' => 'testclient', 'Secret' => 'testpass')));
     return $this->sendResponse($response);
 }
开发者ID:pleio,项目名称:pleiobox,代码行数:7,代码来源:PleioboxJSONApi.php

示例4: initializeAttributes

 protected function initializeAttributes()
 {
     parent::initializeAttributes();
     $this->attributes['access_id'] = ACCESS_PUBLIC;
     $this->attributes['owner_guid'] = elgg_get_site_entity()->getGUID();
     $this->attributes['container_guid'] = elgg_get_site_entity()->getGUID();
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:7,代码来源:ProfileManagerCustomField.php

示例5: profile_manager_group_override

/**
 * function to replace group profile fields
 * 
 * @param $hook_name
 * @param $entity_type
 * @param $return_value
 * @param $parameters
 * @return unknown_type
 */
function profile_manager_group_override($hook_name, $entity_type, $return_value, $parameters)
{
    $result = $return_value;
    // Get all custom group fields
    $options = array("type" => "object", "subtype" => CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE, "limit" => false, "owner_guid" => elgg_get_site_entity()->getGUID());
    $group_fields = elgg_get_entities($options);
    if ($group_fields) {
        $result = array();
        $ordered = array();
        // Order the group fields and filter some types out
        foreach ($group_fields as $group_field) {
            if ($group_field->admin_only != "yes" || elgg_is_admin_logged_in()) {
                $ordered[$group_field->order] = $group_field;
            }
        }
        ksort($ordered);
        // build the correct list
        $result["name"] = "text";
        foreach ($ordered as $group_field) {
            $result[$group_field->metadata_name] = $group_field->metadata_type;
            // should it be handled as tags? TODO: is this still needed? Yes it is, it handles presentation of these fields in listing mode
            if (elgg_get_context() == "search" && ($group_field->output_as_tags == "yes" || $group_field->metadata_type == "multiselect")) {
                $result[$group_field->metadata_name] = "tags";
            }
        }
    }
    return $result;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:37,代码来源:hooks.php

示例6: daily

 /**
  * Add menu items to the filter menu
  *
  * @param string $hook         'cron'
  * @param string $type         'daily'
  * @param string $return_value optional output
  * @param array  $params       supplied params
  *
  * @return void
  */
 public static function daily($hook, $type, $return_value, $params)
 {
     if (!static_out_of_date_enabled()) {
         return;
     }
     $time = elgg_extract('time', $params, time());
     $days = (int) elgg_get_plugin_setting('out_of_date_days', 'static');
     $site = elgg_get_site_entity();
     $options = ['type' => 'object', 'subtype' => \StaticPage::SUBTYPE, 'limit' => false, 'modified_time_upper' => $time - $days * 24 * 60 * 60, 'modified_time_lower' => $time - ($days + 1) * 24 * 60 * 60, 'order_by' => 'e.time_updated DESC'];
     // ignore access
     $ia = elgg_set_ignore_access(true);
     $batch = new \ElggBatch('elgg_get_entities', $options);
     $users = [];
     foreach ($batch as $entity) {
         $last_editors = $entity->getAnnotations(['annotation_name' => 'static_revision', 'limit' => 1, 'order_by' => 'n_table.time_created DESC']);
         if (empty($last_editors)) {
             continue;
         }
         $users[$last_editors[0]->getOwnerGUID()] = $last_editors[0]->getOwnerEntity();
     }
     // restore access
     elgg_set_ignore_access($ia);
     if (empty($users)) {
         return;
     }
     foreach ($users as $user) {
         $subject = elgg_echo('static:out_of_date:notification:subject');
         $message = elgg_echo('static:out_of_date:notification:message', [$user->name, elgg_normalize_url('static/out_of_date/' . $user->username)]);
         notify_user($user->getGUID(), $site->getGUID(), $subject, $message, [], 'email');
     }
 }
开发者ID:coldtrick,项目名称:static,代码行数:41,代码来源:Cron.php

示例7: seo_save_data

/**
 * Save SEF data
 *
 * @param array $data Data
 * @return bool
 */
function seo_save_data($data)
{
    $path = elgg_extract('path', $data);
    $sef_path = elgg_extract('sef_path', $data);
    if (!$path || !$sef_path) {
        return false;
    }
    $sef_hash = sha1($sef_path);
    $original_hash = sha1($path);
    $site = elgg_get_site_entity();
    $file = new ElggFile();
    $file->owner_guid = $site->guid;
    $file->setFilename("seo/{$sef_hash}.json");
    $file->open('write');
    $file->write(json_encode($data));
    $file->close();
    if ($sef_hash != $original_hash) {
        $file = new ElggFile();
        $file->owner_guid = $site->guid;
        $file->setFilename("seo/{$original_hash}.json");
        $file->open('write');
        $file->write(json_encode($data));
        $file->close();
    }
    return true;
}
开发者ID:hypeJunction,项目名称:Elgg-seo,代码行数:32,代码来源:functions.php

示例8: initializeAttributes

 protected function initializeAttributes()
 {
     parent::initializeAttributes();
     $this->attributes['subtype'] = 'hjfield';
     $this->attributes['owner_guid'] = elgg_get_site_entity()->guid;
     $this->attributes['access_id'] = ACCESS_PUBLIC;
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:7,代码来源:hjField.php

示例9: log_emails_send

/**
 * Create a log notification
 * 
 * @param string $hook   Hook name
 * @param string $type   Hook type
 * @param bool   $result Has the notification been sent
 * @param array  $params Hook parameters
 */
function log_emails_send($hook, $type, $result, $params)
{
    $message = $params['notification'];
    $sender = $message->getSender();
    $recipient = $message->getRecipient();
    if (!$sender) {
        return false;
    }
    if (!$recipient || !$recipient->email) {
        return false;
    }
    $to = $recipient->email;
    $site = elgg_get_site_entity();
    // If there's an email address, use it - but only if it's not from a user.
    if (!$sender instanceof \ElggUser && $sender->email) {
        $from = $sender->email;
    } else {
        if ($site->email) {
            $from = $site->email;
        } else {
            // If all else fails, use the domain of the site.
            $from = 'noreply@' . $site->getDomain();
        }
    }
    $date = date("Y-m-d H:i:s");
    error_log(sprintf(elgg_echo('log_emails:content'), $from, $to, $date, $message->subject, $message->body), 3, "php://stderr");
    return true;
    //return elgg_send_email($from, $to, $message->subject, $message->body, $params);
}
开发者ID:rtugores,项目名称:log_emails,代码行数:37,代码来源:start.php

示例10: handlePages

 /**
  * Handles embedded URLs
  *
  * @param array $page URL segments
  * @return boolean
  */
 function handlePages($page)
 {
     $url = get_input('url');
     $handle = get_input('handle');
     $iframe = get_input('iframe', false);
     $site = elgg_get_site_entity();
     if (!$handle) {
         $handle = $site->guid;
     }
     if (!$url || !$handle) {
         return false;
     }
     $parse = elgg_is_logged_in();
     switch ($page[0]) {
         default:
             $data = $this->model->get($url, $handle, $parse);
             $layout = elgg_view('output/card', array('href' => $url, 'handle' => $handle));
             $shell = $iframe ? 'iframe' : 'default';
             echo elgg_view_page($data['title'], $layout, $shell);
             break;
         case 'json':
             $data = $this->model->get($url, $handle, $parse);
             header('Content-Type: application/json');
             echo json_encode($data);
             exit;
     }
     return true;
 }
开发者ID:n8b,项目名称:VMN,代码行数:34,代码来源:Router.php

示例11: security_tools_usersettings_save_handler

/**
 * Listen to the usersettings save hook for some notifications to the user
 *
 * @param string $hook         usersettings:save
 * @param string $type         user
 * @param bool   $return_value not supplied for this hook
 * @param null   $params       not supplied for this hook
 *
 * @return void
 */
function security_tools_usersettings_save_handler($hook, $type, $return_value, $params)
{
    $user_guid = (int) get_input("guid");
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return $return_value;
    }
    $user = get_user($user_guid);
    if (empty($user) || !$user->canEdit()) {
        return $return_value;
    }
    // passwords are different
    if (_elgg_set_user_password() === true) {
        // do we need to notify the user about a password change
        $setting = elgg_get_plugin_setting("mails_password_change", "security_tools");
        if ($setting != "no") {
            $site = elgg_get_site_entity();
            $subject = elgg_echo("security_tools:notify_user:password:subject");
            $message = elgg_echo("security_tools:notify_user:password:message", array($user->name, $site->name, $site->url));
            notify_user($user->getGUID(), $site->getGUID(), $subject, $message, null, "email");
        }
    }
    // email are also different
    $setting = elgg_get_plugin_setting("mails_verify_email_change", "security_tools");
    if ($setting != "no" && $user->getGUID() == elgg_get_logged_in_user_guid()) {
        // verify new email address
        security_tools_prepare_email_change();
    } else {
        // old way, or admin changes your email
        _elgg_set_user_email();
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:44,代码来源:hooks.php

示例12: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $params->subject_uid = "ue{$params->guid}";
     $params->guid = elgg_get_site_entity()->guid;
     $ctrl = new SiteActivity($this->request, $this->graph);
     return $ctrl->post($params);
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:10,代码来源:UserActivity.php

示例13: facebookservice_post

/**
 * Post to a facebook users wall.
 *
 * @param unknown_type $hook
 * @param unknown_type $entity_type
 * @param unknown_type $returnvalue
 * @param unknown_type $params
 */
function facebookservice_post($hook, $entity_type, $returnvalue, $params)
{
    $user_id = $params['userid'];
    $access_token = elgg_get_plugin_user_setting('access_token', $user_id, 'facebook_api');
    $target = elgg_get_plugin_user_setting('uid', $user_id, 'facebook_api');
    $site = elgg_get_site_entity();
    if (!$params['name']) {
        $site_name = $site->name;
    } else {
        $site_name = $params['name'];
    }
    if (!$params['logo']) {
        $logo = elgg_get_site_url() . '_graphics/elgg_logo.png';
    } else {
        $logo = $params['logo'];
    }
    if (!$params['link']) {
        $link = elgg_get_site_url();
    } else {
        $link = $params['link'];
    }
    $attachment = array('access_token' => $access_token, 'message' => $params['message'], 'name' => $site_name, 'link' => $link, 'description' => $params['description'], 'picture' => $logo);
    if (!($access_token && $target)) {
        return NULL;
    }
    $facebook = facebookservice_api();
    $ret_code = $facebook->api('/me/feed', 'POST', $attachment);
    return TRUE;
}
开发者ID:lweddewer,项目名称:facebook_api,代码行数:37,代码来源:start.php

示例14: initializeAttributes

 protected function initializeAttributes()
 {
     parent::initializeAttributes();
     $this->siteDomain = get_site_domain($CONFIG->site_guid);
     $this->site = elgg_get_site_entity();
     $this->approvedDomains = ['forces.gc.ca', 'test.gc.ca'];
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:7,代码来源:UserManagement.php

示例15: river_activity_3C_bday_mailer

function river_activity_3C_bday_mailer($hook, $entity_type, $returnvalue, $params)
{
    $bday = elgg_get_plugin_setting('birth_day', 'river_activity_3C');
    elgg_set_ignore_access(true);
    $siteurl = elgg_get_site_entity()->url;
    $sitename = elgg_get_site_entity()->name;
    $siteemail = elgg_get_site_entity()->email;
    $from = $sitename . ' <' . $siteemail . '>';
    $month = date('m', strtotime("now"));
    $options = array('metadata_names' => 'BD_month', 'metadata_values' => $month, 'types' => 'user', 'limit' => false, 'full_view' => false, 'pagination' => false);
    $bd_users = new ElggBatch('elgg_get_entities_from_metadata', $options);
    $bd_today = date('j, F', strtotime('now'));
    foreach ($bd_users as $bd_user) {
        $bd_name = $bd_user->name;
        $bd_email = $bd_user->email;
        $bd_day = date('j, F', strtotime($bd_user->{$bday}));
        if ($bd_day == $bd_today) {
            if ($bd_email) {
                $message = elgg_echo('river_activity_3C:bday_message', array($bd_name, $bd_day, $sitename, $siteurl));
                elgg_send_email($from, $bd_email, elgg_echo('river_activity_3C:bday_message:subject'), $message);
                $result = elgg_echo("river_activity_3C:bday_mailer_cron_true");
            } else {
                $result = elgg_echo("river_activity_3C:bday_mailer_cron_false");
            }
        }
    }
    elgg_set_ignore_access(false);
    return $returnvalue . $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:29,代码来源:river_activity_3C.php


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