예제 #1
0
function flag_b_playlist_edit()
{
    $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
    $all_playlists = get_b_playlists();
    $flag_options = get_option('flag_options');
    $playlistPath = $flag_options['galleryPath'] . 'playlists/banner/' . sanitize_flagname($_GET['playlist']) . '.xml';
    $playlist = get_b_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$/, "");
	if(insFor=='preview') {
		jQuery('#preview-'+actInp).attr('value', source);
		jQuery('#preview_txt-'+actInp).attr('src', source).text(source);
	}
	tb_remove();
}
jQuery(document).ready(function(){
  jQuery('.del_preview').click(function(){
    var id = jQuery(this).attr('data-id');
	jQuery('#preview-'+id).attr('value', '');
    jQuery('#preview_txt-'+id).attr('src', '#none').text('');
    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 Banner 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_name == 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="[grandbanner xml=<?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 = 'b');
    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="rotator_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-listvideo" 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="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', '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="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"';
        $uploads = wp_upload_dir();
        foreach ($items_a as $item) {
            $ban = get_post($item);
            $thumb = $banthumb = get_post_meta($item, 'thumbnail', true);
            $link = get_post_meta($ban->ID, 'link', true);
            $preview = get_post_meta($ban->ID, 'preview', true);
            if (empty($thumb)) {
                $thumb = wp_get_attachment_thumb_url($ban->ID);
                $banthumb = '';
            }
            $alt = empty($alt) ? ' class="alternate"' : '';
            $alt2 = empty($alt) ? '' : ' alternate';
            $counter++;
            $url = wp_get_attachment_url($ban->ID);
            ?>
		<tr id="ban-<?php 
            echo $ban->ID;
            ?>
"<?php 
            echo $alt;
            ?>
 valign="top">
			<th class="cb" scope="row"><input name="doaction[]" type="checkbox" value="<?php 
            echo $ban->ID;
            ?>
" /></th>
			<td class="id"><p style="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 
        }
    }
    // 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 
}
예제 #2
0
파일: widgets.php 프로젝트: recca004/JAS
    function form($instance)
    {
        global $wpdb;
        require_once dirname(dirname(__FILE__)) . '/admin/get_skin.php';
        require_once dirname(dirname(__FILE__)) . '/admin/banner.functions.php';
        //Defaults
        $instance = wp_parse_args((array) $instance, array('title' => 'Banner', 'xml' => '', 'width' => '100%', 'height' => '200', 'skin' => 'banner_widget_default'));
        $title = esc_html($instance['title']);
        $width = esc_attr($instance['width']);
        $height = esc_attr($instance['height']);
        $skin = esc_attr($instance['skin']);
        $all_playlists = get_b_playlists();
        $all_skins = get_skins(false, 'w');
        ?>

		<p><label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
</label> <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" /></p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('xml');
        ?>
"><?php 
        _e('Select playlist:', 'flag');
        ?>
</label>
				<select size="1" name="<?php 
        echo $this->get_field_name('xml');
        ?>
" id="<?php 
        echo $this->get_field_id('xml');
        ?>
" class="widefat">
<?php 
        foreach ((array) $all_playlists as $playlist_file => $playlist_data) {
            $playlist_name = basename($playlist_file, '.xml');
            ?>

					<option <?php 
            selected($playlist_name, $instance['xml']);
            ?>
 value="<?php 
            echo $playlist_name;
            ?>
"><?php 
            echo $playlist_data['title'];
            ?>
</option>
<?php 
        }
        ?>

				</select>
		</p>
		<p><label for="<?php 
        echo $this->get_field_id('height');
        ?>
"><?php 
        _e('Height:', 'flag');
        ?>
</label> <input id="<?php 
        echo $this->get_field_id('height');
        ?>
" name="<?php 
        echo $this->get_field_name('height');
        ?>
" type="text" style="padding: 3px; width: 45px;" value="<?php 
        echo $height;
        ?>
" /></p>
		<p><label for="<?php 
        echo $this->get_field_id('width');
        ?>
"><?php 
        _e('Width:', 'flag');
        ?>
</label> <input id="<?php 
        echo $this->get_field_id('width');
        ?>
" name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text" style="padding: 3px; width: 45px;" value="<?php 
        echo $width;
        ?>
" /></p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('skin');
        ?>
"><?php 
        _e('Select Skin:', 'flag');
        ?>
</label>
				<select size="1" name="<?php 
        echo $this->get_field_name('skin');
        ?>
" id="<?php 
        echo $this->get_field_id('skin');
        ?>
" class="widefat">
<?php 
        if ($all_skins) {
            foreach ((array) $all_skins as $skin_file => $skin_data) {
                echo '<option value="' . dirname($skin_file) . '"';
                if (dirname($skin_file) == $instance['skin']) {
                    echo ' selected="selected"';
                }
                echo '>' . $skin_data['Name'] . '</option>' . "\n";
            }
        }
        ?>

				</select>
		</p>
<?php 
    }
예제 #3
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 
}
예제 #4
0
if (isset($_POST['copy_file'])) {
    if (copy(FLAG_ABSPATH . 'flagframe.php', ABSPATH . 'flagframe.php')) {
        flagGallery::show_message(__('Success', 'flash-album-gallery'));
    } else {
        flagGallery::show_error(__('Failure', 'flash-album-gallery'));
    }
}
global $flag, $flagdb;
require_once dirname(__FILE__) . '/get_skin.php';
require_once dirname(__FILE__) . '/playlist.functions.php';
require_once dirname(__FILE__) . '/video.functions.php';
require_once dirname(__FILE__) . '/banner.functions.php';
$i_skins = get_skins();
$all_m_playlists = get_playlists();
$all_v_playlists = get_v_playlists();
$all_b_playlists = get_b_playlists();
$fb_url = plugins_url() . '/flash-album-gallery/flagframe.php';
if (file_exists(ABSPATH . 'flagframe.php')) {
    $fb_url = home_url() . '/flagframe.php';
}
?>
<script type="text/javascript">/*<![CDATA[*/
var url = '<?php 
echo $fb_url;
?>
';
jQuery(document).ready(function() {
	jQuery('#galleries input[value="all"]').attr('checked','checked').parent().siblings('.row').find('input').removeAttr('checked');
	jQuery('#items_array').val('all');
	var galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
	var skin = jQuery('#skinname option:selected').val();