<?php
class StaticHtmlToWPAdminListPage
{
private static $instance = null;
private $screen_id = null;
private $not_allowed_urls = array(
);
public static function getInstance()
{
if (!self::$instance) self::$instance = new self();
return self::$instance;
}
public function __construct()
{
$this->not_allowed_urls[] = str_replace(get_site_url(), '', admin_url());
}
public function add_menu()
{
$this->screen_id = add_menu_page(
__('Static HTML pages', 'static-html-to-wp'),
'Static Pages',
'manage_options',
'static-html-to-wp-list-page',
array(self::getInstance(), 'display'),
'dashicons-designmodo',
58
);
}
public function enqueue_scripts(){
$screen = get_current_screen();
if( !$screen || $screen->id != $this->screen_id ){
return;
}
wp_enqueue_style('static-html-to-wp', StaticHtmlToWPApp::getPluginUrl('assets/css/pages-list.min.css'), array(),'1.0.0','all');
wp_enqueue_style('sweetalert2', StaticHtmlToWPApp::getPluginUrl('assets/css/sweetalert2.min.css'), array(),'8.0.1','all');
wp_enqueue_script('promise-polyfill', StaticHtmlToWPApp::getPluginUrl('assets/js/polyfill.min.js'), array(),'8.0.1',true);
wp_enqueue_script('sweetalert2', StaticHtmlToWPApp::getPluginUrl('assets/js/sweetalert2.all.min.js'), array('promise-polyfill'),'8.0.1',true);
wp_enqueue_script('ace', StaticHtmlToWPApp::getPluginUrl('assets/js/ace1.4.2/ace.js'), array(),'1.4.2',true);
wp_enqueue_script('static-html-to-wp', StaticHtmlToWPApp::getPluginUrl('assets/js/pages-list.min.js'), array('sweetalert2', 'ace', 'jquery'),'1.0.0',true);
wp_localize_script( 'static-html-to-wp', 'static_html_to_wp_data',
array(
'ajax_url' => admin_url('admin-ajax.php'),
'not_allowed_urls' => $this->not_allowed_urls,
'actions' => array(
'delete_archive' => '_sh_user_action_delete_archive',
'action_on_existing_archive' => '_sh_user_action_on_existing_archive',
'save_html_file' => '_sh_save_html_file',
),
'aceide_install_link' => add_query_arg(array('s'=>'AceIDE', 'tab'=>'search', 'type'=>'term'),admin_url('plugin-install.php')),
'locale' => array(
'ajax' => array(
'error' => __('Something wrong. Refresh the page and try again.', 'static-html-to-wp'),
'add_new' => __('Create new', 'static-html-to-wp'),
'replace' => __('Replace existing', 'static-html-to-wp'),
'confirm_delete' => __('Are you sure you want to delete this archive?', 'static-html-to-wp'),
),
'url_not_allowed' => __('This URL is not allowed', 'static-html-to-wp'),
'not_installed_aceide' => __('For using this possibility you need to install and activate the AceIDE plugin.', 'static-html-to-wp'),
'install_aceide_button' => __('Install it!', 'static-html-to-wp'),
),
)
);
}
public function display(){
if( isset($_GET['action']) && $_GET['action'] == 'view' && !empty($_GET['id']) ){
if(!empty($_GET['html_page_id']))
$this->displayHtmlPage(absint($_GET['html_page_id']));
else
$this->displayArchivePage(absint($_GET['id']));
}else{
$this->displayListPage();
}
}
public function displayListPage(){
$max_upload = (int)(ini_get('upload_max_filesize'));
$max_post = (int)(ini_get('post_max_size'));
$memory_limit = (int)(ini_get('memory_limit'));
$max_upload_mb = min($max_upload, $max_post, $memory_limit);
$wp_list_table = new StaticHtmlToWPAdminList();
$wp_list_table->prepare_items();
include dirname( StaticHtmlToWPApp::getPluginPath()).'/views/admin/archives-list.php';
}
public function displayArchivePage( $id ){
$archive = StaticHtmlToWPModelArchive::getOneById($id);
if(!empty($archive)){
// if(!$archive->is_checked) $archive->check();
$archive->check();
}
$back_link = remove_query_arg(array('action', 'id'));
$browse_folder_link = is_plugin_active('aceide/AceIDE.php') ? add_query_arg(array('page'=>'aceide','sh_archive_id'=>$id), admin_url('admin.php')): '#';
include dirname( StaticHtmlToWPApp::getPluginPath()).'/views/admin/archive-page.php';
}
public function displayHtmlPage( $id ){
$back_link = remove_query_arg(array('html_page_id'));
$page = StaticHtmlToWPModelPage::getOneById($id);
$browse_folder_link = is_plugin_active('aceide/AceIDE.php') ? add_query_arg(array('page'=>'aceide','sh_archive_id'=>absint($_GET['id'])), admin_url('admin.php')): '#';
include dirname( StaticHtmlToWPApp::getPluginPath()).'/views/admin/html-page.php';
}
public function ajaxUploadArchive(){
check_ajax_referer();
if(empty($_FILES['archivezip'])|| empty($_FILES['archivezip']['name']))
wp_send_json_error(__('Please select a file'));
$archive_zip_file = $_FILES['archivezip'];
if(isset( $archive_zip_file['error'] ) && ! is_numeric( $archive_zip_file['error'] ) && $archive_zip_file['error'])
wp_send_json_error($archive_zip_file['error']);
$file = new StaticHtmlToWPModelFile($archive_zip_file['name'],$archive_zip_file['tmp_name']);
if($file->exists()){
if(!$file->saveTmpFile())
wp_send_json_error(__("Can't upload the file. Most often, the error is caused by incorrect folder permissions within the wp-content/uploads directory.", 'static-html-to-wp'));
wp_send_json_success(array(
'name' => $archive_zip_file['name'],
'path' => $file->getPath(),
'_nonce' => wp_create_nonce(),
'is_exists' => true,
'message' => __("An archive with this name already exists. What do you want to do?", 'static-html-to-wp'),
));
}else{
$isUploaded = $file->unzip();
if(is_wp_error($isUploaded))
wp_send_json_error($isUploaded->get_error_message());
elseif(false === $isUploaded)
wp_send_json_error(__("Something wrong. Refresh the page and try again.", 'static-html-to-wp'));
$file->remove();
$archive = $file->save();
if(empty($archive))
wp_send_json_error(__("Can't save data. Please contact support.", 'static-html-to-wp'));
$archive->check();
wp_send_json_success(array(
'is_exists' => false,
'url' => admin_url('admin.php?page=static-html-to-wp-list-page&action=view&id='.$archive->id),
'message' => __("Archive has been successfully uploaded", 'static-html-to-wp')
));
}
}
public function ajaxUserActionOnExistingArchive()
{
check_ajax_referer(-1, '_nonce');
if( empty($_POST['name']) || empty($_POST['path']) || empty($_POST['user_action']) )
wp_send_json_error(__("Something wrong. Refresh the page and try again.", 'static-html-to-wp'));
$file = new StaticHtmlToWPModelFile($_POST['name'],$_POST['path']);
$action = $_POST['user_action'];
if( 'cancel' == $action ){
$file->remove();
wp_send_json_success(array(
'message' =>''
));
}elseif ( 'add_new' == $action ){
$new_name = StaticHtmlToWPModelArchive::findUniqueName($_POST['name']);
$file->setName($new_name);
$isUploaded = $file->unzip();
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v1.0.zip
共421个文件
js:395个
php:17个
css:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 105 浏览量
2022-04-13
21:26:24
上传
评论
收藏 2.15MB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v1.0 Static HTML - Upload Static Pages With Plugin For WordPress in Minutes 静态HTML - 以分钟为单位的WordPress上传静态页面" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v1.0.zip (421个子文件)
sweetalert2.min.css 26KB
pages-list.css 7KB
pages-list.min.css 6KB
designmodo-icon.css 1014B
designmodo-icon.eot 1KB
worker-xquery.js 1.56MB
mode-php_laravel_blade.js 467KB
mode-php.js 463KB
ace.js 358KB
worker-coffee.js 324KB
mode-jsoniq.js 228KB
mode-xquery.js 226KB
worker-html.js 212KB
worker-javascript.js 160KB
worker-css.js 137KB
mode-slim.js 99KB
keybinding-vim.js 97KB
mode-html_elixir.js 76KB
worker-php.js 76KB
mode-markdown.js 71KB
mode-html_ruby.js 70KB
mode-csound_document.js 70KB
mode-ejs.js 70KB
mode-soy_template.js 68KB
mode-luapage.js 68KB
mode-razor.js 66KB
mode-rhtml.js 64KB
mode-velocity.js 64KB
mode-liquid.js 64KB
mode-twig.js 63KB
mode-smarty.js 63KB
mode-autohotkey.js 62KB
mode-visualforce.js 62KB
mode-coldfusion.js 62KB
mode-handlebars.js 61KB
sweetalert2.all.min.js 61KB
mode-django.js 61KB
mode-curly.js 60KB
mode-html.js 59KB
mode-pgsql.js 58KB
mode-objectivec.js 54KB
worker-xml.js 54KB
mode-jade.js 47KB
worker-lua.js 46KB
mode-mask.js 42KB
sweetalert.min.js 40KB
mode-csound_orchestra.js 39KB
mode-haml.js 39KB
mode-jsp.js 37KB
lsl.js 35KB
ext-language_tools.js 35KB
mode-powershell.js 32KB
mode-ftl.js 32KB
worker-json.js 32KB
mode-svg.js 32KB
mode-erlang.js 29KB
theme-ambiance.js 27KB
mode-lsl.js 26KB
mode-mel.js 25KB
keybinding-emacs.js 24KB
mode-java.js 23KB
mode-scala.js 23KB
mode-groovy.js 22KB
mode-less.js 22KB
mode-sjs.js 21KB
ext-emmet.js 21KB
ruby.js 21KB
mode-matlab.js 20KB
mode-actionscript.js 20KB
mode-css.js 20KB
mode-gobstones.js 20KB
mode-wollok.js 20KB
mode-tsx.js 20KB
mode-typescript.js 20KB
pages-list.js 20KB
css.js 20KB
liquid.js 19KB
html.js 19KB
mode-scss.js 19KB
mode-javascript.js 18KB
mode-perl6.js 18KB
mode-vala.js 17KB
mode-sqlserver.js 16KB
mode-elixir.js 16KB
mode-sass.js 16KB
mode-ocaml.js 16KB
mode-dart.js 14KB
ext-settings_menu.js 14KB
mode-stylus.js 14KB
mode-apache_conf.js 14KB
ext-options.js 14KB
mode-nix.js 13KB
mode-glsl.js 13KB
mode-protobuf.js 13KB
mode-red.js 13KB
mode-kotlin.js 12KB
mode-xml.js 12KB
ext-searchbox.js 12KB
pages-list.min.js 12KB
mode-haskell.js 12KB
共 421 条
- 1
- 2
- 3
- 4
- 5
资源评论
Lee达森
- 粉丝: 1563
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 上海牛津英语_高中一年级上_词汇提炼.doc
- 数学源于生活用于生活.doc
- 苏教版四年级(下册)按课文填空.doc
- 苏版四年级(上册)数学第四单元教学案.doc
- 我国农业银行笔试题目和答案.doc
- 网络安全知识试题库完整.doc
- 我国农业机械化的现状和发展趋势.doc
- 五年级解方程及应用题知识点及例题.doc
- 系学生会学习部申请书(精选多篇).doc
- 小学生科技活动辅导教学案.doc
- 小学数学课堂教学中小组合作学习的有效性.doc
- weixin411医疗就诊微信小程序设计与实现开发-0d26l+django .zip
- 学校团委书记竞聘演讲稿[精选多篇].doc
- 学校消防工作计划(精选多篇).doc
- 一级锅炉水处理试题和答案.doc
- 义务教育阶段双语教育新教双语教学质量评估自查自评报告.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功