PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.5.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.5.0
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / widgets / Instagram.php
spider-elements / widgets Last commit date
templates 1 year ago Accordion.php 1 year ago Alerts_Box.php 1 year ago Animated_Heading.php 1 year ago Before_after.php 1 year ago Blog_Grid.php 1 year ago Buttons.php 1 year ago Cheat_sheet.php 1 year ago Counter.php 1 year ago Fullscreen_Slider.php 1 year ago Icon_box.php 1 year ago Instagram.php 1 year ago Integrations.php 1 year ago List_Item.php 1 year ago Pricing_Table_Switcher.php 1 year ago Pricing_Table_Tabs.php 1 year ago Tabs.php 1 year ago Team_Carousel.php 1 year ago Testimonial.php 1 year ago Timeline.php 1 year ago Video_Playlist.php 1 year ago Video_Popup.php 1 year ago
Instagram.php
194 lines
1 <?php
2 /**
3 * Use namespace to avoid conflict
4 */
5
6 namespace SPEL\Widgets;
7
8 use Elementor\Group_Control_Typography;
9 use Elementor\Widget_Base;
10 use Elementor\Controls_Manager;
11
12 // Exit if accessed directly
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Class Team
19 * @package spider\Widgets
20 * @since 1.0.0
21 */
22 class Instagram extends Widget_Base {
23
24 public function get_name() {
25 return 'spe_instagram'; // ID of the widget (Don't change this name)
26 }
27
28 public function get_title() {
29 return esc_html__( 'Instagram', 'spider-elements' );
30 }
31
32 public function get_icon() {
33 return 'eicon-instagram-post spel-icon';
34 }
35
36 public function get_keywords() {
37 return [ 'spider', 'Instagram', 'Feed', 'Instagram Feed' ];
38 }
39
40 public function get_categories() {
41 return [ 'spider-elements' ];
42 }
43
44 /**
45 * Name: get_style_depends()
46 * Desc: Register the required CSS dependencies for the frontend.
47 */
48 public function get_style_depends() {
49 return [ 'swiper', 'spel-main' ];
50 }
51
52 /**
53 * Name: get_script_depends()
54 * Desc: Register the required JS dependencies for the frontend.
55 */
56 public function get_script_depends() {
57 return [ 'swiper', 'spel-el-widgets' ];
58 }
59
60 /**
61 * Name: register_controls()
62 * Desc: Register controls for these widgets
63 * Params: no params
64 * Return: @void
65 * Since: @1.0.0
66 * Package: @spider-elements
67 * Author: spider-themes
68 */
69 protected function register_controls() {
70 $this->elementor_content_control();
71 $this->counter_style_control();
72 }
73
74
75 /**
76 * Name: elementor_content_control()
77 * Desc: Register the Content Tab output on the Elementor editor.
78 * Params: no params
79 * Return: @void
80 * Since: @1.0.0
81 * Package: @spider-elements
82 * Author: spider-themes
83 */
84
85 public function elementor_content_control() {
86
87 //==================== Select Preset Skin ====================//
88 $this->start_controls_section(
89 'instagram_preset', [
90 'label' => esc_html__( 'Preset Skin', 'spider-elements' ),
91 ]
92 );
93
94 $this->add_control(
95 'style', [
96 'label' => esc_html__( 'Style', 'spider-elements' ),
97 'type' => Controls_Manager::CHOOSE,
98 'options' => [
99 '1' => [
100 'icon' => 'instagram1',
101 'title' => esc_html__( '01 : Instagram', 'spider-elements' )
102 ],
103 ],
104 'default' => '1',
105 ],
106 );
107
108 $this->end_controls_section(); // End Preset Skin
109
110
111 //=================== Instagram Feed ===================//
112 $this->start_controls_section(
113 'sec_instagram', [
114 'label' => esc_html__( 'Instagram Feed', 'spider-elements' ),
115 ]
116 );
117
118 /*$this->add_control(
119 'instagram_app_id', [
120 'label' => esc_html__('Instagram App ID', 'spider-elements'),
121 'type' => Controls_Manager::TEXT,
122 'label_block' => true,
123 'placeholder' => esc_html__('---------------', 'spider-elements')
124 ]
125 );*/
126
127 /*$this->add_control(
128 'instagram_app_secret_key', [
129 'label' => esc_html__('Instagram App Secret', 'spider-elements'),
130 'type' => Controls_Manager::TEXT,
131 'label_block' => true,
132 'placeholder' => esc_html__('---------------', 'spider-elements')
133 ]
134 );*/
135
136 $this->add_control(
137 'instagram_user_token', [
138 'label' => esc_html__( 'Instagram Token', 'spider-elements' ),
139 'description' => esc_html__( 'Enter instagram User Token if you want to show separated user\'s photos', 'spider-elements' ),
140 'type' => Controls_Manager::TEXT,
141 'label_block' => true,
142 'placeholder' => esc_html__( '---------------', 'spider-elements' )
143 ]
144 );
145
146 $this->end_controls_section(); // End Instagram Feed
147
148 }
149
150
151 /**
152 * Name: counter_style_control()
153 * Desc: Register the Style Tab output on the Elementor editor.
154 * Params: no params
155 * Return: @void
156 * Since: @1.0.0
157 * Package: @spider-elements
158 * Author: spider-themes
159 */
160 public function counter_style_control() {
161
162 }
163
164 /**
165 * Name: elementor_render()
166 * Desc: Render the widget output on the frontend.
167 * Params: no params
168 * Return: @void
169 * Since: @1.0.0
170 * Package: @spider-elements
171 * Author: spider-themes
172 */
173 protected function render() {
174 $settings = $this->get_settings_for_display();
175 extract( $settings ); //extract all settings array to variables converted to name of key
176
177
178 $access_token = ! empty( $instagram_user_token ) ? $instagram_user_token : '';
179
180 // Instagram API Endpoint
181 $api_url = "https://graph.instagram.com/v13.0/me/media?fields=id,caption,media_type,media_url,thumbnail_url,permalink,timestamp&access_token=$access_token";
182
183 // Fetch Instagram Data
184 $response = file_get_contents( $api_url );
185 $data = json_decode( $response );
186
187
188 //================= Template Parts =================//
189 include "templates/instagram/instagram-1.php";
190
191 }
192
193
194 }