' . esc_html__( 'The primary keyword is the phrase people search to find a page. Other pages link to it using this phrase. Type your own to override the SEO plugin or AI.', 'linkcortex' ) . '
';
}
/**
* Progress box used by run buttons (filled by admin.js).
*
* @param array|null $active Active run progress, to resume display.
* @return void
*/
public static function progress_box( $active = null ) {
printf(
'
',
esc_attr( $active ? $active['run_id'] : '' ),
esc_html__( 'Pause', 'linkcortex' ),
esc_html__( 'Resume', 'linkcortex' ),
esc_html__( 'Cancel', 'linkcortex' ),
esc_attr__( 'Progress', 'linkcortex' )
);
}
/**
* CSV export of the (filtered) index.
*
* @return void
*/
public static function export() {
global $wpdb;
if ( ! current_user_can( self::CAP ) ) {
wp_die( esc_html__( 'You do not have permission to do that.', 'linkcortex' ) );
}
check_admin_referer( 'ailsug_export_keywords' );
$t = Activator::tables();
$f = Keywords_Table::filters();
$w_params = Keywords_Table::where_params( $f );
$args = array_merge( array( $t['index'] ), $w_params );
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Own table.
$rows = $wpdb->get_results(
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Dynamic filter parameters passed as array.
$wpdb->prepare(
"SELECT * FROM %i WHERE ( %s = 'all' OR ( %s = 'nokeyword' AND primary_keyword = '' ) OR ( %s = 'orphan' AND inbound_count = 0 ) OR ( %s = 'low' AND inbound_count BETWEEN 1 AND 2 ) ) AND ( %s = '' OR post_type = %s ) AND ( %s = '' OR title LIKE %s OR primary_keyword LIKE %s ) ORDER BY post_id ASC",
$args
),
ARRAY_A
);
$out = array();
foreach ( (array) $rows as $row ) {
$secondary = json_decode( (string) $row['secondary_keywords'], true );
$out[] = array(
get_permalink( (int) $row['post_id'] ),
$row['title'],
$row['post_type'],
$row['primary_keyword'],
$row['keyword_source'],
is_array( $secondary ) ? implode( '; ', $secondary ) : '',
$row['inbound_count'],
$row['outbound_count'],
$row['word_count'],
);
}
Csv::download(
'internal-links-keywords-' . gmdate( 'Y-m-d' ) . '.csv',
array( 'URL', 'Title', 'Type', 'Primary keyword', 'Keyword source', 'Secondary keywords', 'Links in', 'Links out', 'Words' ),
$out
);
}
}