<?php
defined( 'ABSPATH' ) || exit; // Exit if accessed directly
?>

<tr id="eos-dp-table-head">
  <th class="fdp-legend" style="vertical-align:top;background:#f1f1f1;border-style:none;text-align:initial;padding-top:45px">
    <span>
      <span class="eos-dp-locked-wrp eos-dp-icon-wrp" style="position:relative"><span class="eos-post-locked-icon" style="width:40px;height:21px"></span>
      <span class="eos-dp-no-decoration fdp-has-tooltip">
        <span class="dashicons dashicons-editor-help" style="font-size:24px"></span>
        <p class="fdp-tooltip" style="width:auto;white-space:inherit"><?php printf( __( 'The row settings will override the %sPost Types settings%s.','eos-dp' ),'<a href="'.admin_url( '?page=eos_dp_by_post_type' ).'" target="_fdp_post_types">','</a>' ); ?></p>
      </span>
    </span>
    <span>&nbsp;&nbsp;&nbsp;</span>
    <span>
      <span class="eos-dp-unlocked-wrp eos-dp-icon-wrp" style="position:relative"><span class="eos-post-unlocked-icon" style="width:40px;height:19px"></span>
      <span class="eos-dp-no-decoration fdp-has-tooltip">
        <span class="dashicons dashicons-editor-help" style="font-size:24px"></span>
        <p class="fdp-tooltip" style="width:auto;white-space:inherit"><?php printf( __( 'The %sPost Types settings%s will override the row settings.','eos-dp' ),'<a href="'.admin_url( '?page=eos_dp_by_post_type' ).'" target="_fdp_post_types">','</a>' ); ?></p>
      </span>
    </span>
    <?php if( !$fdp_is_single_post ){ ?>
    <div style="margin-top:16px">
      <span id="eos-dp-lock-all" class="button<?php echo $is_home ? ' eos-hidden' : ''; ?>">
        <?php esc_html_e( 'Activate all rows','eos-dp-pro' ); ?>
      </span>
      <span id="eos-dp-unlock-all" class="button<?php echo $is_home ? ' eos-hidden' : ''; ?>">
        <?php esc_html_e( 'Disable all rows','eos-dp-pro' ); ?>
      </span>
    </div>
    <?php do_action( 'fdp_before_row_filters' ); ?>
    <div id="fdp-show-page-filters-wrp" style="margin-top:16px"><span id="fdp-show-page-filters" class="button"><?php _e( 'Page Filters','eos-dp' ); ?><span class="dashicons dashicons-arrow-down" style="font-size:28px"></span></span></div>
    <div id="fdp-singles-filter" class="eos-hidden" style="position:absolute">
      <p style="margin-top:6px">
        <span title="<?php _e( 'Show all','eos-dp' ); ?>" style="color:initial;border-color:initial" class="eos-active button fdp-filter-all"><?php _e( 'Show all','eos-dp' ); ?></span>
      </p>
      <div>
        <span title="<?php _e( 'Homepage','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-admin-home" data-class=".fdp-row-is-home"></span>
        <span title="<?php _e( 'Active rows','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-yes" data-class=".eos-post-locked"></span>
        <span title="<?php _e( 'Not active rows','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-no-alt" data-class=".eos-dp-post-row:not(.eos-post-locked)"></span>
        <span title="<?php _e( 'Included in the navigation','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-menu-alt2" data-class=".fdp-in-nav"></span>
        <span title="<?php _e( 'Private','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-privacy" data-class=".fdp-row-private"></span>
        <br/>
        <?php if( $is_hierarchical ){ ?>
        <span title="<?php _e( 'Child page','eos-dp' ); ?>" class="eos-dp-active hover fdp-child-page dashicons dashicons-networking" data-class=".fdp-row-is-child"></span>
        <span title="<?php _e( 'Top level page','eos-dp' ); ?>" class="eos-dp-active hover fdp-parent-page dashicons dashicons-networking" data-class=".fdp-top-level-page"></span>
        <?php } ?>
        <span title="<?php _e( 'Plugins all active','eos-dp' ); ?>" class="eos-dp-active hover fdp-all-active dashicons dashicons-plugins-checked" data-class="[data-disabled-plugins='0']"></span>
        <span title="<?php _e( 'Plugins all disabled','eos-dp' ); ?>" class="eos-dp-active hover fdp-all-disabled dashicons dashicons-admin-plugins" data-class="[data-active-plugins='0']"></span>
        <?php
        if( function_exists( 'eos_scfm_post_types' ) ){ ?>
          <span title="<?php _e( 'Mobile','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-smartphone" data-class=".eos-dp-mobile"></span>
        <?php } ?>
        <?php if( class_exists( 'WooCommerce') && 'page' === $post_type){ ?>
        <span title="<?php _e( 'WooCommerce pages','eos-dp' ); ?>" class="eos-dp-active hover dashicons dashicons-cart" data-class=".eos-dp-woo-row"></span>
      <?php } ?>
      </div>
    </div>
    <?php do_action( 'fdp_after_row_filters' ); ?>
    <?php }else{ ?>
    <div style="clear:both"></div>
    <?php } ?>
  </th>
  <?php
  $n = 0;
  foreach( $active_plugins as $plugin ){
    if( in_array( $plugin,array_keys( $plugins_by_dirs ) ) ){
      $plugin_name = strtoupper( str_replace( '-',' ',dirname( $plugin ) ) );
      $details_url = add_query_arg(
        array(
          'tab' => 'plugin-information',
          'plugin' => dirname( $plugin ),
          'TB_iframe' => true,
          'eos_dp' => $plugin,
          'eos_dp_info' => 'true'
        ),
        admin_url( 'plugin-install.php' )
      );
      ?>
      <th class="eos-dp-name-th">
        <div>
          <div id="eos-dp-plugin-name-<?php echo $n + 1; ?>" class="eos-dp-plugin-name" data-path="<?php echo $plugin; ?>">
            <span><a title="<?php printf( esc_attr__( 'View details of %s','eos-dp' ),esc_attr( $plugin_name ) ); ?>" href="<?php echo esc_url( $details_url ); ?>" target="_blank"><?php echo esc_html( $plugin_name ); ?></a></span>
          </div>
          <div class="eos-dp-global-chk-col-wrp">
            <div class="eos-dp-not-active-wrp"><input title="<?php printf( __( 'Activate/deactivate %s everywhere','eos-dp' ),esc_attr( $plugin_name ) ); ?>" data-col="<?php echo $n + 1; ?>" class="eos-dp-global-chk-col" type="checkbox" /></div>
            <?php if( defined( 'FDP_BETA_VERSION' ) && FDP_BETA_VERSION ){ ?>
              <div class="eos-dp-reset-col" data-col="<?php echo $n + 1; ?>"><span title="<?php printf( __( 'Restore last saved options for %s everywhere','eos-dp' ),esc_attr( $plugin_name ) ); ?>" class="dashicons dashicons-image-rotate"></span></div>
            <?php } ?>
            <?php do_action( 'eos_dp_table_head_col_after' ); ?>
          </div>
          <div class="fdp-p-n"><?php echo $n + 1; ?></div>
        </div>
      </th>
      <?php
      ++$n;
    }
  }
  ?>
</tr>
