public/wordpress/wp-content/plugins/backupbuddy/pluginbuddy/classes/ui.php
/*	start_tabs()
	 *	
	 *	Starts a tabbed interface.
 	 *	@see end_tabs().
	 *	
	 *	@param		string		$interface_tag		Tag/slug for this entire tabbed interface. Should be unique.
	 *	@param		array		$tabs				Array containing an array of settings for this tabbed interface. Ex:  array( array( 'title'> 'my title', 'slug' => 'mytabs' ) );
	 *												Optional setting with key `ajax_url` may define a URL for AJAX loading.
	 *	@param		string		$css				Additional CSS to apply to main outer div. (optional)
	 *	@param		boolean		$echo				Echo output instead of returning. (optional)
	 *	@param		int			$active_tab_index	Tab to start as active/selected.
	 *	@return		null/string						null if $echo = false, all data otherwise.
	 */


Starts a tabbed interface.

@param          string          $interface_tag          Tag/slug for this entire tabbed interface. Should be unique.
@param          array           $tabs                           Array containing an array of settings for this tabbed interface.
Starts a tabbed interface . @param string $interface_tag Tag / slug for this entire tabbed interface . Should be unique . @param array $tabs Array containing an array of settings for this tabbed interface .
public function start_tabs( $interface_tag, $tabs, $css = '', $echo = true, $active_tab_index = 0 ) {
		$this->_tab_interface_tag = $interface_tag;
		pb_backupbuddy::load_script( 'pb_tabs.js', true );
		$prefix = 'pb_' . pb_backupbuddy::settings( 'slug' ) . '_'; 
		$return = '';
		$return .= '<div class="backupbuddy-tabs-wrap">';
		$return .= '<h2 class="nav-tab-wrapper">';
		$i = 0;
		foreach( $tabs as $tab ) {
			if ( ! isset( $tab['css'] ) ) {
				$tab['css'] = '';
			}
			$active_tab_class = '';
			if ( $active_tab_index == $i ) {
				$active_tab_class = 'nav-tab-active';
			}
			if ( isset( $tab['ajax'] ) && ( $tab['ajax_url'] != '' ) ) { 
				$return .= '<a class="nav-tab nav-tab-' . $i . ' ' . $active_tab_class . ' bb-tab-' . $tab['slug'] . '" href="javascript:void(0)" data-ajax="' . $tab['ajax_url'] . '">' . $tab['title'] . '</a>';
			} elseif ( isset( $tab['url'] ) && ( $tab['url'] != '' ) ) {
				$return .= '<a class="nav-tab nav-tab-' . $i . ' ' . $active_tab_class . ' bb-tab-' . $tab['slug'] . '" href="' . $tab['url'] . '">' . $tab['title'] . '</a>';
			} else { 
				$return .= '<a class="nav-tab nav-tab-' . $i . ' ' . $active_tab_class . ' bb-tab-' . $tab['slug'] . '" style="' . $tab['css'] . '" href="#' . $prefix . $this->_tab_interface_tag . '_tab_' . $tab['slug'] . '">' . $tab['title'] . '</a>';
			}
			$i++;
		}
		$return .= '</h2>';
		/*
		$return .= '<div id="' . $prefix . $this->_tab_interface_tag . '_tabs" style="' . $css . '">';
		$return .= '<ul>';
		foreach( $tabs as $tab ) {
			if ( ! isset( $tab['css'] ) ) {
				$tab['css'] = '';
			}
			if ( isset( $tab['ajax'] ) && ( $tab['ajax_url'] != '' ) ) { 
				$return .= '<li><a href="' . $tab['ajax_url'] . '"><span>' . $tab['title'] . '</span></a></li>';
			} else { 
				$return .= '<li style="' . $tab['css'] . '"><a href="#' . $prefix . $this->_tab_interface_tag . '_tab_' . $tab['slug'] . '"><span>' . $tab['title'] . '</span></a></li>';
			}
		}
		$return .= '</ul>';
		$return .= '<br>';
		$return .= '<div class="tabs-borderwrap">';
		*/
		$return .= '<div class="backupbuddy-tab-blocks">';
		if ( $echo === true ) {
			echo $return;
		} else {
			return $return;
		}
	}
public function start_tabs ( $ interface_tag , $ tabs , $ css = '' , $ echo = true , $ active_tab_index = 0 ) { $ this -> _tab_interface_tag = $ interface_tag ; pb_backupbuddy :: load_script ( 'pb_tabs.js' , true ) ; $ prefix = 'pb_' . pb_backupbuddy :: settings ( 'slug' ) . '_' ; $ return = '' ; $ return .= '<div class="backupbuddy-tabs-wrap">' ; $ return .= '<h2 class="nav-tab-wrapper">' ; $ i = 0 ; foreach ( $ tabs as $ tab ) { if ( ! isset ( $ tab [ 'css' ] ) ) { $ tab [ 'css' ] = '' ; } $ active_tab_class = '' ; if ( $ active_tab_index == $ i ) { $ active_tab_class = 'nav-tab-active' ; } if ( isset ( $ tab [ 'ajax' ] ) && ( $ tab [ 'ajax_url' ] != '' ) ) { $ return .= '<a class="nav-tab nav-tab-' . $ i . ' ' . $ active_tab_class . ' bb-tab-' . $ tab [ 'slug' ] . '" href="javascript:void(0)" data-ajax="' . $ tab [ 'ajax_url' ] . '">' . $ tab [ 'title' ] . '</a>' ; } elseif ( isset ( $ tab [ 'url' ] ) && ( $ tab [ 'url' ] != '' ) ) { $ return .= '<a class="nav-tab nav-tab-' . $ i . ' ' . $ active_tab_class . ' bb-tab-' . $ tab [ 'slug' ] . '" href="' . $ tab [ 'url' ] . '">' . $ tab [ 'title' ] . '</a>' ; } else { $ return .= '<a class="nav-tab nav-tab-' . $ i . ' ' . $ active_tab_class . ' bb-tab-' . $ tab [ 'slug' ] . '" style="' . $ tab [ 'css' ] . '" href="#' . $ prefix . $ this -> _tab_interface_tag . '_tab_' . $ tab [ 'slug' ] . '">' . $ tab [ 'title' ] . '</a>' ; } $ i ++ ; } $ return .= '</h2>' ; $ return .= '<div class="backupbuddy-tab-blocks">' ; if ( $ echo === true ) { echo $ return ; } else { return $ return ; } }
start_tabs()
start_tabs ()
// pb_PLUGINSLUG_ /*
		$return .= '<script type="text/javascript">';
		$return .= '	jQuery(document).ready(function() {';
		$return .= '		jQuery("#' . $prefix . $this->_tab_interface_tag . '_tabs").tabs({ active: ' . $active_tab_index . ' });';
		$return .= '	});';
		$return .= '</script>';
		*/ // AJAX tab. // Standard; NO AJAX. /*
		$return .= '<div id="' . $prefix . $this->_tab_interface_tag . '_tabs" style="' . $css . '">';
		$return .= '<ul>';
		foreach( $tabs as $tab ) {
			if ( ! isset( $tab['css'] ) ) {
				$tab['css'] = '';
			}
			if ( isset( $tab['ajax'] ) && ( $tab['ajax_url'] != '' ) ) { // AJAX tab.
				$return .= '<li><a href="' . $tab['ajax_url'] . '"><span>' . $tab['title'] . '</span></a></li>';
			} else { // Standard; NO AJAX.
				$return .= '<li style="' . $tab['css'] . '"><a href="#' . $prefix . $this->_tab_interface_tag . '_tab_' . $tab['slug'] . '"><span>' . $tab['title'] . '</span></a></li>';
			}
		}
		$return .= '</ul>';
		$return .= '<br>';
		$return .= '<div class="tabs-borderwrap">';
		*/