ersion = phpversion(); $table_header = ''; // The table header of our markup. $table_end = ''; // The ending of the table $addons_content = ''; // The inline/row content containing info about each addon specified in the requirements. $html = ''; // General HTML to be shown in plugin inline notification. // Create the table header HTML markup. $table_header .= ''; $table_header .= '
'; $table_header .= '
'; $table_header .= '
' . esc_html__( 'Extension', 'download-monitor' ) . '
'; $table_header .= '
' . esc_html__( 'Requirements', 'download-monitor' ) . '
'; $table_header .= '
' . esc_html__( 'Current', 'download-monitor' ) . '
'; $table_header .= '
' . esc_html__( 'Actions', 'download-monitor' ) . '
'; $table_header .= '
'; foreach ( $addons as $slug => $addon ) { if ( isset( $this->addons_requirements[ $slug ] ) ) { $addon_present = false; // Verify if the addon doesn't meet one or multiple requirements. $addon_row_req = ''; // The addon row HTML markup for requirements info. $addon_row_curr = ''; // The addon row HTML markup for current info. $actions = ''; // The actions content for each addon. $plugin_slug = $addon->get_plugin_name(); $plugin_name = $addon->get_product_name(); if ( version_compare( $addon->get_version(), $this->addons_requirements[ $slug ]['version'], '<' ) ) { $addon_present = true; $required_version = $this->addons_requirements[ $slug ]['version']; $current_version = $addon->get_version(); $addon_row_req .= '

' . esc_html__( 'Extension version:', 'download-monitor' ) . ' ' . esc_html( $required_version ) . ' ' . esc_html__( ' or higher', 'download-monitor' ) . '

'; $addon_row_curr .= '

' . esc_html__( 'Extension version:', 'download-monitor' ) . ' ' . esc_html( $current_version ) . '

'; if ( ! $addon->get_license()->is_active() ) { $actions .= '
' . esc_html__( 'Enter your license key', 'download-monitor' ) . ' or ' . esc_html__( 'Purchase a new one', 'download-monitor' ) . '
'; } else { $actions .= '
'; $update_url = apply_filters( 'dlm_extension_inline_action_' . $plugin_slug, '', $addon ); if ( ! empty( $update_url ) ) { $actions .= '' . esc_html__( 'Update', 'download-monitor' ) . ' ' . esc_html( $plugin_name ) . ''; } else { $actions .= '' . esc_html__( 'Please update extension', 'download-monitor' ) . ''; } $actions .= '
'; } } if ( isset( $this->addons_requirements[ $slug ]['php'] ) && version_compare( $php_version, $this->addons_requirements[ $slug ]['php'], '<' ) ) { $addon_present = true; $required_php_version = $this->addons_requirements[ $slug ]['php']; $addon_row_req .= '

' . esc_html__( 'PHP version:', 'download-monitor' ) . ' ' . esc_html( $required_php_version ) . ' ' . esc_html__( ' or higher', 'download-monitor' ) . '

'; $addon_row_curr .= '

' . esc_html__( 'PHP version:', 'download-monitor' ) . ' ' . esc_html( $php_version ) . '

'; } } // Now, let's create the addon row info content only if the addon doesn't meet the requirements. if ( isset( $addon_present ) && $addon_present ) { $addons_content .= '
'; $addons_content .= '
' . $plugin_name . '
'; $addons_content .= '
' . $addon_row_req . '
'; $addons_content .= '
' . $addon_row_curr . '
'; $addons_content .= $actions; $addons_content .= '
'; } } // If there is content in the addons_content variable it means there is something to be displayed, so display it. if ( ! empty( $addons_content ) ) { $html .= $table_header . $addons_content . $table_end; } echo wp_kses_post( $html ); } }