Exemple #1
0
function flag_skin_options()
{
    $flag_options = get_option('flag_options');
    $act_skin = isset($_GET['skin']) ? urlencode($_GET['skin']) : $flag_options['flashSkin'];
    $act_skin = sanitize_flagname($act_skin);
    $settings = $flag_options['skinsDirURL'] . $act_skin . '/settings';
    $settingsXML = $flag_options['skinsDirABS'] . $act_skin . '/settings/settings.xml';
    $fp = fopen($settingsXML, "r");
    if (!$fp) {
        echo '<p style="color:#ff0000;"><b>Error! The configuration file not be found. You need to reinstall this skin.</b></p>';
    } else {
        $cPanel = FLAG_URLPATH . "lib/cpanel.swf";
        $constructor = FLAG_URLPATH . "lib/";
        $swfObject = FLAG_URLPATH . "admin/js/swfobject.js?ver=2.2";
        ?>

		<div id="skinOptions">
			<script type="text/javascript" src="<?php 
        echo $swfObject;
        ?>
"></script>
			<script type="text/javascript">
				var flashvars = {
					path : "<?php 
        echo $settings;
        ?>
",
					constructor : "<?php 
        echo $constructor;
        ?>
",
					skin : "<?php 
        echo $act_skin;
        ?>
"
				};
				var params = {
					wmode : "transparent",
					scale : "noScale",
					saling : "lt",
					allowfullscreen : "false",
					menu : "false"
				};
				var attributes = {};
				swfobject.embedSWF("<?php 
        echo $cPanel;
        ?>
", "myContent", "600", "550", "9.0.0", "<?php 
        echo FLAG_URLPATH;
        ?>
skins/expressInstall.swf", flashvars, params, attributes);
			</script>
			<div id="myContent"><a href="http://www.adobe.com/go/getflash"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a>
				<p>This page requires Flash Player version 10.1.52 or higher.</p>
			</div>	
		</div> 
		<?php 
    }
    fclose($fp);
}
function flag_playlist_order($playlist = 'deprecated')
{
    global $wpdb;
    //this is the url without any presort variable
    $base_url = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    $flag_options = get_option('flag_options');
    $filename = sanitize_flagname($_GET['playlist']);
    $playlistPath = $flag_options['galleryPath'] . 'playlists/' . $filename . '.xml';
    $playlist = get_playlist_data(ABSPATH . $playlistPath);
    $items_a = $playlist['items'];
    $items = implode(',', $playlist['items']);
    ?>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablednd_0_5.js"></script>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablesorter.js"></script>
<div class="flag-wrap">
			<h2><?php 
    _e('Sort Gallery', 'flash-album-gallery');
    ?>
</h2>

	<div class="alignright tablenav" style="margin-bottom: -36px;">
		<a href="<?php 
    echo esc_url($base_url . "&playlist=" . $filename . '&mode=edit');
    ?>
" class="button-secondary action"><?php 
    _e('Back to playlist', 'flash-album-gallery');
    ?>
</a>
	</div>
	<form id="sortPlaylist" method="POST" action="<?php 
    echo esc_url($base_url . "&playlist=" . $filename . '&mode=edit');
    ?>
" accept-charset="utf-8">
		<div class="alignleft tablenav">
			<?php 
    wp_nonce_field('flag_update');
    ?>
			<input class="button-primary action" type="submit" name="updatePlaylist" value="<?php 
    _e('Update Sort Order', 'flash-album-gallery');
    ?>
" />
		</div>
		<br clear="all" />
		<input type="hidden" name="playlist_title" value="<?php 
    echo esc_html($playlist['title']);
    ?>
" />
		<input type="hidden" name="skinname" value="<?php 
    echo sanitize_flagname($playlist['skin']);
    ?>
" />
		<input type="hidden" name="skinaction" value="<?php 
    echo sanitize_flagname($playlist['skin']);
    ?>
" />
		<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php 
    echo esc_html($playlist['description']);
    ?>
</textarea>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(document).ready(function($) {
    // Initialise the table
    jQuery("#listitems").tableDnD({
      onDragClass: "myDragClass",
	  	onDrop: function() {
				jQuery("#listitems tr:even").addClass('alternate');
				jQuery("#listitems tr:odd").removeClass('alternate');
      }
    });
		$("#flag-listitems").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }
        } 
    });
		$("#flag-listitems").bind("sortEnd",function() { 
				jQuery("#listitems tr:even").addClass('alternate');
				jQuery("#listitems tr:odd").removeClass('alternate');
    }); 

});
/*]]>*/
</script>
<table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >

	<thead>
	<tr>
			<th class="header" width="54"><p style="margin-right:-10px;"><?php 
    _e('ID', 'flash-album-gallery');
    ?>
</p></th>
			<th width="260"><div><?php 
    _e('Play', 'flash-album-gallery');
    ?>
</div></th>
			<th class="header"><p><?php 
    _e('Filename', 'flash-album-gallery');
    ?>
</p></th>
			<th class="header"><p><?php 
    _e('Title', 'flash-album-gallery');
    ?>
</p></th>
	</tr>
	</thead>
	<tfoot>
	<tr>
			<th><?php 
    _e('ID', 'flash-album-gallery');
    ?>
</th>
			<th><?php 
    _e('Play', 'flash-album-gallery');
    ?>
</th>
			<th><?php 
    _e('Filename', 'flash-album-gallery');
    ?>
</th>
			<th><?php 
    _e('Title', 'flash-album-gallery');
    ?>
</th>
	</tr>
	</tfoot>
	<tbody id="listitems">
<?php 
    if (count($items_a)) {
        $flag_options = get_option('flag_options');
        $counter = 0;
        foreach ($items_a as $item) {
            $mp3 = get_post($item);
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : 'alternate';
            $counter++;
            $bg = !isset($alternate) || $alternate == 'alternate' ? 'f9f9f9' : 'ffffff';
            $url = wp_get_attachment_url($mp3->ID);
            ?>
		<tr id="$mp3-<?php 
            echo $mp3->ID;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
				<td scope="row"><input type="hidden" name="item_a[<?php 
            echo $mp3->ID;
            ?>
][ID]" value="<?php 
            echo $mp3->ID;
            ?>
" /><strong><?php 
            echo $mp3->ID;
            ?>
</strong></td>
				<td><script type="text/javascript">swfobject.embedSWF("<?php 
            echo FLAG_URLPATH;
            ?>
lib/mini.swf", "c-<?php 
            echo $mp3->ID;
            ?>
", "250", "20", "10.1.52", "expressInstall.swf", {path:"<?php 
            echo str_replace(array('.mp3'), array(''), $url);
            ?>
",bgcolor:"<?php 
            echo $flag_options['mpBG'];
            ?>
",color1:"<?php 
            echo $flag_options['mpColor1'];
            ?>
",color2:"<?php 
            echo $flag_options['mpColor2'];
            ?>
"}, {wmode:"transparent"}, {id:"f-<?php 
            echo $mp3->ID;
            ?>
",name:"f-<?php 
            echo $mp3->ID;
            ?>
"});</script>
<div class="play"><span id="c-<?php 
            echo $mp3->ID;
            ?>
"></span></div></td>
				<td><?php 
            echo basename($url);
            ?>
</td>
				<td><?php 
            echo esc_html(stripslashes($mp3->post_title));
            ?>
</td>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="4" align="center"><strong>' . __('No entries found', 'flash-album-gallery') . '</strong></td></tr>';
    }
    ?>
		</tbody>
	</table>
	<p class="actions"><input type="submit" class="button-primary action"  name="updatePlaylist" value="<?php 
    _e('Update Sort Order', 'flash-album-gallery');
    ?>
" /></p>
</form>	
<br class="clear"/>
</div><!-- /#wrap -->

<?php 
}
function flag_playlist_edit()
{
    global $wpdb;
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    $all_playlists = get_playlists();
    $flag_options = get_option('flag_options');
    $playlistPath = $flag_options['galleryPath'] . 'playlists/' . sanitize_flagname($_GET['playlist']) . '.xml';
    $playlist = get_playlist_data(ABSPATH . $playlistPath);
    $items_a = $playlist['items'];
    $items = implode(',', $playlist['items']);
    ?>
<script type="text/javascript"> 
//<![CDATA[
function checkAll(form)
{
	jQuery(form).find(':checkbox').each(function(){this.checked = !this.checked});
	return false;
}

function getNumChecked(form)
{
	var num = 0;
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					num++;
		}
	}
	return num;
}

// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {

	var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
	 
	if(numchecked < 1) { 
		alert('<?php 
    echo esc_js(__("No items selected", "flag"));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "delete_items":
			return confirm('<?php 
    echo sprintf(esc_js(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.", 'flag')), "' + numchecked + '");
    ?>
');
			break;			
	}
	
	return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.", 'flag')), "' + numchecked + '");
    ?>
');
}

function showDialog( windowId, height ) {
	var form = document.getElementById('updatePlaylist');
	var elementlist = "";
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					if (elementlist == "")
						elementlist = form.elements[i].value;
					else
						elementlist += "," + form.elements[i].value;
		}
	}
	jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
	jQuery("#" + windowId + "_playlist").val(elementlist);
	tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
}
var current_image = '';
function send_to_editor(html) {
	var source = html.match(/src=\".*\" alt/);
	source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
	jQuery('#mp3thumb-'+actInp).attr('value', source);
	jQuery('#thumb-'+actInp).attr('src', source);
	tb_remove();
}
jQuery(document).ready(function(){
  jQuery('.del_thumb').click(function(){
    var id = jQuery(this).attr('data-id');
	jQuery('#mp3thumb-'+id).attr('value', '');
	jQuery('#thumb-'+id).attr('src', '<?php 
    echo site_url() . "/wp-includes/images/crystal/audio.png";
    ?>
');
    return false;
  });
  jQuery('#skinname').change(function(){
  	var skin = jQuery(this).val();
	jQuery('#skinOptions').attr("href","<?php 
    echo FLAG_URLPATH;
    ?>
admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
  });
});
//]]>
</script>

<div class="flag-wrap">
<h2><?php 
    _e('Playlist', 'flag');
    ?>
: <?php 
    echo esc_html($playlist['title']);
    ?>
</h2>
<div style="float: right; margin: -20px 3px 0 0;">
<span><a href="<?php 
    echo $filepath;
    ?>
"><?php 
    _e('Back to Music Box', 'flag');
    ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<select name="select_playlist" onchange="window.location.href=this.options[this.selectedIndex].value">
	<option selected="selected"><?php 
    _e('Choose another playlist', 'flag');
    ?>
</option>
<?php 
    foreach ((array) $all_playlists as $playlist_file => $playlist_data) {
        $playlist_name = basename($playlist_file, '.xml');
        if ($playlist_file == sanitize_flagname($_GET['playlist'])) {
            continue;
        }
        ?>
	<option value="<?php 
        echo esc_url($filepath . "&playlist=" . $playlist_name . "&mode=edit");
        ?>
"><?php 
        echo esc_html($playlist_data['title']);
        ?>
</option>
<?php 
    }
    ?>
</select>
</div>
<form id="updatePlaylist" class="flagform" method="POST" action="<?php 
    echo esc_url($filepath . "&playlist=" . sanitize_flagname($_GET['playlist']) . "&mode=edit");
    ?>
" accept-charset="utf-8">
<?php 
    wp_nonce_field('flag_update');
    ?>
<input type="hidden" name="page" value="manage-playlist" />

<div id="poststuff" class="metabox-holder">
<div id="post-body"><div id="post-body-content"><div id="normal-sortables" style="position: relative;">
	<div id="flagalleryset" class="postbox" >
		<h3 class="hndle"><span><?php 
    _e('Playlist settings', 'flag');
    ?>
</span></h3>
		<div class="inside">
			<table cellspacing="8" cellpadding="0" border="0">
				<tr>
					<th align="left" valign="middle" scope="row"><?php 
    _e('Shortcode', 'flag');
    ?>
:</th>
					<td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandmusic playlist=<?php 
    echo sanitize_flagname($_GET['playlist']);
    ?>
]" /></td>
					<td rowspan="3" align="left" valign="top"><div><strong style="display: inline-block; width: 100px;"><?php 
    _e("Playlist Skin", 'flag');
    ?>
:</strong>
						<input id="skinaction" type="hidden" name="skinaction" value="<?php 
    echo sanitize_flagname($playlist['skin']);
    ?>
" />
                        <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
                          <?php 
    require_once dirname(__FILE__) . '/get_skin.php';
    $all_skins = get_skins($skin_folder = '', $type = 'm');
    if (count($all_skins)) {
        foreach ((array) $all_skins as $skin_file => $skin_data) {
            $cur = $playlist['skin'] == dirname($skin_file) ? ' selected="selected"' : '';
            echo '<option' . $cur . ' value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
        }
    } else {
        echo '<option value="music_default">' . __("No Skins", "flag") . '</option>';
    }
    ?>
                        </select>&nbsp;&nbsp;<a id="skinOptions" class="thickbox" href="<?php 
    echo FLAG_URLPATH . 'admin/skin_options.php?show_options=1&amp;skin=' . sanitize_flagname($playlist['skin']) . '&amp;TB_iframe=1&amp;width=600&amp;height=560';
    ?>
"><?php 
    _e('Change Skin Options', 'flag');
    ?>
</a>
                    </div>
					<p style="margin:10px 0 0 100px;"><input type="submit" id="updatePlaylistSkin" name="updatePlaylistSkin" class="button-primary action"  value="<?php 
    _e('Update skin options for this playlist', 'flag');
    ?>
" /></p>
					</td>
				</tr>
				<tr>
					<th align="left" valign="middle" scope="row"><?php 
    _e('Title', 'flag');
    ?>
:</th>
					<td align="left" valign="middle"><input type="text" size="50" name="playlist_title" value="<?php 
    echo esc_html($playlist['title']);
    ?>
" /></td>
				</tr>
				<tr>
					<th align="left" valign="top" scope="row"><?php 
    _e('Description', 'flag');
    ?>
:</th>
					<td align="left" valign="top"><textarea name="playlist_descr" cols="60" rows="2" style="width: 95%" ><?php 
    echo esc_html($playlist['description']);
    ?>
</textarea></td>
				</tr>
				<!--<tr>
					<th align="left" valign="top" scope="row"><?php 
    _e('Path', 'flag');
    ?>
:</th> 
					<td align="left" colspan="2" valign="top"><?php 
    echo $playlistPath;
    ?>
</td>
				</tr>-->
			</table>
			<div class="clear"></div>
		</div>
	</div>
</div></div></div>
</div> <!-- poststuff -->
<div class="tablenav flag-tablenav">
	<select id="bulkaction" name="bulkaction" class="alignleft">
		<option value="no_action" ><?php 
    _e("No action", 'flag');
    ?>
</option>
		<option value="delete_items" ><?php 
    _e("Delete items", 'flag');
    ?>
</option>
	</select>
	<input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="updatePlaylist" value="<?php 
    _e("OK", 'flag');
    ?>
" onclick="if ( !checkSelected() ) return false;" />
	<a href="<?php 
    echo wp_nonce_url($filepath . "&playlist=" . sanitize_flagname($_GET['playlist']) . "&mode=sort", 'flag_sort');
    ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
    _e("Sort Playlist", 'flag');
    ?>
</a>
	<a href="#" onClick="jQuery('#form_listitems').submit();return false;" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
    _e("Add/Remove Items from Playlist", 'flag');
    ?>
</a>
	<input type="submit" name="updatePlaylist" class="button-primary action alignright"  value="<?php 
    _e("Update Playlist", 'flag');
    ?>
" />
</div>

<table id="flag-listmusic" class="widefat fixed flag-table" cellspacing="0" >

	<thead>
	<tr>
		<th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('updatePlaylist'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
		<th class="id" width="134" scope="col"><div><?php 
    _e('ID', 'flag');
    ?>
</div></th>
		<th class="size" width="75" scope="col"><div><?php 
    _e('Size', 'flag');
    ?>
</div></th>
		<th class="thumb" width="110" scope="col"><div><?php 
    _e('Thumbnail', 'flag');
    ?>
</div></th>
		<th class="title_filename" scope="col"><div><?php 
    _e('Filename / Title', 'flag');
    ?>
</div></th>
		<th class="description" scope="col"><div><?php 
    _e('Description', 'flag');
    ?>
</div></th>
	</tr>
	</thead>
	<tfoot>
	<tr>
		<th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('updatePlaylist'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
		<th class="id" scope="col"><?php 
    _e('ID', 'flag');
    ?>
</th>
		<th class="size" scope="col"><?php 
    _e('Size', 'flag');
    ?>
</th>
		<th class="thumb" scope="col"><?php 
    _e('Thumbnail', 'flag');
    ?>
</th>
		<th class="title_filename" scope="col"><?php 
    _e('Filename / Title', 'flag');
    ?>
</th>
		<th class="description" scope="col"><?php 
    _e('Description', 'flag');
    ?>
</th>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $counter = 0;
    if (count($items_a)) {
        $alt = ' class="alternate"';
        $flag_options = get_option('flag_options');
        $uploads = wp_upload_dir();
        foreach ($items_a as $item) {
            $mp3 = get_post($item);
            $thumb = $mp3thumb = get_post_meta($item, 'thumbnail', true);
            if (empty($thumb)) {
                $thumb = site_url() . '/wp-includes/images/crystal/audio.png';
                $mp3thumb = '';
            }
            $alt = empty($alt) ? ' class="alternate"' : '';
            $alt2 = empty($alt) ? '' : ' alternate';
            $url = wp_get_attachment_url($mp3->ID);
            $counter++;
            ?>
		<tr id="mp3-<?php 
            echo $mp3->ID;
            ?>
"<?php 
            echo $alt;
            ?>
 valign="top">
			<th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox" value="<?php 
            echo $mp3->ID;
            ?>
" /></th>
			<td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php 
            echo $mp3->ID;
            ?>
</p></td>
			<td class="size" style="padding-bottom: 0; border-bottom: none;"><?php 
            $path = $uploads['basedir'] . str_replace($uploads['baseurl'], '', $url);
            $size = filesize($path);
            echo round($size / 1024 / 1024, 2) . ' Mb';
            ?>
</td>
			<td class="thumb" rowspan="2">
				<div style="width: 100px; height: 100px;"><img id="thumb-<?php 
            echo $mp3->ID;
            ?>
" src="<?php 
            echo esc_url($thumb);
            ?>
" style="height:auto; width:auto; max-height:100px; max-width:100px;" alt="" /></div>
			</td>
			<td class="title_filename" rowspan="2">
				<strong><a href="<?php 
            echo $url;
            ?>
"><?php 
            echo basename($url);
            ?>
</a></strong><br />
				<textarea title="Title" name="item_a[<?php 
            echo $mp3->ID;
            ?>
][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php 
            echo esc_html(stripslashes($mp3->post_title));
            ?>
</textarea><br />
				<p><?php 
            _e('Thumb URL:', 'flag');
            ?>
 <input id="mp3thumb-<?php 
            echo $mp3->ID;
            ?>
" name="item_a[<?php 
            echo $mp3->ID;
            ?>
][post_thumb]" type="text" value="<?php 
            echo esc_url($mp3thumb);
            ?>
" /> <a class="thickbox" onclick="actInp=<?php 
            echo $mp3->ID;
            ?>
" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php 
            _e('Add an Image', 'flag');
            ?>
"><?php 
            _e('assist', 'flag');
            ?>
</a></p>
			</td>
			<td class="description" rowspan="2">
				<textarea name="item_a[<?php 
            echo $mp3->ID;
            ?>
][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1" ><?php 
            echo esc_html(stripslashes($mp3->post_content));
            ?>
</textarea>
			</td>
		</tr>
        <tr class="mp3-<?php 
            echo $mp3->ID . $alt2;
            ?>
">
            <td valign="top" class="player" colspan="3"><script type="text/javascript">swfobject.embedSWF("<?php 
            echo FLAG_URLPATH;
            ?>
lib/mini.swf", "c-<?php 
            echo $mp3->ID;
            ?>
", "250", "20", "10.1.52", "expressInstall.swf", {path:"<?php 
            echo str_replace(array('.mp3'), array(''), $url);
            ?>
",bgcolor:"<?php 
            echo $flag_options['mpBG'];
            ?>
",color1:"<?php 
            echo $flag_options['mpColor1'];
            ?>
",color2:"<?php 
            echo $flag_options['mpColor2'];
            ?>
"}, {wmode:"transparent"}, {id:"f-<?php 
            echo $mp3->ID;
            ?>
",name:"f-<?php 
            echo $mp3->ID;
            ?>
"});</script>
<div class="play" style="padding-left: 4px;"><span id="c-<?php 
            echo $mp3->ID;
            ?>
"></span></div></td>
        </tr>
		<?php 
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="5" align="center"><strong>' . __('No entries found', 'flag') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit" style="text-align: right;"><input type="submit" class="button-primary action" name="updatePlaylist" value="<?php 
    _e("Update Playlist", 'flag');
    ?>
" /></p>
	</form>	
	<form id="form_listitems" name="form_listitems" method="POST" action="<?php 
    echo esc_url($filepath . "&playlist=" . sanitize_flagname($_GET['playlist']) . "&mode=add");
    ?>
">
		<?php 
    wp_nonce_field('flag_add');
    ?>
		<input type="hidden" name="items" value="<?php 
    echo $items;
    ?>
" />
	</form>
	<br class="clear"/>
	</div><!-- /#wrap -->
	<?php 
}
Exemple #4
0
function flag_banner_wp_media_lib($added = false)
{
    global $wpdb;
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    if ($added !== false) {
        $added = preg_replace('/[^\\d,]+/', '', $added);
        $filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
        $flag_options = get_option('flag_options');
        $playlistPath = $flag_options['galleryPath'] . 'playlists/banner/' . sanitize_flagname($_GET['playlist']) . '.xml';
        $playlist = get_b_playlist_data(ABSPATH . $playlistPath);
        $exclude = explode(',', $added);
        $exclude = array_filter($exclude, 'intval');
    } else {
        $items_array_default = isset($_COOKIE['bannerboxplaylist_default']) ? preg_replace('/[^\\d,]+/', '', $_COOKIE['bannerboxplaylist_default']) : '';
        $exclude = explode(',', $items_array_default);
        $exclude = array_filter($exclude, 'intval');
    }
    if (isset($_GET['playlist'])) {
        $playlist_cookie = sanitize_flagname($_GET['playlist']);
    } else {
        $playlist_cookie = 'default';
    }
    $filepath = esc_url($filepath);
    ?>
	<script type="text/javascript">
		<!--
		jQuery(document).ready(function(){
			var storedData = getStorage('bannerboxplaylist_');
			<?php 
    if (isset($_POST['items'])) {
        ?>
			storedData.set('<?php 
        echo $playlist_cookie;
        ?>
', '<?php 
        echo preg_replace('/[^\\d,]+/', '', $_POST['items']);
        ?>
');
			<?php 
    }
    ?>
			jQuery('.cb :checkbox').click(function(){
				var cur, arr, del;
				if(jQuery(this).is(':checked')){
					cur = jQuery(this).val();
					arr = jQuery('#items_array').val();
					if(arr){ del = ','; } else{ del = ''; }
					jQuery('#items_array').val(arr + del + cur);
					jQuery(this).closest('tr').addClass('already-added');
				} else{
					cur = jQuery(this).val();
					arr = jQuery('#items_array').val().split(',');
					arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
					jQuery('#items_array').val(arr);
					jQuery(this).closest('tr').removeClass('already-added');
				}
				storedData.set('<?php 
    echo $playlist_cookie;
    ?>
', jQuery('#items_array').val());
			});
			jQuery('.clear_selected').click(function(){
				jQuery('#items_array').val('');
				jQuery('.cb :checkbox').each(function(){
					jQuery(this).prop('checked', false).closest('tr').removeClass('already-added');
				});
				storedData.set('<?php 
    echo $playlist_cookie;
    ?>
', jQuery('#items_array').val());
			});
		});
		function getStorage(key_prefix){
			return {
				set: function(id, data){
					document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
				},
				get: function(id, data){
					var cookies = document.cookie, parsed = {};
					cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value){
						parsed[key] = decodeURIComponent(value);
					});
					return parsed[key_prefix + id];
				}
			};
		}

		function checkAll(form){
			for(i = 0, n = form.elements.length; i < n; i++){
				if(form.elements[i].type == "checkbox"){
					if(form.elements[i].name == "doaction[]"){
						if(form.elements[i].checked == true){
							form.elements[i].checked = false;
						} else{
							form.elements[i].checked = true;
						}
						jQuery(form.elements[i]).closest('tr').toggleClass('already-added');
					}
				}
			}
			var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
			jQuery('#items_array').val(arr);
		}
		// this function check for a the number of selected images, sumbmit false when no one selected
		function checkSelected(){
			if(!jQuery('#items_array').val()){
				alert('<?php 
    echo esc_js(__("No items selected", "flag"));
    ?>
');
				return false;
			}
			var actionId = jQuery('#bulkaction').val();
			switch(actionId){
				case "new_playlist":
					showDialog('new_playlist', 160);
					return false;
					break;
			}
		}

		function showDialog(windowId, height){
			jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
			jQuery("#" + windowId + "_banid").val(jQuery('#items_array').val());
			tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
		}
		//-->
	</script>
	<div class="flag-wrap">
		<?php 
    if ($added === false) {
        ?>
			<?php 
        if (current_user_can('FlAG Import folder')) {
            $defaultpath = basename(WP_CONTENT_DIR) . '/';
            ?>
				<link rel="stylesheet" type="text/css" href="<?php 
            echo FLAG_URLPATH;
            ?>
admin/js/jqueryFileTree/jqueryFileTree.css"/>
				<script type="text/javascript" src="<?php 
            echo FLAG_URLPATH;
            ?>
admin/js/jqueryFileTree/jqueryFileTree.js"></script>
				<script type="text/javascript">
					/* <![CDATA[ */
					jQuery(function(){
						jQuery("span.browsefiles").show().click(function(){
							jQuery("#file_browser").fileTree({
								script: "admin-ajax.php?action=flag_file_browser&nonce=<?php 
            echo wp_create_nonce('flag-ajax');
            ?>
",
								root: jQuery("#bannerfolder").val()
							}, function(file){
								//var path = file.replace("<?php 
            echo WINABSPATH;
            ?>
", "");
								jQuery("#bannerfolder").val(file);
							});

							jQuery("#file_browser").show("slide");
						});
					});
					/* ]]> */
				</script>

				<!-- import folder -->
				<div id="importfolder">
					<h2><?php 
            _e('Import banners from folder', 'flag');
            ?>
</h2>

					<form name="importfolder" id="importfolder_form" method="POST" action="<?php 
            echo $filepath;
            ?>
" accept-charset="utf-8">
						<?php 
            wp_nonce_field('flag_addbanner');
            ?>
						<table class="form-table">
							<tr valign="top">
								<th scope="row"><?php 
            _e('Import from Server path:', 'flag');
            ?>
</th>
								<td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php 
            echo $defaultpath;
            ?>
"/><span class="browsefiles button" style="display:none"><?php 
            _e('Browse...', "flag");
            ?>
</span>

									<div id="file_browser"></div>
									<br/>
									<p><label><input type="checkbox" name="delete_files" value="delete"/> &nbsp;
											<?php 
            _e('delete files after import in WordPress Media Library', 'flag');
            ?>
</label></p>
								</td>
							</tr>
						</table>
						<div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php 
            _e('Import folder', 'flag');
            ?>
"/></div>
					</form>
				</div>
			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<h2><?php 
    _e('WordPress Image Library', 'flag');
    ?>
</h2>

		<?php 
    // look for pagination
    if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
        $_GET['paged'] = 1;
    }
    $_GET['paged'] = intval($_GET['paged']);
    $objects_per_page = 25;
    $start = ($_GET['paged'] - 1) * $objects_per_page;
    $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE `post_mime_type` LIKE 'image/%' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
    $bannerlist = get_posts($args = array('numberposts' => $objects_per_page, 'offset' => $start, 'orderby' => 'ID', 'order' => 'DESC', 'post_type' => 'attachment', 'post_mime_type' => array('image')));
    // build pagination
    $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => ceil($img_total_count / $objects_per_page), 'current' => intval($_GET['paged']), 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))));
    ?>
		<div class="tablenav" style="overflow: hidden; height: auto;">
			<?php 
    if ($added === false) {
        ?>
				<div class="alignleft"><b><?php 
        _e('Selected Media', 'flag');
        ?>
: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php 
        echo $items_array_default;
        ?>
"/>
					<span class="clear_selected button"><?php 
        _e('Clear Selected', 'flag');
        ?>
</span></div>
			<?php 
    }
    ?>
			<div class="tablenav-pages"><?php 
    $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $objects_per_page + 1), number_format_i18n(min($_GET['paged'] * $objects_per_page, $img_total_count)), number_format_i18n($img_total_count), $page_links);
    echo $page_links_text;
    ?>
</div>
		</div>
		<form id="bannerlib" class="flagform" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
			<?php 
    wp_nonce_field('flag_update');
    ?>
			<input type="hidden" name="page" value="banner-box"/>

			<div class="tablenav">

				<div class="actions">
					<?php 
    if ($added === false) {
        ?>
						<input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php 
        _e('Update Media', 'flag');
        ?>
"/>
						<?php 
        if (function_exists('json_encode')) {
            ?>
							<select name="bulkaction" id="bulkaction">
								<option value="no_action"><?php 
            _e("No action", 'flag');
            ?>
</option>
								<option value="new_playlist"><?php 
            _e("Create new playlist", 'flag');
            ?>
</option>
							</select>
							<input name="showThickbox" class="button-secondary" type="submit" value="<?php 
            _e('Apply', 'flag');
            ?>
" onclick="if ( !checkSelected() ) {return false;
}"/>
						<?php 
        }
        ?>
						<a href="<?php 
        echo admin_url('media-new.php');
        ?>
" class="button"><?php 
        _e('Upload Banner(s)', 'flag');
        ?>
</a>
						<input type="hidden" id="items_array" name="items_array" value=""/>
					<?php 
    } else {
        ?>
						<input type="hidden" name="mode" value="save"/>
						<input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php 
        echo $added;
        ?>
"/>
						<input type="hidden" name="playlist_title" value="<?php 
        echo esc_html($playlist['title']);
        ?>
"/>
						<input type="hidden" name="skinname" value="<?php 
        echo sanitize_flagname($playlist['skin']);
        ?>
"/>
						<input type="hidden" name="skinaction" value="<?php 
        echo sanitize_flagname($playlist['skin']);
        ?>
"/>
						<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php 
        echo esc_html($playlist['description']);
        ?>
</textarea>
						<input name="addToPlaylist" class="button-secondary" type="submit" value="<?php 
        _e('Update Playlist', 'flag');
        ?>
"/>
					<?php 
    }
    ?>
				</div>

			</div>
			<table class="widefat flag-table" cellspacing="0">
				<thead>
				<tr>
					<th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
					<th class="id" width="64" scope="col">
						<div><?php 
    _e('ID', 'flag');
    ?>
</div>
					</th>
					<th class="thumb" width="110" scope="col">
						<div><?php 
    _e('Thumbnail', 'flag');
    ?>
</div>
					</th>
					<th class="title_filename" scope="col">
						<div><?php 
    _e('Filename / Title / Link', 'flag');
    ?>
</div>
					</th>
					<th class="description" scope="col">
						<div><?php 
    _e('Description', 'flag');
    ?>
</div>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
					<th class="id" scope="col"><?php 
    _e('ID', 'flag');
    ?>
</th>
					<th class="thumb" scope="col"><?php 
    _e('Thumbnail', 'flag');
    ?>
</th>
					<th class="title_filename" scope="col"><?php 
    _e('Filename / Title / Link', 'flag');
    ?>
</th>
					<th class="description" scope="col"><?php 
    _e('Description', 'flag');
    ?>
</th>
				</tr>
				</tfoot>
				<tbody>
				<?php 
    $uploads = wp_upload_dir();
    $flag_options = get_option('flag_options');
    if ($bannerlist) {
        foreach ($bannerlist as $ban) {
            $list[] = $ban->ID;
        }
        $class = 'alternate';
        foreach ($bannerlist as $ban) {
            $class = empty($class) ? 'alternate' : '';
            $ex = $checked = '';
            if (($added !== false || !empty($items_array_default)) && in_array($ban->ID, $exclude)) {
                $class .= ' already-added';
                $ex = ' title="' . __("Already Added", "flag") . '"';
                $checked = ' checked="checked"';
            }
            $thumb = get_post_meta($ban->ID, 'thumbnail', true);
            $link = get_post_meta($ban->ID, 'link', true);
            if (empty($thumb)) {
                $thumb = wp_get_attachment_thumb_url($ban->ID);
            }
            $url = wp_get_attachment_url($ban->ID);
            ?>
						<tr id="ban-<?php 
            echo $ban->ID;
            ?>
" class="<?php 
            echo $class;
            ?>
"<?php 
            echo $ex;
            ?>
>
							<td class="cb"><input name="doaction[]" type="checkbox"<?php 
            echo $checked;
            ?>
 value="<?php 
            echo $ban->ID;
            ?>
"/></td>
							<td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php 
            echo $ban->ID;
            ?>
</p></td>
							<td class="thumb">
								<a class="thickbox" title="<?php 
            echo basename($url);
            ?>
" href="<?php 
            echo $url;
            ?>
"><img id="thumb-<?php 
            echo $ban->ID;
            ?>
" src="<?php 
            echo $thumb;
            ?>
" width="100" height="100" alt=""/></a>
							</td>
							<td class="title_filename">
								<strong><a href="<?php 
            echo $url;
            ?>
"><?php 
            echo basename($url);
            ?>
</a></strong><br/>
								<textarea title="Title" name="item_a[<?php 
            echo $ban->ID;
            ?>
][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php 
            echo esc_html(stripslashes($ban->post_title));
            ?>
</textarea><br/>
								<?php 
            _e('URL', 'flag');
            ?>
: <input id="banlink-<?php 
            echo $ban->ID;
            ?>
" name="item_a[<?php 
            echo $ban->ID;
            ?>
][link]" style="width:50%;" type="text" value="<?php 
            echo esc_url($link);
            ?>
"/><br/>
							</td>
							<td class="description">
								<textarea name="item_a[<?php 
            echo $ban->ID;
            ?>
][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php 
            echo esc_html(stripslashes($ban->post_content));
            ?>
</textarea>
							</td>
						</tr>
					<?php 
        }
    } else {
        echo '<tr><td colspan="5" align="center"><strong>' . __('No images in WordPress Media Library.', 'flag') . '</strong></td></tr>';
    }
    ?>
				</tbody>
			</table>
		</form>
	</div>

	<!-- #new_playlist -->
	<div id="new_playlist" style="display: none;">
		<form id="form_new_playlist" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
			<?php 
    wp_nonce_field('flag_update');
    ?>
			<input type="hidden" id="new_playlist_banid" name="items_array" value=""/>
			<input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
			<input type="hidden" name="mode" value="save"/>
			<input type="hidden" name="page" value="banner-box"/>
			<table width="100%" border="0" cellspacing="3" cellpadding="3">
				<tr valign="top">
					<th align="left" style="padding-top: 5px;"><?php 
    _e('Playlist Title', 'flag');
    ?>
</th>
					<td><input type="text" class="alignleft" name="playlist_title" value=""/>

						<div class="alignright"><strong><?php 
    _e("Choose skin", 'flag');
    ?>
:</strong>
							<select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
								<?php 
    require_once dirname(__FILE__) . '/get_skin.php';
    $all_skins = get_skins($skin_folder = '', $type = 'b');
    if (count($all_skins)) {
        foreach ((array) $all_skins as $skin_file => $skin_data) {
            echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
        }
    } else {
        echo '<option value="rotator_default">' . __("No Skins", "flag") . '</option>';
    }
    ?>
							</select>
						</div>
					</td>
				</tr>
				<tr valign="top">
					<th align="left" style="padding-top: 5px;"><?php 
    _e('Playlist Description', 'flag');
    ?>
</th>
					<td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flag');
    ?>
&nbsp;" onclick="tb_remove()"/>
						&nbsp; &nbsp; &nbsp;
						<input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php 
    _e('OK', 'flag');
    ?>
"/>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<!-- /#new_playlist -->
<?php 
}
Exemple #5
0
function flag_playlist_delete($playlist)
{
    $playlist = sanitize_flagname($playlist);
    $flag_options = get_option('flag_options');
    $playlistXML = ABSPATH . $flag_options['galleryPath'] . 'playlists/' . $playlist . '.xml';
    if (file_exists($playlistXML)) {
        if (unlink($playlistXML)) {
            flagGallery::show_message("'" . $playlist . ".xml' " . __('deleted', 'flag'));
        }
    }
}
Exemple #6
0
function flag_video_wp_media_lib($added = false)
{
    global $wpdb;
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    if ($added !== false) {
        $added = preg_replace('/[^\\d,]+/', '', $added);
        $filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
        $flag_options = get_option('flag_options');
        $playlistPath = $flag_options['galleryPath'] . 'playlists/video/' . sanitize_flagname($_GET['playlist']) . '.xml';
        $playlist = get_v_playlist_data(ABSPATH . $playlistPath);
        $exclude = explode(',', $added);
        $exclude = array_filter($exclude, 'intval');
    }
    $filepath = esc_url($filepath);
    ?>

<script type="text/javascript"> 
<!--
jQuery(document).ready(function(){
    jQuery('.cb :checkbox').click(function() {
		var cur, arr, del;
		if(jQuery(this).is(':checked')){
			cur = jQuery(this).val();
			arr = jQuery('#items_array').val();
			if(arr) { del = ','; } else { del = ''; }
			jQuery('#items_array').val(arr+del+cur);
			jQuery(this).closest('tr').css('background-color','#DDFFBB').next().css('background-color','#DDFFBB');
		} else {
			cur = jQuery(this).val();
			arr = jQuery('#items_array').val().split(',');
			arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
			jQuery('#items_array').val(arr);
			jQuery(this).closest('tr').removeAttr('style').next().removeAttr('style');
		}
 	});
    jQuery('.del_thumb').click(function(){
      var id = jQuery(this).attr('data-id');
      jQuery('#flvthumb-'+id).attr('value', '');
      jQuery('#thumb-'+id).attr('src', '<?php 
    echo site_url() . "/wp-includes/images/crystal/video.png";
    ?>
');
      return false;
    })
});
function checkAll(form)	{
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]") {
				if(form.elements[i].checked == true)
					form.elements[i].checked = false;
				else
					form.elements[i].checked = true;
			}
		}
	}
	var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
	jQuery('#items_array').val(arr);
}
// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {
	if(!jQuery('.cb input:checked')) { 
		alert('<?php 
    echo esc_js(__('No items selected', 'flag'));
    ?>
');
		return false; 
	} 
	actionId = jQuery('#bulkaction').val();
	switch (actionId) {
		case "new_playlist":
			showDialog('new_playlist', 160);
			return false;
			break;
	}
}

function showDialog( windowId, height ) {
	jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
	jQuery("#" + windowId + "_flvid").val(jQuery('#items_array').val());
	tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
}
var current_image = '';
function send_to_editor(html) {
	var source = html.match(/src=\".*\" alt/);
	source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
	jQuery('#flvthumb-'+actInp).attr('value', source);
	jQuery('#thumb-'+actInp).attr('src', source);
	tb_remove();
}
//-->
</script>
	<div class="wrap">
<?php 
    if ($added === false) {
        ?>

<?php 
        if (current_user_can('FlAG Import folder')) {
            $defaultpath = basename(WP_CONTENT_DIR) . '/';
            ?>

<link rel="stylesheet" type="text/css" href="<?php 
            echo FLAG_URLPATH;
            ?>
admin/js/jqueryFileTree/jqueryFileTree.css" />
<script type="text/javascript" src="<?php 
            echo FLAG_URLPATH;
            ?>
admin/js/jqueryFileTree/jqueryFileTree.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
	  jQuery(function() {
	    jQuery("span.browsefiles").show().click(function(){
		    jQuery("#file_browser").fileTree({
		      script: "admin-ajax.php?action=flag_file_browser&nonce=<?php 
            echo wp_create_nonce('flag-ajax');
            ?>
",
		      root: jQuery("#videofolder").val()
		    }, function(file) {
		        //var path = file.replace("<?php 
            echo WINABSPATH;
            ?>
", "");
		        jQuery("#videofolder").val(file);
		    });

	    	jQuery("#file_browser").show("slide");
	    });
	  });
/* ]]> */
</script>

		<!-- import folder -->
		<div id="importfolder">
		<h2><?php 
            _e('Import video from folder', 'flag');
            ?>
</h2>
			<form name="importfolder" id="importfolder_form" method="POST" action="<?php 
            echo $filepath;
            ?>
" accept-charset="utf-8" >
			<?php 
            wp_nonce_field('flag_addvideo');
            ?>

				<table class="form-table"> 
				<tr valign="top"> 
					<th scope="row"><?php 
            _e('Import from Server path:', 'flag');
            ?>
</th> 
					<td><input type="text" size="35" id="videofolder" name="videofolder" value="<?php 
            echo $defaultpath;
            ?>
" /><span class="browsefiles button" style="display:none"><?php 
            _e('Browse...', "flag");
            ?>
</span>
						<div id="file_browser"></div><br />
						<p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
						<?php 
            _e('delete files after import in WordPress Media Library', 'flag');
            ?>
</label></p>
					</td> 
				</tr>
				</table>
				<div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php 
            _e('Import folder', 'flag');
            ?>
"/></div>
			</form>
		</div>
<?php 
        }
        ?>

<?php 
    }
    ?>


		<h2><?php 
    _e('WordPress Video Library', 'flag');
    ?>
</h2>
		<form id="videolib" class="flagform" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_update');
    ?>

		<input type="hidden" name="page" value="video-box" />
		
		<div class="tablenav">
			
			<div class="actions">
<?php 
    if ($added === false) {
        ?>

				<input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php 
        _e('Update Media', 'flag');
        ?>
" />
				<?php 
        if (function_exists('json_encode')) {
            ?>

				<select name="bulkaction" id="bulkaction">
					<option value="no_action" ><?php 
            _e("No action", 'flag');
            ?>
</option>
					<option value="new_playlist" ><?php 
            _e("Create new playlist", 'flag');
            ?>
</option>
				</select>
				<input name="showThickbox" class="button-secondary" type="submit" value="<?php 
            _e('Apply', 'flag');
            ?>
" onclick="if ( !checkSelected() ) return false;" />
				<?php 
        }
        ?>

                <a href="<?php 
        echo admin_url('media-new.php');
        ?>
" class="button"><?php 
        _e('Upload Video', 'flag');
        ?>
</a>
				<input type="hidden" id="items_array" name="items_array" value="" />
<?php 
    } else {
        ?>

				<input type="hidden" name="mode" value="save" />
				<input style="width: 80%;" type="text" id="items_array" name="items_array" value="<?php 
        echo $added;
        ?>
" />
				<input type="hidden" name="playlist_title" value="<?php 
        echo esc_html($playlist['title']);
        ?>
" />
				<input type="hidden" name="skinname" value="<?php 
        echo sanitize_flagname($playlist['skin']);
        ?>
" />
				<input type="hidden" name="skinaction" value="<?php 
        echo sanitize_flagname($playlist['skin']);
        ?>
" />
				<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php 
        echo esc_html($playlist['description']);
        ?>
</textarea>
				<input name="addToPlaylist" class="button-secondary" type="submit" value="<?php 
        _e('Update Playlist', 'flag');
        ?>
" />
<?php 
    }
    ?>

			</div>
			
		</div>
		<table class="widefat" cellspacing="0">
			<thead>
			<tr>
        		<th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
        		<th class="id" width="134" scope="col"><div><?php 
    _e('ID', 'flag');
    ?>
</div></th>
        		<th class="size" width="75" scope="col"><div><?php 
    _e('Size', 'flag');
    ?>
</div></th>
        		<th class="thumb" width="110" scope="col"><div><?php 
    _e('Thumbnail', 'flag');
    ?>
</div></th>
        		<th class="title_filename" scope="col"><div><?php 
    _e('Filename / Title', 'flag');
    ?>
</div></th>
        		<th class="description" scope="col"><div><?php 
    _e('Description', 'flag');
    ?>
</div></th>
			</tr>
			</thead>
			<tfoot>
			<tr>
        		<th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php 
    _e('Check', 'flag');
    ?>
</a></th>
        		<th class="id" scope="col"><?php 
    _e('ID', 'flag');
    ?>
</th>
        		<th class="size" scope="col"><?php 
    _e('Size', 'flag');
    ?>
</th>
        		<th class="thumb" scope="col"><?php 
    _e('Thumbnail', 'flag');
    ?>
</th>
        		<th class="title_filename" scope="col"><?php 
    _e('Filename / Title', 'flag');
    ?>
</th>
        		<th class="description" scope="col"><?php 
    _e('Description', 'flag');
    ?>
</th>
			</tr>
			</tfoot>
			<tbody>
<?php 
    $videolist = get_posts($args = array('numberposts' => -1, 'orderby' => 'ID', 'order' => 'DESC', 'post_type' => 'attachment', 'post_mime_type' => array('video/x-flv')));
    $uploads = wp_upload_dir();
    $flag_options = get_option('flag_options');
    if ($videolist) {
        //echo '<pre>';print_r($videolist); echo '</pre>';
        foreach ($videolist as $flv) {
            $list[] = $flv->ID;
        }
        $class = ' class="alternate"';
        foreach ($videolist as $flv) {
            $class = empty($class) ? ' class="alternate"' : '';
            $class2 = empty($class) ? '' : ' alternate';
            $ex = $checked = '';
            if ($added !== false && in_array($flv->ID, $exclude)) {
                $ex = ' style="background-color:#DDFFBB;" title="' . __("Already Added", "flag") . '"';
                $checked = ' checked="checked"';
            }
            $bg = !isset($class) || $class == 'class="alternate"' ? 'f9f9f9' : 'ffffff';
            $thumb = $flvthumb = get_post_meta($flv->ID, 'thumbnail', true);
            if (empty($thumb)) {
                $thumb = site_url() . '/wp-includes/images/crystal/video.png';
                $flvthumb = '';
            }
            $url = wp_get_attachment_url($flv->ID);
            ?>

		<tr id="flv-<?php 
            echo $flv->ID;
            ?>
"<?php 
            echo $class . $ex;
            ?>
>
			<th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox"<?php 
            echo $checked;
            ?>
 value="<?php 
            echo $flv->ID;
            ?>
" /></th>
			<td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php 
            echo $flv->ID;
            ?>
</p></td>
			<td class="size" style="padding-bottom: 0; border-bottom: none;"><?php 
            $path = $uploads['basedir'] . str_replace($uploads['baseurl'], '', $url);
            $size = filesize($path);
            if ($size) {
                echo round($size / 1024 / 1024, 2) . ' Mb';
            } else {
                _e("Can't read file size. Perhaps file is broken.", 'flag');
            }
            ?>
</td>
			<td class="thumb" rowspan="2">
				<a class="thickbox" title="<?php 
            echo basename($url);
            ?>
" href="<?php 
            echo FLAG_URLPATH;
            ?>
admin/flv_preview.php?vid=<?php 
            echo $flv->ID;
            ?>
&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php 
            echo $flv->ID;
            ?>
" src="<?php 
            echo esc_url($thumb);
            ?>
" width="100" height="100" alt="" /></a>
			</td>
			<td class="title_filename" rowspan="2">
				<strong><a href="<?php 
            echo $url;
            ?>
"><?php 
            echo basename($url);
            ?>
</a></strong><br />
				<textarea title="Title" name="item_a[<?php 
            echo $flv->ID;
            ?>
][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php 
            echo esc_html(stripslashes($flv->post_title));
            ?>
</textarea><br />
				<p><?php 
            _e('Thumb URL:', 'flag');
            ?>
 <input id="flvthumb-<?php 
            echo $flv->ID;
            ?>
" name="item_a[<?php 
            echo $flv->ID;
            ?>
][post_thumb]" type="text" value="<?php 
            echo esc_url($flvthumb);
            ?>
" /> <a class="thickbox" onclick="actInp=<?php 
            echo $flv->ID;
            ?>
" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php 
            _e('Add an Image', 'flag');
            ?>
"><?php 
            _e('assist', 'flag');
            ?>
</a></p>
			</td>
			<td class="description" rowspan="2">
				<textarea name="item_a[<?php 
            echo $flv->ID;
            ?>
][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1" ><?php 
            echo esc_html(stripslashes($flv->post_content));
            ?>
</textarea>
			</td>
		</tr>
        <tr class="flv-<?php 
            echo $flv->ID . $class2;
            ?>
"<?php 
            echo $ex;
            ?>
>
            <td valign="top" class="player" colspan="3"><p style="padding: 7px 3px;">Shortcode:<br /><input type="text" style="width: 240px; font-size: 9px;" class="shortcode1" readonly="readonly" onfocus="this.select()" value="[grandflv id=<?php 
            echo $flv->ID;
            ?>
 w=<?php 
            echo $flag_options['vmWidth'];
            ?>
 h=<?php 
            echo $flag_options['vmHeight'];
            ?>
 autoplay=<?php 
            echo $flag_options['vmAutoplay'];
            ?>
]" /></p></td>
        </tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="6" align="center"><strong>' . __('No video in WordPress Media Library.', 'flag') . '</strong></td></tr>';
    }
    ?>
			
			</tbody>
		</table>
		</form>
	</div>

	<!-- #new_playlist -->
	<div id="new_playlist" style="display: none;" >
		<form id="form_new_playlist" method="POST" action="<?php 
    echo $filepath;
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_update');
    ?>

		<input type="hidden" id="new_playlist_flvid" name="items_array" value="" />
		<input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="mode" value="save" />
		<input type="hidden" name="page" value="video-box" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left" style="padding-top: 5px;"><?php 
    _e('Playlist Title', 'flag');
    ?>
</th>
				<td><input type="text" class="alignleft" name="playlist_title" value="" />
                    <div class="alignright"><strong><?php 
    _e("Choose skin", 'flag');
    ?>
:</strong>
                        <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
                          <?php 
    require_once dirname(__FILE__) . '/get_skin.php';
    $all_skins = get_skins($skin_folder = '', $type = 'v');
    if (count($all_skins)) {
        foreach ((array) $all_skins as $skin_file => $skin_data) {
            echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
        }
    } else {
        echo '<option value="video_default">' . __("No Skins", "flag") . '</option>';
    }
    ?>

                        </select>
                    </div>
                </td>
			</tr>
			<tr valign="top">
				<th align="left" style="padding-top: 5px;"><?php 
    _e('Playlist Description', 'flag');
    ?>
</th>
				<td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
			</tr>
		  	<tr>
				<td>&nbsp;</td>
		    	<td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flag');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    		&nbsp; &nbsp; &nbsp;
                    <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php 
    _e('OK', 'flag');
    ?>
" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_playlist -->	
<?php 
}
Exemple #7
0
        echo flagShowVPlayer($file, $width, $height, $wmode = 'opaque');
    } else {
        _e("Can't find playlist");
    }
}
?>

<?php 
if (isset($_GET['mv'])) {
    $height = isset($_GET['h']) ? intval($_GET['h']) : '';
    $width = '100%';
    $mv = intval($_GET['mv']);
    echo flagShowVmPlayer($mv, $width, $height, $autoplay = 'true');
}
?>

<?php 
if (isset($_GET['b'])) {
    $file = sanitize_flagname($_GET['b']);
    $playlistpath = $flag_options['galleryPath'] . 'playlists/banner/' . $file . '.xml';
    if (file_exists($playlistpath)) {
        echo flagShowBanner($file, $width = '', $height = '', $wmode = 'opaque');
    } else {
        _e("Can't find playlist");
    }
}
?>

</div>
</body>
</html>
Exemple #8
0
 /**
  * create a new gallery & folder
  *
  * @class flagAdmin
  * @param string $gallery
  * @param string $defaultpath
  * @param bool $output if the function should show an error messsage or not
  * @return bool|int
  */
 static function create_gallery($gallery, $defaultpath, $output = true)
 {
     global $wpdb, $user_ID;
     // get the current user ID
     get_currentuserinfo();
     $description = '';
     $status = 0;
     if (is_array($gallery)) {
         $gallerytitle = $gallery['title'];
         $description = $gallery['description'];
         $status = intval($gallery['status']);
     } else {
         $gallerytitle = $gallery;
     }
     //cleanup pathname
     $galleryname = sanitize_flagname($gallerytitle);
     $galleryname = apply_filters('flag_gallery_name', $galleryname);
     $galleryname = preg_replace('/[^\\w\\._-]+/', '', $galleryname);
     if (!$galleryname) {
         $galleryname = date('y-m-j_h-i-s');
     }
     $flagpath = $defaultpath . $galleryname;
     $flagRoot = WINABSPATH . $defaultpath;
     $txt = '';
     // No gallery name ?
     if (empty($galleryname)) {
         if ($output) {
             flagGallery::show_error(__('No valid gallery name!', 'flag'));
         }
         return false;
     }
     // check for main folder
     if (!is_dir($flagRoot)) {
         if (!wp_mkdir_p($flagRoot)) {
             $txt = __('Directory', 'flag') . ' <strong>' . $defaultpath . '</strong> ' . __('didn\'t exist. Please create first the main gallery folder ', 'flag') . '!<br />';
             $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flag') . ' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
             if ($output) {
                 flagGallery::show_error($txt);
             }
             return false;
         }
     }
     // check for permission settings, Safe mode limitations are not taken into account.
     if (!is_writeable($flagRoot)) {
         $txt = __('Directory', 'flag') . ' <strong>' . $defaultpath . '</strong> ' . __('is not writeable !', 'flag') . '<br />';
         $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flag') . ' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
         if ($output) {
             flagGallery::show_error($txt);
         }
         return false;
     }
     // 1. Create new gallery folder
     if (!is_dir(WINABSPATH . $flagpath)) {
         if (!wp_mkdir_p(WINABSPATH . $flagpath)) {
             $txt = __('Unable to create directory ', 'flag') . $flagpath . '!<br />';
         }
     }
     // 2. Check folder permission
     if (!is_writeable(WINABSPATH . $flagpath)) {
         $txt .= __('Directory', 'flag') . ' <strong>' . $flagpath . '</strong> ' . __('is not writeable !', 'flag') . '<br />';
     }
     // 3. Now create "thumbs" folder inside
     if (!is_dir(WINABSPATH . $flagpath . '/thumbs')) {
         if (!wp_mkdir_p(WINABSPATH . $flagpath . '/thumbs')) {
             $txt .= __('Unable to create directory ', 'flag') . ' <strong>' . $flagpath . '/thumbs !</strong>';
         }
     }
     if (SAFE_MODE) {
         $help = __('The server setting Safe-Mode is on !', 'flag');
         $help .= '<br />' . __('If you have problems, please create directory', 'flag') . ' <strong>' . $flagpath . '</strong> ';
         $help .= __('and the thumbnails directory', 'flag') . ' <strong>' . $flagpath . '/thumbs</strong> ' . __('with permission 777 manually !', 'flag');
         if ($output) {
             flagGallery::show_message($help);
         }
     }
     // show an error message
     if (!empty($txt)) {
         if (SAFE_MODE) {
             // for safe_mode , better delete folder, both folder must be created manually
             @rmdir(WINABSPATH . $flagpath . '/thumbs');
             @rmdir(WINABSPATH . $flagpath);
         }
         if ($output) {
             flagGallery::show_error($txt);
         }
         return false;
     }
     $result = $wpdb->get_var($wpdb->prepare("SELECT `name` FROM `{$wpdb->flaggallery}` WHERE `name` = '%s' ", $galleryname));
     if ($result) {
         if ($output) {
             flagGallery::show_error(_n('Gallery', 'Galleries', 1, 'flag') . ' <strong>' . $galleryname . '</strong> ' . __('already exists', 'flag'));
         }
         return true;
     } else {
         $result = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->flaggallery} (name, path, title, galdesc, author, status) VALUES (%s, %s, %s, %s, %s, %d)", $galleryname, $flagpath, $gallerytitle, $description, $user_ID, $status));
         // and give me the new id
         $gallery_id = (int) $wpdb->insert_id;
         // here you can inject a custom function
         do_action('flag_created_new_gallery', $gallery_id);
         if ($result) {
             $message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>', 'flag');
             $message = sprintf($message, esc_html(stripcslashes($gallery)), '[flagallery gid=' . $gallery_id . ']');
             $message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
             $message .= __('Edit gallery', 'flag');
             $message .= '</a>';
             if ($output) {
                 flagGallery::show_message($message);
             }
         }
         // return only the id if defined
         if ($gallery_id) {
             return $gallery_id;
         }
         return true;
     }
 }
Exemple #9
0
<?php

require_once dirname(dirname(__FILE__)) . '/flag-config.php';
if (!is_user_logged_in()) {
    die('-1');
}
// check for correct FlAG capability
if (!current_user_can('FlAG Change skin')) {
    die('-1');
}
$flashPost = file_get_contents("php://input");
// parse properties_skin
$arr = array();
parse_str($flashPost, $arr);
$settingsXML = str_replace("\\", "/", dirname(dirname(dirname(__FILE__))) . '/flagallery-skins/' . sanitize_flagname($arr['skin_name']) . '/settings/settings.xml');
if (isset($arr['properties_skin']) && !empty($arr['properties_skin'])) {
    $fp = fopen($settingsXML, "r");
    if (!$fp) {
        exit("2");
        //Failure - not read;
    }
    $mainXML = '';
    while (!feof($fp)) {
        $mainXML .= fgetc($fp);
    }
    $fp = fopen($settingsXML, "w");
    if (!$fp) {
        exit("0");
    }
    //Failure
    $arr['properties_skin'] = str_replace(array('=', '?', '"', '$'), '', $arr['properties_skin']);
function flagShowWidgetBanner($xml, $width, $height, $skin)
{
    require_once dirname(__FILE__) . '/class.swfobject.php';
    require_once dirname(dirname(__FILE__)) . '/admin/banner.functions.php';
    $flag_options = get_option('flag_options');
    $galleryPath = trim($flag_options['galleryPath'], '/');
    $xml = sanitize_flagname($xml);
    $playlistPath = $galleryPath . '/playlists/banner/' . $xml . '.xml';
    $playlist_data = get_b_playlist_data(ABSPATH . $playlistPath);
    if (!$skin) {
        $skin = $playlist_data['skin'];
    }
    $skin = sanitize_flagname($skin);
    $items = $playlist_data['items'];
    $skinpath = str_replace("\\", "/", WP_PLUGIN_DIR) . '/flagallery-skins/' . $skin;
    include_once $skinpath . '/' . $skin . '.php';
    if (isset($flag_options['license_key'])) {
        $lkey = $flag_options['license_key'];
    } else {
        $lkey = '';
    }
    $args = array('xml' => $xml, 'skin' => $skin, 'lkey' => $lkey, 'items' => $items, 'width' => $width, 'height' => $height);
    $out = apply_filters('flagShowWidgetBannerSkin', $args);
    // Replace doubled spaces with single ones (ignored in HTML any way)
    // Remove single and multiline comments, tabs and newline chars
    //$out = preg_replace('@(\s){2,}@', '\1', $out);
    //$out = preg_replace(
    //	'@(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|((?<!:)//.*)|[\t\r\n]@i',
    //	'',
    //	$out
    //);
    return $out;
}
Exemple #11
0
                        flagGallery::show_message(__('Can\'t find skin directory ', 'flash-album-gallery') . ' \'' . $delskin . '\' ' . __('. Try delete it manualy via ftp', 'flash-album-gallery'));
                    }
                }
            } else {
                flagGallery::show_message(__('Can\'t find skin directory ', 'flash-album-gallery') . ' \'' . $delskin . '\' ' . __('. Try delete it manualy via ftp', 'flash-album-gallery'));
            }
        } else {
            flagGallery::show_message(__('You need activate another skin before delete it', 'flash-album-gallery'));
        }
    } else {
        wp_die(__('You do not have sufficient permissions to delete skins of Grand Flagallery.'));
    }
}
if (isset($_GET['skin'])) {
    check_admin_referer('set_default_skin');
    $set_skin = sanitize_flagname($_GET['skin']);
    if ($flag_options['flashSkin'] != $set_skin) {
        $aValid = array('-', '_');
        if (!ctype_alnum(str_replace($aValid, '', $set_skin))) {
            die('try again');
        }
        $active_skin = $flag_options['skinsDirABS'] . $set_skin . '/' . $set_skin . '.php';
        if (!file_exists($active_skin)) {
            die('try again');
        }
        $flag_options['flashSkin'] = $set_skin;
        include_once $active_skin;
        update_option('flag_options', $flag_options);
        flagGallery::show_message(__('Skin', 'flash-album-gallery') . ' \'' . $set_skin . '\' ' . __('activated successfully. Optionally it can be overwritten with shortcode parameter.', 'flash-album-gallery'));
    }
}
Exemple #12
0
 /**
  * Slightly modfifed version of pathinfo(), clean up filename & rename jpeg to jpg
  * 
  * @param string $name The name being checked. 
  * @return array containing information about file
  */
 static function fileinfo($name)
 {
     //Sanitizes a filename replacing whitespace with dashes
     $name = sanitize_flagname($name);
     //get the parts of the name
     $filepart = pathinfo(strtolower($name));
     if (empty($filepart)) {
         return false;
     }
     // required until PHP 5.2.0
     if (empty($filepart['filename'])) {
         $filepart['filename'] = substr($filepart['basename'], 0, strlen($filepart['basename']) - (strlen($filepart['extension']) + 1));
     }
     $filepart['filename'] = sanitize_title_with_dashes($filepart['filename']);
     //extension jpeg will not be recognized by the slideshow, so we rename it
     $filepart['extension'] = $filepart['extension'] == 'jpeg' ? 'jpg' : $filepart['extension'];
     //combine the new file name
     $filepart['basename'] = $filepart['filename'] . '.' . $filepart['extension'];
     return $filepart;
 }
Exemple #13
0
/**
 * @author Sergey Pasyuk
 * @copyright 2009
 */
function flag_v_playlist_order($playlist = 'deprecated')
{
    global $wpdb;
    //this is the url without any presort variable
    $base_url = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    $flag_options = get_option('flag_options');
    $filename = sanitize_flagname($_GET['playlist']);
    $playlistPath = $flag_options['galleryPath'] . 'playlists/video/' . $filename . '.xml';
    $playlist = get_v_playlist_data(ABSPATH . $playlistPath);
    $items_a = $playlist['items'];
    $items = implode(',', $playlist['items']);
    ?>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablednd_0_5.js"></script>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablesorter.js"></script>
<div class="flag-wrap">
			<h2><?php 
    _e('Sort Gallery', 'flag');
    ?>
</h2>

	<div class="alignright tablenav" style="margin-bottom: -36px;">
		<a href="<?php 
    echo esc_url($base_url . "&playlist=" . $filename . '&mode=edit');
    ?>
" class="button-secondary action"><?php 
    _e('Back to playlist', 'flag');
    ?>
</a>
	</div>
	<form id="sortPlaylist" method="POST" action="<?php 
    echo esc_url($base_url . "&playlist=" . $filename . '&mode=edit');
    ?>
" accept-charset="utf-8">
		<div class="alignleft tablenav">
			<?php 
    wp_nonce_field('flag_update');
    ?>
			<input class="button-primary action" type="submit" name="updatePlaylist" value="<?php 
    _e('Update Sort Order', 'flag');
    ?>
" />
		</div>
		<br clear="all" />
		<input type="hidden" name="playlist_title" value="<?php 
    echo esc_html($playlist['title']);
    ?>
" />
		<input type="hidden" name="skinname" value="<?php 
    echo sanitize_flagname($playlist['skin']);
    ?>
" />
		<input type="hidden" name="skinaction" value="<?php 
    echo sanitize_flagname($playlist['skin']);
    ?>
" />
		<textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php 
    echo esc_html($playlist['description']);
    ?>
</textarea>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(document).ready(function($) {
    // Initialise the table
    jQuery("#listitems").tableDnD({
      onDragClass: "myDragClass",
	  	onDrop: function() {
				jQuery("#listitems tr:even").addClass('alternate');
				jQuery("#listitems tr:odd").removeClass('alternate');
      }
    });
		$("#flag-listitems").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }
        } 
    });
		$("#flag-listitems").bind("sortEnd",function() { 
				jQuery("#listitems tr:even").addClass('alternate');
				jQuery("#listitems tr:odd").removeClass('alternate');
    }); 

});
/*]]>*/
</script>
<table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >

	<thead>
	<tr>
			<th class="header" width="54"><p style="margin-right:-10px;"><?php 
    _e('ID', 'flag');
    ?>
</p></th>
			<th width="260"><p><?php 
    _e('Play', 'flag');
    ?>
</p></th>
			<th class="header"><p><?php 
    _e('Filename', 'flag');
    ?>
</p></th>
			<th class="header"><p><?php 
    _e('Title', 'flag');
    ?>
</p></th>
	</tr>
	</thead>
	<tfoot>
	<tr>
			<th><p><?php 
    _e('ID', 'flag');
    ?>
</p></th>
			<th><p><?php 
    _e('Play', 'flag');
    ?>
</p></th>
			<th><p><?php 
    _e('Filename', 'flag');
    ?>
</p></th>
			<th><p><?php 
    _e('Title', 'flag');
    ?>
</p></th>
	</tr>
	</tfoot>
	<tbody id="listitems">
<?php 
    if (count($items_a)) {
        $counter = 0;
        foreach ($items_a as $item) {
            $flv = get_post($item);
            $thumb = get_post_meta($item, 'thumbnail', true);
            if (empty($thumb)) {
                $thumb = site_url() . '/wp-includes/images/crystal/video.png';
            }
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : 'alternate';
            $counter++;
            $bg = !isset($alternate) || $alternate == 'alternate' ? 'f9f9f9' : 'ffffff';
            $url = wp_get_attachment_url($flv->ID);
            ?>
		<tr id="$flv-<?php 
            echo $flv->ID;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
				<td scope="row"><input type="hidden" name="item_a[<?php 
            echo $flv->ID;
            ?>
][ID]" value="<?php 
            echo $flv->ID;
            ?>
" /><strong><?php 
            echo $flv->ID;
            ?>
</strong></td>
				<td width="50"><a class="thickbox" title="<?php 
            echo basename($url);
            ?>
" href="<?php 
            echo FLAG_URLPATH;
            ?>
admin/flv_preview.php?vid=<?php 
            echo $flv->ID;
            ?>
&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php 
            echo $flv->ID;
            ?>
" src="<?php 
            echo esc_url($thumb);
            ?>
" width="20" height="20" alt="" /></a></td>
				<td><?php 
            echo basename($url);
            ?>
</td>
				<td><?php 
            echo esc_html(stripslashes($flv->post_title));
            ?>
</td>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="4" align="center"><strong>' . __('No entries found', 'flag') . '</strong></td></tr>';
    }
    ?>
		</tbody>
	</table>
	<p class="actions"><input type="submit" class="button-primary action"  name="updatePlaylist" value="<?php 
    _e('Update Sort Order', 'flag');
    ?>
" /></p>
</form>	
<br class="clear"/>
</div><!-- /#wrap -->

<?php 
}
Exemple #14
0
<?php

// Create XML output
header("content-type:text/xml;charset=utf-8");
// look up for the path
require_once str_replace("\\", "/", dirname(dirname(__FILE__)) . "/flag-config.php");
/** @var $wpdb wpdb */
global $wpdb;
$siteurl = get_option('siteurl');
// get the gallery id
$gID = explode('_', $_GET['gid']);
$gID = array_filter($gID, 'intval');
$skin = sanitize_flagname($_GET['skinName']);
$flag_options = get_option('flag_options');
$file = str_replace("\\", "/", dirname(dirname(dirname(__FILE__))) . '/flagallery-skins/' . $skin . '/settings/settings.xml');
$url_plug = plugins_url() . '/' . FLAGFOLDER . '/';
$mainXML = "";
$fp = fopen($file, "r");
if (!$fp) {
    exit("0");
    //Failure - not read;
}
while (!feof($fp)) {
    $mainXML .= fgetc($fp);
}
if (isset($flag_options['license_key'])) {
    $lkey = $flag_options['license_key'];
} else {
    $lkey = '';
}
$propertiesXML = substr($mainXML, strpos($mainXML, "<properties>"), strpos($mainXML, "</properties>") - strpos($mainXML, "<properties>"));
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');
}