parent_slug, $this->menu_slug ); } } public function get_page_title() { $title = '' . __( 'Add-Ons', 'ninja-forms' ) . ''; return $title; } public function get_capability() { return apply_filters( 'ninja_forms_admin_extend_capabilities', $this->capability ); } public function display() { // Fetch our marketing feed. $saved = get_option( 'ninja_forms_addons_feed', false ); // If we got back nothing... if ( ! $saved ) { // Default to the in-app file. $items = file_get_contents( Ninja_Forms::$dir . '/deprecated/addons-feed.json' ); $items = json_decode( $items, true ); } // Otherwise... (We did get something from the db.) else { // Use the data we fetched. $items = json_decode( $saved, true ); } //shuffle( $items ); $notices = array(); foreach ($items as &$item) { $plugin_data = array(); if( !empty( $item['plugin'] ) && file_exists( WP_PLUGIN_DIR.'/'.$item['plugin'] ) ){ $plugin_data = get_plugin_data( WP_PLUGIN_DIR.'/'.$item['plugin'], false, true ); } if ( ! file_exists( Ninja_Forms::$dir . '/' . $item[ 'image' ] ) ) { $item[ 'image' ] = 'assets/img/add-ons/placeholder.png'; } $version = isset ( $plugin_data['Version'] ) ? $plugin_data['Version'] : ''; if ( ! empty ( $version ) && $version < $item['version'] ) { $notices[] = array( 'title' => $item[ 'title' ], 'old_version' => $version, 'new_version' => $item[ 'version' ] ); } } Ninja_Forms::template( 'admin-menu-addons.html.php', compact( 'items', 'notices' ) ); } } // End Class NF_Admin_Addons