24 public function saveIconFromUploadedFile(
string $input_name,
string $type =
'icon', array $coords = []): bool {
25 return _elgg_services()->iconService->saveIconFromUploadedFile($this, $input_name,
$type, $coords);
37 public function saveIconFromLocalFile(
string $filename,
string $type =
'icon', array $coords = []): bool {
38 return _elgg_services()->iconService->saveIconFromLocalFile($this, $filename,
$type, $coords);
50 public function saveIconFromElggFile(\
ElggFile $file,
string $type =
'icon', array $coords = []): bool {
74 public function deleteIcon(
string $type =
'icon'): bool {
86 public function getIconLastChange(
string $size,
string $type =
'icon'): ?int {
98 public function hasIcon(
string $size,
string $type =
'icon'): bool {
114 public function getIconURL(
string|array
$params = []): string {
127 public function saveIconCoordinates(array $coords,
string $type =
'icon'):
void {
129 $allowed_keys = [
'x1',
'x2',
'y1',
'y2'];
130 $coords = array_filter($coords,
function(
$value,
$key) use ($allowed_keys) {
131 return in_array(
$key, $allowed_keys) && is_int(
$value);
132 }, ARRAY_FILTER_USE_BOTH);
134 if (!isset($coords[
'x1']) || !isset($coords[
'x2']) || !isset($coords[
'y1']) || !isset($coords[
'y2'])) {
135 throw new InvalidArgumentException(
'Please provide correct coordinates [x1, x2, y1, y2]');
138 if ($coords[
'x1'] < 0 || $coords[
'x2'] < 0 || $coords[
'y1'] < 0 || $coords[
'y2'] < 0) {
139 throw new RangeException(
"Coordinates can't have negative numbers");
142 $this->{
"{$type}_coords"} = serialize($coords);
153 public function getIconCoordinates(
string $type =
'icon'): array {
154 if (!isset($this->{
"{$type}_coords"})) {
158 $coords = unserialize($this->{
"{$type}_coords"}) ?: [];
161 array_walk($coords,
function(&
$value) {
166 return array_filter($coords,
function(
$value) {
179 public function removeIconCoordinates(
string $type =
'icon'):
void {
180 unset($this->{
"{$type}_coords"});
192 public function lockIconThumbnailGeneration(
string $type =
'icon'):
void {
193 $this->{
"{$type}_thumbnail_locked"} = time();
206 public function isIconThumbnailGenerationLocked(
string $type =
'icon',
int $ttl = 30): bool {
207 if (!isset($this->{
"{$type}_thumbnail_locked"})) {
211 $locked = (int) $this->{
"{$type}_thumbnail_locked"};
212 return $locked > (time() - $ttl);
224 public function unlockIconThumbnailGeneration(
string $type =
'icon'):
void {
225 unset($this->{
"{$type}_thumbnail_locked"});
$params
Saves global plugin settings.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
_elgg_services()
Get the global service provider.