$sw_ver"; return $outstr; } if ( ! shortcode_exists( 'ff_hh_versions' ) ) { add_shortcode( 'ff_hh_versions', 'ff_hh_shortcode_versions' ); } // Example: // [ff_hh_versions] // [ff_hh_versions domain="ffhh-sued" branch="experimental" grep="ubiquiti"] function ff_hh_shortcode_versions( $atts, $content, $name ) { $domain = 'ffhh'; $branch = 'stable'; $grep = false; $filter = false; if ( is_array( $atts ) ) { if ( array_key_exists( 'domain', $atts ) && ! empty( $atts['domain'] ) ) { $domain = $atts['domain']; } if ( array_key_exists( 'branch', $atts ) && ! empty( $atts['branch'] ) ) { $branch = $atts['branch']; } if ( array_key_exists( 'grep', $atts ) && ! empty( $atts['grep'] ) ) { $grep = $atts['grep']; } if ( array_key_exists( 'filter', $atts ) && ! empty( $atts['filter'] ) ) { $filter = explode ( ',', $atts['filter'] ); } } $branch_url = FF_HH_UPDATES_URL . $domain . '/' . $branch; $manifest = ff_hh_getmanifest( $branch_url, $domain, $branch ); $outstr = "
Modell | Erstinstallation | Aktualisierung | |
---|---|---|---|
%s | ", $hw ); // factory versions $hw_ver_links = array(); foreach ( $versions as $hw_ver => $filename ) { if ( strpos( $hw, 'Unifi Ac Pro' ) || strpos( $hw, 'Unifi Ac Lite' ) ) { continue; } $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( '%s.x', $branch_url . '/factory/', $filename, $hw_ver ); } if ( count($hw_ver_links) > 0) { $outstr .= 'Hardware Ver. ' . join( ', ', $hw_ver_links ) . ' | '; } else { $outstr .= 'Benutze das Imagezur Aktualisierung | '; } // sysupgrade versions $hw_ver_links = array(); foreach ( $versions as $hw_ver => $filename ) { $hw_ver_links[] = sprintf( '%s.x', $branch_url . '/sysupgrade/', $filename, $hw_ver ); } $outstr .= 'Hardware Ver. ' . join( ', ', $hw_ver_links ) . ' | '; $outstr .= '
'.print_r( $manifest, true ).''; return $outstr; } // some crude rules to add capitalization and whitespace to the // hardware model name. // set $discard_vendor to strip the vendor name // (used for single-vendor lists, e.g. $discard_vendor = 'tp-link' ) function ff_hh_beautify_hw_name( $hw, $discard_vendor = '' ) { if ( ! strncmp( $hw, 'tp-link', 7 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = strtoupper( $hw ); $hw = str_replace( '-', ' ', $hw ); $hw = str_replace( ' TL ', ' TL-', $hw ); } elseif ( ! strncmp( $hw, 'ubiquiti', 8 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = str_replace( 'bullet-m', 'bullet-m', $hw ); $hw = str_replace( '-', ' ', $hw ); $hw = ucwords( $hw ); } elseif ( ! strncmp( $hw, 'ubnt', 4 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = str_replace( 'erx', 'ER-X', $hw ); $hw = str_replace( 'sfp', 'SFP', $hw ); $hw = trim( $hw, ' -' ); $hw = ucwords( $hw ); } elseif ( ! strncmp( $hw, 'd-link', 6 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = strtoupper( $hw ); $hw = str_replace( '-', ' ', $hw ); $hw = str_replace( ' DIR ', ' DIR-', $hw ); } elseif ( ! strncmp( $hw, 'linksys', 7 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = strtoupper( $hw ); $hw = str_replace( '-', ' ', $hw ); $hw = str_replace( ' WRT', ' WRT-', $hw ); } elseif ( ! strncmp( $hw, 'buffalo', 7 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $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 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = strtoupper( $hw ); $hw = str_replace( '-', '', $hw ); } elseif ( ! strncmp( $hw, 'allnet', 6 ) ) { if ( $discard_vendor ) $hw = str_replace( $discard_vendor, '', $hw ); $hw = strtoupper( $hw ); $hw = str_replace( '-', '', $hw ); } elseif ( ! strncmp( $hw, 'gl-inet', 7 ) ) { 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; }