<?php
if (!class_exists('RapidAddon')) {
class RapidAddon {
public $name;
public $slug;
public $fields;
public $options = array();
public $accordions = array();
public $image_sections = array();
public $import_function;
public $post_saved_function;
public $notice_text;
public $logger = null;
public $when_to_run = false;
public $image_options = array(
'download_images' => 'yes',
'download_featured_delim' => ',',
'download_featured_image' => '',
'gallery_featured_image' => '',
'gallery_featured_delim' => ',',
'featured_image' => '',
'featured_delim' => ',',
'search_existing_images' => 1,
'is_featured' => 0,
'create_draft' => 'no',
'set_image_meta_title' => 0,
'image_meta_title_delim' => ',',
'image_meta_title' => '',
'set_image_meta_caption' => 0,
'image_meta_caption_delim' => ',',
'image_meta_caption' => '',
'set_image_meta_alt' => 0,
'image_meta_alt_delim' => ',',
'image_meta_alt' => '',
'set_image_meta_description' => 0,
'image_meta_description_delim' => ',',
'image_meta_description_delim_logic' => 'separate',
'image_meta_description' => '',
'auto_rename_images' => 0,
'auto_rename_images_suffix' => '',
'auto_set_extension' => 0,
'new_extension' => '',
'do_not_remove_images' => 1,
);
protected $isWizard = true;
function __construct($name, $slug) {
$this->name = $name;
$this->slug = $slug;
if (!empty($_GET['id'])){
$this->isWizard = false;
}
}
function set_import_function($name) {
$this->import_function = $name;
}
function set_post_saved_function($name) {
$this->post_saved_function = $name;
}
function is_active_addon($post_type = null) {
if ( ! is_plugin_active('wp-all-import-pro/wp-all-import-pro.php') and ! is_plugin_active('wp-all-import/plugin.php') ){
return false;
}
$addon_active = false;
if ($post_type !== null) {
if (@in_array($post_type, $this->active_post_types) or empty($this->active_post_types)) {
$addon_active = true;
}
}
if ($addon_active){
$current_theme = wp_get_theme();
$parent_theme = $current_theme->parent();
$theme_name = $current_theme->get('Name');
$addon_active = (@in_array($theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
if ( ! $addon_active and $parent_theme ){
$parent_theme_name = $parent_theme->get('Name');
$addon_active = (@in_array($parent_theme_name, $this->active_themes) or empty($this->active_themes)) ? true : false;
}
if ( $addon_active and ! empty($this->active_plugins) ){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
foreach ($this->active_plugins as $plugin) {
if ( ! is_plugin_active($plugin) ) {
$addon_active = false;
break;
}
}
}
}
if ($this->when_to_run == "always") {
$addon_active = true;
}
return apply_filters('rapid_is_active_add_on', $addon_active, $post_type, $this->slug);
}
/**
*
* Add-On Initialization
*
* @param array $conditions - list of supported themes and post types
*
*/
function run($conditions = array()) {
if (empty($conditions)) {
$this->when_to_run = "always";
}
@$this->active_post_types = ( ! empty($conditions['post_types'])) ? $conditions['post_types'] : array();
@$this->active_themes = ( ! empty($conditions['themes'])) ? $conditions['themes'] : array();
@$this->active_plugins = ( ! empty($conditions['plugins'])) ? $conditions['plugins'] : array();
add_filter('pmxi_addons', array($this, 'wpai_api_register'));
add_filter('wp_all_import_addon_parse', array($this, 'wpai_api_parse'));
add_filter('wp_all_import_addon_import', array($this, 'wpai_api_import'));
add_filter('wp_all_import_addon_saved_post', array($this, 'wpai_api_post_saved'));
add_filter('pmxi_options_options', array($this, 'wpai_api_options'));
add_filter('wp_all_import_image_sections', array($this, 'additional_sections'), 10, 1);
add_action('pmxi_extend_options_featured', array($this, 'wpai_api_metabox'), 10, 2);
add_action('admin_init', array($this, 'admin_notice_ignore'));
}
function parse($data) {
if ( ! $this->is_active_addon($data['import']->options['custom_type'])) return false;
$parsedData = $this->helper_parse($data, $this->options_array());
return $parsedData;
}
function add_field($field_slug, $field_name, $field_type, $enum_values = null, $tooltip = "", $is_html = true, $default_text = '') {
$field = array("name" => $field_name, "type" => $field_type, "enum_values" => $enum_values, "tooltip" => $tooltip, "is_sub_field" => false, "is_main_field" => false, "slug" => $field_slug, "is_html" => $is_html, 'default_text' => $default_text);
$this->fields[$field_slug] = $field;
if ( ! empty($enum_values) ){
foreach ($enum_values as $key => $value) {
if (is_array($value))
{
if ($field['type'] == 'accordion')
{
$this->fields[$value['slug']]['is_sub_field'] = true;
}
else
{
foreach ($value as $n => $param) {
if (is_array($param) and ! empty($this->fields[$param['slug']])){
$this->fields[$param['slug']]['is_sub_field'] = true;
}
}
}
}
}
}
return $field;
}
function add_acf_field($field){
$this->fields[$field->post_name] = array(
'type' => 'acf',
'field_obj' => $field
);
}
private $acfGroups = array();
function use_acf_group($acf_group){
$this->add_text(
'<div class="postbox acf_postbox default acf_signle_group rad4">
<h3 class="hndle" style="margin-top:0;"><span>'.$acf_group['title'].'</span></h3>
<div class="inside">');
$acf_fields = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'post_parent' => $acf_group['ID'], 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC'));
if (!empty($acf_fields)){
foreach ($acf_fields as $field) {
$this->add_acf_field($field);
}
}
$this->add_text('</div></div>');
$this->acfGroups[] = $acf_group['ID'];
add_filter('wp_all_import_acf_is_show_group', array($this, 'acf_is_show_group'), 10, 2);
}
function acf_is_show_group($is_show, $acf_group){
return (in_array($acf_group['ID'], $this->acfGroups)) ? false : true;
}
/**
*
* Add an option to WP All Import options list
*
* @param string $slug - option name
* @param string $default_value - default option value
*
*/
function add_option($slug, $default_value = ''){
$this->options[$slug] = $default_value;
}
function options_array() {
$options_list = array();
foreach ($this->fields as $field_slug => $field_params) {
if (in_array($field_params['type'], array('title', 'plain_text', 'acf'))) continue;
$default_value = '';
if (!empty($field_params['enum_values'])){
foreach ($field_params['enum_values'] as $key => $value) {
$default_value = $key;
break;
}
}
$options_list[$field_slug] = $default_value;
}
if ( ! empty($this->options) ){
foreach ($this->options as $slug => $value) {
$options_arr[$slug] = $value;
}
}
$options_arr[$this->slug] = $options_list;
$options_arr['rapid_addon'] = plugin_basename( __FILE__ );
return $options_arr;
}
function wpai_api_options($all_options) {
$all_options = $all_options + $this->options_array();
return $all_options;
}
function wpai_api_register($addons) {
if (empty($addons[$this->slug])) {
$addons[$this->slug] = 1;
}
return $addons;
}
function wpai_api_parse($functions) {
$functions[$this->slug] = array($this, 'pars
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v1.0.10.zip
共22个文件
php:11个
csv:4个
js:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 110 浏览量
2022-04-01
04:38:17
上传
评论
收藏 55KB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v1.0.10 PixelYourSite WooCommerce Cost of Goods Pixely Mocommerce商品费用" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v1.0.10.zip (22个子文件)
pixel-cost-of-goods
pixel_products_cog_export.csv 263B
assets
css
pixel-cog-main.css 3KB
images
pys-square-logo-small.png 2KB
js
woo_report.js 15KB
PapaParse.min.js 19KB
pixel_cog.js 19KB
pixel_products_cat_cog_export.csv 3KB
rapid-addon.php 35KB
.DS_Store 6KB
pixel_products_cog_import_example.csv 97B
pixel_products_cat_cog_import_example.csv 100B
pixel-cost-of-goods.php 6KB
includes
.DS_Store 6KB
classes
class-pixel-cost-of-goods-admin-columns.php 3KB
settings
settings-ajax.php 7KB
wc-settings.php 15KB
class-pixel-cost-of-goods-main.php 4KB
class-plugin-updater.php 15KB
core.php 33KB
reports
class-pixel-export-cost-of-goods.php 5KB
functions-woo-analytics.php 4KB
class-pixel-import-cost-of-goods.php 3KB
共 22 条
- 1
资源评论
Lee达森
- 粉丝: 968
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功