function wpdm_extsc_generate() { ?> <div class="panel panel-default"> <div class="panel-heading">Tree View</div> <div class="panel-body"> <?php wpdm_dropdown_categories('c', 0, 'scc'); ?> <button class="btn btn-primary btn-sm" id="tvw">Insert to Post</button> <script> jQuery('#tvw').click(function(){ cats = jQuery('#scc').val()!='-1'?' category="' + jQuery('#scc').val() + '" ':''; var win = window.dialogArguments || opener || parent || top; win.send_to_editor('[wpdm_tree' + cats + ']'); tinyMCEPopup.close(); return false; }); </script> </div> <div class="panel-heading">Carousel</div> <div class="panel-body"> <?php wpdm_dropdown_categories('c', 0, 'scc1'); ?> <button class="btn btn-primary btn-sm" id="crs">Insert to Post</button> <script> jQuery('#crs').click(function(){ if(jQuery('#pids').val()=='-1'){ alert("Select Category!"); return false; } cats = jQuery('#scc1').val()!='-1'?' category="' + jQuery('#scc1').val() + '" ':''; var win = window.dialogArguments || opener || parent || top; win.send_to_editor('[wpdm_carousel' + cats + ']'); tinyMCEPopup.close(); return false; }); </script> </div> <div class="panel-heading">Slider</div> <div class="panel-body"> <input type="text" id="pids" placeholder="Package IDs separated by comma" style="width: 250px;display: inline" class="form-control input-sm" value="" /> <button class="btn btn-primary btn-sm" id="sld">Insert to Post</button> <script> jQuery('#sld').click(function(){ if(jQuery('#pids').val()==''){ alert("Enter package ids separate by comma!"); return false; } var win = window.dialogArguments || opener || parent || top; win.send_to_editor('[wpdm_slider ids="'+jQuery('#pids').val()+'"]'); tinyMCEPopup.close(); return false; }); </script> </div> </div> <?php }
function wpdm_dropdown_categories($parent = "", $level = 0, $sel = '', $cid = '', $class = array()) { $cats = maybe_unserialize(get_option('_fm_categories')); if (!is_array($cats)) { $cats = array(); } foreach ($cats as $id => $cat) { $pres = str_repeat("—", $level); array_push($class, $parent); if ($parent == '') { $class = array(); } $class = array_unique($class); $cssclass = implode(" ", $class); if ($cat['parent'] == $parent) { if ($sel == $id) { echo "<option class='level_{$level} {$id} {$cssclass}' selected=selected value='{$id}'>{$pres} {$cat['title']}</option>\n"; } else { echo "<option class='level_{$level} {$id} {$cssclass}' value='{$id}'>{$pres} {$cat['title']}</option>\n"; } wpdm_dropdown_categories($id, $level + 1, $sel, $cid, $class); } } }
Title:<br> <input type="text" style="width: 99%;font-size: 14pt" name="cat[title]" value="<?php echo htmlspecialchars($cat[title]); ?> "> Description: <textarea spellcheck=false style="width: 99%;height:150px" name="cat[content]"><?php echo stripslashes(htmlspecialchars($cat[content])); ?> </textarea> <br /> Parent:<br /> <select name="cat[parent]"> <option value="">Top Level Category</option> <?php wpdm_dropdown_categories('', 0, $cat['parent']); ?> </select> <br> <br> <input type="submit" value="<?php echo $_GET['cid'] ? 'Update' : 'Create'; ?> Category" class="button-primary"> </td> </tr> </tbody> </table> </form> </div>
function wpdm_free_tinymce() { global $wpdb; if (!isset($_GET['wpdm_action']) || $_GET['wpdm_action'] != 'wpdm_tinymce_button') { return false; } //wp_enqueue_script('thickbox'); //wp_enqueue_style('thickbox'); //wp_enqueue_script('media-upload'); //wp_enqueue_media(); ?> <html style="height: 100%;background: #eeeeee"> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php echo get_option('blog_charset'); ?> " /> <title>Download Manager</title> <style type="text/css"> *{font-family: Tahoma !important; font-size: 9pt; letter-spacing: 1px;} select,input{padding:5px;font-size: 9pt !important;font-family: Tahoma !important; letter-spacing: 1px;margin:5px;} .button{ background: #7abcff; /* old browsers */ background: -moz-linear-gradient(top, #7abcff 0%, #60abf8 44%, #4096ee 100%); /* firefox */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7abcff), color-stop(44%,#60abf8), color-stop(100%,#4096ee)); /* webkit */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7abcff', endColorstr='#4096ee',GradientType=0 ); /* ie */ -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; border:0px solid #FFF; color: #FFF; cursor: pointer; } .input{ width: 340px; background: #EDEDED; /* old browsers */ background: -moz-linear-gradient(top, #EDEDED 24%, #fefefe 81%); /* firefox */ background: -webkit-gradient(linear, left top, left bottom, color-stop(24%,#EDEDED), color-stop(81%,#fefefe)); /* webkit */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#EDEDED', endColorstr='#fefefe',GradientType=0 ); /* ie */ border:1px solid #aaa; color: #000; } .button-primary{cursor: pointer;} fieldset{padding: 10px;} </style> <style type="text/css"> .wpdm-pro legend{ font-size:10pt; } .wpdm-pro .nav a:active, .wpdm-pro .nav a:hover, .wpdm-pro .nav a{ outline:none !important; } .wpdm-pro button, .wpdm-pro input[type=submit], .wpdm-pro input[type=button], .wpdm-pro input[type=text]{ line-height:26px; min-height:26px; margin-bottom: 10px; } .wpdm-pro .btn small{ font-size: 65%; } #wpdmcats { height:300px; overflow: auto; border:1px solid #eeeeee; border-radius:4px; margin: 0px; padding: 10px; } #wpdmcats li label{ display: inline; font-size:11px; } #wpdmcats li{ list-style: none; } .nav-tabs li a{ text-transform: uppercase; font-weight: bold; } .drag-drop-inside{ text-align: center; padding:5px; border:2px dashed #ddd; margin:5px 0px; } .tab{ padding:10px 20px; text-decoration: none; margin: 0px; display: block; float: left; } .tab:first-child{ border-right:0px } .tab.active{ background:#ffffff; } #qbtn b{ font-weight: normal; } #qbtn input, #qbtn textarea{ margin:0px; margin-bottom: 10px; } .tab-pane{ background: #ffffff; padding:10px; } a.tab{ color: #4096ee; font-weight: 700; } .tab-pane fieldset{ border: 1px solid #dddddd; } </style> <link rel='stylesheet' id='dashicons-css' href='<?php echo includes_url(); ?> /css/dashicons.min.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='admin-bar-css' href='<?php echo includes_url(); ?> /css/admin-bar.min.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='thickbox-css' href='<?php echo includes_url(); ?> /js/thickbox/thickbox.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='buttons-css' href='<?php echo includes_url(); ?> /css/buttons.min.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='mediaelement-css' href='<?php echo includes_url(); ?> /js/mediaelement/mediaelementplayer.min.css?ver=2.13.0' type='text/css' media='all' /> <link rel='stylesheet' id='wp-mediaelement-css' href='<?php echo includes_url(); ?> /js/mediaelement/wp-mediaelement.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='media-views-css' href='<?php echo includes_url(); ?> /css/media-views.min.css?ver=3.9.1' type='text/css' media='all' /> <link rel='stylesheet' id='imgareaselect-css' href='<?php echo includes_url(); ?> /js/imgareaselect/imgareaselect.css?ver=0.9.8' type='text/css' media='all' /> <script type='text/javascript' src='<?php echo admin_url(); ?> /load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,jquery-form,utils,plupload,json2&ver=3.9.1'></script> <?php //do_action('wp_head'); ?> <script type="text/javascript"> jQuery(function(){ var s_title ='', s_desc = ''; jQuery('#addtopost').click(function(){ var win = window.dialogArguments || opener || parent || top; if(jQuery('#s_title').is(":checked")) s_title = ' title="true" '; if(jQuery('#s_desc').is(":checked")) s_desc = ' desc="true" '; var shadow = jQuery('#shadow').val(); var template = ' template="'+jQuery('#template').val()+' '+shadow+'" '; if(jQuery('#template').val()=='') template = ""; win.send_to_editor('[wpdm_file id='+jQuery('#fl').val()+s_title+s_desc+template+']'); parent.tinyMCE.activeEditor.windowManager.close(window); return false; }); jQuery('#addtopostc').click(function(){ var win = window.dialogArguments || opener || parent || top; win.send_to_editor('[wpdm_category id='+jQuery('#flc').val()+']'); parent.tinyMCE.activeEditor.windowManager.close(window); return false; }); jQuery('#addtoposte').click(function(){ var win = window.dialogArguments || opener || parent || top; win.send_to_editor(jQuery('#esc').val()); parent.tinyMCE.activeEditor.windowManager.close(window); return false; }); }); </script> </head> <body> <a href="#scode" class="tab active">Insert ShortCode</a><a href="#qbtn" class="tab">Quick Add</a> <div style="clear: both;"></div> <div id="scode" class="tab-pane"> <fieldset><legend>Embed File</legend> <input type="checkbox" id="s_title" value="1"> <label for="s_title">Show Title</label> <input type="checkbox" id="s_desc" value="1"> <label for="s_desc">Show Description</label> <br/> Template: <select id="template"> <option value="">None</option> <option value="facebook">Facebook</option> <option value="bluebox">Blue Box</option> </select> <br /> Drop Shadow Effect: <select id="shadow"> <option value="">None</option> <option value="drop-shadow raised">Raised</option> <option value="drop-shadow lifted">Lifted</option> <option value="drop-shadow curved curved-hz-2">Curved</option> </select> <br/> <br/> <select id="fl"> <?php $res = $wpdb->get_results("select * from ahm_files", ARRAY_A); foreach ($res as $row) { ?> <option value="<?php echo $row['id']; ?> "><?php echo stripcslashes($row['title']); ?> </option> <?php } ?> </select> <input type="submit" id="addtopost" class="button button-primary" name="addtopost" value="Insert into post" /> </fieldset> <br> <fieldset><legend>Embed Category</legend> <select id="flc"> <?php wpdm_dropdown_categories(); ?> </select> <input type="submit" id="addtopostc" class="button button-primary" name="addtopost" value="Insert into post" /> </fieldset> <br> <fieldset><legend>Additional Short-codes</legend> <select id="esc"> <option value="[wpdm_all_packages]">All Downloads (Data Table)</option> <option value="[wpdm_tree]">All Downloads (Tree View)</option> </select> <input type="submit" id="addtoposte" class="button button-primary" name="addtopost" value="Insert into post" /> </fieldset> </div> <div id="qbtn" class="tab-pane" style="display: none;"> <fieldset> <legend>Add New Package</legend> <form action="admin.php?page=file-manager/add-new-package" id="wpdmpack" method="post"> <input type="hidden" id="act" name="file[access]" value="guest" /> <input type="hidden" name="action" value="save_wpdm_file" /> <input type="hidden" name="wpdmtask" value="create" /> <div class="row-fluid"> <b>Title:</b><br> <input type="text" size="40" name="file[title]" /><br> <b>Description:</b><br> <textarea cols="50" rows="3" class="span12" name="file[description]"></textarea><br> <div> <b>Download Link Label:</b><br> <input type="text" id="act" style="max-width: 100%;" name="file[link_label]" value="Download" /> </div> <div style="clear: both;"></div> <div> </div> <div class="postbox " id="upload_meta_box"> <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span>Upload file from PC</span></h3> <div class="inside"> <input type="hidden" name="file[file]" value="<?php echo $file['file']; ?> " id="wpdmfile" /> <div id="currentfiles"> <div class="cfile" id="cfl"> <?php if ($file['file'] != '') { if (file_exists(UPLOAD_DIR . '/' . $file['file'])) { $filesize = number_format(filesize(UPLOAD_DIR . '/' . $file['file']) / 1025, 2); } else { if (file_exists($file['file'])) { $filesize = number_format(filesize($file['file']) / 1025, 2); } } ?> <div style="float: left"><strong><?php echo basename($file['file']); ?> </strong><br/><?php echo $filesize; ?> KB</div> <a href='#' id="dcf" title="Delete Current File" style="float: right;height:32px;"><img src="<?php echo plugins_url('/download-manager/images/error.png'); ?> " /></a> <?php } else { echo "<span style='font-weight:bold;color:#ddd'>No file uploaded yet!</span>"; } ?> <div style="clear: both;"></div> </div> <div style="clear: both;"></div> <?php if ($file['file'] != '') { ?> <script type="text/javascript"> jQuery('#dcf').click(function(){ if(!confirm('Are your sure?')) return false; jQuery('#cfl').fadeTo('slow',0.3); jQuery.post('admin-ajax.php',{action:'delete_file',file:'<?php echo $file['id']; ?> '},function(res){ jQuery('#cfl').slideUp(); jQuery('#wpdmfile').val(''); }); return false; }); </script> <?php } ?> </div> <div id="plupload-upload-ui" class="hide-if-no-js"> <div id="drag-drop-area"> <div class="drag-drop-inside"> <p class="drag-drop-info"><?php _e('Drop files here'); ?> </p> <p><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?> </p> <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?> " class="button" /></p> </div> </div> </div> <?php $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => false, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_ajax_nonce' => wp_create_nonce('photo-upload'), 'action' => 'file_upload')); // we should probably not apply this filter, plugins may expect wp's media uploader... $plupload_init = apply_filters('plupload_init', $plupload_init); ?> <script type="text/javascript"> jQuery(document).ready(function($){ // create the uploader and pass the config from above var uploader = new plupload.Uploader(<?php echo json_encode($plupload_init); ?> ); // checks if browser supports drag and drop upload, makes some css adjustments if necessary uploader.bind('Init', function(up){ var uploaddiv = jQuery('#plupload-upload-ui'); if(up.features.dragdrop){ uploaddiv.addClass('drag-drop'); jQuery('#drag-drop-area') .bind('dragover.wp-uploader', function(){ uploaddiv.addClass('drag-over'); }) .bind('dragleave.wp-uploader, drop.wp-uploader', function(){ uploaddiv.removeClass('drag-over'); }); }else{ uploaddiv.removeClass('drag-drop'); jQuery('#drag-drop-area').unbind('.wp-uploader'); } }); uploader.init(); // a file was added in the queue uploader.bind('FilesAdded', function(up, files){ //var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10); plupload.each(files, function(file){ jQuery('#filelist').append( '<div class="file" id="' + file.id + '"><b>' + file.name + '</b> (<span>' + plupload.formatSize(0) + '</span>/' + plupload.formatSize(file.size) + ') ' + '<div class="progress progress-success progress-striped active"><div class="bar fileprogress"></div></div></div>'); }); up.refresh(); up.start(); }); uploader.bind('UploadProgress', function(up, file) { jQuery('#' + file.id + " .fileprogress").width(file.percent + "%"); jQuery('#' + file.id + " span").html(plupload.formatSize(parseInt(file.size * file.percent / 100))); }); // a file was uploaded uploader.bind('FileUploaded', function(up, file, response) { // this is your ajax response, update the DOM with it or something... //console.log(response); //response jQuery('#' + file.id ).remove(); var d = new Date(); var ID = d.getTime(); response = response.response; var data = response.split("|||"); jQuery('#wpdmfile').val(data[0]); jQuery('#cfl').html('<div style="float: left"><strong>'+data[0]+'</strong><br/>'+data[1]+' KB</div>').slideDown(); /*if(response.length>20) nm = response.substring(0,7)+'...'+response.substring(response.length-10); jQuery('#currentfiles table.widefat').append("<tr id='"+ID+"' class='cfile'><td><input type='hidden' id='in_"+ID+"' name='files[]' value='"+response+"' /><img id='del_"+ID+"' src='<?php echo plugins_url(); ?> /download-manager/images/minus.png' rel='del' align=left /></td><td>"+response+"</td><td width='40%'><input style='width:99%' type='text' name='wpdm_meta[fileinfo]["+response+"][title]' value='"+response+"' onclick='this.select()'></td><td><input size='10' type='text' id='indpass_"+ID+"' name='wpdm_meta[fileinfo]["+response+"][password]' value=''> <img style='cursor: pointer;float: right;margin-top: -3px' class='genpass' onclick=\"return generatepass('indpass_"+ID+"')\" title='Generate Password' src=\"<?php echo plugins_url('download-manager/images/generate-pass.png'); ?> \" /></td></tr>"); jQuery('#'+ID).fadeIn(); jQuery('#del_'+ID).click(function(){ if(jQuery(this).attr('rel')=='del'){ jQuery('#'+ID).removeClass('cfile').addClass('dfile'); jQuery('#in_'+ID).attr('name','del[]'); jQuery(this).attr('rel','undo').attr('src','<?php echo plugins_url(); ?> /download-manager/images/add.png').attr('title','Undo Delete'); } else if(jQuery(this).attr('rel')=='undo'){ jQuery('#'+ID).removeClass('dfile').addClass('cfile'); jQuery('#in_'+ID).attr('name','files[]'); jQuery(this).attr('rel','del').attr('src','<?php echo plugins_url(); ?> /download-manager/images/minus.png').attr('title','Delete File'); } }); */ }); }); </script> <div id="filelist"></div> <div class="clear"></div> <!--<input type="file" id="file_upload" name="media"/>--> <div class="clear"></div> </div> </div> <input type="submit" class="button btn btn-success" value="Insert into post" /> <div id="sving" style="float: right;margin-right:10px;padding-left: 20px;background:url('<?php echo admin_url('images/loading.gif'); ?> ') left center no-repeat;display: none;">Please Wait...</div> </div> </form> </fieldset> </div> <script type="text/javascript"> jQuery('#wpdmpack').submit(function(){ jQuery('#sving').fadeIn(); jQuery('#publish').attr('disabled','disabled'); jQuery(this).ajaxSubmit({ url:'admin-ajax.php', beforeSubmit:function(){ }, success:function(res){ var msg = ''; jQuery('#sving').fadeOut(); var win = window.dialogArguments || opener || parent || top; win.send_to_editor('[wpdm_file id='+res+']'); parent.tinyMCE.activeEditor.windowManager.close(window); return false; } }); return false; }); jQuery('.tab').click(function(){ jQuery('.tab-pane').hide(); jQuery('.tab').removeClass('active'); jQuery(this).addClass('active'); jQuery(jQuery(this).attr('href')).show(); return false; }); </script> </body> </html> <?php die; }
</option> </select> <input type="text" id="sfld" style="width: 200px;" name="q" value="<?php echo $_REQUEST['q']; ?> "> <input type="submit" class="button-secondary action" id="doaction" value="<?php echo __('Apply', 'wpdmpro'); ?> "> <div style="float: right;"> <select onchange="location.href='admin.php?page=file-manager&cat='+this.value"> <option value="">Select Category:</option> <option value="">All Categories</option> <?php $scat = isset($_GET['cat']) ? $_GET['cat'] : ''; wpdm_dropdown_categories('', 0, $scat); ?> </select> </div> <?php if (isset($_GET['q']) || isset($_GET['cat'])) { ?> <input type="button" class="button-secondary action" onclick="location.href='admin.php?page=file-manager'" value="<?php echo __('Reset Search', 'wpdmpro'); ?> "> <?php } ?>
/** @see WP_Widget::form */ function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ""; $parent = isset($instance['parent']) ? intval($instance['parent']) : 0; $style = isset($instance['style']) ? esc_attr($instance['style']) : 'flat'; ?> <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('parent'); ?> "><?php _e('Parent:'); ?> </label><br/> <?php wpdm_dropdown_categories($this->get_field_name('parent'), $parent, $this->get_field_id('parent')); ?> </p> <p> <label><?php _e('Style:'); ?> </label><br/> <label><input type="radio" name="<?php echo $this->get_field_name('style'); ?> " <?php checked('flat', $style); ?> value="flat"> Flat List</label><br/> <label><input type="radio" name="<?php echo $this->get_field_name('style'); ?> " <?php checked('tree', $style); ?> value="tree"> Hierarchy List</label><br/> <!-- label><input type="radio" name="<?php echo $this->get_field_name('style'); ?> " <?php checked('dropdown', $style); ?> value="dropdown"> Dropdown List</label></br --> </p> <?php }