first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
// No direct access.
defined( 'ABSPATH' ) || die();
global $wp_roles;
$options=array();
foreach ($wp_roles->roles as $k => $role){
$selected = '';
if(in_array(strtolower($k), $this->category->roles)){
$selected = 'checked="checked"';
}
$options[] = '<input type="checkbox" name="params[roles][]" value="'. strtolower($k).'" '.$selected.'/>'.$role['name'].'<br/>';
}
$ordering_options = array(
'ordering' => __('Ordering','wp-smart-editor'),
'ext' => __('Type','wp-smart-editor'),
'title' => __('Title','wp-smart-editor'),
'description' => __('Description','wp-smart-editor'),
'size' => __('Filesize','wp-smart-editor'),
'created_time' => __('Date added','wp-smart-editor'),
'modified_time' => __('Date modified','wp-smart-editor'),
'version' => __('Version','wp-smart-editor'),
'hits' => __('Hits','wp-smart-editor'),
);
if($this->mainConfig['catparameters']=='0'): ?>
<style type="text/css">
#category-theme-params{display: none;}
</style>
<?php endif; ?>
<div class="wpfdparams">
<form id="category_params">
<div class="control-group <?php if ($this->mainConfig['catparameters'] == 0) echo 'hidden'?>">
<label class="control-label" for="wpfd-theme"><?php _e('Theme','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[theme]" id="wpfd-theme" >
<?php foreach($this->themes as $theme) {
if($this->category->params['theme']==$theme) {
$selected = 'selected="selected"';
}else {
$selected = '';
}
echo '<option value="'.$theme.'" '.$selected. ' >'.$theme.'</option>';
}?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="visibility"><?php _e('Visibility','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[visibility]" id="visibility">
<option value="0" <?php if( $this->category->access==0){echo 'selected="selected"';} ?>><?php _e('Public','wp-smart-editor'); ?></option>
<option value="1" <?php if( $this->category->access==1){echo 'selected="selected"';} ?>><?php _e('Private','wp-smart-editor'); ?></option>
</select>
</div>
<div id="visibilitywrap">
<?php echo implode('',$options); ?>
</div>
</div>
<?php if (defined('WPFDA_VERSION')) { ?>
<div class="control-group">
<label class="control-label" for="wpfd-social-locker"><?php _e('Lock content by socials','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[social]" id="wpfd-social-locker" >
<option value="0" <?php if( $this->category->params['social']==0){echo 'selected="selected"';} ?>><?php _e('No','wp-smart-editor'); ?></option>
<option value="1" <?php if( $this->category->params['social']==1){echo 'selected="selected"';} ?>><?php _e('Yes','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<?php } ?>
<div class="control-group">
<label for="ordering" class="control-label"><?php _e('Ordering','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[ordering]" id="ordering" >
<?php foreach ($ordering_options as $order_key => $order_text) { ?>
<option value="<?php echo $order_key;?>" <?php selected($this->category->ordering, $order_key);?>><?php echo $order_text; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="control-group">
<label for="orderingdir" class="control-label"><?php _e('Ordering direction','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[orderingdir]" id="orderingdir">
<option value="asc" <?php selected($this->category->orderingdir, 'asc');?>><?php _e('Ascending','wp-smart-editor'); ?></option>
<option value="desc" <?php selected($this->category->orderingdir, 'desc');?>><?php _e('Descending','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div id="category-theme-params">
<?php
if (wpfdBase::checkExistTheme($this->category->params['theme'])) {
echo $this->loadTemplate('theme-'. $this->category->params['theme']);
} else {
$dir = wp_upload_dir();
$this->setPath($dir['basedir'] . '/wpfd-themes/wpfd-'. $this->category->params['theme'].'/');
echo $this->loadTemplate('theme-'. $this->category->params['theme']);
}
?>
</div>
<?php if ($this->mainConfig['shortcodecat'] == 1) { ?>
<div class="control-group">
<label title="" class="control-label" for="shortcodecat"><?php echo __('Category shortcode', 'wp-smart-editor');?></label>
<div class="controls">
<input type="text" id="shortcodecat" name="shortcodecat" readonly="true" value="[wpfd_category id='<?php echo $this->category->term_id;?>']" class="inputbox">
</div>
</div>
<?php } ?>
<button class="button button-primary" type="submit"><?php _e('Save','wp-smart-editor'); ?></button>
</form>
</div>

View File

@@ -0,0 +1,138 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
// No direct access.
defined( 'ABSPATH' ) || die();
?>
<div class="control-group">
<label class="control-label" for="marginleft"><?php _e('Margin left','wp-smart-editor'); ?></label>
<div class="controls"><input name="params[marginleft]" value="<?php echo $this->params["marginleft"]; ?>" class="inputbox input-block-level" type="text"></div>
</div>
<div class="control-group">
<label class="control-label" for="marginright"><?php _e('Margin right','wp-smart-editor'); ?></label>
<div class="controls"><input name="params[marginright]" value="<?php echo $this->params["marginright"]; ?>" class="inputbox input-block-level" type="text"></div>
</div>
<div class="control-group">
<label class="control-label" for="margintop"><?php _e('Margin top','wp-smart-editor'); ?></label>
<div class="controls"><input name="params[margintop]" value="<?php echo $this->params["margintop"]; ?>" class="inputbox input-block-level" type="text"></div>
</div>
<div class="control-group">
<label class="control-label" for="marginbottom"><?php _e('Margin bottom','wp-smart-editor'); ?></label>
<div class="controls"><input name="params[marginbottom]" value="<?php echo $this->params["marginbottom"]; ?>" class="inputbox input-block-level" type="text"></div>
</div>
<div class="control-group">
<label class="control-label" for="showtitle"><?php _e('Show title','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showtitle]" class="inline">
<option value="1" <?php if($this->params["showtitle"]=="1") { echo 'selected="selected"';}?> ><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showtitle"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="croptitle"><?php _e('Crop titles','wp-smart-editor'); ?></label>
<div class="controls"><input name="params[croptitle]" value="<?php echo $this->params["croptitle"]; ?>" class="inputbox input-block-level" type="text"></div>
</div>
<div class="control-group">
<label class="control-label" for="showsize"><?php _e('Show weight','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showsize]" class="inline">
<option value="1" <?php if($this->params["showsize"]=="1") { echo 'selected="selected"';}?> ><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showsize"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showversion"><?php _e('Show version','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showversion]" class="inline">
<option value="1" <?php if($this->params["showversion"]=="1") { echo 'selected="selected"';}?> ><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showversion"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showhits"><?php _e('Show hits','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showhits]" class="inline">
<option value="1" <?php if($this->params["showhits"]=="1") { echo 'selected="selected"';}?> ><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showhits"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showdownload"><?php _e('Show download link','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showdownload]" class="inline">
<option value="1" <?php if($this->params["showdownload"]=="1") { echo 'selected="selected"';}?>><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showdownload"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="bgdownloadlink"><?php _e('Background download link','wp-smart-editor'); ?></label>
<div class="controls">
<input name="params[bgdownloadlink]" value="<?php echo $this->params["bgdownloadlink"]; ?>" class="inputbox input-block-level wp-color-field" type="text">
</div>
</div>
<div class="control-group">
<label class="control-label" for="colordownloadlink"><?php _e('Color download link','wp-smart-editor'); ?></label>
<div class="controls">
<input name="params[colordownloadlink]" value="<?php echo $this->params["colordownloadlink"]; ?>" class="inputbox input-block-level wp-color-field" type="text">
</div>
</div>
<div class="control-group">
<label class="control-label" for="showdateadd"><?php _e('Show date added','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showdateadd]" class="inline">
<option value="1" <?php if($this->params["showdateadd"]=="1") { echo 'selected="selected"';}?> ><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showdateadd"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showdatemodified"><?php _e('Show date modified','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showdatemodified]" class="inline">
<option value="1" <?php if($this->params["showdatemodified"]=="1") { echo 'selected="selected"';}?>><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showdatemodified"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showsubcategories"><?php _e('Show subcategories','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showsubcategories]" class="inline">
<option value="1" <?php if($this->params["showsubcategories"]=="1") { echo 'selected="selected"';}?>><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showsubcategories"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showbreadcrumb"><?php _e('Show Breadcrumb','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showbreadcrumb]" class="inline">
<option value="1" <?php if($this->params["showbreadcrumb"]=="1") { echo 'selected="selected"';}?>><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showbreadcrumb"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="showfoldertree"><?php _e('Show folder tree','wp-smart-editor'); ?></label>
<div class="controls">
<select name="params[showfoldertree]" class="inline">
<option value="1" <?php if($this->params["showfoldertree"]=="1") { echo 'selected="selected"';}?>><?php _e('Yes','wp-smart-editor'); ?></option>
<option value="0" <?php if($this->params["showfoldertree"]=="0") { echo 'selected="selected"';}?> ><?php _e('No','wp-smart-editor'); ?></option>
</select>
</div>
</div>

View File

@@ -0,0 +1,54 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
use Joomunited\WPFramework\v1_0_4\View;
use Joomunited\WPFramework\v1_0_4\Utilities;
use Joomunited\WPFramework\v1_0_4\Form;
defined( 'ABSPATH' ) || die();
class wpfdViewCategory extends View {
public function render($tpl = null) {
$id_category = Utilities::getInt('id');
if(empty($id_category)) { echo ''; wp_die(); }
$modelCat = $this->getModel('category');
$this->category = $modelCat->getCategory($id_category);
$this->params = (array)$this->category->params;
$modelConfig = $this->getModel('config');
$this->mainConfig = $modelConfig->getConfig();
$this->themes = $modelConfig->getThemes();
if(Utilities::getInput('onlyTheme','GET','int') ) {
$newTheme = Utilities::getInput('theme','GET','string');
$defaultThemeConfig = $modelConfig->getThemeParams( $newTheme);
$this->params = wp_parse_args($this->params,$defaultThemeConfig);
if (wpfdBase::checkExistTheme($newTheme)) {
echo $this->loadTemplate('theme-'. $newTheme);
} else {
$dir = wp_upload_dir();
$this->setPath($dir['basedir'] . '/wpfd-themes/wpfd-'. $newTheme.'/');
echo $this->loadTemplate('theme-'. $newTheme);
}
die();
}
$defaultThemeConfig = $modelConfig->getThemeParams($this->params['theme']);
$this->params = wp_parse_args($this->params, $defaultThemeConfig);
$form = new Form();
if($form->load('category',(array)$this->category->params)){
$this->form = $form->render();
}
parent::render($tpl);
}
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
// No direct access.
defined( 'ABSPATH' ) || die();
?>
<style>
ul.tagit{background: none;background-color:#f5f5f5;}
.wpfdparams ul.tagit {margin: 0 !important;}
.tagit-hidden-field{display:none;}
ul.tagit input[type="text"]{background-color: #f5f5f5;}
ul.tagit li {
font-weight: normal !important;
color: #6B6B6B !important;
font-size: 14px;
}
</style>
<?php echo $this->form; ?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#file_tags").tagit({
availableTags: <?php echo $this->allTagsFiles; ?>,
afterTagAdded:function(e){e.preventDefault();},
allowSpaces :true
});
});
<?php echo wpfd_calendartranslation();?>
</script>

View File

@@ -0,0 +1,34 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
$content = '';
if (!empty($this->versions)) {
$content .= '<table>';
foreach ($this->versions as $meta_id => $file) {
$version = '1';
$content .= '<tr>';
$content .= '<td><a href="admin-ajax.php?action=wpfd&task=file.download&version=' . $version . '&id=' . $this->file_id . '&vid=' . $file['meta_id'] . '&catid='.$file['catid'].'" >';
$content .= date("Y M d", strtotime($file['created_time'])) . ' ';
$content .= '</a></td>';
$content .= '<td>' . wpfdHelperFiles::bytesToSize($file['size']) . '</td>';
$content .= '<td>'.
'<a data-id="' . $this->file_id . '" data-vid="' . $file['meta_id'] . '" data-catid="'.$file['catid'].'" href="#" class="restore"><i class="icon-restore"></i></a>';
if(apply_filters('wpfdAddonCategoryFrom',$file['catid']) == 'dropbox'){
$content .= '';
}else{
$content .= '<a data-id="' . $this->file_id . '" data-vid="' . $file['meta_id'] . '" data-catid="'.$file['catid'].'" href="#" class="trash"><i class="icon-trash"></i></a></td>';
}
$content .= '</tr>';
}
$content .= '</table>';
}
echo $content;

View File

@@ -0,0 +1,72 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
use Joomunited\WPFramework\v1_0_4\Application;
use Joomunited\WPFramework\v1_0_4\View;
use Joomunited\WPFramework\v1_0_4\Utilities;
use Joomunited\WPFramework\v1_0_4\Form;
defined( 'ABSPATH' ) || die();
class wpfdViewFile extends View {
public function render($tpl = null) {
$model = $this->getModel('file');
$idCategory = Utilities::getInt('idCategory');
if (apply_filters('wpfdAddonCategoryFrom', $idCategory) == 'googleDrive') {
$fileId = Utilities::getInput('id', 'GET', 'none');
$datas = apply_filters('wpfdAddonGetFileInfo', $fileId);
}
elseif (apply_filters('wpfdAddonCategoryFrom', $idCategory) == 'dropbox') {
$fileId = Utilities::getInput('id', 'GET', 'none');
$datas = apply_filters('wpfdAddonDropboxGetFileInfo', $fileId,$idCategory);
}
else {
$datas = $model->getfile(Utilities::getInt('id'));
}
$layout = Utilities::getInput('layout','GET','string');
if($layout == 'versions') {
$this->file_id = $datas['ID'];
if(apply_filters('wpfdAddonCategoryFrom', $idCategory) == 'dropbox'){
$this->versions = apply_filters('wpfdAddonDropboxVersionInfo',$datas['ID'],$idCategory);
}
else{
$this->versions = $model->getVersions($datas['ID'],$idCategory) ; //get_post_meta($datas['ID'], '_wpfd_file_versions', false);
}
parent::render($layout);
wp_die();
}
// $application = Application::getInstance('wpfd');
// require_once $application->getPath().DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'forms'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR.'Hits.php';
$form = new Form();
if($form->load('file',$datas)){
$this->form = $form->render('link');
}
$tags = get_terms( 'wpfd-tag', array(
'orderby' => 'count',
'hide_empty' => 0,
) );
$allTagsFiles = '';
if ($tags) {
foreach ($tags as $tag) {
$allTagsFiles[] = ''.$tag->slug;
}
$this->allTagsFiles = '["'.implode('","', $allTagsFiles ).'"]';
} else {
$this->allTagsFiles = '[]';
}
parent::render($tpl);
wp_die();
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
// No direct access.
defined( 'ABSPATH' ) || die();
$items_thead = array(
'ext' => __('#','wp-smart-editor'),
'title' => __('Title','wp-smart-editor'),
'size' => __('File size','wp-smart-editor'),
'created_time' => __('Date added','wp-smart-editor'),
'modified_time' => __('Date modified','wp-smart-editor'),
'version' => __('Version','wp-smart-editor'),
'hits' => __('Hits','wp-smart-editor'),
'actions' => __('Actions','wp-smart-editor')
);
?>
<table class="restable">
<thead>
<tr>
<?php
foreach ($items_thead as $thead_key => $thead_text) {
$icon = '';
if ($thead_key === $this->ordering) {
$icon = '<span class="dashicons dashicons-arrow-' . ($this->orderingdir === 'asc' ? 'up' : 'down') . '"></span>';
}
?>
<th class="<?php echo $thead_key; ?>">
<?php if ($thead_key == 'actions') { ?>
<?php echo $thead_text; ?>
<?php } else { ?>
<a href="#" class="<?php echo($this->ordering === $thead_key ? 'currentOrderingCol' : ''); ?>"
data-ordering="<?php echo $thead_key; ?>"
data-direction="<?php echo $this->orderingdir; ?>"><?php echo $thead_text; ?><?php echo $icon; ?></a>
<?php } ?>
</th>
<?php } ?>
</tr>
</thead>
<tbody >
<?php if(is_array($this->files) || is_object($this->files)):?>
<?php foreach ($this->files as $file): ?>
<tr class="file" data-id-file="<?php echo $file->ID; ?>">
<td class="ext <?php echo $file->ext; ?>"><span class="txt"><?php echo $file->ext; ?></span></td>
<td class="title"><?php echo $file->post_title; ?></td>
<td class="size"><?php echo ($file->size == 'n/a') ? $file->size : wpfdHelperFiles::bytesToSize($file->size); ?></td>
<td class="created"><?php echo mysql2date(wpfdBase::loadValue($this->params, 'date_format', get_option('date_format')), $file->created); ?></td>
<td class="modified"><?php echo mysql2date(wpfdBase::loadValue($this->params, 'date_format', get_option('date_format')), $file->modified); ?></td>
<td class="version"><?php echo $file->version; ?></td>
<td class="hits"><?php echo $file->hits.' '.__('hits','wp-smart-editor'); ?></td>
<td class="actions"><a class="trash"><i class="icon-trash"></i></a> <a href="<?php echo $file->linkdownload;?>" class="download"><i class="icon-download"></i></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>

View File

@@ -0,0 +1,46 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
use Joomunited\WPFramework\v1_0_4\View;
use Joomunited\WPFramework\v1_0_4\Utilities;
defined( 'ABSPATH' ) || die();
class wpfdViewFiles extends View {
public function render($tpl = null) {
$id_category = Utilities::getInt('id_category');
if(empty($id_category)) return '';
$model = $this->getModel();
$category_model = $this->getModel('Category');;
$this->category = $category_model->getCategory($id_category);
$this->ordering = Utilities::getInput('orderCol','GET','none') != null ? Utilities::getInput('orderCol','GET','none') : $this->category->ordering;
$this->orderingdir = Utilities::getInput('orderDir','GET','none') != null ? Utilities::getInput('orderDir','GET','none') : $this->category->orderingdir;
$modelConfig = $this->getModel('Config');
$this->params = $modelConfig->getConfig();
if(apply_filters('wpfdAddonCategoryFrom', $id_category) == 'googleDrive') {
$this->files = apply_filters('wpfdAddonDisplayGoogleDriveCategories', $id_category);
}
elseif(apply_filters('wpfdAddonCategoryFrom', $id_category) == 'dropbox') {
$this->files = apply_filters('wpfdAddonDisplayDropboxCategories', $id_category);
}
else {
$this->files = $model->getFiles($id_category, $this->ordering, $this->orderingdir);
}
parent::render($tpl);
}
}

View File

@@ -0,0 +1,238 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0W
*/
use Joomunited\WPFramework\v1_0_4\Factory;
use Joomunited\WPFramework\v1_0_4\Utilities;
use Joomunited\WPFramework\v1_0_4\Model;
use Joomunited\WPFramework\v1_0_4\Application;
// No direct access.
defined( 'ABSPATH' ) || die();
if (!current_user_can('wpfd_manage_file')) {
wp_die(__('You don\'t have permission to view this page', 'wp-smart-editor'));
}
wp_localize_script('wpfd-main','l10n',array(
'Drop files here to upload'=>__('Drop files here to upload','wp-smart-editor'),
'Or use the button below'=>__('Or use the button below','wp-smart-editor'),
'Add remote file'=>__('Add remote file','wp-smart-editor'),
'Allowed extensions'=>__('Allowed extensions','wp-smart-editor'),
'SEO URL'=>__('SEO URL','wp-smart-editor'),
'Show files import'=>__('Show files import','wp-smart-editor'),
'Max upload file size (Mb)'=>__('Max upload file size (Mb)','wp-smart-editor'),
'Delete all files on uninstall'=>__('Delete all files on uninstall','wp-smart-editor'),
'Close categories'=>__('Close categories','wp-smart-editor'),
'Theme per categories'=>__('Theme per categories','wp-smart-editor'),
'Default theme per category'=>__('Default theme per category','wp-smart-editor'),
'Date format'=>__('Date format','wp-smart-editor'),
'Use viewer'=>__('Use viewer','wp-smart-editor'),
'Extensions to open with viewer'=>__('Extensions to open with viewer','wp-smart-editor'),
'GA download tracking'=>__('GA download tracking','wp-smart-editor'),
'Single user restriction'=>__('Single user restriction','wp-smart-editor'),
'Use WYSIWYG editor'=>__('Use WYSIWYG editor','wp-smart-editor'),
'Load the plugin on frontend'=>__('Load the plugin on frontend','wp-smart-editor'),
'Category owner'=>__('Category owner','wp-smart-editor'),
'Search page'=>__('Search page','wp-smart-editor'),
'Plain text search'=>__('Plain text search','wp-smart-editor'),
'Are you sure'=>__('Are you sure','wp-smart-editor'),
'Delete'=>__('Delete','wp-smart-editor'),
'Edit'=>__('Edit','wp-smart-editor'),
'Your browser does not support HTML5 file uploads'=>__('Your browser does not support HTML5 file uploads','wp-smart-editor'),
'Too many files'=>__('Too many files','wp-smart-editor'),
'is too large'=>__('is too large','wp-smart-editor'),
'Only images are allowed'=>__('Only images are allowed','wp-smart-editor'),
'Do you want to delete &quot;'=>__('Do you want to delete &quot;','wp-smart-editor'),
'Select files'=>__('Select files','wp-smart-editor'),
'Image parameters'=>__('Image parameters','wp-smart-editor'),
'Cancel'=>__('Cancel','wp-smart-editor'),
'Ok'=>__('Ok','wp-smart-editor'),
'Confirm'=>__('Confirm','wp-smart-editor'),
'Save'=>__('Save','wp-smart-editor'),
'close_categories' => 0,
'show_file_import' => 0,
'add_remote_file' => 0,
'Are you sure restore file'=>__('Are you sure you want to restore the file: ','wp-smart-editor'),
'Are you sure remove version'=>__('Are you sure you want to definitively remove this file version','wp-smart-editor'),
));
if (isset($_GET['noheader'])){
global $hook_suffix;
_wp_admin_html_begin();
do_action( 'admin_enqueue_scripts', $hook_suffix );
do_action( "admin_print_scripts-$hook_suffix" );
do_action( 'admin_print_scripts' );
}
$alone = '';
?>
<script type="text/javascript">
ajaxurl = "<?php echo Application::getInstance('wpfd')->getAjaxUrl(); ?>";
dir = "<?php echo Application::getInstance('wpfd')->getBaseUrl(); ?>";
<?php if(Utilities::getInput('caninsert','GET','bool')): ?>
gcaninsert=true;
<?php $alone = 'wpfdalone wp-core-ui '; ?>
<?php else: ?>
gcaninsert=false;
<?php endif; ?>
var Wpfd = {}; Wpfd.maxfilesize = <?php echo apply_filters('wpfd_max_file_size', 300); ?>;
if(typeof(addLoadEvent)==='undefined'){addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};};
</script>
<style>
<?php if(Utilities::getInput('caninsert','GET','bool')): ?>
html.wp-toolbar {padding-top: 0 !important}
<?php endif; ?>
</style>
<div id="mybootstrap" class="<?php echo $alone; ?>">
<div id="mycategories" class="wpfd-column" style="display: none">
<div class="nested dd">
<ol id="categorieslist" class="dd-list nav bs-docs-sidenav2 ">
<?php $content = '';
if(!empty($this->categories)){
$previouslevel = 1;
for ($index = 0; $index < count($this->categories); $index++) {
if($index+1!=count($this->categories)){
$nextlevel = $this->categories[$index+1]->level;
}else{
$nextlevel = 0;
}
$content .= openItem($this->categories[$index],$index);
if($nextlevel>$this->categories[$index]->level){
$content .= openlist($this->categories[$index]);
}elseif($nextlevel==$this->categories[$index]->level){
$content .= closeItem($this->categories[$index]);
}else{
$c = '';
$c .= closeItem($this->categories[$index]);
$c .= closeList($this->categories[$index]);
$content .= str_repeat($c,$this->categories[$index]->level-$nextlevel);
}
$previouslevel = $this->categories[$index]->level;
}
}
echo $content;
?>
</ol>
<input type="hidden" id="categoryToken" name="" />
</div>
</div>
<div id="pwrapper" class="wpfd-column">
<div id="wpreview">
<div class="wpfd-btn-toolbar" id="wpfd-toolbar">
<div class="btn-wrapper">
<button onclick="Wpfd.submitbutton('files.delete')" class="btn btn-small" id="wpfd-delete">
<span class="icon-trash"></span>
<?php _e('Delete files','wp-smart-editor'); ?></button>
</div>
<div class="btn-wrapper">
<button onclick="Wpfd.submitbutton('files.uncheck')" class="btn btn-small" id="wpfd-uncheck">
<span class="icon-remove"></span>
<?php _e('Uncheck','wp-smart-editor'); ?></button>
</div>
</div>
<div id="preview" class="<?php if (current_user_can('wpfd_edit_category') || current_user_can('wpfd_edit_own_category')) echo 'has-wpfd'; else echo 'no-wpfd';?>"></div>
</div>
<input type="hidden" name="id_category" value="" />
<?php if (!isset($_COOKIE['WPFD_hide_upgrade'])) : ?>
<div id="updateGroup">
<div id="updateInfo">
<p style="text-transform: uppercase; font-weight: bold; font-size: 16px"><?php _e('WP File Download Full Version', 'wp-smart-editor') ?></p>
<p id="updateDesc"><?php _e('Save time using WP File Download full version to manage files categories, file access, search engine, themes and more...', 'wp-smart-editor') ?></p>
</div>
<button type="button" class="updateHideBtn"><i class="dashicons dashicons-dismiss" ></i></button>
<a class="updateBtn" href="https://www.joomunited.com/wordpress-products/wp-file-download" target="_blank" title="<?php _e('WP File Download Full Version', 'wp-smart-editor') ?>"><?php _e('More Information','wp-smart-editor') ?></a>
<a class="updateBtn updateHideTxt" href="#" onclick="return false" title="<?php _e('Hide','wp-smart-editor') ?>"><?php _e('Close Notification','wp-smart-editor') ?></a>
</div>
<?php endif; ?>
</div>
<?php if (current_user_can('wpfd_edit_category') || current_user_can('wpfd_edit_own_category') || Utilities::getInput('caninsert', 'GET', 'bool')) { ?>
<div id="rightcol" class="wpfd-column">
<?php if(Utilities::getInput('caninsert', 'GET', 'bool')): ?>
<a id="insertfile" class="button button-primary button-big" style="display: none;" href="#" onclick="if (window.parent) insertFile();"><?php _e('Insert this file','wp-smart-editor'); ?></a>
<?php endif; ?>
<div class="fileblock" style="display: none;">
<div class="well">
<h4><?php _e('Parameters','wp-smart-editor'); ?></h4>
<div id="fileparams">
</div>
</div>
<div id="fileversion">
<div class="well">
<h4><?php _e('Send a new version','wp-smart-editor'); ?></h4>
<div id="versions_content"></div>
<div id="dropbox_version">
<div class="upload">
<span class="message"><?php _e('Drop files here to upload','wp-smart-editor'); ?></span>
<input class="hide" type="file" id="upload_input_version">
<a href="" id="upload_button_version" class="button button-primary button-big">
<?php _e('Select files','wp-smart-editor'); ?>
</a>
</div>
<div class="progress progress-striped active hide">
<div class="bar" style="width: 0%;"></div>
</div>
</div>
<div class="clr"></div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
function openItem($category,$key){
$item = '<li class="dd-item dd3-item '.($key?'':'active').'" data-id-category="'.$category->term_id.'">
<div class="dd-handle dd3-handle"><i class="material-icons wpfd-folder">folder</i></div>
<div class="dd-content dd3-content">';
$item .= '<a href="" class="t">'.apply_filters("wpfdAddonShowCategoryCloud", null, $category->term_id).
apply_filters("wpfdAddonShowCategoryDropbox", null, $category->term_id).
'<span class="title">'.$category->name.'</span> </a> </div>';
return $item;
}
function closeItem($category){
return '</li>';
}
function itemContent($category){
$item = '<div class="dd-handle dd3-handle"><i class="material-icons wpfd-folder">folder</i></div>
<div class="dd-content dd3-content"
<i class="icon-chevron-right"></i>';
if (current_user_can('wpfd_edit_category') || current_user_can('wpfd_edit_own_category')) {
$item .= '<a class="edit"><i class="icon-edit"></i></a>';
}
$item .= '<a href="" class="t"> <span class="title">'.$category->name.'</span> </a>
</div>';
return $item;
}
function openlist($category){
return '<ol class="dd-list">';
}
function closelist($category){
return '</ol>';
}
?>

View File

@@ -0,0 +1,22 @@
<?php
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
use Joomunited\WPFramework\v1_0_4\View;
defined( 'ABSPATH' ) || die();
class wpfdViewWpfd extends View {
public function render($tpl = null) {
$modelCat = $this->getModel('categories');
$this->categories = $modelCat->getCategories();
parent::render($tpl);
}
}