Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tospur
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
felix
tospur
Commits
c3bdf1f0
Commit
c3bdf1f0
authored
Sep 29, 2015
by
shz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tospur
parent
9734ab07
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletions
+65
-1
wp-content/plugins/tospur/Admin/upload.php
+54
-0
wp-content/plugins/tospur/Admin/views/upload.html
+5
-0
wp-content/plugins/tospur/index.php
+6
-1
No files found.
wp-content/plugins/tospur/Admin/upload.php
0 → 100644
View file @
c3bdf1f0
<?php
function
function_upload
()
{
$upload
=
wp_upload_dir
();
$file
=
$upload
[
'basedir'
]
.
'/'
.
$_FILES
[
'file'
][
'name'
];
$to
=
$upload
[
'basedir'
]
.
'/zip/'
;
if
(
$_FILES
)
{
@
rename
(
$_FILES
[
'file'
][
'tmp_name'
],
$file
);
WP_Filesystem
();
$unzipfile
=
unzip_file
(
$file
,
$to
);
if
(
$unzipfile
)
{
echo
'Successfully unzipped the file!'
;
}
else
{
echo
'There was an error unzipping the file.'
;
}
@
unlink
(
$file
);
}
$dir
=
getDir
(
$to
);
//print_r($dir);
Timber
::
render
(
'upload.html'
);
}
function
searchDir
(
$path
,
&
$data
)
{
if
(
is_dir
(
$path
))
{
$dp
=
dir
(
$path
);
while
(
$file
=
$dp
->
read
())
{
if
(
$file
!=
'.'
&&
$file
!=
'..'
)
{
iconv
(
'gb2312'
,
'utf-8'
,
$file
);
echo
$file
;
searchDir
(
$path
.
'/'
.
$file
,
$data
);
}
}
$dp
->
close
();
}
if
(
is_file
(
$path
))
{
$data
[]
=
$path
;
}
}
function
getDir
(
$dir
)
{
$data
=
array
();
searchDir
(
$dir
,
$data
);
return
$data
;
}
?>
\ No newline at end of file
wp-content/plugins/tospur/Admin/views/upload.html
0 → 100644
View file @
c3bdf1f0
<form
enctype=
"multipart/form-data"
method=
"post"
>
<input
type=
"file"
name=
"file"
>
<input
type=
"submit"
value=
"提交"
>
</form>
\ No newline at end of file
wp-content/plugins/tospur/index.php
View file @
c3bdf1f0
...
...
@@ -11,7 +11,8 @@ define('PLUGIN_DIR', dirname(__FILE__) . '/');
add_action
(
'init'
,
'tospur_init'
);
function
tospur_init
()
{
my_plugin_activate
();
{
my_plugin_activate
();
require_once
(
PLUGIN_DIR
.
'Config.php'
);
require_once
(
PLUGIN_DIR
.
'Tools/TCSync.php'
);
require_once
(
PLUGIN_DIR
.
'Tools/Image.php'
);
...
...
@@ -44,6 +45,7 @@ function tospur_init()
require_once
(
PLUGIN_DIR
.
'Admin/Contract_List.php'
);
require_once
(
PLUGIN_DIR
.
'Admin/commissionManage.php'
);
require_once
(
PLUGIN_DIR
.
'Admin/commissionList.php'
);
require_once
(
PLUGIN_DIR
.
'Admin/upload.php'
);
add_action
(
'admin_menu'
,
'reset_menu'
);
tospur_register_script_style
();
tospur_ajax_set
();
...
...
@@ -319,6 +321,7 @@ function reset_menu()
add_menu_page
(
'添加标签'
,
'添加标签'
,
'addTag'
,
'add_tag'
,
'feature::add_feature_html'
,
'dashicons-menu'
);
add_menu_page
(
'添加特色'
,
'添加特色'
,
'addFeature'
,
'add_feature'
,
'feature::add_feature_html'
,
'dashicons-menu'
);
add_menu_page
(
"同步数据"
,
"同步数据"
,
"dataSync"
,
"sync"
,
"TCSyncView::display"
,
'dashicons-menu'
);
add_menu_page
(
"上传"
,
"上传"
,
"jl"
,
"upload"
,
"function_upload"
,
'dashicons-menu'
);
//移除更新信息
remove_action
(
'admin_notices'
,
'update_nag'
,
3
);
global
$menu
;
...
...
@@ -351,3 +354,4 @@ function reset_menu()
}
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment