aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/send2kindle/utils.php
blob: 87cc3de08dfc8a1b2494ed479df8ebd69751828a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
 * Utils for news2kindle
 * @author jwest <jwest@jwest.pl>
 */
class Utils
{
    /**
     * URL encode
     * @param string $url
     * @return string $ar_url
     */
    public static function urlencode( $url )
    {
        $ar_url = explode( '/', $url );

        foreach ( $ar_url as $key => $val )
        {
            $ar_url[ $key ] = urlencode( $val );
        }

        return implode('/', $ar_url );
    }

    /**
     * Prepare ID for google rss article    
     * @param string $id
     * @return string
     */
    public static function prepare_id($id)
    {
        $char_in = array('/', '.', ',', ':');
        $id = str_replace($char_in, '-', $id);
        
        return $id;
    }
}