';
}
if ( isset( $option['values'] ) ) {
echo '';
} else {
echo '';
}
}
}
}
// Sanitize and validate input. Accepts an array, return a sanitized array.
function album_medialib_validate( $input ) {
if ( ! empty( $_POST ) && check_admin_referer( 'album_medialib', 'album_medialib_nonce' ) ) {
if ( isset( $_POST['submit'] ) ) {
if ( $input['transients'] === __( 'Delete transients', 'album-media-library' ) ) {
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
$query = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE(%s)", '\_transient\_album\_medialib\_%' ) );
if ( $query ) {
foreach ( $query as $option_name ) {
delete_transient( str_replace( '_transient_', '', $option_name ) );
}
}
$input['transients'] = true;
} else {
$input['transients'] = (bool) $input['transients'];
}
return $input;
}
if ( isset( $_POST['delete'] ) ) {
// delete transients
global $wpdb;
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
$query = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE(%s)", '\_transient\_album\_medialib\_%' ) );
if ( $query ) {
foreach ( $query as $option_name ) {
delete_transient( str_replace( '_transient_', '', $option_name ) );
}
}
delete_option( 'album_medialib' );
}
return false;
}
}
function album_medialib_help() {
$text = '
';
$text .= __( 'Organize your photos in directories. Store the photos for each album in a subdirectory in the WordPress upload directory.', 'album-media-library' );
$text .= ' ' . sprintf(
/* translators: %1$s, %2$s is an url. */
__( 'You can use a %1$splugin%2$s to do this.', 'album-media-library' ),
'',
''
);
$text .= '
';
$text .= __( 'Import these photos to the Media Library. Maybe your plugin has this function too.', 'album-media-library' );
$text .= '
';
$text .= sprintf(
/* translators: %1$s is a url to a plugin. */
__( 'I use %1$s to import the photos to the Media Library, which I uploaded before with sftp.', 'album-media-library' ),
'Bulk Media Register'
);
$text .= '
';
$text .= sprintf(
/* translators: %1$s is "gallery", %2$s is "Photonic" */
__( 'Use the default %1$s shortcode or install a plugin to display photos from Media Library, which has a shortcode for this, for example %2$s.', 'album-media-library' ),
'gallery',
'Photonic'
);
$text .= '
';
$text .= sprintf(
/* translators: %1$s is "gallery", %2$s "ids". */
__( 'Configure the name of this shortcode (default %1$s) and the list option (default %2$s).', 'album-media-library' ),
'gallery',
'ids'
);
$text .= '
';
$text .= sprintf(
/* translators: %s is "path". */
__( 'Write your shortcode as usual, omit the list option and use an extra option %s.', 'album-media-library' ),
'path'
);
$text .= '
';
$text .= sprintf(
/* translators: %1$s is "path", %2$s an example. */
__( '%1$s is a substring of the directory path, for example %2$s.', 'album-media-library' ),
'path',
'holidays25/day1'
);
$text .= '