"; + echo "
Service:";if($this->data['accounting_status'] == '1'){ echo "Don't have a Service";}else{ echo "Service"; } echo ""; + echo "
Hide:";if($this->data['hide'] == '1'){ echo "Hide"; }else{ echo "Don't Hide"; } echo ""; + echo "
Type:".$type."
"; var_export($this->data); - echo "
Service:".$this->data['accounting_status']; - echo "
Type: ".$type; exit; } $pos = strpos(html_entity_decode($data['proddesc']),""); if($pos !== false && $data['proddesc']){ $tempdesc = substr(html_entity_decode($data['proddesc']),3); }else{ $tempdesc = html_entity_decode(html_entity_decode($data['proddesc'])) ; //$tempdesc = $data['proddesc']; } if(strlen($tempdesc) != 0) { $temp = '
'; $tempdesc = $temp . $tempdesc; } if($type == "FL") { $dataproddesct = iconv_substr($tempdesc,0,123,"UTF-8"); - $dataproddesct .= '...'; + if(strlen($dataproddesct) > 123){ + $dataproddesct .= '...'; + } }else{ $dataproddesct = $tempdesc; } $dataproddesct = str_replace("
","
",$dataproddesct); if($type != "FL" && !empty($result_olc)){ $olcdata = $result_olc[0]; } if (!empty($data['telno'])) { foreach ($data['telno'] as $t) { $data['_format']['telno'][] = $this->formatPhoneNumber($t); } } if (!empty($data['fax'])) { foreach ($data['fax'] as $t) { $data['_format']['fax'][] = $this->formatPhoneNumber($t); } } if($type == "FL"){ /*unset($data['_format']['telno']); $data['_format']['telno'][] = $data['_format']['telno'][0]; unset($data['fax']); $data['fax'][] = $data['fax'][0]; $exp = explode(",", $data['email']); unset($data['email']); $data['email'][] = $exp[0];*/ }else{ /*$exp = explode(",", $data['email']); $data['email'] = $exp;*/ } - $thai_month_arr = array('01'=>'เธก.เธ.','02'=>'เธ.เธ.','03'=>'เธกเธต.เธ.','04'=>'เน€เธก.เธฉ.','05'=>'เธ.เธ.','06'=>'เธกเธด.เธข.','07'=>'เธ.เธ.','08'=>'เธช.เธ.','09'=>'เธ.เธข.','10'=>'เธ•.เธ.','11'=>'เธ.เธข.','12'=>'เธ.เธ.'); + $thai_month_arr = array('01'=>'ม.ค.','02'=>'ก.พ.','03'=>'มี.ค.','04'=>'เม.ย.','05'=>'พ.ค.','06'=>'มิ.ย.','07'=>'ก.ค.','08'=>'ส.ค.','09'=>'ก.ย.','10'=>'ต.ค.','11'=>'พ.ย.','12'=>'ธ.ค.'); list($year, $month,$day) = explode('-', $result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate']); $date_e = $day." ".$thai_month_arr[$month]." ".($year+543); $end_date_promotion = $result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate']; list($year, $month,$day) = explode('-', $result['address'][$data['headingcode']][$data['addressid']]['promotion']['startdate']); $date_s = $day." ".$thai_month_arr[$month]." ".($year+543); $result['address'][$data['headingcode']][$data['addressid']]['promotion']['startdate'] = $date_s; $result['address'][$data['headingcode']][$data['addressid']]['promotion']['enddate'] = $date_e; $result['address'][$data['headingcode']][$data['addressid']]['promotion']['subject'] = preg_replace('/
]*?>/','',html_entity_decode($result['address'][$data['headingcode']][$data['addressid']]['promotion']['subject'])); if(date("Y-m-d") > $end_date_promotion){ $promotion_data = ''; }else{ $promotion_data = $result['address'][$data['headingcode']][$data['addressid']]['promotion']; } if(!empty($data['profile'])){ $data['profile'] = preg_replace('/
]*?>/','',html_entity_decode($data['profile'])); } if (!empty($data['workinghours'])) { $data['_format']['workinghours'] = $this->formatWorkingHour($data['workinghours']); $data['customertyp'] = $data['customertype']; } if(!empty($data['cityname'])){ - $bangkok = array('เธเธ—เธก','เธเธ—เธก.','เธ.เธ—.เธก.','เธเธฃเธธเธเน€เธ—เธ','เธเธฃเธธเธเน€เธ—เธเธฏ','เธเธฃเธธเธเน€เธ—เธเธกเธซเธฒเธเธเธฃ'); + $bangkok = array('กรุงเทพ','กรุงเทพฯ','ก.ท.ม.','กรุงเทพมหานคร','กทม','จังหวัดกรุงเทพมหานคร','จังหวัด กรุงเทพมหานคร'); if(!in_array($data['cityname'],$bangkok)){ $data['cityname'] = t('province') . $data['cityname']; } } if($type == 'FL'){ $data['profile'] = strip_tags($data['profile']); } $data['profile'] = str_replace("
","
",$data['profile']); + $data['lang'] = $this->data['lang']; $display[] = array( '#theme' => 'typ_profile', '#profile' => $data, '#prodescription' => $dataproddesct, '#catalog' => $olcdata, '#type' => $type, '#promotion' => $promotion_data, ); if ($type != 'FL') $display['#attached']['drupalSettings']['disableAds'] = TRUE; $display['#attached']['library'] = array( 'typ_profile/profile.popup', ); return $display; } public function getTitlePromotion(){ return t('How to get promotion'); } public function getPromotion(){ $mobileDetector = \Drupal::service('krs.mobile_detect'); if($mobileDetector->isAndroidOS() == 1 ){ header('location: https://play.google.com/store/apps/details?id=com.initialive.yellowpages.act&hl=th'); exit; }if($mobileDetector->isIOS() == 1){ header('location: https://itunes.apple.com/th/app/thailand-yellowpages/id387848017?mt=8'); exit; }else{ header('location: http://m.yellowpages.co.th/mobile/typliveplus/user/'); exit; } $display[] = array( '#theme' => 'typ_promotion', ); $display['#attached']['library'] = array( 'typ_profile/profile.popup', ); return $display; } } diff --git a/src/Plugin/Block/TYPProfileFacebook.php b/src/Plugin/Block/TYPProfileFacebook.php --- a/src/Plugin/Block/TYPProfileFacebook.php +++ b/src/Plugin/Block/TYPProfileFacebook.php @@ -1,57 +1,57 @@ getRequestUri(); $s = explode("/",$url); $bid = end($s); $this->data = \Drupal::service("typ.search")->getProfile($bid ,AUTO); $this->result = \Drupal::service('typ.unvservice')->loadListing($this->data['customerid'],NULL); $facebook = ''; if($this->data['customertype'] == 'FL' || $this->data['customertype'] == '' || $this->result['accounting_status'] == '1'){ - $facebook = format_string('
+ $facebook = format_string(''); } $build = array(); $build[] = array( '#markup' => $facebook, ); return $build; } } \ No newline at end of file diff --git a/templates/typ-profile.html.twig b/templates/typ-profile.html.twig --- a/templates/typ-profile.html.twig +++ b/templates/typ-profile.html.twig @@ -1,469 +1,474 @@ {% set base_images = 'http://media.yellowpages.co.th/yellowpages' %} {% set base_promotion = 'http://promotion.yellowpages.co.th/media/promotion/' %}{#{% if profile.logo %}#} {##} {##} {##} {#{% else %}#} {##} {##} {##} {#{% endif %}#}{% if type != 'FL' %} {% endif %}{% if type != 'FL' %} {{ profile.profile|raw}} {% if profile.profile %}
{% endif %}
{% else %} {{ profile.profile|raw|slice(0, 100)}}{% if profile.profile|length > 100 %}{{ '...' }}{% endif %} {% if profile.profile %}
{% endif %}
{% endif %} {#{% if not profile.addr %}{% else %}#} {#{% trans %} Address {% endtrans %}#} {#{{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,#} {#profile.districtname,profile.cityname,profile.postcode]|join(' ') }}#} {#{% endif %}#} {#{% if profile.location.lat %}#} {#
#} {#{% else %}#} {#
#} {#{% endif %}#}+ + +{% if not profile.addr %}{% else %}
{% endif %} {% if not profile.telno %}{% else %} {% trans %} Address {% endtrans %}: {{ [profile.addr,profile.soi,profile.road,profile.subdistrictname,profile.districtname,profile.cityname,profile.postcode]|join(' ') }} {% endif %} {% if not profile.fax %}{% else %} {% trans %} Tel {% endtrans %}: {% if not profile.telno %} {% else %} {% if type == 'FL' %} {{ profile._format.telno.0 }}
{% else %} {% for key, tel in profile._format.telno %} {% if loop.last != key+1 %}{{ tel }}{{ "," }} {% else %}{{ tel }}{% endif %} {% endfor %}
{% endif %} {% endif %}{% endif %} {% if not profile.email %}{% else %} {% trans %} Fax {% endtrans %}: {% if not profile.fax %} {% else %} {% if type == 'FL' %} {{ profile._format.fax.0 }}
{% else %} {% for key, fax in profile._format.fax %} {% if loop.last != key+1 %}{{ fax }}{{ "," }} {% else %}{{ fax }}{% endif %} {% endfor %}
{% endif %} {% endif %}{% endif %} {% if not profile.website %}{% else %} {% trans %} Email {% endtrans %}: {% if not profile.email %} {% else %} {% if type == 'FL' %} {% set email = profile.email|split(',') %} {% for key , mail in email %} {% if loop.last != key+1 %}{{ mail }},
{% else %}{{ mail }}
{% endif %} {% endfor %} {% else %} {% set email = profile.email|split(',') %} {% for key , mail in email %} {% if loop.last != key+1 %}{{ mail }},
{% else %}{{ mail }}
{% endif %} {% endfor %} {% endif %} {% endif %}{% endif %} {% if not profile.workinghours %}{% else %} {% trans %} Website {% endtrans %}: {% if not profile.website %} {% else %} {% set website = profile.website|split(',') %} {% if type == 'FL' %} {{ website.0 }} {% else %} {% for key , web in website %} {% if loop.last != key+1 %}{{ web }},
{% else %}{{ web }}
{% endif %} {% endfor %} {% endif %} {% endif %}{% endif %} {% trans %} Work-Time {% endtrans %}: {% if not profile.workinghours %} {% else %} {{ profile._format.workinghours }}
{% endif %}{% if type != 'FL' %} {% if not prodescription or prodescription is empty %} {% else %}
{% trans %} Product And Service {% endtrans %} {{ prodescription|raw }} {% if prodescription and profile.brandname %}
{% endif %} {% endif %} {% if not profile.brandname %} {% else %}
{% trans %} Banner {% endtrans %}
{{ profile.brandname|replace({"":" ","
":" "}) }} {% endif %} {% else %} {% if not prodescription or prodescription is empty %} {% else %}
{% trans %} Product And Service {% endtrans %} {{ prodescription|raw }} {% if prodescription and profile.brandname %}
{% endif %} {% endif %} {% endif %}
{# TAB #} {% if type == 'FL' %}{% if promotion.promotionid %}{% else %}