__( 'کلید امنیتی اپلیکیشن', 'wc_appeto_secure' ), 'desc_tip' => '', 'id' => 'appeto_secure_key_woo', 'type' => 'text', 'css' => 'min-width:300px; direction: ltr; text-align: right;"', 'std' => $secure_key, // WC < 2.0 'default' => $secure_key, // WC >= 2.0 'desc' => __( 'این کلید را در پنل اپتو برای افزونه ووکامرس وارد کنید', 'wc_appeto_secure_desc' ), ); } $updated_settings[] = $section; } return $updated_settings; } add_action( 'admin_head', 'appeto_woo_admin_js' ); function appeto_woo_admin_js(){ if( is_admin() and isset($_GET["page"]) and $_GET["page"] == "wc-settings") { ?> true, '_builtin' => false ); $output = 'array'; $operator = 'and'; $post_types = get_post_types( $args, $output, $operator ); if( is_array( $post_types ) ) { if (!empty($post_types)) { foreach ($post_types as $post_type) { if (!in_array($post_type->name, $deny_types)) { add_meta_box( 'appeto-send-notification ', 'ارسال نوتیفیکیشن - اپتو', 'appeto_display_notification_callback', $post_type->name, 'side', 'high' ); } } } } } add_action( 'add_meta_boxes', 'appeto_register_meta_boxes' ); function appeto_display_notification_callback( $post ) { ?>

در این بخش میتوانید همزمان با انتشار/ویرایش این پست به کاربرانتان نوتیفیکیشن ارسال کنید.

post_title, 0, 100); $desc = substr(strip_tags($post->post_content), 0, 100); $device = "all"; if(isset($_POST['appeto_push_url']) and $_POST['appeto_push_url'] != null) { $url = $post->guid; } if(isset($_POST['appeto_push_title']) and $_POST['appeto_push_title'] != "") { $title = $_POST['appeto_push_title']; } if(isset($_POST['appeto_push_desc']) and $_POST['appeto_push_desc'] != "") { $desc = $_POST['appeto_push_desc']; } if(isset($_POST['appeto_push_devices'])) { $device = $_POST['appeto_push_devices']; } $notifications = new appeto_push_notification(); $notifications->send($device, $url, $title, $desc); } } add_action( 'save_post', 'appeto_save_meta_box', 1, 2); function appeto_custom_get_terms($term) { global $wpdb; $out = array(); $a = $wpdb->get_results($wpdb->prepare("SELECT t.name,t.slug,t.term_group,x.term_taxonomy_id,x.term_id,x.taxonomy,x.description,x.parent,x.count FROM {$wpdb->prefix}term_taxonomy x LEFT JOIN {$wpdb->prefix}terms t ON (t.term_id = x.term_id) WHERE x.taxonomy=%s;",$term)); foreach ($a as $b) { $obj = new stdClass(); $obj->term_id = $b->term_id; $obj->name = $b->name; $obj->slug = $b->slug; $obj->term_group = $b->term_group; $obj->term_taxonomy_id = $b->term_taxonomy_id; $obj->taxonomy = $b->taxonomy; $obj->description = $b->description; $obj->parent = $b->parent; $obj->count = $b->count; $out[] = $obj; } return $out; } } function appeto_change_location($url) { if(!headers_sent()) { header("Location: ".$url); } else { echo ''; } exit; } /* Login/register */ new appeto_auth(); /* woocommrece network */ function appeto_get_network_sites() { $result = array(); if(function_exists('get_sites')) { $sites = get_sites(); } elseif(function_exists('wp_get_sites')) { $sites = wp_get_sites(); } else { $sites = array(); } foreach($sites as $site) { if($site->path == "/") continue; if($site->deleted == 1) continue; $blog_details = get_blog_details( array( 'blog_id' => $site->blog_id ) ); $r["id"] = $site->blog_id; $r["applink"] = base64_encode(json_encode(array("id" => $site->blog_id, "path" => $blog_details->path, "siteurl" => $blog_details->siteurl))); $r["name"] = $blog_details->blogname; $r["path"] = $blog_details->path; $r["siteurl"] = $blog_details->siteurl; $r["image"] = get_option("appeto_ntsite_img_".$site->blog_id, ""); array_push($result, $r); } return $result; } function appeto_encode_this_key( $txt, $hashKey ) { if(function_exists("mcrypt_encrypt")) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($hashKey), $txt, MCRYPT_MODE_CBC, md5(md5($hashKey)))); } return base64_encode($txt); }