Code Duplication    Length = 14-16 lines in 2 locations

includes/functions.php 2 locations

@@ 125-138 (lines=14) @@
122
 * Delete a link in the DB
123
 *
124
 */
125
function yourls_delete_link_by_keyword( $keyword ) {
126
	// Allow plugins to short-circuit the whole function
127
	$pre = yourls_apply_filter( 'shunt_delete_link_by_keyword', null, $keyword );
128
	if ( null !== $pre )
129
		return $pre;
130
131
	global $ydb;
132
133
	$table = YOURLS_DB_TABLE_URL;
134
    $keyword = yourls_sanitize_string($keyword);
135
    $delete = $ydb->fetchAffected("DELETE FROM `$table` WHERE `keyword` = :keyword", array('keyword' => $keyword));
136
	yourls_do_action( 'delete_link', $keyword, $delete );
137
	return $delete;
138
}
139
140
/**
141
 * SQL query to insert a new link in the DB. Returns boolean for success or failure of the inserting
@@ 384-399 (lines=16) @@
381
 * Update a title link (no checks for duplicates etc..)
382
 *
383
 */
384
function yourls_edit_link_title( $keyword, $title ) {
385
	// Allow plugins to short-circuit the whole function
386
	$pre = yourls_apply_filter( 'shunt_edit_link_title', null, $keyword, $title );
387
	if ( null !== $pre )
388
		return $pre;
389
390
	global $ydb;
391
392
	$keyword = yourls_sanitize_keyword( $keyword );
393
	$title = yourls_sanitize_title( $title );
394
395
	$table = YOURLS_DB_TABLE_URL;
396
	$update = $ydb->fetchAffected("UPDATE `$table` SET `title` = :title WHERE `keyword` = :keyword;", array('title' => $title, 'keyword' => $keyword));
397
398
	return $update;
399
}
400
401
402
/**