Thứ Tư, 10 tháng 2, 2021

joomla com_newsfeed load blogspot url change image size


Description: load feed from blogspot.com image reduce 300px, 400px. Need upto 1024px

File edit: com_newsfeeds\views\newsfeed\tmpl\default.php

Line 133:

<?php echo str_replace('&apos;', "'", $text); ?>

Change to:

<?php 

$text = str_replace('/s320/', '/s1024/', $text);

$text = str_replace('/s400/', '/s1024/', $text);

echo str_replace('&apos;', "'", $text); ?>


Image result



Thứ Ba, 26 tháng 11, 2019

PHP - Get Country Code by live IP

Detail: function in region area or coutry
Solution: PHP get live IP from browser, get from http://www.geoplugin.net/json.gp?ip=1.2.3.4

<?php
// PHP code to obtain country, city,
// continent, etc using IP Address
 
//$ip = '52.25.109.230';
$ip= $_SERVER [ "REMOTE_ADDR" ];
 
// Use JSON encoded string and converts
// it into a PHP variable
$ipdat = @json_decode(file_get_contents(
    "http://www.geoplugin.net/json.gp?ip=" . $ip));
//print_r($ipdat);
echo 'Your IP: ' . $ip . "<br/>";
echo 'Country Name: ' . $ipdat->geoplugin_countryName . "<br/>";
echo 'Country code: ' . $ipdat->geoplugin_countryCode . "<br/>";
echo 'City Name: ' . $ipdat->geoplugin_city . "<br/>";
echo 'Continent Name: ' . $ipdat->geoplugin_continentName . "<br/>";
echo 'Latitude: ' . $ipdat->geoplugin_latitude . "<br/>";
echo 'Longitude: ' . $ipdat->geoplugin_longitude . "<br/>";
echo 'Currency Symbol: ' . $ipdat->geoplugin_currencySymbol . "<br/>";
echo 'Currency Code: ' . $ipdat->geoplugin_currencyCode . "<br/>";
echo 'Timezone: ' . $ipdat->geoplugin_timezone;
?>

Thứ Hai, 25 tháng 11, 2019

PHP string Serialize Corrector SOLVED

Reason: many string Serialize NOT right format
Solution: check and correction  string. Check many times on internet
Source : from internet. Not remember exactly. So thanks for all

 /*Serialize Corrector*/
 function serialize_corrector($serialized_string){       
        if ( @unserialize($serialized_string) !== true &&  preg_match('/^[aOs]:/', $serialized_string) ) {
             $serialized_string = preg_replace_callback( '/s\:(\d+)\:\"(.*?)\";/s',    function($matches){return 's:'.strlen($matches[2]).':"'.$matches[2].'";'; },   $serialized_string );
        }
        return $serialized_string;
    }

Thứ Tư, 24 tháng 4, 2019

Turn off Phone number Iphone detect

Vấn đề: phone number html hiển thị tốt trên trình duyệt firefox, chrome.... Hiển thị tốt trên mobile Android.
Khi hiển thị trên Iphone thì ko nhận được style.
Nguyên nhân: iphone tự kiểm tra xác nhận là phone number ra format font khác.
Đã thử xử lý: css important, check css inline đều không được.
Xử lý: 
<meta name="format-detection" content="telephone=no">
Kết quả: nhận style bình thường

Thứ Hai, 15 tháng 4, 2019

Ghi nhận Joomla upgrade 3.4 - 3.9.5

Bước 1: Admin panel thông báo cần upgrade 3.4.3 lên 3.6.5
Thực hiện từ trong admin update: FAILED
Tiến hành download và unzip đè lên: SUCCESS
Bước 2: Admin panel thông báo upgrade 3.6.5 lên 3.9.5
Thực hiện trong admin update: FAILED
Tiến hành download và unzip đè lên: SUCCESS

Run sau khi update 500 server error
Tiến hành tìm kiếm google '3.9.0 postupdate issue'  cần run postupdate.php

Bước 3: run theo hướng dẫn postupdate.php
Nhận được thông báo Update to 3.9.5 completed successfull.

Sau khi kiểm tra nhanh Admin, user, articles, module, contact hoạt động ổn định.

Thứ Hai, 26 tháng 11, 2018

CSS transform scale blank space - SOLVED


Description: Responsive view zoom transform scale. This make blank space. Need fix view full
Explain code: Original is 980, <980 auto scale. When scale important: '.container' is  scale + absolute. Absolute is will make html>body auto height again.

Solution:
HTML
<body>
<div class="container">
CONTENT
</div>
</body>

SCRIPT
var jquery = jQuery.noConflict();
jquery(window).ready(function(){
/*ScallFullScreen*/
ZoomScale();
});
jquery( window ).resize(function() { 
/*ScallFullScreen*/
ZoomScale();
});
/*ScallFullScreen*/
function ZoomScale(){
var widthScreen = jquery(window).width();
var scale = 1;
var wrapper = jquery('.container');
if(widthScreen<980){
/*scale=1*/
scale = widthScreen/980;
jquery(wrapper).css('position','absolute');
jquery(wrapper).css('width','980px');
jquery(wrapper).css('overflow-x','hidden');

}else{
jquery(wrapper).css('position','relative');
jquery(wrapper).css('width','auto');
jquery(wrapper).css('overflow-x','auto');
}
jquery(wrapper).css('-webkit-transform', 'scale(' + scale + ')');
jquery(wrapper).css('transform', 'scale(' + scale + ')');
jquery(wrapper).css('transform-origin', 'left top');
}

Thứ Ba, 3 tháng 7, 2018

PHP random array unique multi SOLVED

/*Original Array*/
$arrayIDs = ['a','aa','bb','cc'];
/*Result*/
$randomArray = [];
/*number unique*/
$numberRandom = 4;
if(count($arrayIDs)> $numberRandom){
while(count($randomArray) < $numberRandom) {
  $randomKey = mt_rand(0, count($arrayIDs)-1);
  $randomArray[$randomKey] = $arrayIDs[$randomKey];
}
}else{
$randomArray = $arrayIDs;
}