-
Notifications
You must be signed in to change notification settings - Fork 1
/
helper.php
57 lines (48 loc) · 1.16 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* @package Polytope.InstagramGallery
* @subpackage mod_polinstagallery
*
* @copyright Copyright (C) 2020 POLYTOPE, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
require_once __DIR__ . '/helper/instagram.php';
/**
* Instagram Gallery Helper
*
* @package mod_poly_instagallery
*
* @since version 1.3.0
*/
class ModPolyInstagalleryHelper
{
public static function getItemsAjax()
{
$app = JFactory::getApplication();
$input = $app->input;
$moduleId = $input->get('moduleId');
$module = JModuleHelper::getModuleById($moduleId);
$params = new JRegistry($module->params);
$result = array();
$items = InstagramHelper::getInstagramItems($params);
if (!$items)
{
return json_encode($result);
}
$itemNum = intval($params->get('gallery_items', 8));
for ($col = 0; $col < count($items); $col++)
{
if ($col >= $itemNum)
{
break;
}
$item = $items[$col];
$item['display_url'] = InstagramHelper::getDisplayUrl($item);
if (!empty($item['display_url']))
{
$result[] = $item;
}
}
return json_encode($result);
}
}