AddOns.php
5 years ago
Categories.php
3 years ago
Packages.php
1 week ago
Settings.php
5 months ago
Stats.php
4 years ago
Templates.php
2 years ago
Welcome.php
6 months ago
AddOns.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * User: shahnuralam |
| 4 | * Date: 11/9/15 |
| 5 | * Time: 8:01 PM |
| 6 | */ |
| 7 | |
| 8 | namespace WPDM\Admin\Menu; |
| 9 | |
| 10 | |
| 11 | use WPDM\__\Session; |
| 12 | |
| 13 | class AddOns |
| 14 | { |
| 15 | |
| 16 | function __construct() |
| 17 | { |
| 18 | add_action('admin_menu', array($this, 'Menu')); |
| 19 | } |
| 20 | |
| 21 | function Menu() |
| 22 | { |
| 23 | add_submenu_page('edit.php?post_type=wpdmpro', __( "Add-Ons ‹ Download Manager" , "download-manager" ), __("Add-Ons" , "download-manager" ), WPDM_MENU_ACCESS_CAP, 'wpdm-addons', array($this, 'UI')); |
| 24 | } |
| 25 | |
| 26 | function UI(){ |
| 27 | if (!Session::get('wpdm_addon_store_data') || !is_array(json_decode(Session::get('wpdm_addon_store_data')))) { |
| 28 | $data = wpdm_remote_get('https://www.wpdownloadmanager.com/?wpdm_api_req=getPackageList'); |
| 29 | $cats = wpdm_remote_get('https://www.wpdownloadmanager.com/cats.json'); |
| 30 | Session::set('wpdm_addon_store_data', $data); |
| 31 | Session::set('wpdm_addon_store_cats', $cats); |
| 32 | } else { |
| 33 | $data = Session::get('wpdm_addon_store_data'); |
| 34 | $cats = Session::get('wpdm_addon_store_cats'); |
| 35 | //wpdmprecho($cats); |
| 36 | } |
| 37 | $error = $data; |
| 38 | $data = json_decode($data); |
| 39 | $cats = json_decode($cats); |
| 40 | if(!is_array($data)) echo $error; |
| 41 | else |
| 42 | include wpdm_admin_tpl_path('addons-list.php'); |
| 43 | |
| 44 | } |
| 45 | |
| 46 | } |
| 47 |