Skip to content

Commit

Permalink
changed: updated for Elgg 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Jul 26, 2022
1 parent 4eabfd8 commit e159a5e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# opensearch

![Elgg 4.2](https://img.shields.io/badge/Elgg-4.2-green.svg)
![Elgg 4.3](https://img.shields.io/badge/Elgg-4.3-green.svg)
![OpenSearch 1.1](https://img.shields.io/badge/OpenSearch-1.1-green.svg)
[![Build Status](https://scrutinizer-ci.com/g/ColdTrick/opensearch/badges/build.png?b=master)](https://scrutinizer-ci.com/g/ColdTrick/opensearch/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ColdTrick/opensearch/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ColdTrick/opensearch/?branch=master)
Expand Down
18 changes: 13 additions & 5 deletions classes/ColdTrick/OpenSearch/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace ColdTrick\OpenSearch;

use Elgg\Database\QueryBuilder;

class Export {

/**
Expand Down Expand Up @@ -247,11 +249,13 @@ public static function entityRelationshipsToObject(\Elgg\Hook $hook) {
return;
}

$relationships = get_entity_relationships($entity->guid);
if (empty($relationships)) {
return;
}

$relationships = elgg_get_relationships([
'batch' => true,
'wheres' => function(QueryBuilder $qb, $main_alias) use ($entity) {
return $qb->compare("{$main_alias}.guid_one", '=', $entity->guid, ELGG_VALUE_GUID);
}
]);

$result = [];
/* @var $relationship \ElggRelationship */
foreach ($relationships as $relationship) {
Expand All @@ -264,6 +268,10 @@ public static function entityRelationshipsToObject(\Elgg\Hook $hook) {
];
}

if (empty($result)) {
return;
}

$return = $hook->getValue();

if (!isset($return->relationships)) {
Expand Down
2 changes: 1 addition & 1 deletion classes/ColdTrick/OpenSearch/Menus/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function admin(\Elgg\Hook $hook) {
return;
}

$current_path = parse_url(current_page_url(), PHP_URL_PATH);
$current_path = parse_url(elgg_get_current_url(), PHP_URL_PATH);
$site_path = parse_url(elgg_get_site_url(), PHP_URL_PATH);
$parsed_path = substr($current_path, strlen($site_path));

Expand Down
2 changes: 1 addition & 1 deletion classes/ColdTrick/OpenSearch/SearchParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ public function addEntityAccessFilter(int $user_guid = 0) {
}

// add acl filter
$access_array = get_access_array($user_guid);
$access_array = elgg_get_access_array($user_guid);
if (!empty($access_array)) {
$access_filter[]['terms']['access_id'] = $access_array;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"coldtrick/sniffs": "dev-master"
},
"conflict": {
"elgg/elgg": "<4.2"
"elgg/elgg": "<4.3"
},
"config": {
"allow-plugins": {
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion views/default/opensearch/search/suggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

$url = elgg_view('output/url', [
'text' => elgg_format_element('strong', [], $suggestion),
'href' => elgg_http_add_url_query_elements(current_page_url(), ['q' => $suggestion]),
'href' => elgg_http_add_url_query_elements(elgg_get_current_url(), ['q' => $suggestion]),
]);

$query = elgg_format_element('i', [], $query);
Expand Down
2 changes: 1 addition & 1 deletion views/default/opensearch/stats/indices.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
$title = elgg_view('output/url', [
'text' => elgg_echo('opensearch:stats:index:index', [$index]),
'href' => "#index_{$index}",
'rel' => 'toggle',
'class' => 'elgg-toggle',
]);

echo elgg_view_module('info', $title, $content);
Expand Down

0 comments on commit e159a5e

Please sign in to comment.