<?php
class CleverAccounts {
public function __construct () {
add_action( 'init', array( $this, 'clever_register_post_type_accounts' ) );
if ( ! is_admin() ) {
return;
}
add_filter( 'manage_cleverwa_accounts_posts_columns', array( $this, 'clever_accounts_post_type_columns' ) );
add_action( 'manage_cleverwa_accounts_posts_custom_column', array( $this, 'clever_accounts_post_type_columns_data' ), 10, 2 );
add_filter( 'manage_edit-cleverwa_accounts_sortable_columns', array( $this, 'clever_accounts_sortable_columns' ) );
add_action( 'add_meta_boxes', array( $this, 'clever_add_meta_boxes' ) );
add_action( 'save_post', array( $this, 'clever_save_meta_boxes' ) );
}
public function clever_register_post_type_accounts () {
$labels = array(
'name' => _x( 'WhatsApp Accounts', 'post type general name', 'cleverwa' ),
'singular_name' => _x( 'WhatsApp Account', 'post type singular name', 'cleverwa' ),
'menu_name' => _x( 'Accounts', 'admin menu', 'cleverwa' ),
'name_admin_bar' => _x( 'Account', 'add new on admin bar', 'cleverwa' ),
'add_new' => _x( 'Add New', 'book', 'cleverwa' ),
'add_new_item' => __( 'Add New Account', 'cleverwa' ),
'new_item' => __( 'New Account', 'cleverwa' ),
'edit_item' => __( 'Edit Account', 'cleverwa' ),
'view_item' => __( 'View Account', 'cleverwa' ),
'all_items' => __( 'All Accounts', 'cleverwa' ),
'search_items' => __( 'Search Accounts', 'cleverwa' ),
'parent_item_colon' => __( 'Parent Accounts:', 'cleverwa' ),
'not_found' => __( 'No accounts found.', 'cleverwa' ),
'not_found_in_trash' => __( 'No accounts found in Trash.', 'cleverwa' )
);
$args = array(
'labels' => $labels,
'description' => __( 'WhatsApp Accounts', 'cleverwa' ),
'public' => false,
'exclude_from_search'=> true,
'show_ui' => true,
'show_in_menu' => 'cleverwa_parent',
'query_var' => false,
'rewrite' => false,
'capability_type' => 'post',
'menu_position' => null,
'supports' => array( 'title', 'thumbnail' )
);
register_post_type( 'cleverwa_accounts', $args );
}
public function clever_accounts_post_type_columns ( $defaults ) {
unset( $defaults['title'] );
unset( $defaults['date'] );
$defaults['title'] = esc_html__( 'Account Title', 'cleverwa' );
$defaults['picture'] = esc_html__( 'Picture', 'cleverwa' );
$defaults['number'] = esc_html__( 'Number', 'cleverwa' );
$defaults['role'] = esc_html__( 'Role Title', 'cleverwa' );
$defaults['pinned'] = esc_html__( 'Pin Account', 'cleverwa' );
return $defaults;
}
public function clever_accounts_post_type_columns_data ( $column_name, $post_id ) {
if ( $column_name == 'picture' ) {
if ( has_post_thumbnail( $post_id ) ) {
echo '<img src="' . get_the_post_thumbnail_url() . '" style="max-width: 40px;"/>';
}
}
if ( $column_name == 'number' ) {
echo get_post_meta( $post_id, 'cleverwa_number', true );
}
if ( $column_name == 'role' ) {
echo get_post_meta( $post_id, 'cleverwa_title', true );
}
if ( $column_name == 'pinned' ) {
echo get_post_meta( $post_id, 'cleverwa_pin_account', true ) === 'on' ? esc_html__( 'Yes', 'cleverwa' ) : esc_html__( 'No', 'cleverwa' );
}
}
public function clever_accounts_sortable_columns ( $columns ) {
$columns['number'] = 'number';
$columns['time'] = 'time';
return $columns;
}
public function clever_add_meta_boxes () {
$screen = get_current_screen();
add_meta_box(
'cleverwa-links',
esc_html__( 'Links', 'cleverwa' ),
array( $this, 'clever_links' ),
array( 'cleverwa_accounts' ),
'side'
);
if( 'add' !== $screen->action ) {
add_meta_box(
'cleverwa-copy-shortcode',
esc_html__( 'Shortcode for this account', 'cleverwa' ),
array( $this, 'clever_copy_shortcode' ),
array( 'cleverwa_accounts' ),
'side'
);
}
add_meta_box(
'cleverwa-account-information',
esc_html__( 'WhatsApp Account Information', 'cleverwa' ),
array( $this, 'clever_account_information' ),
array( 'cleverwa_accounts' ),
'normal'
);
add_meta_box(
'cleverwa-page-targeting',
esc_html__( 'Page Targeting', 'cleverwa' ),
array( $this, 'clever_page_targeting' ),
array( 'cleverwa_accounts' ),
'normal'
);
add_meta_box(
'cleverwa-button-style',
esc_html__( 'Button Style', 'cleverwa' ),
array( $this, 'clever_button_style' ),
array( 'cleverwa_accounts' ),
'normal'
);
}
public function clever_account_information ( $post ) {
global $pagenow;
$new = 'post-new.php' === $pagenow ? true : false;
$number = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_number', true ) );
$name = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_name', true ) );
$title = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_title', true ) );
$predefined_text = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_predefined_text', true ) );
if ( function_exists( 'sanitize_textarea_field' ) ) {
$predefined_text = sanitize_textarea_field( get_post_meta( $post->ID, 'cleverwa_predefined_text', true ) );
}
$button_label = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_button_label', true ) );
$hour_start = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_hour_start', true ) ) : '';
$minute_start = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_minute_start', true ) ) : '';
$hour_end = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_hour_end', true ) ) : '23';
$minute_end = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_minute_end', true ) ) : '59';
$sunday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_sunday', true ) ) : 'on';
$monday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_monday', true ) ) : 'on';
$tuesday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_tuesday', true ) ) : 'on';
$wednesday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_wednesday', true ) ) : 'on';
$thursday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_thursday', true ) ) : 'on';
$friday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_friday', true ) ) : 'on';
$saturday = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_saturday', true ) ) : 'on';
$hide_on_large_screen = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_hide_on_large_screen', true ) ) : 'off';
$hide_on_small_screen = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_hide_on_small_screen', true ) ) : 'off';
$pin_account = ! $new ? sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_pin_account', true ) ) : 'off';
$offline_text = sanitize_text_field( get_post_meta( $post->ID, 'cleverwa_offline_text', true ) );
$availability = array(
'sunday' => array(
'label' => esc_html( 'Sunday', 'cleverwa' ),
'enable' => 0,
'hour_start' => 0,
'minute_start' => 0,
'hour_end' => 23,
'minute_end' => 59
)
,
'monday' => array(
'label' => esc_html( 'Monday', 'cleverwa' ),
'enable' => 1,
'hour_start' => 0,
'minute_start' => 0,
'hour_end' => 23,
'minute_end' => 59
)
,
'tuesday' => array(
'label' => esc_html( 'Tuesday', 'cleverwa' ),
'enable' => 1,
'hour_start' => 0,
'minute_start' => 0,
'hour_end' => 23,
'minute_end' => 59
)
,
'wednesday' => array(
'label' => esc_html( 'Wednesday', 'cleverwa' ),
'enable' => 1,
'hour_start' => 0,
'minute_start
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v1.0.0.zip
共42个文件
php:26个
png:5个
css:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 197 浏览量
2022-04-01
12:34:35
上传
评论
收藏 178KB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v1.0.0 Clever WhatsApp Chat WordPress Plugin 聪明WhatsApp聊天WordPress插件" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v1.0.0.zip (42个子文件)
clever-whatsapp
assets
css
jquery-minicolors.css 7KB
admin.css 9KB
auto-generated-cleverwa.css 2KB
public.css 11KB
images
loader.gif 41KB
jquery.minicolors.png 67KB
logo-group.png 2KB
logo-white-small.png 926B
logo-green-nobg.png 15KB
logo-green-small.png 7KB
js
vendor
jquery.minicolors.min.js 15KB
admin.js 14KB
public.js 17KB
clever-whatsapp.php 2KB
languages
cleverwa-pt_BR.po 22KB
cleverwa.pot 16KB
cleverwa-pt_BR.mo 12KB
includes
controllers
CleverFloatingWidgetAutoDisplay.php 2KB
CleverFloatingWidgetSelectedAccounts.php 1KB
CleverFloatingWidgetConsentConfirmation.php 2KB
CleverSettings.php 3KB
CleverFloatingWidgetDisplaySettings.php 4KB
CleverWoocommerceButton.php 2KB
CleverFloatingWidget.php 486B
views
CleverFloatingWidgetAutoDisplay.php 3KB
CleverFloatingWidgetHeader.php 1KB
CleverFloatingWidgetSelectedAccounts.php 772B
CleverFloatingWidgetConsentConfirmation.php 2KB
CleverSettings.php 4KB
CleverFloatingWidgetDisplaySettings.php 7KB
CleverWoocommerceButton.php 3KB
classes
CleverController.php 939B
CleverTemplates.php 3KB
CleverScriptsAndStyles.php 1KB
CleverUtils.php 5KB
CleverAccounts.php 32KB
CleverDisplay.php 26KB
CleverWoocommerce.php 6KB
CleverAjax.php 3KB
CleverActivation.php 3KB
CleverMenuLink.php 4KB
CleverShortcode.php 4KB
共 42 条
- 1
资源评论
Lee达森
- 粉丝: 968
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功