asset-manager
5 years ago
dashboard-widgets
6 months ago
metaboxes
1 week ago
settings
4 months ago
stats
1 week ago
templates
1 week ago
addons-list.php
1 week ago
admin-footer.php
2 months ago
admin-head.php
2 years ago
edit-store-profile.php
5 years ago
iconfinder.php
2 years ago
page-header.php
6 months ago
settings.php
6 months ago
stats.php
6 months ago
welcome.php
6 months ago
iconfinder.php
39 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | die( 'Dream more!' ); |
| 4 | } |
| 5 | $APIKEY = 'GQRRWhqteBVhP0cbLAbQiJd0GfriMAvNUlYJcnVZCq8ze10V8JrvZZwjZlcGwCMD'; |
| 6 | $CLIENTID = 'WeAwwpz38IRnLaXylfaERh6NJ6Zf495eVfrqJo4r8kuOLaLEJ43ZGjvoEqJctEsd'; |
| 7 | |
| 8 | |
| 9 | $url = 'https://api.iconfinder.com/v4/icons/search?query='.wpdm_query_var('kw').'&count=96'; |
| 10 | |
| 11 | $headers = array( |
| 12 | "Authorization" => "Bearer {$APIKEY}", |
| 13 | "Accept' => 'application/json", |
| 14 | ); |
| 15 | |
| 16 | $response = wp_remote_get($url, array( |
| 17 | 'headers' => $headers, |
| 18 | )); |
| 19 | |
| 20 | if (is_wp_error($response)) { |
| 21 | echo 'Error: ' . $response->get_error_message(); |
| 22 | } else { |
| 23 | $icons = json_decode($response['body']); |
| 24 | |
| 25 | $icons = array_reverse($icons->icons); |
| 26 | foreach ($icons as $icon) { |
| 27 | $icon = end($icon->raster_sizes)->formats[0]->preview_url; |
| 28 | ?> |
| 29 | <div class="panel panel-default iconres c-pointer" data-icon="<?= $icon ?>" style="width: 60px;margin: 10px;display: inline-block"> |
| 30 | <div class="panel-body"> |
| 31 | <img src="<?= $icon ?>" style="max-width: 100%" /> |
| 32 | </div> |
| 33 | </div> |
| 34 | <?php |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | |
| 39 |