function findalignImage($maxchars, $content, $adjustImageSize, $float, $openWindow, $mediaImage, $thisLink, $noFollow, $catID, $stripSome)
{
    $leadmatch = 0;
    global $YTmatch;
    global $anyimage;
    global $ftp;
    global $RSSdefaultImage;
    global $featuredImage;
    $featuredImage = '';
    if ($ftp == 1) {
        $imagefix = "ftpimagefix";
    } else {
        $imagefix = "imagefix";
    }
    $anchorLink = '<a href="' . $thisLink . '" >';
    //construct hyperlink for image
    $strmatch = '^\\s*(?:<p.*>)?\\<a.*href="(.*)">\\s*(<img.*src=[\'"].*[\'"]\\s*?\\/?>)[^\\<]*<\\/a\\>\\s*(.*)$';
    $strmatch2 = '^(\\s*)(?:<p.*>)?(<img.*src=[\'"].*[\'"]\\s*?\\/?>)\\s*(.*)$';
    $strmatch3 = '^(.*)(<img.*src=[\'"].*[\'"]\\s*?\\/?>)\\s*(.*)$';
    //match first image if it exists
    if (preg_match("/{$strmatch}/sU", $content, $matches)) {
        //matches a leading hperlinked image
        $leadMatch = 1;
    } else {
        if (preg_match("/{$strmatch2}/sU", $content, $matches)) {
            //matches a leading non-hperlinked image
            $leadMatch = 2;
        } else {
            if (preg_match("/{$strmatch3}/sU", $content, $matches)) {
                //matches first image
                $leadMatch = 3;
            }
        }
    }
    $catImageArray = getDefaultCatImage($catID);
    //var_dump($catImageArray);
    if ($RSSdefaultImage == 1 && $catImageArray[0] == True) {
        $mediaImage = "<img src=\"{$catImageArray['1']}\">";
        $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
        $featuredImage = $catImageArray[1];
    } else {
        if ($leadMatch == 1 && isbug($matches[2]) == False) {
            $mediaImage = $matches[2];
            $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
            $featuredImage = preg_replace('#.*src="([^\\"]+)".*#', '\\1', $matches[2]);
        } else {
            if ($leadMatch == 2 && isbug($matches[2]) == False) {
                $mediaImage = $matches[2];
                $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
                $featuredImage = preg_replace('#.*src="([^\\"]+)".*#', '\\1', $matches[2]);
            } else {
                if (!IS_Null($mediaImage) && verifyimage($mediaImage) == True) {
                    //  match media enclosure image if it exists
                    $featuredImage = $mediaImage;
                    $mediaImage = "<img src=\"{$mediaImage}\">";
                    $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
                } else {
                    if ($leadMatch == 3 && $anyimage == 1) {
                        $mediaImage = $matches[2];
                        $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
                        $featuredImage = preg_replace('#.*src="([^\\"]+)".*#', '\\1', $matches[2]);
                    } else {
                        if ($RSSdefaultImage == 2 && $catImageArray[1] == True) {
                            $mediaImage = "<img src=\"{$catImageArray['1']}\">";
                            $content = joinContent($content, $adjustImageSize, $imagefix, $float, $anchorLink, $maxchars, $mediaImage, $leadMatch, $stripSome);
                            $featuredImage = $catImageArray[1];
                        } else {
                            //matches no leading image or media enclosure and no default category image
                            if ($ftp == 1) {
                                $content = limitwords($maxchars, $content);
                            } else {
                                $content = limitwords($maxchars, strip_tags($content));
                            }
                        }
                    }
                }
            }
        }
    }
    return $content;
}
예제 #2
0
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY tgl DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '"><span>' . $gambar . '' . limitwords($data[1], 8) . '...</span></a></li>';
    }
    echo "</ul>";
    echo '</div>';
} else {
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY tgl DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $nicetime = nicetime($data['tgl']);
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '">' . $gambar . '' . limitwords($data[1], 8) . '...<br>
' . $nicetime . '
</a></li>';
    }
    echo "</ul>";
    echo '</div>';
}
$out = ob_get_contents();
ob_end_clean();
예제 #3
0
$jumlah = $koneksi_db->sql_numrows($hitungjumlah);
if ($jumlah > 1) {
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY hits DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '"><span>' . $gambar . '' . limitwords($data[1], 8) . '...</span></a></li>';
    }
    echo "</ul>";
    echo '</div>';
} else {
    $perintah = "SELECT * FROM artikel WHERE publikasi=1 ORDER BY hits DESC LIMIT {$awal},{$jml}";
    $hasil = mysql_query($perintah);
    echo '<div id="terpopuler"><ul class="ui-tabs-nav">';
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $judul = AuraCMSSEO($data[1]);
        $hits = $data['hits'];
        $gambar = $data['gambar'] == '' ? '<img src="mod/news/images/normal/news-default.jpg">' : '<img src="mod/news/images/normal/' . $data['gambar'] . '">';
        //$id = $data[0];
        echo '<li class="ui-tabs-nav-item">';
        echo '<a href="article-' . $judul . '.html" title="' . $data[1] . '">' . $gambar . '' . limitwords($data[1], 8) . '...<br>dilihat ' . $hits . '</a></li>';
    }
    echo "</ul>";
    echo '</div>';
}
$out = ob_get_contents();
ob_end_clean();