コード例 #1
1
 public function add_download_info($item_id, $item, $order)
 {
     $product = $order->get_product_from_item($item);
     if (is_fancy_product($product->id) && $product->is_downloadable() && $order->is_download_permitted()) {
         $url = add_query_arg(array('order' => $order->id, 'item_id' => $item_id), get_permalink($item['product_id']));
         echo '<a href="' . esc_url($url) . '" class="fpd-order-item-download" style="font-size: 0.85em;">' . fpd_get_option('fpd_label_download_on_product_page') . '</a>';
     }
 }
 public static function output()
 {
     global $thepostid;
     $stage_width = fpd_get_option('fpd_stage_width');
     $stage_height = fpd_get_option('fpd_stage_height');
     include_once FPD_PLUGIN_ADMIN_DIR . '/views/html-order-viewer.php';
 }
コード例 #3
0
ファイル: class-admin.php プロジェクト: pcuervo/ur-imprint
 public function init_admin()
 {
     self::$ajax_nonce = wp_create_nonce('fpd_ajax_nonce');
     //add capability to administrator
     $role = get_role('administrator');
     $role->add_cap(Fancy_Product_designer::CAPABILITY);
     require_once FPD_PLUGIN_ADMIN_DIR . '/class-admin-product.php';
     require_once FPD_PLUGIN_ADMIN_DIR . '/class-admin-order.php';
     if (get_option('fpd_plugin_activated', false)) {
         delete_option('fpd_plugin_activated');
         wp_redirect(esc_url_raw(admin_url('admin.php?page=fancy_product_designer&info=activated')));
         exit;
     }
     //delete sharing images
     if (intval(fpd_get_option('fpd_sharing_cache_days')) !== 0 && get_transient('fpd_check_shares_dir') === false) {
         $cache_days_in_sec = intval(fpd_get_option('fpd_sharing_cache_days')) * DAY_IN_SECONDS;
         $share_dir = WP_CONTENT_DIR . '/uploads/fpd_shares/';
         $dirs = array_filter(glob($share_dir . '*'), 'is_dir');
         foreach ($dirs as $dir) {
             $time = strtotime(basename($dir));
             //folder date in seconds
             $seconds = time() - $time;
             //past seconds
             if ($seconds > $cache_days_in_sec) {
                 $this->delete_files($dir);
             }
         }
         set_transient('fpd_check_shares_dir', 'yes', DAY_IN_SECONDS);
     }
 }
コード例 #4
0
ファイル: functions.php プロジェクト: baden03/access48
function wc_checkout_description_tp($other_data, $cart_item)
{
    if (!function_exists('fpd_get_option')) {
        return $other_data;
    }
    //$post_data = get_post( $cart_item['product_id'] );
    $fpd_detail_arr = json_decode(html_entity_decode(stripslashes($cart_item['fpd_data']['fpd_product'])), true);
    //$fpd_elems_arr = array_slice($fpd_detail_arr[0]['elements'], 1);
    $fpd_elems_arr = $fpd_detail_arr[0]['elements'];
    //var_dump($fpd_elems_arr[2]);
    $hex_names = explode(',', fpd_get_option('fpd_hex_names'));
    $hex_name_arr = array();
    foreach ($hex_names as $hexVal) {
        list($key, $val) = explode(':', $hexVal);
        $hex_name_arr['#' . strtoupper($key)] = $val;
    }
    //var_dump($hex_name_arr);
    foreach ($fpd_elems_arr as $elem_key => $element_arr) {
        foreach ($element_arr as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $val_key => $val_val) {
                    if ($val_key == 'currentColor' && !empty($val_val)) {
                        if (!empty($hex_name_arr[strtoupper($val_val)])) {
                            $fpd_detail_value = $hex_name_arr[strtoupper($val_val)];
                        } else {
                            $fpd_detail_value = $val_val;
                        }
                    }
                    if ($val_key == 'font' && !empty($val_val)) {
                        $fpd_detail_value .= ', ' . $val_val;
                    }
                }
            } else {
                if ($key == 'title' && !empty($value)) {
                    $fpd_detail_name = trim($value);
                }
            }
        }
        /*
        if(empty($fpd_detail_value)){
            $fpd_detail_value = $value;
        }
        */
        if (!empty($fpd_detail_value)) {
            $other_data[] = array('name' => $fpd_detail_name, 'value' => $fpd_detail_value);
        }
        /*
        if(!empty($font_title)){
            $other_data[] = array(
                'name' => $font_title,
                'value' => $font_value
            );
        }
        */
    }
    //$other_data[] = array( 'name' =>  $fpd_detail_str );
    return $other_data;
}
 /**
  * 	Returns an option from the individual settings. If no option is not found in the individual settings, it will return the option from the main settings.
  */
 public function get_option($name)
 {
     if (isset($this->individual_settings[$name])) {
         $value = fpd_convert_string_value_to_int($this->individual_settings[$name]);
     } else {
         $value = fpd_get_option('fpd_' . $name);
     }
     return $value;
 }
 public static function get_color_prices()
 {
     $color_prices = '{}';
     if (fpd_not_empty(fpd_get_option('fpd_color_prices'))) {
         $color_prices = '{"' . str_replace('#', '', fpd_get_option('fpd_color_prices'));
         $color_prices = str_replace(':', '":', $color_prices);
         $color_prices = str_replace(',', ',"', $color_prices);
         $color_prices .= '}';
     }
     return $color_prices;
 }
 public static function get_labels_object_string($additional_labels = array())
 {
     $productDesignerLabels = self::get_options();
     $productDesignerLabels = $productDesignerLabels['product-designer'];
     $obj_string = '{';
     foreach ($productDesignerLabels as $key => $value) {
         $id = $value['id'];
         $option_value = fpd_get_option($id);
         $option_value = empty($option_value) || !fpd_get_option('fpd_use_label_settings') ? $value['default'] : $option_value;
         if (isset($additional_labels[$id]) && $id === 'fpd_label_uploadedDesignSizeAlert') {
             $image_dimensions = $additional_labels[$id];
             $option_value = str_replace('%minW', $image_dimensions['minW'], $option_value);
             $option_value = str_replace('%minH', $image_dimensions['minH'], $option_value);
             $option_value = str_replace('%maxW', $image_dimensions['maxW'], $option_value);
             $option_value = str_replace('%maxH', $image_dimensions['maxH'], $option_value);
         }
         $obj_string .= str_replace('fpd_label_', '', $value['id']) . ':"' . htmlspecialchars_decode(esc_js($option_value)) . '",';
     }
     $obj_string = rtrim($obj_string, ",");
     $obj_string .= '}';
     return $obj_string;
 }
        private function get_share_html()
        {
            ob_start();
            ?>
			<div class="fpd-share-design fpd-clearfix">
				<a href="#" id="fpd-share-button" class="<?php 
            echo fpd_get_option('fpd_start_customizing_css_class');
            ?>
" ><i class="fa fa-share-alt"></i><?php 
            echo fpd_get_option('fpd_label_sharing_button');
            ?>
</a>
				<div>
					<p class="fpd-share-process fpd-hidden"><?php 
            echo fpd_get_option('fpd_label_sharing_processing');
            ?>
</p>
					<div class="fpd-share-widget"></div>
					<a href="" target="_blank" class="fpd-share-url fpd-hidden"></a>
				</div>
			</div>
			<?php 
            $output = ob_get_contents();
            ob_end_clean();
            return $output;
        }
コード例 #9
0
 public function reset_cart_item_link($link, $cart_item, $cart_item_key)
 {
     $url = add_query_arg(array('cart_item_key' => $cart_item_key), $cart_item['data']->get_permalink());
     return sprintf('<a href="%s">%s<br /><i style="opacity: 1; font-size: 0.9em;">%s</i></a>', $url, $cart_item['data']->get_title(), fpd_get_option('fpd_cart_reedit_product'));
 }
 public function get_option($name)
 {
     global $wpdb;
     $options = $wpdb->get_row("SELECT options FROM " . FPD_PRODUCTS_TABLE . " WHERE ID=" . $this->id . "");
     if (isset($options->options)) {
         $options = fpd_convert_obj_string_to_array($options->options);
         if (isset($options[$name])) {
             $value = fpd_convert_string_value_to_int($options[$name]);
         } else {
             $value = fpd_get_option('fpd_' . $name);
         }
     } else {
         $value = fpd_get_option('fpd_' . $name);
     }
     return $value;
 }
 public function footer_handler()
 {
     if (self::$add_script) {
         if (fpd_get_option('fpd_type_of_uploader') == 'php') {
             wp_enqueue_script('fpd-jquery-form');
         }
         wp_enqueue_script('jquery-fpd');
         if (fpd_get_option('fpd_sharing')) {
             wp_enqueue_script('fpd-jssocials');
         }
     }
 }
 public function enqueue_styles_scripts($hook)
 {
     if (function_exists('get_woocommerce_currency') && version_compare(WC_VERSION, '2.3.0', '<')) {
         wp_register_style('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css', false, '3.5.2');
         wp_register_script('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js', array('jquery'), '3.5.2');
     }
     wp_register_style('fpd-admin-icon-font', plugins_url('/css/icon-font.css', __FILE__), false, Fancy_Product_Designer::VERSION);
     wp_register_style('fpd-admin', plugins_url('/css/admin.css', __FILE__), array('radykal-tooltipster'), Fancy_Product_Designer::VERSION);
     wp_register_script('fpd-admin', plugins_url('/js/admin.js', __FILE__), array('jquery', 'radykal-tooltipster'), Fancy_Product_Designer::VERSION);
     wp_localize_script('fpd-admin', 'fpd_admin_opts', array('adminAjaxUrl' => admin_url('admin-ajax.php'), 'ajaxNonce' => FPD_Admin::$ajax_nonce, 'enterTitlePrompt' => __('Please enter a title', 'radykal'), 'tryAgain' => __('Something went wrong. Please try again!', 'radykal'), 'addToLibrary' => __('Add imported image source to media library?', 'radykal'), 'remove' => __('Are you sure you want to delete it?.', 'radykal')));
     global $post;
     //woocommerce post types
     if ($hook == 'post-new.php' || $hook == 'post.php') {
         if ('shop_order' === $post->post_type) {
             FPD_Fonts::output_webfont_links();
             wp_enqueue_style('jquery-fpd');
             wp_enqueue_style('fpd-admin-icon-font');
             wp_enqueue_style('fpd-admin');
             wp_enqueue_script('jquery-fpd');
             wp_enqueue_script('fpd-admin');
         } else {
             wp_enqueue_style('wp-color-picker');
             wp_enqueue_style('radykal-admin');
             wp_enqueue_style('fpd-admin');
             wp_enqueue_script('wp-color-picker');
             wp_enqueue_script('radykal-admin');
             wp_enqueue_script('fpd-admin');
             if ('product' === $post->post_type) {
                 wp_enqueue_style('select2');
                 wp_enqueue_script('select2');
             } else {
                 wp_enqueue_style('radykal-select2');
                 wp_enqueue_script('radykal-select2');
             }
         }
     }
     //manage fancy products
     if ($hook == 'toplevel_page_fancy_product_designer') {
         wp_enqueue_media();
         wp_enqueue_style('fpd-admin-icon-font');
         wp_enqueue_style('radykal-admin');
         wp_enqueue_style('fpd-admin');
         wp_enqueue_script('fpd-admin');
         wp_enqueue_script('fpd-manage-fancy-products', plugins_url('/js/manage-fancy-products.js', __FILE__), array('jquery-ui-core', 'jquery-ui-mouse', 'jquery-ui-sortable'), Fancy_Product_Designer::VERSION);
         wp_localize_script('fpd-manage-fancy-products', 'fpd_fancy_products_opts', array('adminAjaxUrl' => admin_url('admin-ajax.php'), 'ajaxNonce' => FPD_Admin::$ajax_nonce, 'enterTitlePrompt' => __('Please enter a title', 'radykal'), 'remove' => __('Are you sure you want to delete it?.', 'radykal'), 'tryAgain' => __('Something went wrong. Please try again!', 'radykal'), 'selectProduct' => __('Please select a Fancy Product first to assign the category!', 'radykal'), 'nothingToExport' => __('This product does not contain any views!', 'radykal'), 'addToLibrary' => __('Add imported image source to media library?', 'radykal'), 'noJSON' => __('Sorry, but the selected file is not a valid JSON object. Are you sure you have selected the correct file to import?', 'radykal'), 'chooseThumbnail' => __('Choose a thumbnail', 'radykal')));
     }
     //product builder
     if ($hook == 'fancy-product-designer_page_fpd_product_builder') {
         wp_enqueue_media();
         wp_enqueue_style('radykal-select2');
         wp_enqueue_style('radykal-tagsmanager');
         wp_enqueue_style('fpd-admin-icon-font');
         wp_enqueue_style('radykal-admin');
         wp_enqueue_style('fpd-admin');
         wp_enqueue_style('fpd-fonts');
         FPD_Fonts::output_webfont_links();
         wp_register_script('fpd-product-builder', plugins_url('/js/product-builder.js', __FILE__), array('jquery-ui-core', 'jquery-ui-mouse', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-widget', 'radykal-tagsmanager', 'radykal-select2', 'radykal-admin', 'fpd-admin'), Fancy_Product_Designer::VERSION);
         wp_localize_script('fpd-product-builder', 'fpd_product_builder_opts', array('adminUrl' => admin_url(), 'originX' => fpd_get_option('fpd_common_parameter_originx'), 'originY' => fpd_get_option('fpd_common_parameter_originy'), 'paddingControl' => fpd_get_option('fpd_padding_controls'), 'defaultFont' => get_option('fpd_default_font') ? get_option('fpd_default_font') : 'Arial', 'enterTitlePrompt' => __('Enter a title for the element', 'radykal'), 'chooseElementImageTitle' => __('Choose an element image', 'radykal'), 'set' => __('Set', 'radykal'), 'enterYourText' => __('Enter your text.', 'radykal'), 'removeElement' => __('Remove element?', 'radykal'), 'notChanged' => __('You have not saved your changes!', 'radykal'), 'changeImageSource' => __('Change Image Source', 'radykal')));
         wp_enqueue_script('fpd-curved-text', plugins_url('/js/fabric.curvedText.js', __FILE__), array('fabric'));
         wp_enqueue_script('fpd-webfont', plugins_url('/js/webfont.js', __FILE__));
         wp_enqueue_script('fpd-product-builder');
     }
     //manage designs
     if ($hook == 'fancy-product-designer_page_fpd_manage_designs') {
         wp_enqueue_media();
         wp_enqueue_style('radykal-select2');
         wp_enqueue_style('fpd-admin-icon-font');
         wp_enqueue_style('radykal-admin');
         wp_enqueue_style('fpd-admin');
         wp_enqueue_script('radykal-select2');
         wp_enqueue_script('radykal-admin');
         wp_enqueue_script('fpd-admin');
         wp_enqueue_script('fpd-manage-fancy-designs', plugins_url('/js/manage-fancy-designs.js', __FILE__), Fancy_Product_Designer::VERSION);
         wp_localize_script('fpd-manage-fancy-designs', 'fpd_fancy_designs_opts', array('chooseDesign' => __('Choose a Design Image', 'radykal')));
     }
     //shortcode orders
     if ($hook == 'fancy-product-designer_page_fpd_orders') {
         FPD_Fonts::output_webfont_links();
         wp_enqueue_style('jquery-fpd');
         wp_enqueue_style('fpd-admin-icon-font');
         wp_enqueue_style('fpd-admin');
         wp_enqueue_script('jquery-fpd');
         wp_enqueue_script('fpd-admin');
     }
     //settings
     if ($hook == 'fancy-product-designer_page_fpd_settings') {
         wp_enqueue_style('radykal-select2');
         wp_enqueue_style('radykal-admin');
         wp_enqueue_style('fpd-admin');
         wp_enqueue_style('wp-color-picker');
         wp_enqueue_script('radykal-ace-editor');
         wp_enqueue_script('radykal-select2');
         wp_enqueue_script('radykal-admin');
         wp_enqueue_script('wp-color-picker');
         wp_enqueue_script('fpd-admin');
     }
 }
		<h2><?php 
_e('Fancy View Options', 'radykal');
?>
</h2>
		<p class="description">
			<?php 
_e('Here you can adjust some options for a single view. This allows, among other things to use different prices in different views.', 'radykal');
?>
		</p>
		<div class="fpd-modal-content">
			<table class="form-table radykal-settings-form">
				<tbody>

					<?php 
radykal_output_option_item(array('id' => 'designs_parameter_price', 'title' => 'Custom Image Price', 'type' => 'number', 'default' => fpd_get_option('fpd_designs_parameter_price'), 'description' => __('This price will be used for custom added images.', 'radykal')));
radykal_output_option_item(array('id' => 'custom_texts_parameter_price', 'title' => 'Custom Text Price', 'type' => 'number', 'default' => fpd_get_option('fpd_custom_texts_parameter_price'), 'description' => __('This price will be used for custom added images.', 'radykal')));
radykal_output_option_item(array('type' => 'section_title', 'title' => 'What kind of media types can the customer add in this view?'));
radykal_output_option_item(array('id' => 'disable_image_upload', 'title' => 'Disable Image Upload', 'type' => 'checkbox', 'default' => 'no'));
radykal_output_option_item(array('id' => 'disable_custom_text', 'title' => 'Disable Custom Text', 'type' => 'checkbox', 'default' => 'no'));
radykal_output_option_item(array('id' => 'disable_facebook', 'title' => 'Disable Facebook', 'type' => 'checkbox', 'default' => 'no'));
radykal_output_option_item(array('id' => 'disable_instagram', 'title' => 'Disable Instagram', 'type' => 'checkbox', 'default' => 'no'));
radykal_output_option_item(array('id' => 'disable_designs', 'title' => 'Disable Designs', 'type' => 'checkbox', 'default' => 'no'));
?>

				</tbody>
			</table>
		</div>
		<div class="fpd-modal-btns">
			<button class="button button-primary fpd-save-modal"><?php 
_e('Set', 'radykal');
?>
コード例 #14
0
 public function create_shortcode_order()
 {
     if (!isset($_POST['product'])) {
         die;
     }
     if (!class_exists('FPD_Shortcode_Order')) {
         require_once FPD_PLUGIN_DIR . '/inc/class-shortcode-order.php';
     }
     $insert_id = FPD_Shortcode_Order::create($_POST['name'], $_POST['email'], $_POST['product']);
     if ($insert_id) {
         echo json_encode(array('id' => $insert_id, 'message' => fpd_get_option('fpd_label_order_success_sent')));
     } else {
         echo json_encode(array('error' => fpd_get_option('fpd_label_order_fail_sent')));
     }
     die;
 }
<div class="fpd-modal-wrapper" id="fpd-modal-edit-product-options">
	<div class="fpd-modal-dialog">
		<a href="#" class="fpd-close-modal">&times;</a>
		<h3><?php 
_e('Fancy Product Options', 'radykal');
?>
</h3>
		<div class="fpd-modal-content">
			<table class="form-table">
				<tbody>

					<?php 
radykal_output_option_item(array('id' => 'stage_width', 'title' => 'Product Designer Width', 'type' => 'number', 'default' => fpd_get_option('fpd_stage_width')));
radykal_output_option_item(array('id' => 'stage_height', 'title' => 'Product Designer Stage Height', 'type' => 'number', 'default' => fpd_get_option('fpd_stage_height')));
?>

				</tbody>
			</table>
		</div>
		<div class="fpd-modal-btns">
			<button class="button button-primary fpd-save-modal"><?php 
_e('Set', 'radykal');
?>
</button>
		</div>
	</div>
</div>
							<th scope="row"><label><?php 
_e('Price', 'radykal');
?>
</label></th>
							<td><input type="number" min="0" step="0.01" name="custom_texts_parameter_price" placeholder="<?php 
echo fpd_get_option('fpd_custom_texts_parameter_price');
?>
" value=""></td>
						</tr>
						<tr valign="top">
							<th scope="row"><label><?php 
_e('Colors', 'radykal');
?>
</label></th>
							<td><input type="text" name="custom_texts_parameter_colors" value="" placeholder="<?php 
echo fpd_get_option('fpd_custom_texts_parameter_colors');
?>
"></td>
						</tr>
					</tbody>
				</table>
			</div>

			<div id="tab4">
				<table class="form-table">
					<tbody>
						<tr valign="top">
							<th scope="row"><label><?php 
_e('Product Designer Positioning', 'radykal');
?>
</label></th>