";print_r(is_plugin_active());exit; if (!is_plugin_active('ar-for-wordpress-premium/ar-wordpress.php')) { flush_rewrite_rules(); ar_wp_CURL_Call(ar_wp_register_on_plugin . 'active.php'); } else { wp_die('You Can Not Activate Demo Version, Because AR for Wordpress-Advance Paid Version Already Activate...!'); } } /* * **** End **** */ /* * ***** Deactivate plugin (Register)****** */ register_deactivation_hook(__FILE__, 'ar_wp_plugin_deactivation'); function ar_wp_plugin_deactivation() { flush_rewrite_rules(); ar_wp_CURL_Call(ar_wp_register_on_plugin . 'deactive.php'); } /* * **** End **** */ /* * ******** Function CUrl ************* */ function ar_wp_CURL_Call($link) { ob_start(); $data = array( 'method' => 'POST', 'body' => array( 'domain_name' => site_url(), 'plugin_type' => 1, 'sitetitle' => get_bloginfo('name') )); $response = wp_remote_post($link, $data); return $response['body']; ob_flush(); } /* * *********** End ******************** */ /* * ***** Add Css and Js ********** */ add_action('init', 'ar_wp_register_script'); function ar_wp_register_script() { wp_register_script('custom_jquery', plugins_url('assets/js/custom-jquery.js', __FILE__), array('jquery'), '2.5.1'); wp_enqueue_script('custom_jquery'); wp_localize_script('custom_jquery', 'get', array( 'url' => esc_url(plugins_url('assets/css/images/loading.gif', __FILE__)), 'sucess_symbol' => esc_url(plugins_url('assets/css/images/green-tick.png', __FILE__)), 'convert' => esc_url(plugins_url('convert-dae-curl.php', __FILE__)), 'webappUrl' => esc_url(site_url()), 'ar_wp_ajax_nonce' => wp_create_nonce("ar_wp_upload_model_file"), 'ar_ajaxurl' => admin_url('admin-ajax.php'), 'model_select_message' => 'Model file is required( Please select model file OR Create model )' // Custom Error Message if Model file is not selected )); // Set Parametar to get in js file wp_register_script('jquery_validate', plugins_url('assets/js/jquery-validate-min.js', __FILE__), array('jquery'), '1.3'); wp_enqueue_script('jquery_validate'); wp_register_style('new_style', plugins_url('assets/css/ar-admin.css', __FILE__), false, '1.0.0', 'all'); wp_enqueue_style('new_style'); wp_register_style('acf_style', plugins_url('assets/css/ar-input.css', __FILE__), false, '1.0.0', 'all'); wp_enqueue_style('acf_style'); wp_register_style('acf_group', plugins_url('assets/css/ar-field-group.css', __FILE__), false, '1.0.0', 'all'); wp_enqueue_style('acf_group'); wp_register_style('acf_global', plugins_url('assets/css/ar-global.css', __FILE__), false, '1.0.0', 'all'); wp_enqueue_style('acf_global'); } /* * **** End **** */ /* * **** Change Feture Image Dispaly******* */ // Rename the featured Box text. add_action('admin_head', 'ar_wp_remove_my_meta_boxen'); function ar_wp_remove_my_meta_boxen() { remove_meta_box('postimagediv', 'armodels', 'side'); add_meta_box('postimagediv', __('Model Image'), 'post_thumbnail_meta_box', 'armodels', 'side', 'low'); } // Rename the featured image text. function ar_wp_rename_set_featured_image($content) { return $content = str_replace(__('Set featured image'), __('Set Model Image'), $content); } add_filter('admin_post_thumbnail_html', 'ar_wp_rename_set_featured_image'); // Rename the Remove featured image text. function ar_wp_rename_remove_featured_image($content) { return str_replace('Remove featured image', 'Remove Model Image', $content); } add_filter('admin_post_thumbnail_html', 'ar_wp_rename_remove_featured_image'); /* * ******** End ************* */ /* * ******* Custome Woocommerce Product Custome Product Post Type *********** */ require_once(plugin_dir_path(__FILE__) . 'custome-ar-product-post-type.php'); /* * ************* End **************** */ /* * ******* Custome Woocommerce Product Custome Fields (Save 3D Model Files and Images)*********** */ require_once(plugin_dir_path(__FILE__) . 'custome-fields.php'); /* * ************* End **************** */ /* * *********** Custome Woocommerce Category Fetch *********** */ require_once(plugin_dir_path(__FILE__) . 'cat-fetch.php'); /* * ************ End ******************** */ /* * *********** Custome Woocommerce Product Fetch *********** */ require_once(plugin_dir_path(__FILE__) . 'product-fetch.php'); require_once(plugin_dir_path(__FILE__) . 'product-fetch-single.php'); /* * ************* End **************** */ /* * *********** Convert DAE File *********** */ require_once(plugin_dir_path(__FILE__) . 'convert-dae-curl.php'); /* * ************* End **************** */ /* * ******** Add the custom columns to the book post type: ************* */ add_filter('manage_armodels_posts_columns', 'ar_wp_custom_edit_book_columns'); function ar_wp_custom_edit_book_columns($columns) { unset($columns['date']); $columns['pro-image'] = __('Product Image'); //name of the column $columns['Shortcode'] = __('Shortcode', 'your_text_domain'); $newSrc = esc_url(plugins_url("assets/css/images/chair.png", __FILE__)); $columns['thumbs'] = __('
AR Model
'); //name of the column $columns['date'] = __('Date', 'your_text_domain'); return $columns; } // Add the data to the custom columns for the book post type: add_action('manage_armodels_posts_custom_column', 'ar_wp_custom_armodels_column', 10, 2); function ar_wp_custom_armodels_column($column, $post_id) { switch ($column) { case 'Shortcode' : echo get_post_meta($post_id, 'ar_wp_Shortcode', true); break; case 'pro-image' : if (has_post_thumbnail()) { echo the_post_thumbnail(array(40, 40)); } else { $newSrc = esc_url(plugins_url("assets/css/images/placeholder.png", __FILE__)); echo ''; } break; case 'thumbs' : $get_model_check = get_post_meta($post_id, 'ar_wp_product_Detail', true); if (!empty($get_model_check)) { $newSrc = esc_url(plugins_url("assets/css/images/chair.png", __FILE__)); $product_link = admin_url('post.php?post=' . $post_id) . '&action=edit#wp_ar_wp_custom_attachment"'; echo '
AR Model
'; break; } } } /* * ************ End ****************** */ /* * ********* Security app ********** */ function encryptIt($q) { $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; $qEncoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), $q, MCRYPT_MODE_CBC, md5(md5($cryptKey)))); return( $qEncoded ); } /* * ********** End ***************** */ /* * *********** Add Short Code Display Button in Web App ****************** */ function ar_wp_button_openApp($atts) { $getpost_Id = $atts['id']; $nonce = encryptIt(preg_replace("(^https?://)", "", site_url())); return '
'; } add_shortcode('arwordpress', 'ar_wp_button_openApp'); /* * ************** End ***************** */ /* * *********** Remove View option form listing ************** */ add_filter('post_row_actions', 'ar_wp_remove_row_actions', 10, 1); function ar_wp_remove_row_actions($actions) { if (get_post_type() === 'armodels') unset($actions['view']); return $actions; } /* * ************** End ***************** */ /* * ********** Check Security **************** */ function decryptIt($nonce) { $cryptKey = 'qJB0rGtIn5UB1xG03efyCp'; $nonce = str_replace(" ", "+", $nonce); $qDecoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), base64_decode($nonce), MCRYPT_MODE_CBC, md5(md5($cryptKey))), "\0"); return( $qDecoded ); } /* * ************* End *************************** */ $GLOBALS['model_select_message'] = 'Model file is required( Please select model file OR Create model )'; // Custom Error Message if Model file is not selected ?>