├── 404.php ├── LICENSE ├── README.md ├── archive.php ├── comments.php ├── css ├── bootstrap.css ├── font-awesome.min.css └── nav.css ├── fonts ├── FontAwesome.otf ├── fontawesome-webfont.eot ├── fontawesome-webfont.svg ├── fontawesome-webfont.ttf ├── fontawesome-webfont.woff └── fontawesome-webfont.woff2 ├── footer.php ├── functions.php ├── go.php ├── header.php ├── images ├── add.png ├── alipay_qrcode.png ├── app-ico.png ├── favicon.png ├── login.jpg ├── logo-collapsed@2x.png ├── logo@2x.png ├── logo_dark@2x.png └── wechat_qrcode.png ├── inc ├── ajax.php ├── contribute-ajax.php ├── fav-content.php ├── frame │ ├── assets │ │ ├── css │ │ │ ├── cs-framework-light.css │ │ │ ├── cs-framework-rtl.css │ │ │ ├── cs-framework-rtl.min.css │ │ │ ├── cs-framework.css │ │ │ ├── cs-framework.min.css │ │ │ ├── font-awesome.css │ │ │ └── font-awesome.min.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ ├── images │ │ │ ├── checkerboard.png │ │ │ ├── chosen-sprite.png │ │ │ ├── chosen-sprite@2x.png │ │ │ └── setting.png │ │ ├── js │ │ │ ├── cs-framework.js │ │ │ ├── cs-framework.min.js │ │ │ ├── cs-plugins.js │ │ │ ├── cs-plugins.min.js │ │ │ └── vendor │ │ │ │ ├── chosen.jquery.js │ │ │ │ ├── jquery.actual.js │ │ │ │ ├── jquery.interdependencies.js │ │ │ │ └── jquery.tooltip.js │ │ └── scss │ │ │ ├── cs-framework-light.scss │ │ │ ├── cs-framework-rtl.scss │ │ │ ├── cs-framework.scss │ │ │ └── vendor │ │ │ ├── _base.scss │ │ │ ├── _chosen.scss │ │ │ └── _mixins.scss │ ├── classes │ │ ├── abstract.class.php │ │ ├── customize.class.php │ │ ├── framework.class.php │ │ ├── metabox.class.php │ │ ├── options.class.php │ │ ├── shortcode.class.php │ │ └── taxonomy.class.php │ ├── config │ │ ├── framework.config.php │ │ ├── metabox.config.php │ │ └── taxonomy.config.php │ ├── cs-framework-path.php │ ├── cs-framework.php │ ├── fields │ │ ├── background │ │ │ └── background.php │ │ ├── backup │ │ │ └── backup.php │ │ ├── checkbox │ │ │ └── checkbox.php │ │ ├── color_picker │ │ │ └── color_picker.php │ │ ├── content │ │ │ └── content.php │ │ ├── fieldset │ │ │ └── fieldset.php │ │ ├── gallery │ │ │ └── gallery.php │ │ ├── group │ │ │ └── group.php │ │ ├── heading │ │ │ └── heading.php │ │ ├── icon │ │ │ ├── 01-font-awesome.json │ │ │ └── icon.php │ │ ├── image │ │ │ └── image.php │ │ ├── image_select │ │ │ └── image_select.php │ │ ├── notice │ │ │ └── notice.php │ │ ├── number │ │ │ └── number.php │ │ ├── radio │ │ │ └── radio.php │ │ ├── repeater │ │ │ └── repeater.php │ │ ├── select │ │ │ └── select.php │ │ ├── sorter │ │ │ └── sorter.php │ │ ├── subheading │ │ │ └── subheading.php │ │ ├── switcher │ │ │ └── switcher.php │ │ ├── text │ │ │ └── text.php │ │ ├── textarea │ │ │ └── textarea.php │ │ ├── typography │ │ │ ├── google-fonts.json │ │ │ └── typography.php │ │ ├── upload │ │ │ └── upload.php │ │ └── wysiwyg │ │ │ └── wysiwyg.php │ ├── functions │ │ ├── actions.php │ │ ├── customize.php │ │ ├── deprecated.php │ │ ├── enqueue.php │ │ ├── fallback.php │ │ ├── helpers.php │ │ ├── sanitize.php │ │ └── validate.php │ └── index.php ├── img-upload.php ├── inc.php ├── post-type.php └── register.php ├── index.php ├── js ├── TweenMax.min.js ├── app.js ├── bootstrap.min.js ├── jquery-3.7.1.min.js └── lazyload.min.js ├── languages ├── en.mo ├── en.po ├── en_GB.mo ├── en_GB.po ├── en_US.mo ├── en_US.po └── webstack.pot ├── page.php ├── screenshot.jpg ├── search-tool.php ├── search.php ├── single-sites.php ├── single.php ├── style.css ├── taxonomy-favorites.php ├── template-contribute.php ├── template-posts.php └── templates ├── bulletin.php ├── friendlink.php ├── header-banner.php ├── header-nav.php └── site-card.php /404.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 14 | 15 |
16 |
17 |
18 |
19 |

404

20 |

21 |
22 | 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 owen, LoveDoLove 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebStack 2 | WordPress 版 WebStack 主题。前往演示站 3 |
4 | 5 | ### 声明 6 | 当你使用 WebStack 主题发布文章、文字、图片、视频等内容均属于你自己的行为,你的这些行为所带来的安全或法律风险均需自行承担。 7 | 8 | 9 | “Webstack Pro”是作者在19年尝试的一个收费项目,现已不在维护支持,且与Viggo无关,应当时名字欠缺考虑,给Viggo带来了不必要的麻烦,在此道歉。
10 | 现今网络上流传的“Webstack Pro”版本均为盗用作者19年的内容,与作者和Viggo无关。 11 | 12 | ### 首页截图 13 |
14 | 15 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/01.png) 16 |
17 | 18 | ### 环境要求 19 | + WordPress 4.4+ 20 | + WordPress 伪静态 21 | + PHP 5.7+ 7.0+ 22 |
23 | 24 | ### 安装指南 25 | + 安装 WordPress ,教程百度 26 | + 设置伪静态(下方规则按自己服务器环境二选一) 27 | ``` 28 | # Nginx规则 29 | location / 30 | { 31 | try_files $uri $uri/ /index.php?$args; 32 | } 33 | rewrite /wp-admin$ $scheme://$host$uri/ permanent; 34 | 35 | # Apache 规则 36 | 37 | RewriteEngine On 38 | RewriteBase / 39 | RewriteRule ^index\.php$ - [L] 40 | RewriteCond %{REQUEST_FILENAME} !-f 41 | RewriteCond %{REQUEST_FILENAME} !-d 42 | RewriteRule . /index.php [L] 43 | 44 | ``` 45 | + WordPress 后台「主题」栏目 -> 上传主题 -> 启用主题,或者在 /wp-content/themes 文件夹新建webstack文件夹,并上传所有文件 46 | + 果然点击地址出现404,请到WordPress 后台「设置」栏目 -> 固定链接 -> 保存更改 47 | + 反馈交♂流:一为忆 48 | 49 |
50 | 51 | ### 主题使用 52 | + 在 WordPress 后台“网址”文章类型下添加内容 53 | + 分类最多两级,且父级不要添加内容 54 | + 可以不添加网址图片,主题会自动获取目标网址的 favicon 图标 55 | + 导航菜单栏标题前面的图标请在分类图像描述中填入(参考下图),图标样式请参考fontawesome 56 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/02.png) 57 | + 增加分类快速添加图标的方法 58 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/07.png) 59 | + 导航菜单栏下方可以添加自定义菜单,在后台的外观-->菜单里设置,在菜单的css类添加图标(参考下图),图标样式请参考fontawesome 60 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/03.png) 61 | + 如果菜单里没有css类,请按下图添加 62 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/04.jpg) 63 | + 如果你有更多功能需求,点我-> 64 |
65 | 66 | ### 后台截图 67 |
68 | 69 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/05.jpg) 70 | ![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/06.png) 71 |
72 | 73 | ### 感谢 74 | 感谢 Viggo 的前台设计 75 |
76 | 77 | ### 更新 78 | 更新日志 79 | 更新方法为替换源文件,或者在wordpress后台删除主题,然后重新安装主题 80 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 20 |
21 | 22 | 23 | 24 | 25 |
26 |
27 |
28 |

29 |
30 |
31 | 32 | 33 |
34 |

35 | 36 |

37 | 49 |
50 |
51 |
52 |
53 | 54 |
55 |
56 | 0, 58 | 'before_page_number' => '', 59 | 'mid_size' => 2, 60 | ));?> 61 |
62 |
63 |
64 |
65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /comments.php: -------------------------------------------------------------------------------- 1 | 25 | 26 |
27 | 28 | 32 |

33 | 53 |

54 | 55 |
    56 | 100, 60 | 'style' => 'ol', 61 | 'short_ping' => true, 62 | ) 63 | ); 64 | ?> 65 |
66 | 67 | 75 | 76 |

77 | 82 | 83 |
84 | -------------------------------------------------------------------------------- /fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | ' . io_get_option('icp') . ' '; 17 | } 18 | if ($police_icp = io_get_option('police_icp')) { 19 | if (preg_match('/\d+/', $police_icp, $arr)) { 20 | $_icp .= ' ' . $police_icp . ' '; 21 | } 22 | } 23 | ?> 24 | 39 |
40 |
41 | 42 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | <?php _e('加载中','i_theme') ?> 23 | 24 | 35 | 36 | 37 | 38 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | 53 | -------------------------------------------------------------------------------- /header.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | > 15 | 16 | 17 | 18 | 19 | <?php bloginfo('name'); ?> | <?php bloginfo( 'description');?> 20 | 21 | <?php wp_title( '|', true, 'right' ); bloginfo('name'); ?> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | > 37 |
38 | -------------------------------------------------------------------------------- /images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/add.png -------------------------------------------------------------------------------- /images/alipay_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/alipay_qrcode.png -------------------------------------------------------------------------------- /images/app-ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/app-ico.png -------------------------------------------------------------------------------- /images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/favicon.png -------------------------------------------------------------------------------- /images/login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/login.jpg -------------------------------------------------------------------------------- /images/logo-collapsed@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/logo-collapsed@2x.png -------------------------------------------------------------------------------- /images/logo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/logo@2x.png -------------------------------------------------------------------------------- /images/logo_dark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/logo_dark@2x.png -------------------------------------------------------------------------------- /images/wechat_qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/images/wechat_qrcode.png -------------------------------------------------------------------------------- /inc/ajax.php: -------------------------------------------------------------------------------- 1 | $wp_upload_dir['url'] . '/' . $dataname, // 外部链接的 url 19 | 'post_mime_type' => $file['type'], // 文件 mime 类型 20 | 'post_title' => preg_replace( '/\.[^.]+$/', '', $basename ), // 附件标题,采用去除扩展名之后的文件名 21 | 'post_content' => '', // 文章内容,留空 22 | 'post_status' => 'inherit' 23 | ); 24 | $attach_id = wp_insert_attachment( $attachment, $filename ); // 插入附件信息 25 | if($attach_id != 0){ 26 | require_once( ABSPATH . 'wp-admin/includes/image.php' ); // 确保包含此文件,因为wp_generate_attachment_metadata()依赖于此文件。 27 | $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); 28 | wp_update_attachment_metadata( $attach_id, $attach_data ); // 生成附件的元数据,并更新数据库记录。 29 | print_r(json_encode(array('status'=>1,'msg'=>__('图片添加成功','i_theme'),'data'=>array('id'=>$attach_id,'src'=>wp_get_attachment_url( $attach_id ),'title'=>$basename)))); 30 | exit(); 31 | }else{ 32 | echo '{"status":4,"msg":"'.__('图片上传失败!','i_theme').'"}'; 33 | exit(); 34 | } 35 | } 36 | } 37 | 38 | //删除图片 39 | add_action('wp_ajax_nopriv_img_remove', 'io_img_remove'); 40 | add_action('wp_ajax_img_remove', 'io_img_remove'); 41 | function io_img_remove(){ 42 | $attach_id = $_POST["id"]; 43 | if( empty($attach_id) ){ 44 | echo '{"status":3,"msg":"'.__('没有上传图像!','i_theme').'"}'; 45 | exit; 46 | } 47 | if ( false === wp_delete_attachment( $attach_id ) ) 48 | echo '{"status":4,"msg":"'.sprintf(__('图片 %s 删除失败!','i_theme'), $attach_id).'"}'; 49 | else 50 | echo '{"status":1,"msg":"'.__('删除成功!','i_theme').'"}'; 51 | exit; 52 | } 53 | 54 | //提交文章 55 | add_action('wp_ajax_nopriv_contribute_post', 'io_contribute'); 56 | add_action('wp_ajax_contribute_post', 'io_contribute'); 57 | function io_contribute(){ 58 | $delay = 40; 59 | if( isset($_COOKIE["tougao"]) && ( time() - $_COOKIE["tougao"] ) < $delay ){ 60 | error('{"status":2,"msg":"'.sprintf(__('您投稿也太勤快了吧,%s秒后再试!','i_theme'), ($delay - ( time() - $_COOKIE["tougao"] )) ).'"}'); 61 | } 62 | 63 | //表单变量初始化 64 | $sites_link = isset( $_POST['tougao_sites_link'] ) ? trim(htmlspecialchars($_POST['tougao_sites_link'], ENT_QUOTES)) : ''; 65 | $sites_sescribe = isset( $_POST['tougao_sites_sescribe'] ) ? trim(htmlspecialchars($_POST['tougao_sites_sescribe'], ENT_QUOTES)) : ''; 66 | $title = isset( $_POST['tougao_title'] ) ? trim(htmlspecialchars($_POST['tougao_title'], ENT_QUOTES)) : ''; 67 | $category = isset( $_POST['tougao_cat'] ) ? $_POST['tougao_cat'] : '0'; 68 | $sites_ico = isset( $_POST['tougao_sites_ico'] ) ? trim(htmlspecialchars($_POST['tougao_sites_ico'], ENT_QUOTES)) : ''; 69 | $wechat_qr = isset( $_POST['tougao_wechat_qr'] ) ? trim(htmlspecialchars($_POST['tougao_wechat_qr'], ENT_QUOTES)) : ''; 70 | $content = isset( $_POST['tougao_content'] ) ? trim(htmlspecialchars($_POST['tougao_content'], ENT_QUOTES)) : ''; 71 | 72 | // 表单项数据验证 73 | if ( $category == "0" ){ 74 | error('{"status":4,"msg":"'.__('请选择分类。','i_theme').'"}'); 75 | } 76 | if ( !empty(get_term_children($category, 'favorites'))){ 77 | error('{"status":4,"msg":"'.__('不能选用父级分类目录。','i_theme').'"}'); 78 | } 79 | if ( empty($sites_sescribe) || mb_strlen($sites_sescribe) > 50 ) { 80 | error('{"status":4,"msg":"'.__('网站描叙必须填写,且长度不得超过50字。','i_theme').'"}'); 81 | } 82 | if ( empty($sites_link) && empty($wechat_qr) ){ 83 | error('{"status":3,"msg":"'.__('网站链接和公众号二维码至少填一项。','i_theme').'"}'); 84 | } 85 | elseif ( !empty($sites_link) && !preg_match('/http(s)?:\/\/[\w.]+[\w\/]*[\w.]*\??[\w=&\+\%]*/is', $sites_link)) { 86 | error('{"status":4,"msg":"'.__('网站链接必须符合URL格式。','i_theme').'"}'); 87 | } 88 | if ( empty($title) || mb_strlen($title) > 30 ) { 89 | error('{"status":4,"msg":"'.__('网站名称必须填写,且长度不得超过30字。','i_theme').'"}'); 90 | } 91 | //if ( empty($content) || mb_strlen($content) > 10000 || mb_strlen($content) < 6) { 92 | // error('{"status":4,"msg":"内容必须填写,且长度不得超过10000字,不得少于6字。"}'); 93 | //} 94 | 95 | $tougao = array( 96 | 'comment_status' => 'closed', 97 | 'ping_status' => 'closed', 98 | //'post_author' => 1,//用于投稿的用户ID 99 | 'post_title' => $title, 100 | 'post_content' => $content, 101 | 'post_status' => 'pending', 102 | 'post_type' => 'sites', 103 | //'tax_input' => array( 'favorites' => array($category) ) //游客不可用 104 | ); 105 | 106 | // 将文章插入数据库 107 | $status = wp_insert_post( $tougao ); 108 | if ($status != 0){ 109 | global $wpdb; 110 | add_post_meta($status, '_sites_sescribe', $sites_sescribe); 111 | add_post_meta($status, '_sites_link', $sites_link); 112 | add_post_meta($status, '_sites_order', '0'); 113 | if( !empty($sites_ico)) 114 | add_post_meta($status, '_thumbnail', $sites_ico); 115 | if( !empty($wechat_qr)) 116 | add_post_meta($status, '_wechat_qr', $wechat_qr); 117 | wp_set_post_terms( $status, array($category), 'favorites'); //设置文章分类 118 | setcookie("tougao", time(), time()+$delay+10); 119 | error('{"status":1,"msg":"'.__('投稿成功!','i_theme').'"}'); 120 | }else{ 121 | error('{"status":4,"msg":"'.__('投稿失败!','i_theme').'"}'); 122 | } 123 | } 124 | function error($ErrMsg) { 125 | echo $ErrMsg; 126 | exit; 127 | } 128 | -------------------------------------------------------------------------------- /inc/contribute-ajax.php: -------------------------------------------------------------------------------- 1 | 50 ) { 36 | error('{"status":4,"msg":"网站描叙必须填写,且长度不得超过50字。"}'); 37 | } 38 | if ( empty($sites_link) && empty($wechat_qr) ){ 39 | error('{"status":3,"msg":"网站链接和公众号二维码至少填一项。"}'); 40 | } 41 | elseif ( !empty($sites_link) && !preg_match('/http(s)?:\/\/[\w.]+[\w\/]*[\w.]*\??[\w=&\+\%]*/is', $sites_link)) { 42 | error('{"status":4,"msg":"网站链接必须符合URL格式。"}'); 43 | } 44 | if ( empty($title) || mb_strlen($title) > 30 ) { 45 | error('{"status":4,"msg":"网站名称必须填写,且长度不得超过30字。"}'); 46 | } 47 | //if ( empty($content) || mb_strlen($content) > 10000 || mb_strlen($content) < 6) { 48 | // error('{"status":4,"msg":"内容必须填写,且长度不得超过10000字,不得少于6字。"}'); 49 | //} 50 | $tougao = array( 51 | 'comment_status' => 'closed', 52 | 'ping_status' => 'closed', 53 | //'post_author' => 1,//用于投稿的用户ID 54 | 'post_title' => $title, 55 | 'post_content' => $content, 56 | 'post_status' => 'pending', 57 | 'post_type' => 'sites', 58 | //'tax_input' => array( 'favorites' => array($category) ) //游客不可用 59 | ); 60 | 61 | // 将文章插入数据库 62 | $status = wp_insert_post( $tougao ); 63 | if ($status != 0){ 64 | global $wpdb; 65 | add_post_meta($status, '_sites_sescribe', $sites_sescribe); 66 | add_post_meta($status, '_sites_link', $sites_link); 67 | add_post_meta($status, '_sites_order', '0'); 68 | if( !empty($sites_ico)) 69 | add_post_meta($status, '_thumbnail', $sites_ico); 70 | if( !empty($wechat_qr)) 71 | add_post_meta($status, '_wechat_qr', $wechat_qr); 72 | wp_set_post_terms( $status, array($category), 'favorites'); //设置文章分类 73 | setcookie("tougao", time(), time()+30); 74 | error('{"status":1,"msg":"投稿成功!"}'); 75 | }else{ 76 | error('{"status":4,"msg":"投稿失败!"}'); 77 | } 78 | 79 | function error($ErrMsg) { 80 | echo $ErrMsg; 81 | exit; 82 | } 83 | -------------------------------------------------------------------------------- /inc/fav-content.php: -------------------------------------------------------------------------------- 1 | 15 |

name; ?>

16 | '.__('此分类需登陆后查看','i_theme').'
'; 19 | return; 20 | } 21 | $site_n = io_get_option('site_n'); 22 | $category_count = $mid->category_count; 23 | $count = $site_n; 24 | if($site_n == 0) $count = min(get_option('posts_per_page'),$category_count); 25 | if($site_n >= 0 && $count < $category_count){ 26 | $link = esc_url( get_term_link( $mid, 'res_category' ) ); 27 | echo "more+"; 28 | } 29 | ?> 30 |
31 | 'sites', //自定义文章类型,这里为sites 37 | 'ignore_sticky_posts' => 1, //忽略置顶文章 38 | 'posts_per_page' => $site_n, //显示的文章数量 39 | 'meta_key' => '_sites_order', 40 | 'orderby' => array( 'meta_value_num' => 'DESC', 'ID' => 'DESC' ), 41 | 'tax_query' => array( 42 | array( 43 | 'taxonomy' => 'favorites', //分类法名称 44 | 'field' => 'id', //根据分类法条款的什么字段查询,这里设置为ID 45 | 'terms' => $mid->term_id, //分类法条款,输入分类的ID,多个ID使用数组:array(1,2) 46 | ) 47 | ), 48 | ); 49 | $myposts = new WP_Query( $args ); 50 | if(!$myposts->have_posts()): ?> 51 |
52 |
53 |
54 | have_posts()): while ($myposts->have_posts()): $myposts->the_post(); 56 | $link_url = get_post_meta($post->ID, '_sites_link', true); 57 | $default_ico = get_theme_file_uri('/images/favicon.png'); 58 | if(io_is_visible( get_post_meta($post->ID, '_visible', true))): 59 | ?> 60 |
61 | 62 |
63 | 64 |
65 |
66 | -------------------------------------------------------------------------------- /inc/frame/assets/css/cs-framework-light.css: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * ----------------------------------------------------------- 4 | * 5 | * Codestar Framework Light Theme 6 | * A Lightweight and easy-to-use WordPress Options Framework 7 | * 8 | * Copyright 2015 Codestar 9 | * 10 | * ----------------------------------------------------------- 11 | * 12 | */ 13 | /** 14 | * 15 | * Option 16 | * 17 | */ 18 | .cs-option-framework { 19 | box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.04); 20 | border: 1px solid #e5e5e5; 21 | } 22 | 23 | .cs-framework .cs-header { 24 | background-color: #f9f9f9; 25 | border-bottom: 1px solid #eee; 26 | } 27 | 28 | .cs-framework .cs-footer { 29 | border-top: 1px solid #eee; 30 | background-color: #f9f9f9; 31 | } 32 | 33 | .cs-framework .cs-header h1 { 34 | color: #333; 35 | } 36 | 37 | /** 38 | * Nav container 39 | */ 40 | .cs-framework .cs-nav-background { 41 | background-color: #f9f9f9; 42 | border-right: 1px solid #eee; 43 | } 44 | 45 | .cs-framework .cs-nav ul li a { 46 | border-bottom-color: #eee; 47 | background-color: transparent; 48 | color: #555; 49 | } 50 | 51 | .cs-framework .cs-nav ul li a:hover { 52 | color: #333; 53 | } 54 | 55 | .cs-framework .cs-nav ul ul { 56 | border-bottom-color: #eee; 57 | } 58 | 59 | .cs-framework .cs-nav ul ul::before { 60 | background-color: #eee; 61 | } 62 | 63 | .cs-framework .cs-nav ul ul li a { 64 | padding: 12px 12px 12px 24px; 65 | background-color: transparent; 66 | border-bottom-color: #eee; 67 | } 68 | 69 | .cs-framework .cs-nav ul li .cs-section-active, 70 | .cs-framework .cs-nav ul ul li .cs-section-active { 71 | background-color: #fff; 72 | color: #333; 73 | } 74 | 75 | /** 76 | * Element container 77 | */ 78 | .cs-framework .cs-body:before, 79 | .cs-framework .cs-body:after { 80 | display: table; 81 | content: ""; 82 | } 83 | 84 | .cs-framework .cs-body:after { 85 | clear: both; 86 | } 87 | 88 | .cs-framework .cs-content .cs-section-title { 89 | background-color: #00a0d2; 90 | } 91 | 92 | .cs-element .cs-title { 93 | width: 35%; 94 | } 95 | 96 | .cs-field-heading, 97 | .cs-field-subheading, 98 | .cs-element .cs-title h4 { 99 | color: #333; 100 | font-weight: 400; 101 | } 102 | 103 | .cs-element .cs-fieldset { 104 | margin-left: 38%; 105 | } 106 | 107 | .cs-field-switcher .cs-text-desc { 108 | margin: 0; 109 | clear: both; 110 | } 111 | 112 | .cs-field-switcher label em { 113 | background-color: #c5c5c5; 114 | } 115 | 116 | .cs-field-switcher label input:checked ~ em { 117 | background-color: #00a0d2; 118 | } 119 | 120 | .cs-element input[type="text"], 121 | .cs-element textarea { 122 | width: 100%; 123 | padding: 6px 8px; 124 | } 125 | 126 | .cs-element input[type="text"], 127 | .cs-element input[type="number"], 128 | .cs-element select { 129 | height: 34px; 130 | } 131 | 132 | .cs-fieldset .wp-editor-wrap { 133 | float: left; 134 | width: 100%; 135 | } 136 | 137 | .cs-fieldset .wp-editor-tools { 138 | padding-top: 0 !important; 139 | background-color: transparent !important; 140 | } 141 | 142 | .cs-field-upload { 143 | position: relative; 144 | } 145 | 146 | .cs-field-upload input[type="text"] { 147 | padding-right: 75px; 148 | } 149 | 150 | .cs-field-upload .button { 151 | margin-top: 10px; 152 | } 153 | 154 | /* Seperator */ 155 | .cs-framework .cs-nav .cs-seperator { 156 | color: #888; 157 | border-bottom-color: #dadada; 158 | } 159 | -------------------------------------------------------------------------------- /inc/frame/assets/css/cs-framework-rtl.css: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * ----------------------------------------------------------- 4 | * 5 | * Codestar Framework 6 | * A Lightweight and easy-to-use WordPress Options Framework 7 | * 8 | * Copyright 2015 Codestar 9 | * 10 | * ----------------------------------------------------------- 11 | * 12 | */ 13 | .cs-framework { 14 | margin-left: 20px; 15 | margin-right: 0; 16 | } 17 | .cs-framework .cs-header h1 { 18 | float: right; 19 | } 20 | .cs-framework .cs-header fieldset { 21 | float: left; 22 | } 23 | .cs-framework .cs-nav { 24 | float: right; 25 | } 26 | .cs-framework .cs-nav ul { 27 | clear: right; 28 | } 29 | .cs-framework .cs-nav ul li .cs-section-active:after { 30 | right: auto; 31 | left: 0; 32 | border-left-color: #fff; 33 | border-right-color: transparent; 34 | } 35 | .cs-framework .cs-nav ul li .cs-arrow:after { 36 | content: "\f053"; 37 | right: auto; 38 | left: 10px; 39 | } 40 | .cs-framework .cs-nav ul li.cs-tab-active .cs-arrow:after { 41 | -moz-transform: rotate(-90deg); 42 | -ms-transform: rotate(-90deg); 43 | -webkit-transform: rotate(-90deg); 44 | transform: rotate(-90deg); 45 | } 46 | .cs-framework .cs-nav ul ul li a { 47 | padding-right: 25px; 48 | padding-left: 15px; 49 | } 50 | .cs-framework .cs-nav ul ul:before { 51 | left: auto; 52 | right: 15px; 53 | } 54 | .cs-framework .cs-nav .cs-icon { 55 | margin-left: 5px; 56 | margin-right: 0; 57 | } 58 | .cs-framework .cs-nav-background { 59 | left: auto; 60 | right: 0; 61 | } 62 | .cs-framework .cs-content { 63 | margin-left: 0; 64 | margin-right: 225px; 65 | } 66 | .cs-framework .cs-content .cs-sections { 67 | float: right; 68 | } 69 | .cs-framework .cs-show-all .cs-content { 70 | margin-right: 0; 71 | overflow: hidden; 72 | } 73 | .cs-framework .cs-expand-all { 74 | right: auto; 75 | left: 40px; 76 | } 77 | .cs-framework .cs-footer { 78 | text-align: left; 79 | } 80 | 81 | .cs-metabox-framework { 82 | margin: -6px -12px -12px -12px; 83 | } 84 | .cs-metabox-framework .cs-content .cs-section-title { 85 | padding: 20px; 86 | } 87 | 88 | .cs-element .cs-title { 89 | float: right; 90 | } 91 | .cs-element .cs-fieldset { 92 | margin-left: 0; 93 | margin-right: 30%; 94 | } 95 | 96 | .cs-pseudo-field { 97 | padding: 0 0 0 5px !important; 98 | } 99 | 100 | .cs-field-number em { 101 | margin-left: 0; 102 | margin-right: 5px; 103 | } 104 | 105 | .cs-field-typography select, 106 | .cs-field-typography .chosen-container { 107 | margin-right: 0; 108 | margin-left: 5px; 109 | } 110 | 111 | .cs-field-checkbox .horizontal li, 112 | .cs-field-radio .horizontal li { 113 | margin-right: 0; 114 | margin-left: 15px; 115 | } 116 | 117 | .cs-field-switcher label { 118 | float: right; 119 | } 120 | .cs-field-switcher .cs-text-desc { 121 | float: right; 122 | margin-left: 0; 123 | margin-right: 5px; 124 | } 125 | 126 | .cs-field-color_picker .cs-alpha-slider { 127 | margin-left: 0; 128 | margin-right: 2px; 129 | } 130 | .cs-field-color_picker .cs-alpha-slider .ui-slider-handle { 131 | margin: 0 -11px; 132 | } 133 | .cs-field-color_picker .cs-alpha-slider-offset { 134 | background-position: center right; 135 | } 136 | .cs-field-color_picker .cs-alpha-text { 137 | right: auto; 138 | left: 10px; 139 | } 140 | 141 | .cs-field-group .ui-accordion-icons { 142 | padding-left: 0; 143 | padding-right: 30px; 144 | } 145 | .cs-field-group .ui-accordion-header-icon { 146 | left: auto; 147 | right: .5em; 148 | } 149 | .cs-field-group .dashicons-arrow-right:before { 150 | content: "\f141"; 151 | } 152 | 153 | .cs-help { 154 | right: auto; 155 | left: 5px; 156 | } 157 | 158 | .cs-field-icon .button { 159 | margin-right: 0; 160 | margin-left: 5px; 161 | } 162 | .cs-field-icon .cs-icon-preview i { 163 | margin-right: 0; 164 | margin-left: 5px; 165 | } 166 | 167 | .cs-field-gallery ul li { 168 | margin-right: 0; 169 | margin-left: 5px; 170 | } 171 | .cs-field-gallery .button { 172 | margin-right: 0; 173 | margin-left: 5px; 174 | } 175 | 176 | .cs-field-sorter .cs-modules { 177 | float: right; 178 | margin-right: 0; 179 | margin-left: 10px; 180 | } 181 | 182 | .cs-taxonomy-add-fields .cs-fieldset { 183 | margin-right: 0; 184 | } 185 | .cs-taxonomy-add-fields .cs-help { 186 | left: -5px; 187 | right: auto; 188 | } 189 | 190 | .cs-taxonomy-edit-fields .cs-fieldset { 191 | margin-left: 0; 192 | margin-right: 225px; 193 | } 194 | .cs-taxonomy-edit-fields .cs-help { 195 | right: auto; 196 | left: -5px; 197 | } 198 | 199 | #cs-save-ajax { 200 | right: auto; 201 | left: 5px; 202 | } 203 | 204 | .cs-dialog .cs-element { 205 | padding-right: 15px; 206 | padding-left: 30px; 207 | } 208 | .cs-dialog .cs-shortcode-clone .cs-remove-clone { 209 | right: auto; 210 | left: 5px; 211 | } 212 | 213 | #customize-controls .cs-element .cs-fieldset, 214 | .widget-content .cs-element .cs-fieldset, 215 | #side-sortables .cs-element .cs-fieldset { 216 | margin-right: 0; 217 | } 218 | 219 | @media only screen and (max-width: 1200px) { 220 | .cs-metabox-framework .cs-element .cs-fieldset { 221 | margin-left: 0; 222 | } 223 | } 224 | @media only screen and (max-width: 782px) { 225 | .cs-framework .cs-fieldset, 226 | .cs-framework .cs-content { 227 | margin-right: 0; 228 | } 229 | } 230 | .ui-dialog { 231 | right: auto; 232 | } 233 | -------------------------------------------------------------------------------- /inc/frame/assets/css/cs-framework-rtl.min.css: -------------------------------------------------------------------------------- 1 | /* Codestar Framework | A Lightweight and easy-to-use WordPress Options Framework - v1.0.2*/ 2 | .cs-framework{margin-left:20px;margin-right:0}.cs-framework .cs-header h1{float:right}.cs-framework .cs-header fieldset{float:left}.cs-framework .cs-nav{float:right}.cs-framework .cs-nav ul{clear:right}.cs-framework .cs-nav ul li .cs-section-active:after{right:auto;left:0;border-left-color:#fff;border-right-color:transparent}.cs-framework .cs-nav ul li .cs-arrow:after{content:"\f053";right:auto;left:10px}.cs-framework .cs-nav ul li.cs-tab-active .cs-arrow:after{-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.cs-framework .cs-nav ul ul li a{padding-right:25px;padding-left:15px}.cs-framework .cs-nav ul ul:before{left:auto;right:15px}.cs-framework .cs-nav .cs-icon{margin-left:5px;margin-right:0}.cs-framework .cs-nav-background{left:auto;right:0}.cs-framework .cs-content{margin-left:0;margin-right:225px}.cs-framework .cs-content .cs-sections{float:right}.cs-framework .cs-show-all .cs-content{margin-right:0;overflow:hidden}.cs-framework .cs-expand-all{right:auto;left:40px}.cs-framework .cs-footer{text-align:left}.cs-metabox-framework{margin:-6px -12px -12px}.cs-metabox-framework .cs-content .cs-section-title{padding:20px}.cs-element .cs-title{float:right}.cs-element .cs-fieldset{margin-left:0;margin-right:30%}.cs-pseudo-field{padding:0 0 0 5px!important}.cs-field-number em{margin-left:0;margin-right:5px}.cs-field-typography .chosen-container,.cs-field-typography select{margin-right:0;margin-left:5px}.cs-field-checkbox .horizontal li,.cs-field-radio .horizontal li{margin-right:0;margin-left:15px}.cs-field-switcher label{float:right}.cs-field-switcher .cs-text-desc{float:right;margin-left:0;margin-right:5px}.cs-field-color_picker .cs-alpha-slider{margin-left:0;margin-right:2px}.cs-field-color_picker .cs-alpha-slider .ui-slider-handle{margin:0 -11px}.cs-field-color_picker .cs-alpha-slider-offset{background-position:center right}.cs-field-color_picker .cs-alpha-text{right:auto;left:10px}.cs-field-group .ui-accordion-icons{padding-left:0;padding-right:30px}.cs-field-group .ui-accordion-header-icon{left:auto;right:.5em}.cs-field-group .dashicons-arrow-right:before{content:"\f141"}.cs-help{right:auto;left:5px}.cs-field-gallery .button,.cs-field-gallery ul li,.cs-field-icon .button,.cs-field-icon .cs-icon-preview i{margin-right:0;margin-left:5px}.cs-field-sorter .cs-modules{float:right;margin-right:0;margin-left:10px}.cs-taxonomy-add-fields .cs-fieldset{margin-right:0}.cs-taxonomy-add-fields .cs-help{left:-5px;right:auto}.cs-taxonomy-edit-fields .cs-fieldset{margin-left:0;margin-right:225px}.cs-taxonomy-edit-fields .cs-help{right:auto;left:-5px}#cs-save-ajax{right:auto;left:5px}.cs-dialog .cs-element{padding-right:15px;padding-left:30px}.cs-dialog .cs-shortcode-clone .cs-remove-clone{right:auto;left:5px}#customize-controls .cs-element .cs-fieldset,#side-sortables .cs-element .cs-fieldset,.widget-content .cs-element .cs-fieldset{margin-right:0}@media only screen and (max-width:1200px){.cs-metabox-framework .cs-element .cs-fieldset{margin-left:0}}@media only screen and (max-width:782px){.cs-framework .cs-content,.cs-framework .cs-fieldset{margin-right:0}}.ui-dialog{right:auto} -------------------------------------------------------------------------------- /inc/frame/assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /inc/frame/assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /inc/frame/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /inc/frame/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /inc/frame/assets/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /inc/frame/assets/images/checkerboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/images/checkerboard.png -------------------------------------------------------------------------------- /inc/frame/assets/images/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/images/chosen-sprite.png -------------------------------------------------------------------------------- /inc/frame/assets/images/chosen-sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/images/chosen-sprite@2x.png -------------------------------------------------------------------------------- /inc/frame/assets/images/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/inc/frame/assets/images/setting.png -------------------------------------------------------------------------------- /inc/frame/assets/js/vendor/jquery.actual.js: -------------------------------------------------------------------------------- 1 | /*! Copyright 2012, Ben Lin (http://dreamerslab.com/) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Version: 1.0.16 5 | * 6 | * Requires: jQuery >= 1.2.3 7 | */ 8 | ;( function ( $ ){ 9 | $.fn.addBack = $.fn.addBack || $.fn.andSelf; 10 | 11 | $.fn.extend({ 12 | 13 | actual : function ( method, options ){ 14 | // check if the jQuery method exist 15 | if( !this[ method ]){ 16 | throw '$.actual => The jQuery method "' + method + '" you called does not exist'; 17 | } 18 | 19 | var defaults = { 20 | absolute : false, 21 | clone : false, 22 | includeMargin : false 23 | }; 24 | 25 | var configs = $.extend( defaults, options ); 26 | 27 | var $target = this.eq( 0 ); 28 | var fix, restore; 29 | 30 | if( configs.clone === true ){ 31 | fix = function (){ 32 | var style = 'position: absolute !important; top: -1000 !important; '; 33 | 34 | // this is useful with css3pie 35 | $target = $target. 36 | clone(). 37 | attr( 'style', style ). 38 | appendTo( 'body' ); 39 | }; 40 | 41 | restore = function (){ 42 | // remove DOM element after getting the width 43 | $target.remove(); 44 | }; 45 | }else{ 46 | var tmp = []; 47 | var style = ''; 48 | var $hidden; 49 | 50 | fix = function (){ 51 | // get all hidden parents 52 | $hidden = $target.parents().addBack().filter( ':hidden' ); 53 | style += 'visibility: hidden !important; display: block !important; '; 54 | 55 | if( configs.absolute === true ) style += 'position: absolute !important; '; 56 | 57 | // save the origin style props 58 | // set the hidden el css to be got the actual value later 59 | $hidden.each( function (){ 60 | // Save original style. If no style was set, attr() returns undefined 61 | var $this = $( this ); 62 | var thisStyle = $this.attr( 'style' ); 63 | 64 | tmp.push( thisStyle ); 65 | // Retain as much of the original style as possible, if there is one 66 | $this.attr( 'style', thisStyle ? thisStyle + ';' + style : style ); 67 | }); 68 | }; 69 | 70 | restore = function (){ 71 | // restore origin style values 72 | $hidden.each( function ( i ){ 73 | var $this = $( this ); 74 | var _tmp = tmp[ i ]; 75 | 76 | if( _tmp === undefined ){ 77 | $this.removeAttr( 'style' ); 78 | }else{ 79 | $this.attr( 'style', _tmp ); 80 | } 81 | }); 82 | }; 83 | } 84 | 85 | fix(); 86 | // get the actual value with user specific methed 87 | // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc 88 | // configs.includeMargin only works for 'outerWidth' and 'outerHeight' 89 | var actual = /(outer)/.test( method ) ? 90 | $target[ method ]( configs.includeMargin ) : 91 | $target[ method ](); 92 | 93 | restore(); 94 | // IMPORTANT, this plugin only return the value of the first element 95 | return actual; 96 | } 97 | }); 98 | })( jQuery ); 99 | -------------------------------------------------------------------------------- /inc/frame/assets/scss/cs-framework-light.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * ----------------------------------------------------------- 4 | * 5 | * Codestar Framework Light Theme 6 | * A Lightweight and easy-to-use WordPress Options Framework 7 | * 8 | * Copyright 2015 Codestar 9 | * 10 | * ----------------------------------------------------------- 11 | * 12 | */ 13 | @import "compass"; 14 | @import "vendor/mixins"; 15 | 16 | /** 17 | * 18 | * Option 19 | * 20 | */ 21 | .cs-option-framework { 22 | box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.04); 23 | border: 1px solid #e5e5e5; 24 | } 25 | 26 | .cs-framework .cs-header { 27 | background-color: #f9f9f9; 28 | border-bottom: 1px solid #eee; 29 | } 30 | 31 | .cs-framework .cs-footer { 32 | border-top: 1px solid #eee; 33 | background-color: #f9f9f9; 34 | } 35 | 36 | .cs-framework .cs-header h1 { 37 | color: #333; 38 | } 39 | 40 | /** 41 | * Nav container 42 | */ 43 | .cs-framework .cs-nav-background { 44 | background-color: #f9f9f9; 45 | border-right: 1px solid #eee; 46 | } 47 | 48 | .cs-framework .cs-nav ul li a { 49 | border-bottom-color: #eee; 50 | background-color: transparent; 51 | color: #555; 52 | } 53 | 54 | .cs-framework .cs-nav ul li a:hover { 55 | color: #333; 56 | } 57 | 58 | .cs-framework .cs-nav ul ul { 59 | border-bottom-color: #eee; 60 | } 61 | 62 | .cs-framework .cs-nav ul ul::before { 63 | background-color: #eee; 64 | } 65 | 66 | .cs-framework .cs-nav ul ul li a { 67 | padding: 12px 12px 12px 24px; 68 | background-color: transparent; 69 | border-bottom-color: #eee; 70 | } 71 | 72 | .cs-framework .cs-nav ul li .cs-section-active, 73 | .cs-framework .cs-nav ul ul li .cs-section-active { 74 | background-color: #fff; 75 | color: #333; 76 | } 77 | 78 | /** 79 | * Element container 80 | */ 81 | .cs-framework .cs-body:before, 82 | .cs-framework .cs-body:after { 83 | display: table; 84 | content: ""; 85 | } 86 | 87 | .cs-framework .cs-body:after { 88 | clear: both; 89 | } 90 | 91 | .cs-framework .cs-content .cs-section-title { 92 | background-color: #00a0d2; 93 | } 94 | 95 | .cs-element .cs-title { 96 | width: 35%; 97 | } 98 | 99 | .cs-field-heading, 100 | .cs-field-subheading, 101 | .cs-element .cs-title h4 { 102 | color: #333; 103 | font-weight: 400; 104 | } 105 | 106 | .cs-element .cs-fieldset { 107 | margin-left: 38%; 108 | } 109 | 110 | .cs-field-switcher .cs-text-desc { 111 | margin: 0; 112 | clear: both; 113 | } 114 | 115 | .cs-field-switcher label em { 116 | background-color: #c5c5c5; 117 | } 118 | 119 | .cs-field-switcher label input:checked ~ em { 120 | background-color: #00a0d2; 121 | } 122 | 123 | .cs-element input[type="text"], 124 | .cs-element input[type="number"], 125 | .cs-element select, 126 | .cs-element textarea { 127 | width: 100%; 128 | padding: 6px 8px; 129 | } 130 | 131 | 132 | .cs-element input[type="text"], 133 | .cs-element input[type="number"], 134 | .cs-element select { 135 | height: 34px; 136 | } 137 | 138 | .cs-fieldset .wp-editor-wrap { 139 | float: left; 140 | width: 100%; 141 | } 142 | 143 | .cs-fieldset .wp-editor-tools { 144 | padding-top: 0 !important; 145 | background-color: transparent !important; 146 | } 147 | 148 | .cs-field-upload { 149 | position: relative; 150 | } 151 | 152 | .cs-field-upload input[type="text"] { 153 | padding-right: 75px; 154 | } 155 | 156 | .cs-field-upload .button { 157 | position: absolute; 158 | top: 34px; 159 | right: 32px; 160 | } 161 | 162 | /* Seperator */ 163 | .cs-framework .cs-nav .cs-seperator { 164 | color: #888; 165 | border-bottom-color: #dadada; 166 | } 167 | -------------------------------------------------------------------------------- /inc/frame/assets/scss/cs-framework-rtl.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * ----------------------------------------------------------- 4 | * 5 | * Codestar Framework 6 | * A Lightweight and easy-to-use WordPress Options Framework 7 | * 8 | * Copyright 2015 Codestar 9 | * 10 | * ----------------------------------------------------------- 11 | * 12 | */ 13 | @import "compass"; 14 | @import "vendor/mixins"; 15 | 16 | .cs-framework{ 17 | margin-left: 20px; 18 | margin-right: 0; 19 | 20 | .cs-header{ 21 | h1{ 22 | float: right; 23 | } 24 | 25 | fieldset{ 26 | float: left; 27 | } 28 | } 29 | 30 | .cs-nav{ 31 | float: right; 32 | 33 | ul{ 34 | clear: right; 35 | 36 | li{ 37 | .cs-section-active:after{ 38 | right: auto; 39 | left: 0; 40 | border-left-color: #fff; 41 | border-right-color: transparent; 42 | } 43 | 44 | .cs-arrow:after{ 45 | content: "\f053"; 46 | right: auto; 47 | left: 10px; 48 | } 49 | 50 | &.cs-tab-active .cs-arrow:after{ 51 | @include transform( rotate(-90deg) ); 52 | } 53 | } 54 | 55 | ul{ 56 | li{ 57 | a{ 58 | padding-right: 25px; 59 | padding-left: 15px; 60 | } 61 | } 62 | 63 | &:before{ 64 | left: auto; 65 | right: 15px; 66 | } 67 | } 68 | } 69 | 70 | .cs-icon{ 71 | margin-left: 5px; 72 | margin-right: 0; 73 | } 74 | } 75 | 76 | .cs-nav-background{ 77 | left: auto; 78 | right: 0; 79 | } 80 | 81 | .cs-content{ 82 | margin-left: 0; 83 | margin-right: 225px; 84 | 85 | .cs-sections{ 86 | float: right; 87 | } 88 | } 89 | 90 | .cs-show-all .cs-content { 91 | margin-right: 0; 92 | overflow: hidden; 93 | } 94 | 95 | .cs-expand-all { 96 | right: auto; 97 | left: 40px; 98 | } 99 | 100 | .cs-footer{ 101 | text-align: left; 102 | } 103 | } 104 | 105 | .cs-metabox-framework{ 106 | margin: -6px -12px -12px -12px; 107 | 108 | .cs-content{ 109 | .cs-section-title{ 110 | padding: 20px; 111 | } 112 | } 113 | } 114 | 115 | .cs-element{ 116 | .cs-title{ 117 | float: right; 118 | } 119 | 120 | .cs-fieldset{ 121 | margin-left: 0; 122 | margin-right: 30%; 123 | } 124 | } 125 | 126 | .cs-pseudo-field{ 127 | padding: 0 0 0 5px !important; 128 | } 129 | 130 | .cs-field-number em{ 131 | margin-left: 0; 132 | margin-right: 5px; 133 | } 134 | 135 | .cs-field-typography select, 136 | .cs-field-typography .chosen-container{ 137 | margin-right: 0; 138 | margin-left: 5px; 139 | } 140 | 141 | .cs-field-checkbox .horizontal li, 142 | .cs-field-radio .horizontal li{ 143 | margin-right: 0; 144 | margin-left: 15px; 145 | } 146 | 147 | .cs-field-switcher{ 148 | label{ 149 | float: right; 150 | } 151 | 152 | .cs-text-desc{ 153 | float: right; 154 | margin-left: 0; 155 | margin-right: 5px; 156 | } 157 | } 158 | 159 | .cs-field-color_picker{ 160 | .cs-alpha-slider{ 161 | margin-left: 0; 162 | margin-right: 2px; 163 | 164 | .ui-slider-handle{ 165 | margin: 0 -11px; 166 | } 167 | } 168 | 169 | .cs-alpha-slider-offset{ 170 | background-position: center right; 171 | } 172 | 173 | .cs-alpha-text{ 174 | right: auto; 175 | left: 10px; 176 | } 177 | } 178 | 179 | .cs-field-group{ 180 | .ui-accordion-icons{ 181 | padding-left: 0; 182 | padding-right: 30px; 183 | } 184 | 185 | .ui-accordion-header-icon{ 186 | left: auto; 187 | right: .5em; 188 | } 189 | 190 | .dashicons-arrow-right:before{ 191 | content: "\f141"; 192 | } 193 | } 194 | 195 | .cs-help{ 196 | right: auto; 197 | left: 5px; 198 | } 199 | 200 | .cs-field-icon{ 201 | .button{ 202 | margin-right: 0; 203 | margin-left: 5px; 204 | } 205 | 206 | .cs-icon-preview i{ 207 | margin-right: 0; 208 | margin-left: 5px; 209 | } 210 | } 211 | 212 | .cs-field-gallery{ 213 | ul li{ 214 | margin-right: 0; 215 | margin-left: 5px; 216 | } 217 | 218 | .button{ 219 | margin-right: 0; 220 | margin-left: 5px; 221 | } 222 | } 223 | 224 | .cs-field-sorter .cs-modules{ 225 | float: right; 226 | margin-right: 0; 227 | margin-left: 10px; 228 | } 229 | 230 | .cs-taxonomy-add-fields{ 231 | 232 | .cs-fieldset{ 233 | margin-right: 0; 234 | } 235 | 236 | .cs-help{ 237 | left: -5px; 238 | right: auto; 239 | } 240 | } 241 | 242 | .cs-taxonomy-edit-fields{ 243 | 244 | .cs-fieldset{ 245 | margin-left: 0; 246 | margin-right: 225px; 247 | } 248 | 249 | .cs-help{ 250 | right: auto; 251 | left: -5px; 252 | } 253 | } 254 | 255 | #cs-save-ajax{ 256 | right: auto; 257 | left: 5px; 258 | } 259 | 260 | .cs-dialog{ 261 | .cs-element{ 262 | padding-right: 15px; 263 | padding-left: 30px; 264 | } 265 | 266 | .cs-shortcode-clone .cs-remove-clone{ 267 | right: auto; 268 | left: 5px; 269 | } 270 | } 271 | 272 | #customize-controls .cs-element .cs-fieldset, 273 | .widget-content .cs-element .cs-fieldset, 274 | #side-sortables .cs-element .cs-fieldset{ 275 | margin-right: 0; 276 | } 277 | 278 | @media only screen and (max-width:1200px){ 279 | .cs-metabox-framework .cs-element .cs-fieldset{ 280 | margin-left: 0; 281 | } 282 | } 283 | 284 | @media only screen and (max-width:782px){ 285 | .cs-framework .cs-fieldset, 286 | .cs-framework .cs-content{ 287 | margin-right: 0; 288 | } 289 | } 290 | 291 | .ui-dialog{ 292 | right: auto; 293 | } 294 | -------------------------------------------------------------------------------- /inc/frame/assets/scss/cs-framework.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * ----------------------------------------------------------- 4 | * 5 | * Codestar Framework 6 | * A Lightweight and easy-to-use WordPress Options Framework 7 | * 8 | * Copyright 2015 Codestar 9 | * 10 | * ----------------------------------------------------------- 11 | * 12 | */ 13 | @import "compass"; 14 | @import "vendor/mixins"; 15 | @import "vendor/chosen"; 16 | @import "vendor/base"; 17 | -------------------------------------------------------------------------------- /inc/frame/assets/scss/vendor/_mixins.scss: -------------------------------------------------------------------------------- 1 | @mixin opacity( $opacity ) { 2 | opacity: $opacity; 3 | } -------------------------------------------------------------------------------- /inc/frame/classes/abstract.class.php: -------------------------------------------------------------------------------- 1 | options = apply_filters( 'cs_customize_options', $options ); 43 | 44 | do_action( 'cs_customize_options_config', $this->options ); 45 | 46 | if( ! empty( $this->options ) ) { 47 | $this->addAction( 'customize_register', 'customize_register' ); 48 | } 49 | 50 | } 51 | 52 | // instance 53 | public static function instance( $options = array() ){ 54 | if ( is_null( self::$instance ) && CS_ACTIVE_CUSTOMIZE ) { 55 | self::$instance = new self( $options ); 56 | } 57 | return self::$instance; 58 | } 59 | 60 | // customize register 61 | public function customize_register( $wp_customize ) { 62 | 63 | // load extra WP_Customize_Control 64 | cs_locate_template( 'functions/customize.php' ); 65 | do_action( 'cs_customize_register', $wp_customize ); 66 | 67 | $panel_priority = 1; 68 | 69 | foreach ( $this->options as $value ) { 70 | 71 | $this->priority = $panel_priority; 72 | 73 | if( isset( $value['sections'] ) ) { 74 | 75 | $wp_customize->add_panel( $value['name'], array( 76 | 'title' => $value['title'], 77 | 'priority' => ( isset( $value['priority'] ) ) ? $value['priority'] : $panel_priority, 78 | 'description' => ( isset( $value['description'] ) ) ? $value['description'] : '', 79 | )); 80 | 81 | $this->add_section( $wp_customize, $value, $value['name'] ); 82 | 83 | } else { 84 | 85 | $this->add_section( $wp_customize, $value ); 86 | 87 | } 88 | 89 | $panel_priority++; 90 | 91 | } 92 | 93 | } 94 | 95 | // add customize section 96 | public function add_section( $wp_customize, $value, $panel = false ) { 97 | 98 | $section_priority = ( $panel ) ? 1 : $this->priority; 99 | $sections = ( $panel ) ? $value['sections'] : array( 'sections' => $value ); 100 | 101 | foreach ( $sections as $section ) { 102 | 103 | // add_section 104 | $wp_customize->add_section( $section['name'], array( 105 | 'title' => $section['title'], 106 | 'priority' => ( isset( $section['priority'] ) ) ? $section['priority'] : $section_priority, 107 | 'description' => ( isset( $section['description'] ) ) ? $section['description'] : '', 108 | 'panel' => ( $panel ) ? $panel : '', 109 | ) ); 110 | 111 | $setting_priority = 1; 112 | 113 | foreach ( $section['settings'] as $setting ) { 114 | 115 | $setting_name = CS_CUSTOMIZE . '[' . $setting['name'] .']'; 116 | 117 | // add_setting 118 | $wp_customize->add_setting( $setting_name, 119 | wp_parse_args( $setting, array( 120 | 'type' => 'option', 121 | 'capability' => 'edit_theme_options', 122 | 'sanitize_callback' => 'cs_sanitize_clean', 123 | ) 124 | ) 125 | ); 126 | 127 | // add_control 128 | $control_args = wp_parse_args( $setting['control'], array( 129 | 'unique' => CS_CUSTOMIZE, 130 | 'section' => $section['name'], 131 | 'settings' => $setting_name, 132 | 'priority' => $setting_priority, 133 | )); 134 | 135 | if( $control_args['type'] == 'cs_field' ) { 136 | 137 | $call_class = 'WP_Customize_'. $control_args['type'] .'_Control'; 138 | $wp_customize->add_control( new $call_class( $wp_customize, $setting['name'], $control_args ) ); 139 | 140 | } else { 141 | 142 | $wp_controls = array( 'color', 'upload', 'image', 'media' ); 143 | $call_class = 'WP_Customize_'. ucfirst( $control_args['type'] ) .'_Control'; 144 | 145 | if( in_array( $control_args['type'], $wp_controls ) && class_exists( $call_class ) ) { 146 | $wp_customize->add_control( new $call_class( $wp_customize, $setting['name'], $control_args ) ); 147 | } else { 148 | $wp_customize->add_control( $setting['name'], $control_args ); 149 | } 150 | 151 | } 152 | 153 | $setting_priority++; 154 | } 155 | 156 | $section_priority++; 157 | 158 | } 159 | 160 | } 161 | 162 | } 163 | -------------------------------------------------------------------------------- /inc/frame/classes/metabox.class.php: -------------------------------------------------------------------------------- 1 | options = apply_filters( 'cs_metabox_options', $options ); 34 | 35 | if( ! empty( $this->options ) ) { 36 | $this->addAction( 'add_meta_boxes', 'add_meta_box' ); 37 | $this->addAction( 'save_post', 'save_post', 10, 2 ); 38 | } 39 | 40 | } 41 | 42 | // instance 43 | public static function instance( $options = array() ){ 44 | if ( is_null( self::$instance ) && CS_ACTIVE_METABOX ) { 45 | self::$instance = new self( $options ); 46 | } 47 | return self::$instance; 48 | } 49 | 50 | // add metabox 51 | public function add_meta_box( $post_type ) { 52 | 53 | foreach ( $this->options as $value ) { 54 | add_meta_box( $value['id'], $value['title'], array( &$this, 'render_meta_box_content' ), $value['post_type'], $value['context'], $value['priority'], $value ); 55 | } 56 | 57 | } 58 | 59 | // metabox render content 60 | public function render_meta_box_content( $post, $callback ) { 61 | 62 | global $post, $cs_errors, $typenow; 63 | 64 | wp_nonce_field( 'cs-framework-metabox', 'cs-framework-metabox-nonce' ); 65 | 66 | $unique = $callback['args']['id']; 67 | $sections = $callback['args']['sections']; 68 | $meta_value = get_post_meta( $post->ID, $unique, true ); 69 | $transient = get_transient( 'cs-metabox-transient' ); 70 | //$cs_errors = $transient['errors']; 71 | $has_nav = ( count( $sections ) >= 2 && $callback['args']['context'] != 'side' ) ? true : false; 72 | $show_all = ( ! $has_nav ) ? ' cs-show-all' : ''; 73 | $section_id = ( ! empty( $transient['ids'][$unique] ) ) ? $transient['ids'][$unique] : ''; 74 | $section_id = cs_get_var( 'cs-section', $section_id ); 75 | 76 | echo '
'; 77 | 78 | echo ''; 79 | 80 | echo '
'; 81 | 82 | if( $has_nav ) { 83 | 84 | echo '
'; 85 | 86 | echo '
    '; 87 | $num = 0; 88 | foreach( $sections as $value ) { 89 | 90 | if( ! empty( $value['typenow'] ) && $value['typenow'] !== $typenow ) { continue; } 91 | 92 | $tab_icon = ( ! empty( $value['icon'] ) ) ? '' : ''; 93 | 94 | if( isset( $value['fields'] ) ) { 95 | $active_section = ( ( empty( $section_id ) && $num === 0 ) || $section_id == $value['name'] ) ? ' class="cs-section-active"' : ''; 96 | echo '
  • '. $tab_icon . $value['title'] .'
  • '; 97 | } else { 98 | echo '
  • '. $tab_icon . $value['title'] .'
  • '; 99 | } 100 | 101 | $num++; 102 | } 103 | echo '
'; 104 | 105 | echo '
'; 106 | 107 | } 108 | 109 | echo '
'; 110 | 111 | echo '
'; 112 | $num = 0; 113 | foreach( $sections as $v ) { 114 | 115 | if( ! empty( $v['typenow'] ) && $v['typenow'] !== $typenow ) { continue; } 116 | 117 | if( isset( $v['fields'] ) ) { 118 | 119 | $active_content = ( ( empty( $section_id ) && $num === 0 ) || $section_id == $v['name'] ) ? ' style="display: block;"' : ''; 120 | 121 | echo '
'; 122 | echo ( isset( $v['title'] ) ) ? '

'. $v['title'] .'

' : ''; 123 | 124 | foreach ( $v['fields'] as $field_key => $field ) { 125 | 126 | $default = ( isset( $field['default'] ) ) ? $field['default'] : ''; 127 | $elem_id = ( isset( $field['id'] ) ) ? $field['id'] : ''; 128 | if($callback['args']['data_type'] !== 'serialize' ) {//iotheme.cn 129 | $elem_value = get_post_meta($post->ID, $elem_id,true); 130 | }else{ 131 | $elem_value = ( is_array( $meta_value ) && isset( $meta_value[$elem_id] ) ) ? $meta_value[$elem_id] : $default; 132 | }//iotheme.cn 133 | echo cs_add_element( $field, $elem_value, $unique ); 134 | 135 | } 136 | echo '
'; 137 | 138 | } 139 | 140 | $num++; 141 | } 142 | echo '
'; 143 | 144 | echo '
'; 145 | 146 | echo '
'; 147 | 148 | echo ( $has_nav ) ? '
' : ''; 149 | 150 | echo '
'; 151 | 152 | echo '
'; 153 | 154 | echo '
'; 155 | 156 | } 157 | 158 | // save metabox options 159 | public function save_post( $post_id, $post ) { 160 | 161 | if ( wp_verify_nonce( cs_get_var( 'cs-framework-metabox-nonce' ), 'cs-framework-metabox' ) ) { 162 | 163 | $errors = array(); 164 | $post_type = cs_get_var( 'post_type' ); 165 | 166 | foreach ( $this->options as $request_value ) { 167 | 168 | if( in_array( $post_type, (array) $request_value['post_type'] ) ) { 169 | 170 | $request_key = $request_value['id']; 171 | $request = cs_get_var( $request_key, array() ); 172 | 173 | // ignore _nonce 174 | if( isset( $request['_nonce'] ) ) { 175 | unset( $request['_nonce'] ); 176 | } 177 | 178 | foreach( $request_value['sections'] as $key => $section ) { 179 | 180 | if( isset( $section['fields'] ) ) { 181 | 182 | foreach( $section['fields'] as $field ) { 183 | 184 | if( isset( $field['type'] ) && isset( $field['id'] ) ) { 185 | 186 | $field_value = cs_get_vars( $request_key, $field['id'] ); 187 | 188 | // sanitize options 189 | if( isset( $field['sanitize'] ) && $field['sanitize'] !== false ) { 190 | $sanitize_type = $field['sanitize']; 191 | } else if ( ! isset( $field['sanitize'] ) ) { 192 | $sanitize_type = $field['type']; 193 | } 194 | 195 | if( has_filter( 'cs_sanitize_'. $sanitize_type ) ) { 196 | $request[$field['id']] = apply_filters( 'cs_sanitize_' . $sanitize_type, $field_value, $field, $section['fields'] ); 197 | } 198 | 199 | // validate options 200 | if ( isset( $field['validate'] ) && has_filter( 'cs_validate_'. $field['validate'] ) ) { 201 | 202 | $validate = apply_filters( 'cs_validate_' . $field['validate'], $field_value, $field, $section['fields'] ); 203 | 204 | if( ! empty( $validate ) ) { 205 | 206 | $errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' ); 207 | $default_value = isset( $field['default'] ) ? $field['default'] : ''; 208 | if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn 209 | if($meta_value = get_post_meta($post_id, $field['id'],true)) 210 | $request[$field['id']] = $meta_value ; 211 | }else{ 212 | $meta_value = get_post_meta( $post_id, $request_key, true ); 213 | $request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value; 214 | }//iotheme.cn 215 | 216 | } 217 | 218 | } 219 | 220 | } 221 | 222 | } 223 | 224 | } 225 | 226 | } 227 | 228 | $request = apply_filters( 'cs_save_post', $request, $request_key, $post ); 229 | 230 | //if( empty( $request ) ) { 231 | 232 | //delete_post_meta( $post_id, $request_key ); 233 | 234 | //} else { 235 | 236 | //update_post_meta( $post_id, $request_key, $request ); 237 | 238 | //} 239 | if ( empty( $request ) ) {//iotheme.cn 240 | 241 | if ( $request_value['data_type'] !== 'serialize' ) { 242 | foreach ( $request as $key => $value ) { 243 | delete_post_meta( $post_id, $key ); 244 | } 245 | } else { 246 | delete_post_meta( $post_id, $request_key ); 247 | } 248 | 249 | } else { 250 | 251 | if ( $request_value['data_type'] !== 'serialize' ) { 252 | foreach ( $request as $key => $value ) { 253 | update_post_meta( $post_id, $key, $value ); 254 | } 255 | } else { 256 | update_post_meta( $post_id, $request_key, $request ); 257 | } 258 | 259 | }//iotheme.cn 260 | 261 | $transient['ids'][$request_key] = cs_get_vars( 'cs_section_id', $request_key ); 262 | $transient['errors'] = $errors; 263 | 264 | } 265 | 266 | } 267 | 268 | set_transient( 'cs-metabox-transient', $transient, 10 ); 269 | 270 | } 271 | 272 | } 273 | 274 | } 275 | -------------------------------------------------------------------------------- /inc/frame/classes/shortcode.class.php: -------------------------------------------------------------------------------- 1 | options = apply_filters( 'cs_shortcode_options', $options ); 52 | $this->exclude_post_types = apply_filters( 'cs_shortcode_exclude', $this->exclude_post_types ); 53 | 54 | if( ! empty( $this->options ) ) { 55 | 56 | $this->shortcodes = $this->get_shortcodes(); 57 | $this->addAction( 'media_buttons', 'media_shortcode_button', 99 ); 58 | $this->addAction( 'admin_footer', 'shortcode_dialog', 99 ); 59 | $this->addAction( 'customize_controls_print_footer_scripts', 'shortcode_dialog', 99 ); 60 | $this->addAction( 'wp_ajax_cs-get-shortcode', 'shortcode_generator', 99 ); 61 | 62 | } 63 | 64 | } 65 | 66 | // instance 67 | public static function instance( $options = array() ){ 68 | if ( is_null( self::$instance ) && CS_ACTIVE_SHORTCODE ) { 69 | self::$instance = new self( $options ); 70 | } 71 | return self::$instance; 72 | } 73 | 74 | // add shortcode button 75 | public function media_shortcode_button( $editor_id ) { 76 | 77 | global $post; 78 | 79 | $post_type = ( isset( $post->post_type ) ) ? $post->post_type : ''; 80 | 81 | if( ! in_array( $post_type, $this->exclude_post_types ) ) { 82 | echo ''. esc_html__( '添加短代码', 'cs-framework' ) .''; 83 | } 84 | 85 | } 86 | 87 | // shortcode dialog 88 | public function shortcode_dialog() { 89 | ?> 90 |
91 |
92 | 105 |
106 |
107 | 110 |
111 | shortcodes[$request]; 122 | 123 | if( isset( $shortcode['fields'] ) ) { 124 | 125 | foreach ( $shortcode['fields'] as $key => $field ) { 126 | 127 | if( isset( $field['id'] ) ) { 128 | $field['attributes'] = ( isset( $field['attributes'] ) ) ? wp_parse_args( array( 'data-atts' => $field['id'] ), $field['attributes'] ) : array( 'data-atts' => $field['id'] ); 129 | } 130 | 131 | $field_default = ( isset( $field['default'] ) ) ? $field['default'] : ''; 132 | 133 | if( in_array( $field['type'], array('image_select', 'checkbox') ) && isset( $field['options'] ) ) { 134 | $field['attributes']['data-check'] = true; 135 | } 136 | 137 | echo cs_add_element( $field, $field_default, 'shortcode' ); 138 | 139 | } 140 | 141 | } 142 | 143 | if( isset( $shortcode['clone_fields'] ) ) { 144 | 145 | $clone_id = isset( $shortcode['clone_id'] ) ? $shortcode['clone_id'] : $shortcode['name']; 146 | 147 | echo '
'; 148 | echo ''; 149 | 150 | foreach ( $shortcode['clone_fields'] as $key => $field ) { 151 | 152 | $field['sub'] = true; 153 | $field['attributes'] = ( isset( $field['attributes'] ) ) ? wp_parse_args( array( 'data-clone-atts' => $field['id'] ), $field['attributes'] ) : array( 'data-clone-atts' => $field['id'] ); 154 | $field_default = ( isset( $field['default'] ) ) ? $field['default'] : ''; 155 | 156 | if( in_array( $field['type'], array('image_select', 'checkbox') ) && isset( $field['options'] ) ) { 157 | $field['attributes']['data-check'] = true; 158 | } 159 | 160 | echo cs_add_element( $field, $field_default, 'shortcode' ); 161 | 162 | } 163 | 164 | echo '
'; 165 | 166 | echo ''; 167 | 168 | } 169 | 170 | die(); 171 | } 172 | 173 | // getting shortcodes from config array 174 | public function get_shortcodes() { 175 | 176 | $shortcodes = array(); 177 | 178 | foreach ( $this->options as $group_value ) { 179 | foreach ( $group_value['shortcodes'] as $shortcode ) { 180 | $shortcodes[$shortcode['name']] = $shortcode; 181 | } 182 | } 183 | 184 | return $shortcodes; 185 | } 186 | 187 | } 188 | -------------------------------------------------------------------------------- /inc/frame/classes/taxonomy.class.php: -------------------------------------------------------------------------------- 1 | options = apply_filters( 'cs_taxonomy_options', $options ); 34 | 35 | if( ! empty( $this->options ) ) { 36 | $this->addAction( 'admin_init', 'add_taxonomy_fields' ); 37 | } 38 | 39 | } 40 | 41 | // instance 42 | public static function instance( $options = array() ) { 43 | if ( is_null( self::$instance ) && CS_ACTIVE_TAXONOMY ) { 44 | self::$instance = new self( $options ); 45 | } 46 | return self::$instance; 47 | } 48 | 49 | // add taxonomy add/edit fields 50 | public function add_taxonomy_fields() { 51 | 52 | foreach ( $this->options as $option ) { 53 | 54 | $opt_taxonomy = $option['taxonomy']; 55 | $get_taxonomy = cs_get_var( 'taxonomy' ); 56 | 57 | if( $get_taxonomy == $opt_taxonomy ) { 58 | 59 | $this->addAction( $opt_taxonomy .'_add_form_fields', 'render_taxonomy_form_fields' ); 60 | $this->addAction( $opt_taxonomy .'_edit_form', 'render_taxonomy_form_fields' ); 61 | 62 | $this->addAction( 'created_'. $opt_taxonomy, 'save_taxonomy' ); 63 | $this->addAction( 'edited_'. $opt_taxonomy, 'save_taxonomy' ); 64 | $this->addAction( 'delete_'. $opt_taxonomy, 'delete_taxonomy' ); 65 | 66 | } 67 | 68 | } 69 | 70 | } 71 | 72 | // render taxonomy add/edit form fields 73 | public function render_taxonomy_form_fields( $term ) { 74 | 75 | global $cs_errors; 76 | 77 | $form_edit = ( is_object( $term ) && isset( $term->taxonomy ) ) ? true : false; 78 | $taxonomy = ( $form_edit ) ? $term->taxonomy : $term; 79 | $classname = ( $form_edit ) ? 'edit' : 'add'; 80 | $cs_errors = get_transient( 'cs-taxonomy-transient' ); 81 | 82 | wp_nonce_field( 'cs-taxonomy', 'cs-taxonomy-nonce' ); 83 | 84 | echo '
'; 85 | 86 | foreach( $this->options as $option ) { 87 | 88 | if( $taxonomy == $option['taxonomy'] ) { 89 | 90 | $tax_value = ( $form_edit ) ? get_term_meta( $term->term_id, $option['id'], true ) : ''; 91 | 92 | foreach ( $option['fields'] as $field ) { 93 | 94 | $default = ( isset( $field['default'] ) ) ? $field['default'] : ''; 95 | $elem_id = ( isset( $field['id'] ) ) ? $field['id'] : ''; 96 | $elem_value = $default;//iotheme.cn 97 | if ($form_edit){ 98 | if($option['data_type'] !== 'serialize' ) { 99 | $elem_value = get_term_meta($term->term_id, $elem_id,true); 100 | }else{ 101 | $elem_value = ( is_array( $tax_value ) && isset( $tax_value[$elem_id] ) ) ? $tax_value[$elem_id] : $default; 102 | } 103 | }//iotheme.cn 104 | 105 | echo cs_add_element( $field, $elem_value, $option['id'] ); 106 | 107 | } 108 | 109 | } 110 | 111 | } 112 | 113 | echo '
'; 114 | 115 | } 116 | 117 | // save taxonomy form fields 118 | public function save_taxonomy( $term_id ) { 119 | 120 | if ( wp_verify_nonce( cs_get_var( 'cs-taxonomy-nonce' ), 'cs-taxonomy' ) ) { 121 | 122 | $errors = array(); 123 | $taxonomy = cs_get_var( 'taxonomy' ); 124 | 125 | foreach ( $this->options as $request_value ) { 126 | 127 | if( $taxonomy == $request_value['taxonomy'] ) { 128 | 129 | $request_key = $request_value['id']; 130 | $request = cs_get_var( $request_key, array() ); 131 | 132 | // ignore _nonce 133 | if( isset( $request['_nonce'] ) ) { 134 | unset( $request['_nonce'] ); 135 | } 136 | 137 | if( isset( $request_value['fields'] ) ) { 138 | 139 | foreach( $request_value['fields'] as $field ) { 140 | 141 | if( isset( $field['type'] ) && isset( $field['id'] ) ) { 142 | 143 | $field_value = cs_get_vars( $request_key, $field['id'] ); 144 | 145 | // sanitize options 146 | if( isset( $field['sanitize'] ) && $field['sanitize'] !== false ) { 147 | $sanitize_type = $field['sanitize']; 148 | } else if ( ! isset( $field['sanitize'] ) ) { 149 | $sanitize_type = $field['type']; 150 | } 151 | 152 | if( has_filter( 'cs_sanitize_'. $sanitize_type ) ) { 153 | $request[$field['id']] = apply_filters( 'cs_sanitize_' . $sanitize_type, $field_value, $field, $request_value['fields'] ); 154 | } 155 | 156 | // validate options 157 | if ( isset( $field['validate'] ) && has_filter( 'cs_validate_'. $field['validate'] ) ) { 158 | 159 | $validate = apply_filters( 'cs_validate_' . $field['validate'], $field_value, $field, $request_value['fields'] ); 160 | 161 | if( ! empty( $validate ) ) { 162 | 163 | $errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' ); 164 | $default_value = isset( $field['default'] ) ? $field['default'] : ''; 165 | if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn 166 | if($meta_value = get_term_meta($term_id, $field['id'],true)) 167 | $request[$field['id']] = $meta_value ; 168 | }else{ 169 | $meta_value = get_term_meta( $term_id, $request_key, true ); 170 | $request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value; 171 | }//iotheme.cn 172 | 173 | } 174 | 175 | } 176 | 177 | } 178 | 179 | } 180 | 181 | } 182 | 183 | $request = apply_filters( 'cs_save_taxonomy', $request, $request_key, $term_id ); 184 | 185 | if( empty( $request ) ) { 186 | 187 | if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn 188 | foreach ( $request as $key => $value ) { 189 | delete_term_meta( $term_id, $key ); 190 | } 191 | } else { 192 | delete_term_meta( $term_id, $request_key ); 193 | }//iotheme.cn 194 | 195 | } else { 196 | 197 | if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn 198 | foreach ( $request as $key => $value ) { 199 | update_term_meta( $term_id, $key, $value ); 200 | } 201 | } else { 202 | update_term_meta( $term_id, $request_key, $request ); 203 | }//iotheme.cn 204 | 205 | } 206 | 207 | } 208 | 209 | } 210 | 211 | set_transient( 'cs-taxonomy-transient', $errors, 10 ); 212 | 213 | } 214 | 215 | } 216 | 217 | // delete taxonomy 218 | public function delete_taxonomy( $term_id ) { 219 | 220 | $taxonomy = cs_get_var( 'taxonomy' ); 221 | 222 | if( ! empty( $taxonomy ) ) { 223 | 224 | foreach ( $this->options as $request_value ) { 225 | 226 | if( $taxonomy == $request_value['taxonomy'] ) { 227 | 228 | if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn 229 | foreach( $request_value['fields'] as $field ) { 230 | delete_term_meta( $term_id, $field['id'] ); 231 | } 232 | } else { 233 | delete_term_meta( $term_id, $request_value['id'] ); 234 | }//iotheme.cn 235 | 236 | } 237 | 238 | } 239 | 240 | } 241 | 242 | } 243 | 244 | } 245 | -------------------------------------------------------------------------------- /inc/frame/config/metabox.config.php: -------------------------------------------------------------------------------- 1 | 'sites_meta', 17 | 'title' => '网址链接属性', 18 | 'post_type' => 'sites', 19 | 'data_type' => 'unserialize', 20 | 'context' => 'normal', 21 | 'priority' => 'high', 22 | 'sections' => array( 23 | array( 24 | 'name' => 'section_4', 25 | 'fields' => array( 26 | array( 27 | 'id' => '_visible', 28 | 'type' => 'radio', 29 | 'title' => '可查看用户', 30 | 'class' => 'horizontal', 31 | 'options' => array( 32 | '1' => '仅管理员可见', 33 | '2' => '登陆可见', 34 | '0' => '所有人', 35 | ), 36 | 'default' => '0', 37 | ), 38 | array( 39 | "id" => "_sites_link", 40 | "type"=>"text", 41 | "title" => "输入网址链接,", 42 | 'after' =>'需包含 http(s)://
注意:“网址”和“公众号二维码”两者可同时填写,但是至少填一项。', 43 | ), 44 | 45 | array( 46 | "id" => "_sites_sescribe", 47 | "type"=>"text", 48 | "title" => "描叙", 49 | ), 50 | 51 | array( 52 | "id" => "_sites_order", 53 | "std" => "0", 54 | "title" => "网址排序数值越大越靠前", 55 | "type"=>"text" 56 | ), 57 | 58 | array( 59 | "id" => "_thumbnail", 60 | "type"=>"image", 61 | "title" => "添加图标地址,调用自定义图标", 62 | 'add_title' => '添加图标', 63 | ), 64 | 65 | array( 66 | "id" => "_wechat_qr", 67 | "type"=>"image", 68 | "title" => "添加公众号二维码", 69 | 'add_title' => '添加二维码', 70 | ), 71 | ), 72 | ), 73 | 74 | ), 75 | ); 76 | CSFramework_Metabox::instance( $options ); -------------------------------------------------------------------------------- /inc/frame/config/taxonomy.config.php: -------------------------------------------------------------------------------- 1 | 'favorites_meta', 17 | 'title' => '图标设置', 18 | 'taxonomy' => 'favorites', 19 | 'data_type' => 'unserialize', 20 | 'fields' => array( 21 | array( 22 | 'type' => 'notice', 23 | 'content' => '

'.__('注意,最多2级,且父级不应有内容','i_theme').'

', 24 | 'class' => 'info', 25 | ), 26 | array( 27 | 'id' => '_view_user', 28 | 'type' => 'radio', 29 | 'title' => '可查看用户', 30 | 'class' => 'horizontal', 31 | 'options' => array( 32 | '1' => '仅管理员可见', 33 | '2' => '登陆可见', 34 | '0' => '所有人', 35 | ), 36 | 'default' => '0', 37 | 'after' => '注意:分类下的网址不受此值影响
权限跟随父级,如果父级设置为“仅管理员可见”,则子级也只有管理员可见', 38 | ), 39 | array( 40 | 'id' => '_term_ico', 41 | 'type' => 'icon', 42 | 'title' => '选择菜单图标', 43 | 'default' => 'fa fa-chrome' 44 | ), 45 | array( 46 | 'id' => '_term_order', 47 | 'type' => 'text', 48 | 'title' => '排序', 49 | 'after' =>'数字越大越靠前', 50 | 'default' => '0', 51 | ), 52 | array( 53 | 'type' => 'notice', 54 | 'content' => '注意:如果添加新的分类后首页没有显示,请检测“排序”字段有没有值,如果没有,请设置一个值,默认为 0。', 55 | 'class' => 'info', 56 | ), 57 | ), 58 | ); 59 | CSFramework_Taxonomy::instance( $options ); -------------------------------------------------------------------------------- /inc/frame/cs-framework.php: -------------------------------------------------------------------------------- 1 | 22 | * 23 | * This program is free software; you can redistribute it and/or modify 24 | * it under the terms of the GNU General Public License as published by 25 | * the Free Software Foundation; either version 2 of the License, or 26 | * (at your option) any later version. 27 | * 28 | * This program is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | * GNU General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU General Public License 34 | * along with this program; if not, write to the Free Software 35 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 36 | * 37 | * ------------------------------------------------------------------------------------------------ 38 | * 39 | */ 40 | 41 | // ------------------------------------------------------------------------------------------------ 42 | require_once plugin_dir_path( __FILE__ ) .'/cs-framework-path.php'; 43 | // ------------------------------------------------------------------------------------------------ 44 | 45 | if( ! function_exists( 'cs_framework_init' ) && ! class_exists( 'CSFramework' ) ) { 46 | function cs_framework_init() { 47 | 48 | // active modules 49 | defined( 'CS_ACTIVE_FRAMEWORK' ) or define( 'CS_ACTIVE_FRAMEWORK', true ); 50 | defined( 'CS_ACTIVE_METABOX' ) or define( 'CS_ACTIVE_METABOX', true ); 51 | defined( 'CS_ACTIVE_TAXONOMY' ) or define( 'CS_ACTIVE_TAXONOMY', true ); 52 | defined( 'CS_ACTIVE_SHORTCODE' ) or define( 'CS_ACTIVE_SHORTCODE', true ); 53 | defined( 'CS_ACTIVE_CUSTOMIZE' ) or define( 'CS_ACTIVE_CUSTOMIZE', true ); 54 | defined( 'CS_ACTIVE_LIGHT_THEME' ) or define( 'CS_ACTIVE_LIGHT_THEME', true ); 55 | 56 | // helpers 57 | cs_locate_template( 'functions/deprecated.php' ); 58 | cs_locate_template( 'functions/fallback.php' ); 59 | cs_locate_template( 'functions/helpers.php' ); 60 | cs_locate_template( 'functions/actions.php' ); 61 | cs_locate_template( 'functions/enqueue.php' ); 62 | cs_locate_template( 'functions/sanitize.php' ); 63 | cs_locate_template( 'functions/validate.php' ); 64 | 65 | // classes 66 | cs_locate_template( 'classes/abstract.class.php' ); 67 | cs_locate_template( 'classes/options.class.php' ); 68 | cs_locate_template( 'classes/framework.class.php' ); 69 | cs_locate_template( 'classes/metabox.class.php' ); 70 | cs_locate_template( 'classes/taxonomy.class.php' ); 71 | //cs_locate_template( 'classes/shortcode.class.php' ); 72 | //cs_locate_template( 'classes/customize.class.php' ); 73 | 74 | // configs 75 | cs_locate_template( 'config/framework.config.php' ); 76 | cs_locate_template( 'config/metabox.config.php' ); 77 | cs_locate_template( 'config/taxonomy.config.php' ); 78 | //cs_locate_template( 'config/shortcode.config.php' ); 79 | //cs_locate_template( 'config/customize.config.php' ); 80 | 81 | } 82 | add_action( 'init', 'cs_framework_init', 10 ); 83 | } 84 | -------------------------------------------------------------------------------- /inc/frame/fields/background/background.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $value_defaults = array( 21 | 'image' => '', 22 | 'repeat' => '', 23 | 'position' => '', 24 | 'attachment' => '', 25 | 'size' => '', 26 | 'color' => '', 27 | ); 28 | 29 | $this->value = wp_parse_args( $this->element_value(), $value_defaults ); 30 | 31 | if( isset( $this->field['settings'] ) ) { extract( $this->field['settings'] ); } 32 | 33 | $upload_type = ( isset( $upload_type ) ) ? $upload_type : 'image'; 34 | $button_title = ( isset( $button_title ) ) ? $button_title : esc_html__( '上传', 'cs-framework' ); 35 | $frame_title = ( isset( $frame_title ) ) ? $frame_title : esc_html__( '上传', 'cs-framework' ); 36 | $insert_title = ( isset( $insert_title ) ) ? $insert_title : esc_html__( '使用图像', 'cs-framework' ); 37 | 38 | echo '
'; 39 | echo 'element_class() . $this->element_attributes() .'/>'; 40 | echo ''. $button_title .''; 41 | echo '
'; 42 | 43 | // background attributes 44 | echo '
'; 45 | echo cs_add_element( array( 46 | 'pseudo' => true, 47 | 'type' => 'select', 48 | 'name' => $this->element_name( '[repeat]' ), 49 | 'options' => array( 50 | '' => 'repeat', 51 | 'repeat-x' => 'repeat-x', 52 | 'repeat-y' => 'repeat-y', 53 | 'no-repeat' => 'no-repeat', 54 | 'inherit' => 'inherit', 55 | ), 56 | 'attributes' => array( 57 | 'data-atts' => 'repeat', 58 | ), 59 | 'value' => $this->value['repeat'] 60 | ) ); 61 | echo cs_add_element( array( 62 | 'pseudo' => true, 63 | 'type' => 'select', 64 | 'name' => $this->element_name( '[position]' ), 65 | 'options' => array( 66 | '' => 'left top', 67 | 'left center' => 'left center', 68 | 'left bottom' => 'left bottom', 69 | 'right top' => 'right top', 70 | 'right center' => 'right center', 71 | 'right bottom' => 'right bottom', 72 | 'center top' => 'center top', 73 | 'center center' => 'center center', 74 | 'center bottom' => 'center bottom' 75 | ), 76 | 'attributes' => array( 77 | 'data-atts' => 'position', 78 | ), 79 | 'value' => $this->value['position'] 80 | ) ); 81 | echo cs_add_element( array( 82 | 'pseudo' => true, 83 | 'type' => 'select', 84 | 'name' => $this->element_name( '[attachment]' ), 85 | 'options' => array( 86 | '' => 'scroll', 87 | 'fixed' => 'fixed', 88 | ), 89 | 'attributes' => array( 90 | 'data-atts' => 'attachment', 91 | ), 92 | 'value' => $this->value['attachment'] 93 | ) ); 94 | echo cs_add_element( array( 95 | 'pseudo' => true, 96 | 'type' => 'select', 97 | 'name' => $this->element_name( '[size]' ), 98 | 'options' => array( 99 | '' => 'size', 100 | 'cover' => 'cover', 101 | 'contain' => 'contain', 102 | 'inherit' => 'inherit', 103 | 'initial' => 'initial', 104 | ), 105 | 'attributes' => array( 106 | 'data-atts' => 'size', 107 | ), 108 | 'value' => $this->value['size'] 109 | ) ); 110 | echo cs_add_element( array( 111 | 'pseudo' => true, 112 | 'id' => $this->field['id'].'_color', 113 | 'type' => 'color_picker', 114 | 'name' => $this->element_name('[color]'), 115 | 'attributes' => array( 116 | 'data-atts' => 'bgcolor', 117 | ), 118 | 'value' => $this->value['color'], 119 | 'default' => ( isset( $this->field['default']['color'] ) ) ? $this->field['default']['color'] : '', 120 | 'rgba' => ( isset( $this->field['rgba'] ) && $this->field['rgba'] === false ) ? false : '', 121 | ) ); 122 | echo '
'; 123 | 124 | echo $this->element_after(); 125 | 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /inc/frame/fields/backup/backup.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | echo ''; 21 | submit_button( esc_html__( '导入备份', 'cs-framework' ), 'primary cs-import-backup', 'backup', false ); 22 | echo '( '. esc_html__( '复制粘贴您的备份字符串到这里', 'cs-framework' ).' )'; 23 | 24 | echo '
'; 25 | 26 | echo ''; 27 | echo ''. esc_html__( '导出下载备份', 'cs-framework' ) .''; 28 | echo '-( '. esc_html__( '或者', 'cs-framework' ) .' )-'; 29 | submit_button( esc_html__( '重置所有选项', 'cs-framework' ), 'cs-warning-primary cs-reset-confirm', $this->unique . '[resetall]', false ); 30 | echo ''. esc_html__( '确认重置所有选项', 'cs-framework' ) .''; 31 | 32 | echo $this->element_after(); 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /inc/frame/fields/checkbox/checkbox.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | if( isset( $this->field['options'] ) ) { 21 | 22 | $options = $this->field['options']; 23 | $options = ( is_array( $options ) ) ? $options : array_filter( $this->element_data( $options ) ); 24 | 25 | if( ! empty( $options ) ) { 26 | 27 | echo 'element_class() .'>'; 28 | foreach ( $options as $key => $value ) { 29 | echo '
  • '; 30 | } 31 | echo ''; 32 | } 33 | 34 | } else { 35 | $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : ''; 36 | echo ''; 37 | } 38 | 39 | echo $this->element_after(); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /inc/frame/fields/color_picker/color_picker.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo 'element_class( 'cs-field-color-picker' ) . $this->element_attributes( $this->extra_attributes() ) .'/>'; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | public function extra_attributes() { 25 | 26 | $atts = array(); 27 | 28 | if( isset( $this->field['id'] ) ) { 29 | $atts['data-depend-id'] = $this->field['id']; 30 | } 31 | 32 | if ( isset( $this->field['rgba'] ) && $this->field['rgba'] === false ) { 33 | $atts['data-rgba'] = 'false'; 34 | } 35 | 36 | if( isset( $this->field['default'] ) ) { 37 | $atts['data-default-color'] = $this->field['default']; 38 | } 39 | 40 | return $atts; 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /inc/frame/fields/content/content.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo $this->field['content']; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /inc/frame/fields/fieldset/fieldset.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | echo '
    '; 21 | 22 | foreach ( $this->field['fields'] as $field ) { 23 | 24 | $field_id = ( isset( $field['id'] ) ) ? $field['id'] : ''; 25 | $field_default = ( isset( $field['default'] ) ) ? $field['default'] : ''; 26 | $field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default; 27 | $unique_id = $this->unique .'['. $this->field['id'] .']'; 28 | 29 | if ( ! empty( $this->field['un_array'] ) ) { 30 | echo cs_add_element( $field, cs_get_option( $field_id ), $this->unique ); 31 | } else { 32 | echo cs_add_element( $field, $field_value, $unique_id ); 33 | } 34 | 35 | } 36 | 37 | echo '
    '; 38 | 39 | echo $this->element_after(); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /inc/frame/fields/gallery/gallery.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $value = $this->element_value(); 21 | $add = ( ! empty( $this->field['add_title'] ) ) ? $this->field['add_title'] : esc_html__( '添加画廊', 'cs-framework' ); 22 | $edit = ( ! empty( $this->field['edit_title'] ) ) ? $this->field['edit_title'] : esc_html__( '编辑画廊', 'cs-framework' ); 23 | $clear = ( ! empty( $this->field['clear_title'] ) ) ? $this->field['clear_title'] : esc_html__( '清除', 'cs-framework' ); 24 | $hidden = ( empty( $value ) ) ? ' hidden' : ''; 25 | 26 | echo '
      '; 27 | 28 | if( ! empty( $value ) ) { 29 | 30 | $values = explode( ',', $value ); 31 | 32 | foreach ( $values as $id ) { 33 | $attachment = wp_get_attachment_image_src( $id, 'thumbnail' ); 34 | echo '
    • '; 35 | } 36 | 37 | } 38 | 39 | echo '
    '; 40 | echo ''. $add .''; 41 | echo ''. $edit .''; 42 | echo ''. $clear .''; 43 | echo 'element_class() . $this->element_attributes() .'/>'; 44 | 45 | echo $this->element_after(); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /inc/frame/fields/group/group.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $fields = array_values( $this->field['fields'] ); 21 | $last_id = ( is_array( $this->value ) ) ? max( array_keys( $this->value ) ) : 0; 22 | $acc_title = ( isset( $this->field['accordion_title'] ) ) ? $this->field['accordion_title'] : esc_html__( '添加', 'cs-framework' ); 23 | $field_title = ( isset( $fields[0]['title'] ) ) ? $fields[0]['title'] : $fields[1]['title']; 24 | $field_id = ( isset( $fields[0]['id'] ) ) ? $fields[0]['id'] : $fields[1]['id']; 25 | $el_class = ( isset( $this->field['title'] ) ) ? sanitize_title( $field_title ) : 'no-title'; 26 | $search_id = cs_array_search( $fields, 'id', $acc_title ); 27 | 28 | if( ! empty( $search_id ) ) { 29 | 30 | $acc_title = ( isset( $search_id[0]['title'] ) ) ? $search_id[0]['title'] : $acc_title; 31 | $field_id = ( isset( $search_id[0]['id'] ) ) ? $search_id[0]['id'] : $field_id; 32 | 33 | } 34 | 35 | echo ''; 49 | 50 | echo '
    '; 51 | 52 | if( ! empty( $this->value ) ) { 53 | 54 | foreach ( $this->value as $key => $value ) { 55 | 56 | $title = ( isset( $this->value[$key][$field_id] ) ) ? $this->value[$key][$field_id] : ''; 57 | 58 | if ( is_array( $title ) && isset( $this->multilang ) ) { 59 | $lang = cs_language_defaults(); 60 | $title = $title[$lang['current']]; 61 | $title = is_array( $title ) ? $title[0] : $title; 62 | } 63 | 64 | $field_title = ( ! empty( $search_id ) ) ? $acc_title : $field_title; 65 | 66 | echo '
    '; 67 | echo '

    '. $field_title .': '. $title .'

    '; 68 | echo '
    '; 69 | 70 | foreach ( $fields as $field ) { 71 | $field['sub'] = true; 72 | $unique = $this->unique . '[' . $this->field['id'] . ']['.$key.']'; 73 | $value = ( isset( $field['id'] ) && isset( $this->value[$key][$field['id']] ) ) ? $this->value[$key][$field['id']] : ''; 74 | echo cs_add_element( $field, $value, $unique ); 75 | } 76 | 77 | echo ''; 78 | echo '
    '; 79 | echo '
    '; 80 | 81 | } 82 | 83 | } 84 | 85 | echo '
    '; 86 | 87 | echo ''. $this->field['button_title'] .''; 88 | 89 | echo $this->element_after(); 90 | 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /inc/frame/fields/heading/heading.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo $this->field['content']; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /inc/frame/fields/icon/icon.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $value = $this->element_value(); 21 | $hidden = ( empty( $value ) ) ? ' hidden' : ''; 22 | 23 | echo '
    '; 24 | echo ''; 25 | echo ''. esc_html__( '添加Icon', 'cs-framework' ) .''; 26 | echo ''. esc_html__( '移除Icon', 'cs-framework' ) .''; 27 | echo 'element_class( 'cs-icon-value' ) . $this->element_attributes() .' />'; 28 | echo '
    '; 29 | 30 | echo $this->element_after(); 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /inc/frame/fields/image/image.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $preview = ''; 21 | $value = $this->element_value(); 22 | $add = ( ! empty( $this->field['add_title'] ) ) ? $this->field['add_title'] : esc_html__( '添加图像', 'cs-framework' ); 23 | $hidden = ( empty( $value ) ) ? ' hidden' : ''; 24 | 25 | if( ! empty( $value ) ) { 26 | if(is_numeric( $value )){ 27 | $attachment = wp_get_attachment_image_src( $value, 'thumbnail' ); 28 | $preview = $attachment[0]; 29 | }else{ 30 | $preview = $value; 31 | } 32 | } 33 | $preview = $value; 34 | echo 'element_class() . $this->element_attributes() .'/>'; 35 | echo '
    preview
    '; 36 | echo ''. $add .''; 37 | 38 | echo $this->element_after(); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /inc/frame/fields/image_select/image_select.php: -------------------------------------------------------------------------------- 1 | field['radio'] ) ) ? 'radio' : 'checkbox'; 19 | $input_attr = ( ! empty( $this->field['multi_select'] ) ) ? '[]' : ''; 20 | 21 | echo $this->element_before(); 22 | echo ( empty( $input_attr ) ) ? '
    ' : ''; 23 | 24 | if( isset( $this->field['options'] ) ) { 25 | $options = $this->field['options']; 26 | foreach ( $options as $key => $value ) { 27 | echo ''; 28 | } 29 | } 30 | 31 | echo ( empty( $input_attr ) ) ? '
    ' : ''; 32 | echo $this->element_after(); 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /inc/frame/fields/notice/notice.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo '
    '. $this->field['content'] .'
    '; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /inc/frame/fields/number/number.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | if( isset( $this->field['min'] ) ) { 20 | $min = ' min="'.$this->field['min'].'" '; 21 | } 22 | if( isset( $this->field['max'] ) ) { 23 | $max = ' max="'.$this->field['max'].'" '; 24 | } 25 | $unit = ( isset( $this->field['unit'] ) ) ? ''. $this->field['unit'] .'' : ''; 26 | echo 'element_class() . $this->element_attributes() .'/>'. $unit; 27 | echo $this->element_after(); 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /inc/frame/fields/radio/radio.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | if( isset( $this->field['options'] ) ) { 21 | 22 | $options = $this->field['options']; 23 | $options = ( is_array( $options ) ) ? $options : array_filter( $this->element_data( $options ) ); 24 | 25 | if( ! empty( $options ) ) { 26 | 27 | echo 'element_class() .'>'; 28 | foreach ( $options as $key => $value ) { 29 | echo '
  • '; 30 | } 31 | echo ''; 32 | } 33 | 34 | } else { 35 | $label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : ''; 36 | echo ''; 37 | } 38 | 39 | echo $this->element_after(); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /inc/frame/fields/repeater/repeater.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | if( isset( $this->field['options'] ) ) { 21 | 22 | $options = $this->field['options']; 23 | $class = $this->element_class(); 24 | $options = ( is_array( $options ) ) ? $options : array_filter( $this->element_data( $options ) ); 25 | $extra_name = ( isset( $this->field['attributes']['multiple'] ) ) ? '[]' : ''; 26 | $chosen_rtl = ( is_rtl() && strpos( $class, 'chosen' ) ) ? 'chosen-rtl' : ''; 27 | 28 | echo ''; 39 | 40 | } 41 | 42 | echo $this->element_after(); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /inc/frame/fields/sorter/sorter.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $value = $this->element_value(); 21 | $enabled =''; 22 | $options = $this->field['default']['disabled']; 23 | if( is_array($options) || empty($options) ){ 24 | $value = ( ! empty( $value ) ) ? $value : $this->field['default']; 25 | $enabled = ( ! empty( $value['enabled'] ) ) ? $value['enabled'] : array(); 26 | $disabled = ( ! empty( $value['disabled'] ) ) ? $value['disabled'] : array(); 27 | }else{ 28 | $options = array_filter( $this->element_data( $options ) ); 29 | $default = array( 30 | 'enabled' => array(), 31 | 'disabled' => $options, 32 | ); 33 | $value = ( ! empty( $value ) ) ? $value : $default; 34 | $enabled = ( ! empty( $value['enabled'] ) ) ? array_intersect_assoc($value['enabled'],$options) : array(); 35 | $disabled = array_diff_assoc($options,$enabled);//删除已经激活的 36 | } 37 | $enabled_title = ( isset( $this->field['enabled_title'] ) ) ? $this->field['enabled_title'] : esc_html__( '启用的模块', 'cs-framework' ); 38 | $disabled_title = ( isset( $this->field['disabled_title'] ) ) ? $this->field['disabled_title'] : esc_html__( '未启用的模块', 'cs-framework' ); 39 | echo '
    '; 40 | echo '

    '. $enabled_title .'

    '; 41 | echo '
      '; 42 | if( ! empty( $enabled ) ) { 43 | foreach( $enabled as $en_id => $en_name ) { 44 | echo '
    • '; 45 | } 46 | } 47 | echo '
    '; 48 | echo '
    '; 49 | 50 | echo '
    '; 51 | echo '

    '. $disabled_title .'

    '; 52 | echo '
      '; 53 | if( ! empty( $disabled ) ) { 54 | foreach( $disabled as $dis_id => $dis_name ) { 55 | echo '
    • '; 56 | } 57 | } 58 | echo '
    '; 59 | echo '
    '; 60 | echo '
    '; 61 | 62 | echo $this->element_after(); 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /inc/frame/fields/subheading/subheading.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo $this->field['content']; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /inc/frame/fields/switcher/switcher.php: -------------------------------------------------------------------------------- 1 | element_value(); //iotheme.cn 18 | if($_value == "true" ) $_value = 1; 19 | echo $this->element_before(); 20 | $label = ( isset( $this->field['label'] ) ) ? '
    '. $this->field['label'] . '
    ' : ''; 21 | echo '' . $label; 22 | echo $this->element_after(); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /inc/frame/fields/text/text.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo 'element_class() . $this->element_attributes() .'/>'; 20 | echo $this->element_after(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /inc/frame/fields/textarea/textarea.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | echo $this->shortcode_generator(); 20 | echo ''; 21 | echo $this->element_after(); 22 | 23 | } 24 | 25 | public function shortcode_generator() { 26 | if( isset( $this->field['shortcode'] ) && CS_ACTIVE_SHORTCODE ) { 27 | echo ''. esc_html__( '添加短代码', 'cs-framework' ) .''; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /inc/frame/fields/typography/typography.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $defaults_value = array( 21 | 'family' => 'Arial', 22 | 'variant' => 'regular', 23 | 'font' => 'websafe', 24 | ); 25 | 26 | $default_variants = apply_filters( 'cs_websafe_fonts_variants', array( 27 | 'regular', 28 | 'italic', 29 | '700', 30 | '700italic', 31 | 'inherit' 32 | )); 33 | 34 | $websafe_fonts = apply_filters( 'cs_websafe_fonts', array( 35 | 'Arial', 36 | 'Arial Black', 37 | 'Comic Sans MS', 38 | 'Impact', 39 | 'Lucida Sans Unicode', 40 | 'Tahoma', 41 | 'Trebuchet MS', 42 | 'Verdana', 43 | 'Courier New', 44 | 'Lucida Console', 45 | 'Georgia, serif', 46 | 'Palatino Linotype', 47 | 'Times New Roman' 48 | )); 49 | 50 | $value = wp_parse_args( $this->element_value(), $defaults_value ); 51 | $family_value = $value['family']; 52 | $variant_value = $value['variant']; 53 | $is_variant = ( isset( $this->field['variant'] ) && $this->field['variant'] === false ) ? false : true; 54 | $is_chosen = ( isset( $this->field['chosen'] ) && $this->field['chosen'] === false ) ? '' : 'chosen '; 55 | $google_json = cs_get_google_fonts(); 56 | $chosen_rtl = ( is_rtl() && ! empty( $is_chosen ) ) ? 'chosen-rtl ' : ''; 57 | 58 | if( is_object( $google_json ) ) { 59 | 60 | $googlefonts = array(); 61 | 62 | foreach ( $google_json->items as $key => $font ) { 63 | $googlefonts[$font->family] = $font->variants; 64 | } 65 | 66 | $is_google = ( array_key_exists( $family_value, $googlefonts ) ) ? true : false; 67 | 68 | echo ''; 87 | 88 | if( ! empty( $is_variant ) ) { 89 | 90 | $variants = ( $is_google ) ? $googlefonts[$family_value] : $default_variants; 91 | $variants = ( $value['font'] === 'google' || $value['font'] === 'websafe' ) ? $variants : array( 'regular' ); 92 | 93 | echo ''; 100 | 101 | } 102 | 103 | echo ''; 104 | 105 | } else { 106 | 107 | echo esc_html__( '错误!不能加载json文件', 'cs-framework' ); 108 | 109 | } 110 | 111 | echo $this->element_after(); 112 | 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /inc/frame/fields/upload/upload.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | if( isset( $this->field['settings'] ) ) { extract( $this->field['settings'] ); } 21 | 22 | $upload_type = ( isset( $upload_type ) ) ? $upload_type : 'image'; 23 | $button_title = ( isset( $button_title ) ) ? $button_title : esc_html__( '上传', 'cs-framework' ); 24 | $frame_title = ( isset( $frame_title ) ) ? $frame_title : esc_html__( '上传', 'cs-framework' ); 25 | $insert_title = ( isset( $insert_title ) ) ? $insert_title : esc_html__( '使用图像', 'cs-framework' ); 26 | 27 | $value = $this->element_value(); 28 | $hidden = ( empty( $value ) ) ? ' hidden' : ''; 29 | 30 | echo 'element_class() . $this->element_attributes() .'/>'; 31 | echo '
    preview
    '; 32 | echo ''. $button_title .''; 33 | 34 | echo $this->element_after(); 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /inc/frame/fields/wysiwyg/wysiwyg.php: -------------------------------------------------------------------------------- 1 | element_before(); 19 | 20 | $defaults = array( 21 | 'textarea_rows' => 10, 22 | 'textarea_name' => $this->element_name() 23 | ); 24 | 25 | $settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array(); 26 | $settings = wp_parse_args( $settings, $defaults ); 27 | 28 | $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : ''; 29 | $field_value = $this->element_value(); 30 | 31 | wp_editor( $field_value, $field_id, $settings ); 32 | 33 | echo $this->element_after(); 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /inc/frame/functions/actions.php: -------------------------------------------------------------------------------- 1 | = 2 ) ? '

    '. $object->name .'

    ' : ''; 26 | 27 | foreach ( $object->icons as $icon ) { 28 | echo ''; 29 | } 30 | 31 | } else { 32 | echo '

    '. esc_html__( '错误!不能加载json文件', 'cs-framework' ) .'

    '; 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | do_action( 'cs_add_icons' ); 40 | do_action( 'cs_add_icons_after' ); 41 | 42 | die(); 43 | } 44 | add_action( 'wp_ajax_cs-get-icons', 'cs_get_icons' ); 45 | } 46 | 47 | /** 48 | * 49 | * Export options 50 | * 51 | * @since 1.0.0 52 | * @version 1.0.0 53 | * 54 | */ 55 | if( ! function_exists( 'cs_export_options' ) ) { 56 | function cs_export_options() { 57 | 58 | header('Content-Type: plain/text'); 59 | header('Content-disposition: attachment; filename=backup-options-'. gmdate( 'd-m-Y' ) .'.txt'); 60 | header('Content-Transfer-Encoding: binary'); 61 | header('Pragma: no-cache'); 62 | header('Expires: 0'); 63 | 64 | echo cs_encode_string( get_option( CS_OPTION ) ); 65 | 66 | die(); 67 | } 68 | add_action( 'wp_ajax_cs-export-options', 'cs_export_options' ); 69 | } 70 | 71 | /** 72 | * 73 | * Set icons for wp dialog 74 | * 75 | * @since 1.0.0 76 | * @version 1.0.0 77 | * 78 | */ 79 | if( ! function_exists( 'cs_set_icons' ) ) { 80 | function cs_set_icons() { 81 | 82 | echo '
    '; 83 | echo '
    '; 84 | echo '
    '. esc_html__( '加载...', 'cs-framework' ) .'
    '; 85 | echo '
    '; 86 | 87 | } 88 | add_action( 'admin_footer', 'cs_set_icons' ); 89 | add_action( 'customize_controls_print_footer_scripts', 'cs_set_icons' ); 90 | } 91 | -------------------------------------------------------------------------------- /inc/frame/functions/customize.php: -------------------------------------------------------------------------------- 1 | options['id'] = $this->id; 19 | $this->options['default'] = $this->setting->default; 20 | $this->options['attributes']['data-customize-setting-link'] = $this->settings['default']->id; 21 | echo cs_add_element( $this->options, $this->value(), $this->unique ); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /inc/frame/functions/deprecated.php: -------------------------------------------------------------------------------- 1 | '; 32 | 33 | if( isset( $field['title'] ) ) { 34 | $field_desc = ( isset( $field['desc'] ) ) ? '

    '. $field['desc'] .'

    ' : ''; 35 | $output .= '

    ' . $field['title'] . '

    '. $field_desc .'
    '; 36 | } 37 | 38 | $output .= ( isset( $field['title'] ) ) ? '
    ' : ''; 39 | 40 | $value = ( !isset( $value ) && isset( $field['default'] ) ) ? $field['default'] : $value; 41 | $value = ( isset( $field['value'] ) ) ? $field['value'] : $value; 42 | 43 | if( class_exists( $class ) ) { 44 | ob_start(); 45 | $element = new $class( $field, $value, $unique ); 46 | $element->output(); 47 | $output .= ob_get_clean(); 48 | } else { 49 | $output .= '

    '. esc_html__( '此字段不可用!', 'cs-framework' ) .'

    '; 50 | } 51 | 52 | $output .= ( isset( $field['title'] ) ) ? '
    ' : ''; 53 | $output .= '
    '; 54 | $output .= ''; 55 | 56 | return $output; 57 | 58 | } 59 | } 60 | 61 | /** 62 | * 63 | * Encode string for backup options 64 | * 65 | * @since 1.0.0 66 | * @version 1.0.0 67 | * 68 | */ 69 | if ( ! function_exists( 'cs_encode_string' ) ) { 70 | function cs_encode_string( $string ) { 71 | return serialize( $string ); 72 | } 73 | } 74 | 75 | /** 76 | * 77 | * Decode string for backup options 78 | * 79 | * @since 1.0.0 80 | * @version 1.0.0 81 | * 82 | */ 83 | if ( ! function_exists( 'cs_decode_string' ) ) { 84 | function cs_decode_string( $string ) { 85 | return unserialize( $string ); 86 | } 87 | } 88 | 89 | /** 90 | * 91 | * Get google font from json file 92 | * 93 | * @since 1.0.0 94 | * @version 1.0.0 95 | * 96 | */ 97 | if ( ! function_exists( 'cs_get_google_fonts' ) ) { 98 | function cs_get_google_fonts() { 99 | 100 | global $cs_google_fonts; 101 | 102 | if( ! empty( $cs_google_fonts ) ) { 103 | 104 | return $cs_google_fonts; 105 | 106 | } else { 107 | 108 | ob_start(); 109 | cs_locate_template( 'fields/typography/google-fonts.json' ); 110 | $json = ob_get_clean(); 111 | 112 | $cs_google_fonts = json_decode( $json ); 113 | 114 | return $cs_google_fonts; 115 | } 116 | 117 | } 118 | } 119 | 120 | /** 121 | * 122 | * Get icon fonts from json file 123 | * 124 | * @since 1.0.0 125 | * @version 1.0.0 126 | * 127 | */ 128 | if ( ! function_exists( 'cs_get_icon_fonts' ) ) { 129 | function cs_get_icon_fonts( $file ) { 130 | 131 | ob_start(); 132 | cs_locate_template( $file ); 133 | $json = ob_get_clean(); 134 | 135 | return json_decode( $json ); 136 | 137 | } 138 | } 139 | 140 | /** 141 | * 142 | * Array search key & value 143 | * 144 | * @since 1.0.0 145 | * @version 1.0.0 146 | * 147 | */ 148 | if ( ! function_exists( 'cs_array_search' ) ) { 149 | function cs_array_search( $array, $key, $value ) { 150 | 151 | $results = array(); 152 | 153 | if ( is_array( $array ) ) { 154 | if ( isset( $array[$key] ) && $array[$key] == $value ) { 155 | $results[] = $array; 156 | } 157 | 158 | foreach ( $array as $sub_array ) { 159 | $results = array_merge( $results, cs_array_search( $sub_array, $key, $value ) ); 160 | } 161 | 162 | } 163 | 164 | return $results; 165 | 166 | } 167 | } 168 | 169 | /** 170 | * 171 | * Getting POST Var 172 | * 173 | * @since 1.0.0 174 | * @version 1.0.0 175 | * 176 | */ 177 | if ( ! function_exists( 'cs_get_var' ) ) { 178 | function cs_get_var( $var, $default = '' ) { 179 | 180 | if( isset( $_POST[$var] ) ) { 181 | return $_POST[$var]; 182 | } 183 | 184 | if( isset( $_GET[$var] ) ) { 185 | return $_GET[$var]; 186 | } 187 | 188 | return $default; 189 | 190 | } 191 | } 192 | 193 | /** 194 | * 195 | * Getting POST Vars 196 | * 197 | * @since 1.0.0 198 | * @version 1.0.0 199 | * 200 | */ 201 | if ( ! function_exists( 'cs_get_vars' ) ) { 202 | function cs_get_vars( $var, $depth, $default = '' ) { 203 | 204 | if( isset( $_POST[$var][$depth] ) ) { 205 | return $_POST[$var][$depth]; 206 | } 207 | 208 | if( isset( $_GET[$var][$depth] ) ) { 209 | return $_GET[$var][$depth]; 210 | } 211 | 212 | return $default; 213 | 214 | } 215 | } 216 | 217 | /** 218 | * 219 | * Load options fields 220 | * 221 | * @since 1.0.0 222 | * @version 1.0.0 223 | * 224 | */ 225 | if ( ! function_exists( 'cs_load_option_fields' ) ) { 226 | function cs_load_option_fields() { 227 | 228 | $located_fields = array(); 229 | 230 | foreach ( glob( CS_DIR .'/fields/*/*.php' ) as $cs_field ) { 231 | $located_fields[] = basename( $cs_field ); 232 | cs_locate_template( str_replace( CS_DIR, '', $cs_field ) ); 233 | } 234 | 235 | $override_name = apply_filters( 'cs_framework_override', 'cs-framework-override' ); 236 | $override_dir = get_template_directory() .'/'. $override_name .'/fields'; 237 | 238 | if( is_dir( $override_dir ) ) { 239 | 240 | foreach ( glob( $override_dir .'/*/*.php' ) as $override_field ) { 241 | 242 | if( ! in_array( basename( $override_field ), $located_fields ) ) { 243 | 244 | cs_locate_template( str_replace( $override_dir, '/fields', $override_field ) ); 245 | 246 | } 247 | 248 | } 249 | 250 | } 251 | 252 | do_action( 'cs_load_option_fields' ); 253 | 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /inc/frame/functions/sanitize.php: -------------------------------------------------------------------------------- 1 | (1000 * 1024)) { 34 | echo '{"status":3,"msg":"图片大小不能超过1M"}'; 35 | exit(); 36 | } 37 | */ 38 | $dataname = date("YmdHis_").substr(md5(time()), 0, 8) . '.' . $baseext; 39 | $filename = $wp_upload_dir['path'] . '/' . $dataname; 40 | rename( $file['tmp_name'], $filename ); // 将上传的图片文件移动到上传目录 41 | $attachment = array( 42 | 'guid' => $wp_upload_dir['url'] . '/' . $dataname, // 外部链接的 url 43 | 'post_mime_type' => $file['type'], // 文件 mime 类型 44 | 'post_title' => preg_replace( '/\.[^.]+$/', '', $basename ), // 附件标题,采用去除扩展名之后的文件名 45 | 'post_content' => '', // 文章内容,留空 46 | 'post_status' => 'inherit' 47 | ); 48 | $attach_id = wp_insert_attachment( $attachment, $filename ); // 插入附件信息 49 | if($attach_id != 0){ 50 | require_once( ABSPATH . 'wp-admin/includes/image.php' ); // 确保包含此文件,因为wp_generate_attachment_metadata()依赖于此文件。 51 | $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); 52 | wp_update_attachment_metadata( $attach_id, $attach_data ); // 生成附件的元数据,并更新数据库记录。 53 | // 返回消息至前端 54 | print_r(json_encode(array('status'=>1,'msg'=>'图片添加成功','data'=>array('id'=>$attach_id,'src'=>wp_get_attachment_url( $attach_id ),'title'=>time())))); 55 | exit(); 56 | }else{ 57 | echo '{"status":4,"msg":"图片上传失败!"}'; 58 | exit(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /inc/register.php: -------------------------------------------------------------------------------- 1 | get('Version')); 17 | wp_register_style( 'font-awesome', THEME_URL.'/css/font-awesome.min.css', array(), $theme_version, 'all' ); 18 | wp_register_style( 'bootstrap', THEME_URL.'/css/bootstrap.css', array(), $theme_version, 'all' ); 19 | wp_register_style( 'nav', THEME_URL.'/css/nav.css', array(), $theme_version ); 20 | 21 | wp_register_script( 'bootstrap', THEME_URL.'/js/bootstrap.min.js', array('jquery'), $theme_version, true ); 22 | wp_register_script( 'TweenMax', THEME_URL.'/js/TweenMax.min.js', array('jquery'), $theme_version, true ); 23 | wp_register_script( 'appjs', THEME_URL.'/js/app.js', array('jquery'), $theme_version, true ); 24 | wp_register_script( 'lazyload', THEME_URL.'/js/lazyload.min.js', array('jquery'), $theme_version, true ); 25 | 26 | if( !is_admin() ) 27 | { 28 | wp_enqueue_style('font-awesome'); 29 | wp_enqueue_style('bootstrap'); 30 | wp_enqueue_style('nav'); 31 | 32 | wp_deregister_script( 'jquery' ); 33 | wp_register_script( 'jquery', THEME_URL.'/js/jquery-3.7.1.min.js', array(), $theme_version ,false); 34 | wp_enqueue_script('jquery'); 35 | 36 | wp_enqueue_script('bootstrap'); 37 | wp_enqueue_script('TweenMax'); 38 | wp_enqueue_script('appjs'); 39 | 40 | if(io_get_option('lazyload')) wp_enqueue_script('lazyload'); 41 | 42 | if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 43 | wp_enqueue_script( 'comment-reply' ); 44 | } 45 | } 46 | wp_localize_script('appjs', 'theme' , array( 47 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), 48 | 'addico' => get_theme_file_uri('/images/add.png'), 49 | 'version' => $theme_version, 50 | )); 51 | } 52 | add_action('wp_enqueue_scripts', 'theme_load_scripts'); 53 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 17 |
    18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 30 | 31 |
    32 |
    ' . stripslashes( io_get_option('ad_home') ) . '
    ' . stripslashes( io_get_option('ad_home') ) . '
    '; ?> 33 | 34 | term_id, '_view_user', true)); 37 | if ($__visible === 0) { 38 | continue; 39 | } 40 | if($category->category_parent == 0){ 41 | $children = get_categories(array( 42 | 'taxonomy' => 'favorites', 43 | 'meta_key' => '_term_order', 44 | 'orderby' => 'meta_value_num', 45 | 'order' => 'desc', 46 | 'child_of' => $category->term_id, 47 | 'hide_empty' => 0 48 | ) 49 | ); 50 | if(empty($children)){ 51 | fav_con($category, $__visible); 52 | }else{ 53 | foreach($children as $mid) { 54 | $__visible = io_is_visible(get_term_meta($mid->term_id, '_view_user', true)); 55 | if ($__visible === 0) { 56 | continue; 57 | } 58 | fav_con($mid, $__visible); 59 | } 60 | } 61 | } 62 | } 63 | get_template_part( 'templates/friendlink' ); 64 | ?> 65 |
    66 | 一为主题
    升级到最新的" 425 | "OneNav导航主题,体验更多功能" 426 | msgstr "" 427 | 428 | #. Author of the plugin/theme 429 | msgid "iowen" 430 | msgstr "" 431 | 432 | #. Author URI of the plugin/theme 433 | msgid "https://www.iowen.cn/" 434 | msgstr "" 435 | 436 | #. Template Name of the plugin/theme 437 | msgid "投稿模板" 438 | msgstr "" 439 | 440 | #. Template Name of the plugin/theme 441 | msgid "文章列表" 442 | msgstr "" 443 | -------------------------------------------------------------------------------- /page.php: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 18 |
    19 | 20 |
    21 |
    22 |
    23 |
    24 |

    25 |
    26 |
    27 |
    28 | 29 | 30 | ', '' ); ?> 31 | 32 |
    33 |
    34 |
    35 |
    36 | 41 |
    42 |
    43 |
    44 | -------------------------------------------------------------------------------- /screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/owen0o0/WebStack/7e00c226482db9ddc66d3f7c8b53c91a62353578/screenshot.jpg -------------------------------------------------------------------------------- /search.php: -------------------------------------------------------------------------------- 1 | 17 |
    18 | 19 | 25 | 26 |
    27 |
    28 |

    29 |
    30 | 31 | 32 |
    33 |
    34 |
    35 | 36 | 37 | 38 | 39 | ID, '_sites_link', true); 41 | $default_ico = get_theme_file_uri('/images/favicon.png'); 42 | if(io_is_visible( get_post_meta($post->ID, '_visible', true))): 43 | ?> 44 | 48 | 49 |
    50 |
    51 |
    52 | 0, 54 | 'before_page_number' => '', 55 | 'mid_size' => 2, 56 | ));?> 57 |
    58 |
    59 | 60 |
    61 |
    62 |
    63 | 64 | 25 |
    26 | 27 | 28 | 29 |
    30 |
    31 |
    32 |
    33 | '.__('此内容需登陆后查看','i_theme').'
    '; 36 | } else { 37 | ?> 38 |
    39 | 41 |
    42 |
    43 | ID, '_sites_link', true); 45 | $m_thumbnail = get_post_meta(get_the_ID(), '_thumbnail', true); 46 | if ($m_thumbnail == '' && $m_link_url == '') 47 | $imgurl = get_theme_file_uri('/images/favicon.png'); 48 | else 49 | $imgurl = $m_thumbnail ? $m_thumbnail : (io_get_option('ico_url') . format_url($m_link_url) . io_get_option('ico_png')); 50 | $sitetitle = get_the_title(); 51 | ?> 52 |
    53 |
    54 | <?php echo $sitetitle ?> 55 |
    56 |
    57 |
    58 |
    59 | name; 64 | $link = esc_url(get_term_link($term, 'res_category')); 65 | echo " " . $name . ""; 66 | } 67 | } 68 | ?> 69 |
    70 |
    71 | 72 |

    73 | ID); 75 | $qrurl = "//api.qrserver.com/v1/create-qr-code/?size=150x150&margin=10&data=" . $m_post_link_url; 76 | $qrname = __("手机查看", "i_theme"); 77 | if (get_post_meta(get_the_ID(), '_wechat_qr', true)) { 78 | $qrurl = get_post_meta(get_the_ID(), '_wechat_qr', true); 79 | $qrname = __("公众号", "i_theme"); 80 | } 81 | ?> 82 |
    83 | 84 | 85 | 86 | 87 |
    88 |
    89 | 90 |
    91 |
    92 |
    93 | 94 | ' . stripslashes(io_get_option('ad_right')) . '
    '; ?> 96 | 97 |
    98 |
    99 |
    100 | 108 | 109 |
    110 | 111 |
    112 | ', ''); 114 | } 115 | ?> 116 |
    117 | 118 |

    119 |
    120 | ID,'favorites', array('fields' => 'ids') ); 125 | $args = array( 126 | 'post_type' => 'sites',// 文章类型 127 | 'post_status' => 'publish', 128 | 'posts_per_page' => 6, // 文章数量 129 | 'orderby' => 'rand', // 随机排序 130 | 'tax_query' => array( 131 | array( 132 | 'taxonomy' => 'favorites', // 分类法 133 | 'field' => 'id', 134 | 'terms' => $custom_taxterms 135 | ) 136 | ), 137 | 'post__not_in' => array ($post->ID), // 排除当前文章 138 | ); 139 | $related_items = new WP_Query( $args ); 140 | if ($related_items->have_posts()) : 141 | while ( $related_items->have_posts() ) : $related_items->the_post(); 142 | $link_url = get_post_meta($post->ID, '_sites_link', true); 143 | $default_ico = get_theme_file_uri('/images/favicon.png'); 144 | if(io_is_visible( get_post_meta($post->ID, '_visible', true))): 145 | ?> 146 | 149 |
    '.__('没有相关内容!','i_theme').'
    '; 152 | ?> 153 |
    154 | 155 | 160 |
    161 | 162 | ' . stripslashes( io_get_option('ad_footer') ) . '
    '; ?> 163 | 164 |
    165 | 166 | 167 | -------------------------------------------------------------------------------- /single.php: -------------------------------------------------------------------------------- 1 | 15 |
    16 | 17 |
    18 |
    19 |
    20 |
    21 |

    22 | 34 |
    35 |
    36 |
    37 | 38 | 39 | ', '' ); ?> 40 | 41 |
    42 |
    43 |
    44 |
    45 | 50 |
    51 |
    52 |
    53 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name:WebStack 3 | Theme URI:https://www.iotheme.cn 4 | Description:wordpress 导航主题!官方网站:一为主题
    升级到最新的OneNav导航主题,体验更多功能 5 | Version:1.2025 6 | Requires at least: 6.0 7 | Tested up to: 6.6 8 | Requires PHP: 5.6 9 | Author:iowen, LoveDoLove 10 | Author URI: https://www.iowen.cn/ 11 | License URI: https://www.iotheme.cn/disclaimer 12 | Text Domain: i_theme 13 | Domain Path: /languages 14 | Tags: 导航, 菜单, 响应式, 兼容性 15 | */ 16 | -------------------------------------------------------------------------------- /taxonomy-favorites.php: -------------------------------------------------------------------------------- 1 | 24 |
    25 | 26 | 27 | 28 | 31 | 32 | 33 |

    34 | '.__('此分类需登陆后查看','i_theme').'
    '; 37 | } else { 38 | ?> 39 |
    40 | ID, '_sites_link', true); 45 | $default_ico = get_theme_file_uri('/images/favicon.png'); 46 | if (io_is_visible(get_post_meta($post->ID, '_visible', true))): 47 | ?> 48 | 51 | 52 |
    53 |
    54 | 55 |
    56 | 0, 59 | 'before_page_number' => '', 60 | 'mid_size' => 2, 61 | ) 62 | ); ?> 63 |
    64 | 65 | -------------------------------------------------------------------------------- /template-posts.php: -------------------------------------------------------------------------------- 1 | 1, 15 | 'paged' => $paged, 16 | ); 17 | 18 | if(isset($_GET['cat'])) 19 | $args['cat'] = $_GET['cat']; 20 | $args = apply_filters('io_blog_post_query_var_filters', $args); 21 | query_posts( $args ); 22 | 23 | 24 | ?> 25 |
    26 | 27 |
    28 |
    29 |
    30 |
    31 |
    32 | 33 | 34 |
    35 |

    36 | 37 |

    38 | 50 |
    51 |
    52 |
    53 |
    54 | 55 |
    56 |
    57 | 0, 59 | 'before_page_number' => '', 60 | 'mid_size' => 2, 61 | ));?> 62 |
    63 |
    64 |
    65 |
    66 |
    67 | 68 | 69 | -------------------------------------------------------------------------------- /templates/bulletin.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |
    16 |
    17 |
    18 |
    19 |
      20 | 'bulletin', 23 | 'posts_per_page' => io_get_option('bulletin_n') 24 | ); 25 | query_posts($args); while ( have_posts() ) : the_post(); 26 | ?> 27 | ', esc_url( get_permalink() ) ), ' ('. get_the_time('m/d').')' ); ?> 28 | 29 | 30 |
    31 |
    32 | 33 |
    34 |
    35 | 50 | -------------------------------------------------------------------------------- /templates/friendlink.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 |

    17 | 18 |

    19 | 24 | -------------------------------------------------------------------------------- /templates/header-banner.php: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /templates/header-nav.php: -------------------------------------------------------------------------------- 1 | 'favorites', 17 | 'parent' => 0, 18 | 'meta_key' => '_term_order', 19 | 'orderby' => 'meta_value_num', 20 | 'order' => 'desc', 21 | 'hide_empty' => 0, 22 | )); 23 | ?> 24 | -------------------------------------------------------------------------------- /templates/site-card.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | ID, '_wechat_qr', true)){ 20 | $title=""; 21 | $is_html = 'data-html="true"'; 22 | } else { 23 | switch(io_get_option('po_prompt')) { 24 | case 'null': 25 | $title = get_the_title(); 26 | $tooltip = ''; 27 | break; 28 | case 'url': 29 | if($link_url=="") 30 | $title = __('地址错误!','i_theme'); 31 | break; 32 | case 'summary': 33 | $title = get_post_meta($post->ID, '_sites_sescribe', true); 34 | break; 35 | case 'qr': 36 | if($link_url=="") 37 | $title = __('地址错误!','i_theme'); 38 | else{ 39 | $title = ""; 40 | $is_html = 'data-html="true"'; 41 | } 42 | break; 43 | default: 44 | } 45 | } 46 | $url = ''; 47 | $blank = '_blank'; 48 | if(io_get_option('details_page')){ 49 | $url=get_permalink(); 50 | }else{ 51 | if($link_url==""){ 52 | $url = 'javascript:'; 53 | $blank = ''; 54 | }else{ 55 | if(io_get_option('is_go')) 56 | $url = home_url().'/go/?url='.base64_encode($link_url) ; 57 | else 58 | $url = $link_url; 59 | } 60 | } 61 | $ico = io_theme_get_thumb(); 62 | //判断是不是文章 post 63 | if(get_post_type() == 'post'){ 64 | $title = ''; 65 | $url = get_permalink(); 66 | }else{ 67 | $ico = $ico ?: (io_get_option('ico_url') . format_url($link_url) . io_get_option('ico_png')); 68 | } 69 | ?> 70 | title=""> 71 |
    72 |
    73 | 74 | 75 | 76 | 77 | 78 |
    79 |
    80 |
    81 | 82 |
    83 |

    ID, '_sites_sescribe', true) ?: preg_replace("/(\s|\ \;| |\xc2\xa0)/","",get_the_excerpt($post->ID)); ?>

    84 |
    85 |
    86 |
    87 | 88 | --------------------------------------------------------------------------------