Exemple #1
0
function flag_created_b_playlists()
{
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    $all_playlists = get_b_playlists();
    $total_all_playlists = count($all_playlists);
    $flag_options = get_option('flag_options');
    ?>
	<div class="flag-wrap">
		<h2><?php 
    _e('Created playlists', 'flag');
    ?>
</h2>
		<table class="widefat flag-table" cellspacing="0">
			<thead>
			<tr>
				<th scope="col" width="25%"><?php 
    _e('Title', 'flag');
    ?>
</th>
				<th scope="col" width="55%"><?php 
    _e('Description', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Quantity', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Shortcode', 'flag');
    ?>
</th>
				<th scope="col"><?php 
    _e('Action', 'flag');
    ?>
</th>
			</tr>
			</thead>
			<tbody>
			<?php 
    if ($all_playlists) {
        foreach ((array) $all_playlists as $playlist_file => $playlist_data) {
            $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
            $class = !isset($class) || $class == 'class="alternate"' ? '' : 'class="alternate"';
            $playlist_name = basename($playlist_file, '.xml');
            if (count($query_m) != count($playlist_data['items'])) {
                flagSave_bPlaylist($playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name);
            }
            ?>
					<tr id="<?php 
            echo $playlist_name;
            ?>
" <?php 
            echo $class;
            ?>
 >
						<td>
							<a href="<?php 
            echo esc_url($filepath . '&playlist=' . $playlist_name . '&mode=edit');
            ?>
" class='edit' title="<?php 
            _e('Edit');
            ?>
">
								<?php 
            echo esc_html($playlist_data['title']);
            ?>
							</a>
						</td>
						<td><?php 
            echo esc_html($playlist_data['description']);
            echo '&nbsp;(' . __("player", "flag") . ': <strong>' . esc_html($playlist_data['skin']) . '</strong>)';
            ?>
</td>
						<td><?php 
            echo count($query_m);
            ?>
</td>
						<td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandbanner xml=<?php 
            echo $playlist_name;
            ?>
]"/></td>
						<td>
							<a href="<?php 
            echo wp_nonce_url($filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete');
            ?>
" class="delete" onclick="javascript:check=confirm( '<?php 
            _e("Delete this playlist?", 'flag');
            ?>
');if(check==false) {return false;
								}"><?php 
            _e('Delete', 'flag');
            ?>
</a>
						</td>
					</tr>
				<?php 
        }
    } else {
        echo '<tr><td colspan="5" align="center"><strong>' . __('No playlists found', 'flag') . '</strong></td></tr>';
    }
    ?>
			</tbody>
		</table>
	</div>

<?php 
}
function flagSave_bPlaylistSkin($file)
{
    $file = sanitize_flagname($file);
    $flag_options = get_option('flag_options');
    $playlistPath = ABSPATH . $flag_options['galleryPath'] . 'playlists/banner/' . $file . '.xml';
    // Save options
    $title = esc_html($_POST['playlist_title']);
    $descr = esc_html($_POST['playlist_descr']);
    $items = get_b_playlist_data($playlistPath);
    $data = $items['items'];
    flagSave_bPlaylist($title, $descr, $data, $file, $skinaction = 'update');
}