get_iframe_url(); $name = '3drt-' . $viewData->id; if (empty($elementId)) { $elementId = $name; } //if height is not set, do not provide height parameter $height = ($viewData->height) ? 'height="' . $viewData->height . '"' : ''; if ($iframe_url) { $html = ''; } else { YoFLA360()->add_error('Error constructing iframe url.'); $html = YoFLA360()->get_errors(); } return $html; } /** * Outputs the div embed code for integrating a 360 view into a webpage * * @param $viewData YoFLA360Viewdata * @return string */ public function get_embed_div_element_html($viewData) { $template_string = '
'; $configFile = $viewData->config_url; $path = $viewData->get_product_url(); if (strpos($configFile, 'http') === 0) { $path = ""; } $values = array( '{id}' => $viewData->id, '{width}' => $viewData->width, '{height}' => $viewData->height, '{styles}' => $viewData->get_styles(), '{path}' => $path, '{ga_enabled}' => ($viewData->ga_enabled) ? 'true' : 'false', '{ga_tracking_id}' => $viewData->ga_tracking_id, '{ga_label}' => $viewData->get_ga_label(), '{ga_category}' => $viewData->ga_category, '{config_file}' => $configFile, '{theme_url}' => $viewData->theme_url, ); $new_html = strtr($template_string, $values); return $new_html; } /** * Outputs the div embed code for integrating a 360 view into a webpage (next360 version) * * @param $viewData YoFLA360Viewdata * @return string */ public function get_embed_div_element_html_next360($viewData) { //die("url is: ".$viewData->get_product_url()); $template_string = '
'; $productUrl = YoFLA360()->Utils()->get_product_url($viewData); $values = array( '{id}' => $viewData->id, '{width}' => $viewData->width, '{height}' => $viewData->height, '{styles}' => $viewData->get_styles(), '{path}' => $productUrl, '{ga_enabled}' => ($viewData->ga_enabled) ? 'true' : 'false', '{ga_tracking_id}' => $viewData->ga_tracking_id, '{ga_label}' => $viewData->get_ga_label(), '{ga_category}' => $viewData->ga_category, ); $new_html = strtr($template_string, $values); return $new_html; } /** * Wraps the provided string in html comments with information about hte plugin * * @param $html_code * @return string */ public function format_plugin_output($html_code) { //start html output $html_code_start = "\n" . '' . "\n"; $html_code_end = "\n" . '' . "\n"; $output = $html_code_start . $html_code . $html_code_end; return $output; } /** * Adds html code to error message that is returned to page * * @param $msg * @return string */ public function format_error($msg) { $str = '
360 Plugin Error:
' . PHP_EOL . $msg . PHP_EOL . '
'; return $str; } }//class