Compare commits
No commits in common. "images-list" and "master" have entirely different histories.
images-lis
...
master
|
@ -1,252 +1,266 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Freifunk Hamburg Firmware Shortcodes
|
Plugin Name: Freifunk Hamburg Firmware List Shortcode
|
||||||
Plugin URI: https://github.com/freifunkhamburg/freifunk-versions
|
Plugin URI: http://mschuette.name/
|
||||||
Description: Shortcodes for Freifunk Hamburg firmware information
|
Description: Defines shortcodes to display Freifunk Hamburg Firmware versions
|
||||||
Author: Freifunk Hamburg
|
Version: 0.5dev
|
||||||
Author URI: https://github.com/freifunkhamburg
|
|
||||||
Author: Martin Schuette
|
Author: Martin Schuette
|
||||||
Author URI: https://mschuette.name/
|
Author URI: http://mschuette.name/
|
||||||
Licence: 2-Clause BSD
|
Licence: 2-clause BSD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define( 'FIRMWARE_BASE_URL', 'https://updates.hamburg.freifunk.net' );
|
define( 'FF_HH_UPDATES_URL', 'https://updates.hamburg.freifunk.net/' );
|
||||||
define( 'FIRMWARE_CACHETIME', 1 );
|
define( 'FF_HH_CACHETIME', 1 );
|
||||||
|
|
||||||
// Download firmware list and return the current release.
|
/* gets metadata from URL, handles caching */
|
||||||
function firmware_get_release( $base_url, $domain, $branch ) {
|
function ff_hh_getmanifest( $branch_url, $domain, $branch ) {
|
||||||
$cache_key = 'ff_firmware_release_' . $domain . '_' . $branch;
|
// Caching
|
||||||
if ( false === ( $sw_ver = get_transient( $cache_key ) ) ) {
|
$cache_key = 'ff_hh_manifest_' . $domain . '_' . $branch;
|
||||||
$sw_ver = '???';
|
if ( WP_DEBUG || ( false === ( $manifest = get_transient( $cache_key ) ) ) ) {
|
||||||
$url = "$base_url/$domain/$branch/images/images.list";
|
$manifest = array();
|
||||||
$http_response = wp_remote_get( $url );
|
$url = $branch_url . '/sysupgrade/' . $branch . '.manifest';
|
||||||
$input = wp_remote_retrieve_body( $http_response );
|
$http_response = wp_remote_get( $url ); // TODO: error handling
|
||||||
foreach ( explode( "\n", $input ) as $line ) {
|
$input = wp_remote_retrieve_body( $http_response );
|
||||||
$ret = sscanf( $line, 'RELEASE=%s', $sw_ver );
|
foreach ( explode( "\n", $input ) as $line ) {
|
||||||
if ( $ret === 1 ) {
|
$ret = sscanf( $line, '%s %s %s %s', $hw, $sw_ver, $hash, $filename );
|
||||||
// break processing on first matching line
|
if ( $ret === 4 ) {
|
||||||
$cachetime = FIRMWARE_CACHETIME * MINUTE_IN_SECONDS;
|
if ( preg_match( '/^(.*)-v(\d+)$/', $hw, $matches ) ) {
|
||||||
set_transient( $cache_key, $sw_ver, $cachetime );
|
$hw = $matches[1];
|
||||||
break;
|
$hw_ver = $matches[2];
|
||||||
}
|
} else {
|
||||||
}
|
$hw_ver = '1';
|
||||||
}
|
}
|
||||||
return $sw_ver;
|
$manifest[$hw][$hw_ver] = $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cachetime = FF_HH_CACHETIME * MINUTE_IN_SECONDS;
|
||||||
|
set_transient( $cache_key, $manifest, $cachetime );
|
||||||
|
}
|
||||||
|
return $manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download firmware list and return the firmware versions.
|
/* gets latest version from first manifest line */
|
||||||
// The returned array is structured like this:
|
function ff_hh_getlatest( $branch_url, $domain, $branch ) {
|
||||||
// versions[hardware_name][hardware_version][factory|upgrade] => URL
|
// Caching
|
||||||
function firmware_get_versions( $base_url, $domain, $branch ) {
|
$cache_key = 'ff_hh_latestversion_' . $domain . '_' . $branch;
|
||||||
$release = firmware_get_release( $base_url, $domain, $branch );
|
if ( false === ( $sw_ver = get_transient( $cache_key ) ) ) {
|
||||||
$factory_regex = "/^(?:.*$release-)(.*)\.(?:bin|img|img\.gz)$/";
|
$sw_ver = 'unknown';
|
||||||
$upgrade_regex = "/^(?:.*$release-)(.*)(?:-sysupgrade\..*)$/";
|
$url = $branch_url . '/sysupgrade/' . $branch . '.manifest';
|
||||||
$cache_key = 'ff_firmware_versions_' . $domain . '_' . $branch;
|
$input = wp_remote_retrieve_body( wp_remote_get( $url ) );
|
||||||
if ( WP_DEBUG || ( false === ( $versions = get_transient( $cache_key ) ) ) ) {
|
foreach ( explode( "\n", $input ) as $line ) {
|
||||||
$versions = [];
|
$ret = sscanf( $line, '%s %s %s %s', $hw, $sw_ver, $hash, $filename );
|
||||||
$url = "$base_url/$domain/$branch/images/images.list";
|
if ( $ret === 4 ) {
|
||||||
$http_response = wp_remote_get( $url );
|
// break processing on first matching line
|
||||||
$input = wp_remote_retrieve_body( $http_response );
|
$cachetime = FF_HH_CACHETIME * MINUTE_IN_SECONDS;
|
||||||
|
set_transient( $cache_key, $sw_ver, $cachetime );
|
||||||
foreach ( explode( "\n", $input ) as $line ) {
|
break;
|
||||||
$ret = sscanf( $line, '%s %s', $folder, $filename );
|
}
|
||||||
if ( $ret !== 2 ) {
|
}
|
||||||
continue;
|
}
|
||||||
}
|
return $sw_ver;
|
||||||
|
|
||||||
$url = "$base_url/$domain/$branch/images/$folder/$filename";
|
|
||||||
if ( $folder === 'sysupgrade' ) {
|
|
||||||
$result = firmware_parse_version( $filename, $upgrade_regex );
|
|
||||||
if ( $result !== NULL ) {
|
|
||||||
$versions[$result[0]][$result[1]]['upgrade'] = $url;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$result = firmware_parse_version( $filename, $factory_regex );
|
|
||||||
if ( $result !== NULL ) {
|
|
||||||
$versions[$result[0]][$result[1]]['factory'] = $url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$cachetime = FIRMWARE_CACHETIME * MINUTE_IN_SECONDS;
|
|
||||||
set_transient( $cache_key, $versions, $cachetime );
|
|
||||||
}
|
|
||||||
return $versions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function firmware_parse_version( $filename, $regex ) {
|
if ( ! shortcode_exists( 'ff_hh_latestversion' ) ) {
|
||||||
if ( preg_match( $regex, $filename, $matches ) ) {
|
add_shortcode( 'ff_hh_latestversion', 'ff_hh_shortcode_latestversion' );
|
||||||
$hw = $matches[1];
|
|
||||||
$hw_ver = '1';
|
|
||||||
if ( preg_match( '/^(.*?)-?v(\d+)$/', $hw, $matches ) ) {
|
|
||||||
$hw = $matches[1];
|
|
||||||
$hw_ver = $matches[2];
|
|
||||||
}
|
|
||||||
return [$hw, $hw_ver];
|
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example:
|
// Example:
|
||||||
// [ff_firmware_release]
|
// [ff_hh_latestversion]
|
||||||
// [ff_firmware_release domain="ffhh" branch="experimental"]
|
// [ff_hh_latestversion domain="ffhh-sued" branch="experimental"]
|
||||||
function firmware_release( $atts, $content, $name ) {
|
function ff_hh_shortcode_latestversion( $atts, $content, $name ) {
|
||||||
$domain = 'multi';
|
$domain = 'ffhh';
|
||||||
$branch = 'stable';
|
$branch = 'stable';
|
||||||
if ( is_array( $atts ) ) {
|
if ( is_array( $atts ) ) {
|
||||||
if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) {
|
if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) {
|
||||||
$domain = $atts['domain'];
|
$domain = $atts['domain'];
|
||||||
}
|
}
|
||||||
if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) {
|
if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) {
|
||||||
$branch = $atts['branch'];
|
$branch = $atts['branch'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sw_ver = firmware_get_release( FIRMWARE_BASE_URL, $domain, $branch );
|
|
||||||
$outstr = "<span class=\"ff $name\">$sw_ver</span>";
|
$branch_url = FF_HH_UPDATES_URL . $domain . '/' . $branch;
|
||||||
return $outstr;
|
if ( $domain === 'multi' ) { $branch_url = $branch_url . '/images'; }
|
||||||
|
$sw_ver = ff_hh_getlatest( $branch_url, $domain, $branch );
|
||||||
|
$outstr = "<span class=\"ff $name\">$sw_ver</span>";
|
||||||
|
return $outstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! shortcode_exists( 'ff_hh_versions' ) ) {
|
||||||
|
add_shortcode( 'ff_hh_versions', 'ff_hh_shortcode_versions' );
|
||||||
|
}
|
||||||
// Example:
|
// Example:
|
||||||
// [ff_firmware_versions]
|
// [ff_hh_versions]
|
||||||
// [ff_firmware_versions prefix="ubiquiti,ubnt" filter="ac-pro"]
|
// [ff_hh_versions domain="ffhh-sued" branch="experimental" grep="ubiquiti"]
|
||||||
function firmware_versions( $atts, $content, $name ) {
|
function ff_hh_shortcode_versions( $atts, $content, $name ) {
|
||||||
$domain = 'multi';
|
$domain = 'ffhh';
|
||||||
$branch = 'stable';
|
$branch = 'stable';
|
||||||
$prefix = false;
|
$grep = false;
|
||||||
$filter = false;
|
$filter = false;
|
||||||
if ( is_array( $atts ) ) {
|
if ( is_array( $atts ) ) {
|
||||||
if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) {
|
if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) {
|
||||||
$domain = $atts['domain'];
|
$domain = $atts['domain'];
|
||||||
}
|
}
|
||||||
if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) {
|
if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) {
|
||||||
$branch = $atts['branch'];
|
$branch = $atts['branch'];
|
||||||
}
|
}
|
||||||
if ( array_key_exists( 'prefix', $atts ) && ! empty( $atts['prefix'] ) ) {
|
if ( array_key_exists( 'grep', $atts ) && ! empty( $atts['grep'] ) ) {
|
||||||
$prefix = explode ( ',', $atts['prefix'] );
|
$grep = $atts['grep'];
|
||||||
}
|
}
|
||||||
if ( array_key_exists( 'filter', $atts ) && ! empty( $atts['filter'] ) ) {
|
if ( array_key_exists( 'filter', $atts ) && ! empty( $atts['filter'] ) ) {
|
||||||
$filter = explode ( ',', $atts['filter'] );
|
$filter = explode ( ',', $atts['filter'] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$versions = firmware_get_versions( FIRMWARE_BASE_URL, $domain, $branch );
|
$branch_url = FF_HH_UPDATES_URL . $domain . '/' . $branch;
|
||||||
if ( $prefix ) {
|
if ( $domain === 'multi' ) { $branch_url = $branch_url . '/images'; }
|
||||||
$filtered = [];
|
$manifest = ff_hh_getmanifest( $branch_url, $domain, $branch );
|
||||||
foreach ( $versions as $hw => $hw_versions ) {
|
|
||||||
foreach ( $prefix as $pfx ) {
|
|
||||||
if ( strpos ( $hw, $pfx ) === 0 ) {
|
|
||||||
$hw = substr( $hw, strlen($pfx) );
|
|
||||||
$hw = trim( $hw, '-' );
|
|
||||||
$filtered[$hw] = $hw_versions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$versions = $filtered;
|
|
||||||
}
|
|
||||||
if ( $filter ) {
|
|
||||||
$filtered = [];
|
|
||||||
foreach ( $versions as $hw => $hw_versions ) {
|
|
||||||
foreach ( $filter as $flt ) {
|
|
||||||
if ( strpos ( $hw, $flt ) === FALSE ) {
|
|
||||||
$filtered[$hw] = $hw_versions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$versions = $filtered;
|
|
||||||
}
|
|
||||||
|
|
||||||
$outstr = "\n<div class=\"ff $name\">";
|
$outstr = "<div class=\"ff $name\">";
|
||||||
$outstr .= "\n<table>\n<tr><th>Modell</th><th>Erstinstallation</th><th>Aktualisierung</th></tr>";
|
$outstr .= '<table><tr><th>Modell</th><th>Erstinstallation</th><th>Aktualisierung</th></tr>';
|
||||||
|
|
||||||
ksort($versions);
|
ksort($manifest);
|
||||||
foreach ( $versions as $hw => $hw_versions ) {
|
foreach ( $manifest as $hw => $versions ) {
|
||||||
$hw = firmware_beautify_hw_name( $hw, $prefix );
|
// select some models
|
||||||
$outstr .= sprintf( "\n<tr><td>%s</td>", $hw );
|
if ( $grep && ( false === strpos( $hw, $grep ) ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// filter others
|
||||||
|
if ( $filter ) {
|
||||||
|
$filtered = false;
|
||||||
|
foreach ( $filter as $flt ) {
|
||||||
|
if ( strpos ( $hw, $flt ) !== false ) {
|
||||||
|
$filtered = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $filtered ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// factory images
|
$hw = ff_hh_beautify_hw_name( $hw, $grep );
|
||||||
$factory_links = [];
|
$outstr .= sprintf( "\n<tr><td>%s</td>", $hw );
|
||||||
foreach ( $hw_versions as $hw_ver => $urls ) {
|
|
||||||
if ( ! array_key_exists( 'factory', $urls ) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$factory_url = $urls['factory'];
|
|
||||||
$factory_links[] = "<a href=\"$factory_url\">$hw_ver.x</a>";
|
|
||||||
}
|
|
||||||
if ( count($factory_links) > 0 ) {
|
|
||||||
$outstr .= '<td>Version ' . join( ', ', $factory_links ) . '</td>';
|
|
||||||
} else {
|
|
||||||
$outstr .= '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// upgrade images
|
// factory versions
|
||||||
$upgrade_links = [];
|
$hw_ver_links = array();
|
||||||
foreach ( $hw_versions as $hw_ver => $urls ) {
|
foreach ( $versions as $hw_ver => $filename ) {
|
||||||
if ( ! array_key_exists( 'upgrade', $urls ) ) {
|
if ( strpos( $hw, 'Unifi Ac Pro' ) || strpos( $hw, 'Unifi Ac Lite' ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$upgrade_url = $urls['upgrade'];
|
|
||||||
$upgrade_links[] = "<a href=\"$upgrade_url\">$hw_ver.x</a>";
|
|
||||||
}
|
|
||||||
if ( count($upgrade_links) > 0 ) {
|
|
||||||
$outstr .= '<td>Version ' . join( ', ', $upgrade_links ) . '</td>';
|
|
||||||
} else {
|
|
||||||
$outstr .= '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$outstr .= "</tr>";
|
$filename = str_replace( '-sysupgrade', '', $filename );
|
||||||
}
|
if (strpos($filename,'netgear') !== false) {
|
||||||
|
$filename = str_replace( '.bin', '.img', $filename );
|
||||||
|
$filename = str_replace( '.tar', '.img', $filename );
|
||||||
|
}
|
||||||
|
$hw_ver_links[] = sprintf(
|
||||||
|
'<a href="%s%s">%s.x</a>',
|
||||||
|
$branch_url . '/factory/',
|
||||||
|
$filename,
|
||||||
|
$hw_ver
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ( count($hw_ver_links) > 0) {
|
||||||
|
$outstr .= '<td>Hardware Ver. ' . join( ', ', $hw_ver_links ) . '</td>';
|
||||||
|
} else {
|
||||||
|
$outstr .= '<td><i>Benutze das Image</br>zur Aktualisierung</i></td>';
|
||||||
|
}
|
||||||
|
|
||||||
$outstr .= "\n</table>";
|
// sysupgrade versions
|
||||||
$outstr .= "\n</div>\n";
|
$hw_ver_links = array();
|
||||||
|
foreach ( $versions as $hw_ver => $filename ) {
|
||||||
|
$hw_ver_links[] = sprintf(
|
||||||
|
'<a href="%s%s">%s.x</a>',
|
||||||
|
$branch_url . '/sysupgrade/',
|
||||||
|
$filename,
|
||||||
|
$hw_ver
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$outstr .= '<td>Hardware Ver. ' . join( ', ', $hw_ver_links ) . '</td>';
|
||||||
|
|
||||||
return $outstr;
|
$outstr .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$outstr .= '</table>';
|
||||||
|
$outstr .= '</div>';
|
||||||
|
// $outstr .= '<pre>'.print_r( $manifest, true ).'</pre>';
|
||||||
|
return $outstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add capitalization and whitespace to the hardware model name.
|
// some crude rules to add capitalization and whitespace to the
|
||||||
function firmware_beautify_hw_name( $hw, $prefix ) {
|
// hardware model name.
|
||||||
$vendor = '';
|
// set $discard_vendor to strip the vendor name
|
||||||
if ( $prefix ) {
|
// (used for single-vendor lists, e.g. $discard_vendor = 'tp-link' )
|
||||||
$vendor = $prefix[0];
|
function ff_hh_beautify_hw_name( $hw, $discard_vendor = '' ) {
|
||||||
}
|
if ( ! strncmp( $hw, 'tp-link', 7 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
if ( $vendor === '8devices' ) {
|
$hw = strtoupper( $hw );
|
||||||
$hw = str_replace( 'carambola2-board', 'carambola 2', $hw );
|
$hw = str_replace( '-', ' ', $hw );
|
||||||
$hw = ucwords( $hw );
|
$hw = str_replace( ' TL ', ' TL-', $hw );
|
||||||
} elseif ( $vendor === 'buffalo' ) {
|
} elseif ( ! strncmp( $hw, 'ubiquiti', 8 ) ) {
|
||||||
$hw = str_replace( 'hp-ag300h-wzr-600dhp', 'hp-ag300h & wzr-600dhp', $hw );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
$hw = strtoupper( $hw );
|
$hw = str_replace( 'bullet-m', 'bullet-m', $hw );
|
||||||
} elseif ( $vendor === 'd-link' ) {
|
$hw = str_replace( '-', ' ', $hw );
|
||||||
$hw = str_replace( '-', ' ', $hw );
|
$hw = ucwords( $hw );
|
||||||
$hw = str_replace( 'dir ', 'dir-', $hw );
|
} elseif ( ! strncmp( $hw, 'ubnt', 4 ) ) {
|
||||||
$hw = strtoupper( $hw );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
} elseif ( $vendor === 'onion' ) {
|
$hw = str_replace( 'erx', 'ER-X', $hw );
|
||||||
$hw = ucwords( $hw );
|
$hw = str_replace( 'sfp', 'SFP', $hw );
|
||||||
} elseif ( $vendor === 'tp-link' ) {
|
$hw = trim( $hw, ' -' );
|
||||||
$hw = str_replace( 'n-nd', 'n/nd', $hw );
|
$hw = ucwords( $hw );
|
||||||
$hw = str_replace( '-', ' ', $hw );
|
} elseif ( ! strncmp( $hw, 'd-link', 6 ) ) {
|
||||||
$hw = str_replace( 'tl ', 'tl-', $hw );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
$hw = strtoupper( $hw );
|
$hw = strtoupper( $hw );
|
||||||
$hw = str_replace( 'ARCHER', 'Archer', $hw );
|
$hw = str_replace( '-', ' ', $hw );
|
||||||
} elseif ( $vendor === 'ubiquiti' ) {
|
$hw = str_replace( ' DIR ', ' DIR-', $hw );
|
||||||
$hw = str_replace( '-', ' ', $hw );
|
} elseif ( ! strncmp( $hw, 'linksys', 7 ) ) {
|
||||||
$hw = ucwords( $hw );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
$hw = str_replace( 'Ac', 'AC', $hw );
|
$hw = strtoupper( $hw );
|
||||||
$hw = str_replace( 'Ap', 'AP', $hw );
|
$hw = str_replace( '-', ' ', $hw );
|
||||||
$hw = str_replace( 'Erx', 'ER-X', $hw );
|
$hw = str_replace( ' WRT', ' WRT-', $hw );
|
||||||
$hw = str_replace( 'Sfp', 'SFP', $hw );
|
} elseif ( ! strncmp( $hw, 'buffalo', 7 ) ) {
|
||||||
$hw = str_replace( 'Xw', 'XW', $hw );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
} else {
|
$hw = strtoupper( $hw );
|
||||||
$hw = strtoupper( $hw );
|
$hw = str_replace( 'HP-AG300H-WZR-600DHP', 'HP-AG300H & WZR-600DHP', $hw );
|
||||||
}
|
$hw = str_replace( '-WZR', 'WZR', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'netgear', 7 ) ) {
|
||||||
return $hw;
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
}
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
if ( ! shortcode_exists( 'ff_firmware_release' ) ) {
|
} elseif ( ! strncmp( $hw, 'allnet', 6 ) ) {
|
||||||
add_shortcode( 'ff_firmware_release', 'firmware_release' );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
}
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
if ( ! shortcode_exists( 'ff_firmware_versions' ) ) {
|
} elseif ( ! strncmp( $hw, 'gl-', 3 ) ) {
|
||||||
add_shortcode( 'ff_firmware_versions', 'firmware_versions' );
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'onion-omega', 11 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'alfa', 4 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'wd', 2 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, '8devices', 8 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( 'CARAMBOLA2-BOARD', 'Carambola 2', $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'meraki', 6 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( 'meraki', '', $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
} elseif ( ! strncmp( $hw, 'openmesh', 8 ) ) {
|
||||||
|
if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw );
|
||||||
|
$hw = strtoupper( $hw );
|
||||||
|
$hw = str_replace( 'openmesh', '', $hw );
|
||||||
|
$hw = str_replace( '-', '', $hw );
|
||||||
|
}
|
||||||
|
return $hw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue