function DeveloppezDotComExtractContent($url)
 {
     $articleHTMLContent = file_get_html($url);
     $text = convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext);
     $text = utf8_encode($text);
     return trim($text);
 }
function sluggify($text)
{
    $text = strtolower($text);
    // exporeted newsblur has quotes in Unicode. convert them to ASCII
    $text = convert_smart_quotes($text);
    if (mb_detect_encoding($text, 'ASCII', true)) {
        return preg_replace("|[^a-z0-9]+|", "-", $text);
    } else {
        return urlencode($text);
    }
}
Example #3
0
 function find($id = null, $page = null, $perpage = null)
 {
     global $dba;
     if (is_numeric($id)) {
         $cond = "WHERE id = {$id}";
         $returnsingle = true;
     } elseif (is_array($id)) {
         $final = array();
         foreach ($id as $i) {
             array_push($final, $this->find($i));
         }
         return $final;
     } else {
         $cond = $id;
     }
     $this->get_table();
     if ($page != null && $perpage != null) {
         $limit = " LIMIT " . $page . "," . $perpage;
     } else {
         $limit = "";
     }
     $sql = "SELECT * from " . $this->tablename . " {$cond} {$limit} ";
     $sqlcount = "SELECT count(id) from " . $this->tablename . " {$cond}";
     $rscount = $dba->GetOne($sqlcount);
     $this->last_find_count = $rscount;
     if ($dba->debug || $dba->file_debug) {
         file_put_contents('logs/sql.log', "\n[" . date('m/d/y h:i:s A') . "] - " . $sql, FILE_APPEND);
     }
     $rs = $dba->GetAll($sql);
     $this->get_object_type();
     $obj_return = array();
     if (is_array($rs)) {
         foreach ($rs as $record) {
             $obj = new $this->obj_type();
             foreach ($record as $key => $value) {
                 $key = str_replace(" ", "_", $key);
                 $obj->{$key} = convert_smart_quotes(urldecode(stripslashes($value)));
                 if (substr($obj->{$key}, 0, 2) == 'a:') {
                     $obj->{$key} = unserialize($obj->{$key});
                     $obj->{$key} = strip_slashes_recursive($obj->{$key});
                 }
             }
             $obj->get_associated();
             $obj_return[] = $obj;
         }
     } else {
         return false;
     }
     if ($returnsingle) {
         return $obj_return[0];
     }
     return $obj_return;
 }
Example #4
0
function insert_bookmark($parameters)
{
    $expected_parameters = array('user_id', 'document_id', 'document_title', 'query', 'keywords');
    validate_all_parameters_set($parameters, $expected_parameters);
    // if false returns echoes error message back
    $qk_string = get_qk_string($parameters['query'], $parameters['keywords']);
    $mysqli = get_mysqli();
    set_sp_parameter($mysqli, '@user_id', $parameters['user_id']);
    set_sp_parameter($mysqli, '@document_id', $parameters['document_id']);
    set_sp_parameter($mysqli, '@document_title', convert_smart_quotes($parameters['document_title']));
    set_sp_parameter($mysqli, '@qk_string', $qk_string);
    $result = call_sp($mysqli, 'insert_data', '@user_id, @document_id, @document_title, @qk_string');
    $row = $result->fetch_assoc();
    $mysqli->close();
    return $row['message'];
}
/**
 * Smarty {summarize} modifier plugin
 *
 * Type:     modifier<br>
 * Name:     summarize<br>
 * Purpose:  shorten and flatten a string removing some or all markup
 *
 * @param $string
 * @param $strtype
 * @param $type
 *
 * @return array
 */
function smarty_modifier_summarize($string, $strtype, $type)
{
    $sep = $strtype == "html" ? array("</p>", "</div>") : array("\r\n", "\n", "\r");
    $origstring = $string;
    switch ($type) {
        case "para":
            foreach ($sep as $s) {
                $para = explode($s, $string);
                $string = $para[0];
            }
            if (strlen($string) < strlen($origstring) - 4) {
                $string .= " ...";
            }
            //			return str_replace("&amp;#160;"," ",htmlentities(convert_smart_quotes(strip_tags($string)),ENT_QUOTES));
            return convert_smart_quotes(strip_tags($string));
            break;
        case "paralinks":
            foreach ($sep as $s) {
                $para = explode($s, $string);
                $string = $para[0];
            }
            if (strlen($string) < strlen($origstring) - 4) {
                $string .= " ...";
            }
            //			return str_replace("&#160;"," ",htmlspecialchars_decode(htmlentities(convert_smart_quotes(strip_tags($string,'<a>')),ENT_QUOTES)));
            return convert_smart_quotes(strip_tags($string, '<a>'));
            break;
        default:
            $words = explode(" ", strip_tags($string));
            $string = implode(" ", array_slice($words, 0, $type + 0));
            if (strlen($string) < strlen($origstring) - 4) {
                $string .= " ...";
            }
            //			return str_replace("&amp;#160;"," ",htmlentities(convert_smart_quotes($string),ENT_QUOTES));
            return convert_smart_quotes($string);
            break;
    }
}
     $i++;
 }
 // clean duplicates cats and tags
 $freeTag = array_unique($freeTag);
 $yakCatName = array_unique($yakCatName);
 $yakCatId = array_unique($yakCatId);
 if (sizeof($freeTag) > 0) {
     $freeTag = array_diff($freeTag, $yakCatName);
 }
 $freeTag = (array) $freeTag;
 $freeTagNew = array_values($freeTag);
 $freeTag = $freeTagNew;
 // clean curly quotes and html tags
 //$content = (!empty($content))?strip_tags(convert_smart_quotes($content),"<br><b><strong>"):"";
 $content = !empty($content) ? convert_smart_quotes($content) : "";
 $title = strip_tags(trim(convert_smart_quotes($title)));
 // NOTE:  WE INTRODUCE MULTIPLE INFO IF WE HAVE MULTIPLE LOCATIONS
 $i = 0;
 $geolocItem = array();
 foreach ($placeArray as $geolocItem) {
     if (!empty($title) && !empty($geolocItem['lat']) && !empty($geolocItem['lng']) || $status >= 10) {
         $datePubArray1 = explode(' ', $datePub);
         $datePubArrayD = explode('/', $datePubArray1[0]);
         $datePubArrayT = explode(':', $datePubArray1[1]);
         if ($feed['yakType'] == 2) {
             $tsEnd = date_timestamp_get($dateTimeEnd) + $feed['persistDays'] * 86400;
             $tsPub = $tsEnd - 15 * 86400;
         } else {
             $tsPub = gmmktime($datePubArrayT[0], $datePubArrayT[1], $datePubArrayT[2], $datePubArrayD[0], $datePubArrayD[1], $datePubArrayD[2]);
             $tsEnd = $tsPub + $feed['persistDays'] * 86400;
         }
Example #7
0
 function mapIt($i)
 {
     $i = convert_smart_quotes($i);
     // clean rounded quotes from MSWord
     return '/' . $i . '/';
 }
Example #8
0
/**
 * Site meta, title, and favicon
 * in header.php
 * 
 * @since 1.0.0
 */
function reactor_do_reactor_head()
{
    ?>
<meta charset="<?php 
    bloginfo('charset');
    ?>
" />
<title><?php 
    wp_title('|', true, 'right');
    ?>
</title>

<!-- google chrome frame for ie -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   
<!-- mobile meta -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

<?php 
    global $post;
    //Twitter Cards
    $twitter_thumbs = '';
    $temp_post = '';
    $temp_auth = '';
    $temp_gplus = '';
    $twitter_desc = get_bloginfo('description');
    if (is_home() || is_front_page()) {
        $twitter_url = get_bloginfo('url');
        $twitter_title = get_bloginfo('name');
        $GLOBALS['dfmcat'][0] = 'Home';
    } else {
        if (is_category()) {
            $id = get_query_var('cat');
            $twitter_desc_temp = category_description($id);
            $twitter_desc = strlen($twitter_desc_temp) > 0 ? strip_tags(category_description($id)) : $twitter_desc;
            $twitter_url = get_category_link($id);
            $twitter_title = get_cat_name($id) . ' - ' . get_bloginfo('name');
            $GLOBALS['dfmcat'][0] = get_cat_name($id);
        } else {
            if (is_tag()) {
                $tag_slug = get_query_var('tag');
                $tag = get_term_by('slug', $tag_slug, 'post_tag');
                $twitter_desc = 'Articles tagged ' . $tag->name . ' - ' . get_bloginfo('description');
                $twitter_url = get_tag_link((int) $tag->term_id);
                $twitter_title = $tag->name . ' - ' . get_bloginfo('name');
            } else {
                if (is_singular()) {
                    $twitter_thumbs = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
                    $twitter_desc = strip_tags(get_the_excerpt());
                    $twitter_desc = convert_smart_quotes(htmlentities($twitter_desc, ENT_QUOTES, 'UTF-8'));
                    $twitter_url = get_permalink();
                    $twitter_title = get_the_title();
                    $temp_post = get_post($post->ID);
                    $temp_auth = get_the_author_meta('twitter', $post->post_author);
                    $temp_gplus = get_the_author_meta('googleplus', $post->post_author);
                    $GLOBALS['dfmcat'][0] = $category[0]->category_parent != ('' || null) ? get_cat_name($category[0]->category_parent) : $category[0]->cat_name;
                    $GLOBALS['dfmcat'][1] = $category[0]->category_parent != ('' || null) ? $category[0]->cat_name : '';
                    $GLOBALS['dfmid'] = $post->ID;
                    $GLOBALS['dfmby'] = get_the_author_meta('display_name', $post->post_author);
                }
            }
        }
    }
    $twitter_thumb = $twitter_thumbs != '' ? $twitter_thumbs[0] : get_stylesheet_directory_uri() . '/images/facebooklogo600.jpg';
    $twitter_user_id = $temp_post != '' && is_single() ? $temp_post->post_author : '@RVRB';
    $twitter_creator = $temp_auth != '' && is_single() ? '@' . $temp_auth : '@RVRB';
    //echo ( ($temp_gplus != '') && is_single() ) ? '<link rel="author" href="' . $temp_gplus . '" />' : '<link rel="publisher" href="http://plus.google.com/100931264054788579031" />';
    ?>

<meta name="twitter:card" content="<?php 
    echo is_single() ? 'summary_large_image' : 'summary';
    ?>
" />
<meta name="twitter:site" content="@katchabird" />
<meta name="twitter:creator" content="<?php 
    echo $twitter_creator;
    ?>
" />
<meta name="twitter:url" content="<?php 
    echo $twitter_url;
    ?>
" />
<meta name="twitter:title" content="<?php 
    echo $twitter_title;
    ?>
" />
<meta name="twitter:description" content="<?php 
    echo $twitter_desc;
    ?>
" />
<meta name="twitter:image:src" content="<?php 
    echo $twitter_thumb;
    ?>
" />
<meta name="twitter:domain" content="katchabird.com" />

<!-- <meta property="fb:app_id" content="589548971098932"/> -->
<meta property="og:title" content="<?php 
    echo $twitter_title;
    ?>
" />
<meta property="og:type" content="<?php 
    echo is_single() ? 'article' : 'blog';
    ?>
" />
<meta property="og:url" content="<?php 
    echo $twitter_url;
    ?>
" />
<meta property="og:image" content="<?php 
    echo $twitter_thumb;
    ?>
" />
<meta property="og:site_name" content="<?php 
    bloginfo('name');
    ?>
" />
<meta property="og:description" content="<?php 
    echo $twitter_desc;
    ?>
" />
<meta property="article:publisher" content="http://www.facebook.com/katchabird" />

<?php 
    if (!is_singular()) {
        ?>
  <!-- <meta http-equiv="refresh" content="1800"> -->
<?php 
    }
    ?>
<meta name="dcterms.audience" content="Global" />
<meta name="robots" content="follow, all" />

<meta name="dcterms.rightsHolder" content="Katchabird Designs" />
<meta name="dcterms.rights" content="All content copyright Katchabird Designs or other copyrighth holders. All rights reserved." />
<meta name="dcterms.dateCopyrighted" content="<?php 
    echo date_i18n('Y');
    ?>
" />

<meta name="description" content="<?php 
    echo $twitter_desc;
    ?>
" />
<meta name="keywords" content="knitting,patterns,colorado,fiber,crafts,<?php 
    $GLOBALS['rel_art'] = '';
    if (has_tag()) {
        $posttags = get_the_tags();
        foreach ($posttags as $tag) {
            $GLOBALS['rel_art'] .= ', ' . $tag->name;
        }
        echo $GLOBALS['rel_art'];
    }
    ?>
" />

<?php 
    $favicon_uri = reactor_option('favicon_image') ? reactor_option('favicon_image') : get_stylesheet_directory_uri() . '/favicon.ico';
    ?>
<link rel="shortcut icon" href="<?php 
    echo $favicon_uri;
    ?>
">
<link href='http://fonts.googleapis.com/css?family=Alegreya:400italic,700italic,900italic,400,700,900|Podkova:400,700' rel='stylesheet' type='text/css'>

<?php 
}
function swp_add_twitter_card($info)
{
    if (is_singular()) {
        // Check if Twitter Cards are Activated
        if ($info['swp_user_options']['swp_twitter_card']) {
            /*****************************************************************
             *                                                                *
             *     YOAST SEO: It rocks, so let's coordinate with it	         *
             *                                                                *
             ******************************************************************/
            // Check if Yoast Exists so we can coordinate output with their plugin accordingly
            if (defined('WPSEO_VERSION')) {
                // Collect their Social Descriptions as backups if they're not defined in ours
                $yoast_twitter_title = get_post_meta($info['postID'], '_yoast_wpseo_twitter-title', true);
                $yoast_twitter_description = get_post_meta($info['postID'], '_yoast_wpseo_twitter-description', true);
                $yoast_twitter_image = get_post_meta($info['postID'], '_yoast_wpseo_twitter-image', true);
                // Collect their SEO fields as 3rd string backups in case we need them
                $yoast_seo_title = get_post_meta($info['postID'], '_yoast_wpseo_title', true);
                $yoast_seo_description = get_post_meta($info['postID'], '_yoast_wpseo_metadesc', true);
                // Cancel their output if ours have been defined so we don't have two sets of tags
                remove_action('wpseo_head', array('WPSEO_Twitter', 'get_instance'), 40);
            }
            /*****************************************************************
             *                                                                *
             *     JET PACK: If ours are activated, disable theirs	         *
             *                                                                *
             ******************************************************************/
            if (class_exists('JetPack')) {
                add_filter('jetpack_disable_twitter_cards', '__return_true', 99);
            }
            /*****************************************************************
             *                                                                *
             *     TWITTER TITLE										         *
             *                                                                *
             ******************************************************************/
            // If the user defined a Social Media title, use it, otherwise check for Yoast's
            if (!$info['title'] && isset($yoast_twitter_title) && $yoast_twitter_title) {
                $info['title'] = $yoast_twitter_title;
                // If not title has been defined, let's check the SEO description as a 3rd string option
            } elseif (!$info['title'] && isset($yoast_seo_title) && $yoast_seo_title) {
                $info['title'] = $yoast_seo_title;
                // If not title has been defined, let's use the post title
            } elseif (!$info['title']) {
                $info['title'] = convert_smart_quotes(htmlspecialchars_decode(get_the_title()));
            }
            /*****************************************************************
             *                                                                *
             *     TWITTER DESCRIPTION								         *
             *                                                                *
             ******************************************************************/
            // Open Graph Description
            if (!$info['description'] && isset($yoast_twitter_description) && $yoast_twitter_description) {
                $info['description'] = $yoast_twitter_description;
                // If not title has been defined, let's check the SEO description as a 3rd string option
            } elseif (!$info['description'] && isset($yoast_seo_description) && $yoast_seo_description) {
                $info['description'] = $yoast_seo_description;
                // If not, then let's use the excerpt
            } elseif (!$info['description']) {
                $info['description'] = convert_smart_quotes(htmlspecialchars_decode(swp_get_excerpt_by_id($info['postID'])));
            }
            /*****************************************************************
             *                                                                *
             *     TWITTER IMAGE								         *
             *                                                                *
             ******************************************************************/
            // Open Graph Description
            if (!$info['imageURL'] && isset($yoast_twitter_image) && $yoast_twitter_image) {
                $info['imageURL'] = $yoast_twitter_image;
            } else {
                // If nothing else is defined, let's use the post Thumbnail as long as we have the URL cached
                $twitter_image = get_post_meta($info['postID'], 'swp_open_thumbnail_url', true);
                if ($twitter_image) {
                    $info['imageURL'] = $twitter_image;
                }
            }
            /*****************************************************************
             *                                                                *
             *     PUT IT ALL TOGETHER						         		 *
             *                                                                *
             ******************************************************************/
            // Check if we have everything we need for a large image summary card
            if ($info['imageURL']) {
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:card" content="summary_large_image">';
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:title" content="' . trim($info['title']) . '">';
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:description" content="' . $info['description'] . '">';
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:image" content="' . $info['imageURL'] . '">';
                if ($info['swp_user_options']['twitterID']) {
                    $info['header_output'] .= PHP_EOL . '<meta name="twitter:site" content="@' . str_replace('@', '', $info['swp_user_options']['twitterID']) . '">';
                }
                if ($info['user_twitter_handle']) {
                    $info['header_output'] .= PHP_EOL . '<meta name="twitter:creator" content="@' . str_replace('@', '', $info['user_twitter_handle']) . '">';
                }
                // Otherwise create a small summary card
            } else {
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:card" content="summary">';
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:title" content="' . str_replace('"', '\'', $info['title']) . '">';
                $info['header_output'] .= PHP_EOL . '<meta name="twitter:description" content="' . str_replace('"', '\'', $info['description']) . '">';
                if ($info['swp_user_options']['twitterID']) {
                    $info['header_output'] .= PHP_EOL . '<meta name="twitter:site" content="@' . str_replace('@', '', $info['swp_user_options']['twitterID']) . '">';
                }
                if ($info['user_twitter_handle']) {
                    $info['header_output'] .= PHP_EOL . '<meta name="twitter:creator" content="@' . str_replace('@', '', $info['user_twitter_handle']) . '">';
                }
            }
        }
    }
    return $info;
}
Example #10
0
 function image($image, $album, $size = array(), $user_size = array(), $active = true, $controller, $users, $smart = null, $watermark = null)
 {
     $data = array();
     if ($active && !$image['active']) {
         return '';
     }
     $size_str = '';
     $arr = unserialize($image['anchor']);
     if (empty($arr)) {
         $x = $y = 50;
     } else {
         $x = $arr['x'];
         $y = $arr['y'];
     }
     if (isImage($image['src'])) {
         foreach ($size as $s) {
             $s = explode(',', $s);
             $pre_array = array('width' => $s[1], 'height' => $s[2], 'square' => $s[3], 'quality' => $s[4], 'sharpening' => $s[5], 'anchor_x' => $x, 'anchor_y' => $y);
             if (!is_null($watermark) && $watermark > 0) {
                 $watermark_array = array('watermark_id' => $watermark, 'watermark_location' => $controller->watermarks[$watermark]['position'], 'watermark_opacity' => $controller->watermarks[$watermark]['opacity']);
                 $pre_water_array = array_merge($pre_array, $watermark_array);
             }
             list($w, $h) = computeSize(ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $image['src'], $s[1], $s[2], $s[3]);
             $data[$s[0]] = array();
             $data[$s[0]]['url'] = __p(array_merge(array('src' => $image['src'], 'album_id' => $image['aid']), $pre_array));
             if (isset($pre_water_array)) {
                 $data[$s[0]]['watermarked_url'] = __p(array_merge(array('src' => $image['src'], 'album_id' => $image['aid'], 'modified_on' => $image['modified_on']), $pre_water_array));
             }
             $data[$s[0]]['width'] = $w;
             $data[$s[0]]['height'] = $h;
         }
     } else {
         if (!empty($image['lg_preview'])) {
             list($p, $x, $y) = explode(':', $image['lg_preview']);
             $local_path = ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $p;
             $original = DIR_HOST . '/' . ALBUM_DIR . '/album-' . $image['aid'] . DS . 'lg' . DS . $p;
             list($_w, $_h) = getimagesize($local_path);
             $data['lg_preview'] = array('src' => $p, 'focal' => array('x' => $x, 'y' => $y), 'original' => array('url' => $original, 'width' => $_w, 'height' => $_h));
             foreach ($size as $s) {
                 $s = explode(',', $s);
                 $pre_array = array('width' => $s[1], 'height' => $s[2], 'square' => $s[3], 'quality' => $s[4], 'sharpening' => $s[5], 'anchor_x' => $x, 'anchor_y' => $y);
                 if (!is_null($watermark)) {
                     $watermark_array = array('watermark_id' => $watermark['id'], 'watermark_location' => $watermark['position'], 'watermark_opacity' => $watermark['opacity']);
                     $pre_array = array_merge($pre_array, $watermark_array);
                 }
                 list($w, $h) = computeSize(ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $p, $s[1], $s[2], $s[3]);
                 $data[$s[0]]['url'] = __p(array_merge(array('src' => $p, 'album_id' => $image['aid'], 'modified_on' => $image['modified_on']), $pre_array));
                 $data[$s[0]]['width'] = $w;
                 $data[$s[0]]['height'] = $h;
             }
         }
         if (!empty($image['tn_preview'])) {
             list($p, $x, $y) = explode(':', $image['tn_preview']);
             $local_path = ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $p;
             list($_w, $_h) = getimagesize($local_path);
             $original = DIR_HOST . '/' . ALBUM_DIR . '/album-' . $image['aid'] . DS . 'lg' . DS . $p;
             $data['thumb_preview'] = array('src' => $p, 'focal' => array('x' => $x, 'y' => $y), 'original' => array('url' => $original, 'width' => $_w, 'height' => $_h));
             foreach ($size as $s) {
                 $s = explode(',', $s);
                 $pre_array = array('width' => $s[1], 'height' => $s[2], 'square' => $s[3], 'quality' => $s[4], 'sharpening' => $s[5], 'anchor_x' => $x, 'anchor_y' => $y);
                 list($w, $h) = computeSize(ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $p, $s[1], $s[2], $s[3]);
                 $data['thumb_preview'][$s[0]]['url'] = __p(array_merge(array('src' => $p, 'album_id' => $image['aid'], 'modified_on' => $image['modified_on']), $pre_array));
                 $data['thumb_preview'][$s[0]]['width'] = $w;
                 $data['thumb_preview'][$s[0]]['height'] = $h;
             }
         }
     }
     $local_path = ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $image['src'];
     if (isImage($image['src'])) {
         list($original_w, $original_h) = getimagesize($local_path);
     } else {
         $original_w = $original_h = 0;
     }
     $original = DIR_HOST . '/' . ALBUM_DIR . '/album-' . $image['aid'] . '/lg/' . $image['src'];
     if (empty($image['title']) && !empty($album['title_template'])) {
         if (is_null($smart)) {
             $image['title'] = $controller->Director->formTitle($image, $album);
         } else {
             $image['title'] = $controller->Director->formTitle($image, $smart, $album);
         }
     }
     if (empty($image['caption']) && !empty($album['caption_template'])) {
         if (is_null($smart)) {
             $image['caption'] = $controller->Director->formCaption($image, $album);
         } else {
             $image['caption'] = $controller->Director->formCaption($image, $smart, $album);
         }
     }
     if (empty($image['link']) && !empty($album['link_template'])) {
         @(list($image['link'], $image['target']) = $controller->Director->formLink($image, $album));
     }
     if (!empty($image['start_on']) || !empty($image['end_on'])) {
         $data['schedule'] = array('begin' => $image['start_on'], 'end' => $image['end_on']);
     }
     $data['creator'] = $this->user($image['created_by'], $users, $user_size);
     $data['updater'] = $this->user($image['updated_by'], $users, $user_size);
     $data['public'] = $this->user(null, $users, $user_size);
     $data['title'] = convert_smart_quotes($image['title']);
     $data['caption'] = convert_smart_quotes($image['caption']);
     $data['id'] = $image['id'];
     $data['src'] = $image['src'];
     $data['album_id'] = $image['aid'];
     $data['is_video'] = $image['is_video'];
     $data['tags'] = $image['tags'];
     $data['link'] = $image['link'];
     $data['active'] = $image['active'];
     $data['seq'] = $image['seq'];
     $data['pause'] = $image['pause'];
     $data['target'] = $image['target'];
     $data['modified'] = $image['modified_on'];
     $data['created'] = $image['created_on'];
     $data['public'] = $image['public'];
     $data['captured_on'] = $image['captured_on'];
     $data['filesize'] = $image['filesize'];
     $data['original'] = array('url' => $original, 'width' => $original_w, 'height' => $original_h);
     $data['focal'] = array('x' => $x, 'y' => $y);
     $mimes = array('jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'flv' => 'video/x-flv', 'f4v' => 'video/f4v', 'swf' => 'application/x-shockwave-flash', 'mov' => 'video/quicktime', 'mp4' => 'video/mp4', 'm4v' => 'video/x-m4v', '3gp' => 'video/3gpp', '3g2' => 'video/3gpp2');
     $info = pathinfo($local_path);
     if (array_key_exists($info['extension'], $mimes)) {
         $data['mime_type'] = $mimes[$info['extension']];
     } else {
         if (function_exists('mime_content_type')) {
             $data['mime_type'] = mime_content_type($local_path);
         } else {
             $data['mime_type'] = '';
         }
     }
     if ($controller->includeMeta) {
         list($mdata, $dummy) = $controller->Director->imageMetaData(ALBUMS . DS . 'album-' . $image['aid'] . DS . 'lg' . DS . $image['src']);
         if (!empty($mdata)) {
             $data['iptc'] = array();
             $data['exif'] = array();
             foreach ($controller->Director->iptcTags as $tag) {
                 $tag_clean = str_replace(' ', '_', $tag);
                 $data['iptc'][$tag_clean] = $controller->Director->parseMetaTags("iptc:{$tag}", $mdata, 'w');
             }
             foreach ($controller->Director->exifTags as $tag) {
                 $tag_clean = str_replace(' ', '_', $tag);
                 $data['exif'][$tag_clean] = $controller->Director->parseMetaTags("exif:{$tag}", $mdata, 'w');
             }
         }
     }
     if (!is_null($smart)) {
         $data['original_album'] = array('id' => $album['id'], 'title' => $album['name'], 'tags' => $album['tags']);
     }
     return $data;
 }
Example #11
0
        $alert[] = "invalid_revert";
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Save row
if (isset($_POST['saving'])) {
    $query_save = $has_id && $_POST['save_and'] != 'duplicate' ? 'UPDATE ' : 'INSERT INTO ';
    $query_save .= "`{$table}` SET ";
    $save_array = array();
    foreach ($table_rows['fields'] as $field) {
        $value = $_POST[$field];
        $value = is_array($value) ? ',' . implode(',', $value) . ',' : $value;
        // For drop downs ARRAY
        $value = $value == "NULL" || $value == ",NULL," ? '' : $value;
        // For drop downs NULL
        $value = convert_smart_quotes($value);
        // Removes some WORD style characters
        // Based on field settings:
        $value = $settings['field_option'][$table . ',' . $field]['text_area']['no_nl2br'] == 'true' ? $value : nl2br($value);
        $value = $settings['field_option'][$table . ',' . $field]['text_area']['urls_to_links'] == 'true' ? convert_urls_to_links($value) : $value;
        $value = str_replace("'", "\\'", $value);
        $save_array[] = "`{$field}` = '{$value}'";
    }
    if ($table_rows['active'] == '1') {
        $save_array[] = "`active` = '" . $_POST['active'] . "'";
    }
    if ($table_rows['sort'] == '1' && !$has_id && $_POST['save_and'] != 'duplicate') {
        // Get the next highest sort int
        $sth = $dbh->query("SELECT max(sort) AS max_sort FROM `{$table}` ");
        $next_sort = ($sort = $sth->fetch()) ? $sort["max_sort"] + 1 : 1;
        $save_array[] = "`sort` = '{$next_sort}'";
Example #12
0
     // It's going to Google (doesn't like quoted-printable, but likes html breaks)
     $body = $items[$i]->body;
     $body = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>", "</p>"), "\n", $items[$i]->body)));
     //				$body = chop(strip_tags($items[$i]->body,"<br><p>"));
     $body = str_replace(array("\r"), "", $body);
     $body = str_replace(array("&#160;"), " ", $body);
     $body = convert_smart_quotes($body);
     $body = str_replace(array("\n"), "<br />", $body);
 } else {
     // It's going elsewhere (doesn't like quoted-printable)
     $body = $items[$i]->body;
     $body = chop(strip_tags(str_replace(array("<br />", "<br>", "br/>", "</p>"), "\n", $items[$i]->body)));
     //				$body = chop(strip_tags($items[$i]->body,"<br><p>"));
     $body = str_replace(array("\r"), "", $body);
     $body = str_replace(array("&#160;"), " ", $body);
     $body = convert_smart_quotes($body);
     $body = str_replace(array("\n"), " -- ", $body);
 }
 $title = $items[$i]->title;
 $msg .= "BEGIN:VEVENT\n";
 $msg .= $dtstart . $dtend;
 $msg .= "UID:" . $items[$i]->eventdate->id . "\n";
 $msg .= "DTSTAMP:" . date("Ymd\\THis", time()) . "Z\n";
 if ($title) {
     $msg .= "SUMMARY:{$title}\n";
 }
 //			if($body) { $msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:".quoted_printable_encode($body)."\n";}
 if ($body) {
     $msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" . $body . "\n";
 }
 //	if($link_url) { $msg .= "URL: $link_url\n";}
Example #13
0
function convert_smart_quotes($string)
{
    $search = array('&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;');
    $replace = array('&#039;', '&#039;', '&#034;', '&#034;');
    return str_replace($search, $replace, $string);
}
//Twitter Cards
$twitter_thumbs = '';
$ogtype = 'blog';
$twitter_desc = '';
if (is_single() || is_page()) {
    $twitter_thumbs = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
    $temp_post = get_post($post->ID);
    $ogtype = 'article';
    $twitter_desc = strip_tags(get_the_excerpt());
    $twitter_desc = convert_smart_quotes(htmlentities($twitter_desc, ENT_QUOTES, 'UTF-8'));
}
$twitter_url = get_permalink();
$twitter_title = get_the_title();
$twitter_thumb = $twitter_thumbs != '' ? $twitter_thumbs[0] : get_stylesheet_directory_uri() . '/images/facebooklogo600.jpg';
?>
<link rel="publisher" href="http://plus.google.com/111763340133522077402" />

<meta name="twitter:card" value="summary" />
<meta name="twitter:url" value="<?php 
echo $twitter_url;
?>
" />
<meta name="twitter:title" value="<?php 
echo $twitter_title;
?>
Example #14
0
 function LabelLayout($x, $y, $albumNo, $title, $artist, $genre, $review, $reviewer, $reccs, $noairs, $silence, $general_genre)
 {
     $width = 3.3;
     $height = 4.8;
     $linespace = 0.152;
     $ladywidth = 0.55;
     $ladyoffset = 0.002;
     $alnowidth = 0.45;
     //width for the album number
     $aralgenwidth = 0.49;
     //width of the area with artist, album, and genre
     $noairwidth = 0.83;
     $rotspacer = 4.3;
     //space in the boxes with N, H, M, and L
     $this->SetXY($x, $y);
     $this->SetFont('', '', 9);
     $this->Rect($x - 0.1, $y - 0.18, $width + 0.2, $height + 0.2);
     //$this->SetLeftMargin($x);
     //$this->SetRightMargin($x+$width);
     $this->SetTopMargin($y);
     $this->Image('wsbflady.png', $x, $y, $ladywidth - $ladyoffset);
     //general genre at the top
     $this->SetX($x + $ladywidth);
     $this->Cell($width - $ladywidth - $alnowidth - $rotspacer * $linespace, $linespace, $general_genre, 1, 0, 'C');
     //rotation
     $this->SetX($x + ($width - $alnowidth) - $rotspacer * $linespace);
     $this->Cell($linespace, $linespace, "N", "LTRB", 0, 'C');
     $this->Cell($linespace, $linespace, "H", "LTRB", 0, 'C');
     $this->Cell($linespace, $linespace, "M", "LTRB", 0, 'C');
     $this->Cell($linespace, $linespace, "L", "LTRB", 0, 'C');
     //album code
     $this->SetFont('', 'B', 16);
     $this->SetX($x + ($width - $alnowidth) + 0.08);
     $this->Cell($alnowidth, $linespace, $albumNo, 0, 1, 'R');
     //artist
     $this->SetX($x + $ladywidth);
     $this->SetFont('', 'B', 9);
     $this->Cell($aralgenwidth, $linespace, "Artist: ");
     $this->SetFont('', '');
     $this->MultiCell($width - $ladywidth - $aralgenwidth, $linespace, $artist, 0, 'L');
     //album
     $this->SetX($x + $ladywidth);
     $this->SetFont('', 'B');
     $this->Cell($aralgenwidth, $linespace, "Album: ");
     $this->SetFont('', '');
     $this->MultiCell($width - $ladywidth - $aralgenwidth, $linespace, $title);
     //genre
     $this->SetX($x + $ladywidth);
     $this->SetFont('', 'B');
     $this->Cell($aralgenwidth, $linespace, "Genre: ");
     $this->SetFont('', '');
     $this->MultiCell($width - $ladywidth - $aralgenwidth, $linespace, $genre);
     //review
     $this->SetX($x);
     $this->SetFont('', 'B', 9);
     $this->Cell($width, $linespace, "Property of WSBF-FM Clemson - 88.1", '', 1, 'C');
     $this->SetFont('', '', 9);
     $this->SetX($x);
     $review = convert_smart_quotes($review);
     $this->MultiCell($width, $linespace, $review, "LTR", 'L');
     //reviewer
     $this->SetX($x);
     $this->SetFont('', 'B', '');
     $this->Cell(0.8, $linespace, "Reviewed by:", "L", 'L');
     $this->SetFont('', '', 9);
     $this->Cell($width - 0.8, $linespace, $reviewer, "RB", 1, 'L');
     $this->SetFont('', '', 9);
     //reccomended
     if (sizeof($reccs) > 0) {
         $this->SetFont('', '', 9);
         $reccList = "";
         $this->SetFont('', 'B', '');
         $this->SetX($x);
         $this->Cell($width, $linespace, "Recommended:", "TR", 'L', 2);
         foreach ($reccs as $recc) {
             $reccList .= $recc . ", ";
         }
         $this->SetX($x);
         $reccList = substr_replace($reccList, "", -2);
         $this->SetFont('', '', 9);
         $this->MultiCell($width, $linespace, "             " . $reccList, 'LR', 'L');
     } else {
         $this->SetX($x);
         $this->SetFont('', 'B');
         $this->Cell($width, $linespace, "Album Apparently Has No Recommended Tracks?", 'T', 1, 'C');
         $this->SetFont('', '', 9);
     }
     //no-air
     if (sizeof($noairs) > 0) {
         $this->SetFont('', 'B', 9);
         $noairList = "";
         $this->SetX($x);
         $this->Cell($width, $linespace, "No-Air:", "TR", 'L', 2);
         foreach ($noairs as $noair) {
             $noairList .= $noair . ", ";
         }
         $this->SetX($x);
         $this->SetFont('', '', 9);
         $noairList = substr_replace($noairList, "", -2);
         $this->MultiCell($width, $linespace, "        " . $noairList, 'LRTB', 'L');
     } else {
         $this->SetX($x);
         $this->SetFont('', 'B');
         $this->Cell($width, $linespace, "Album Is FCC Clean", 'T', 1, 'C');
         $this->SetFont('', '', 9);
     }
     //silence after track
     if (sizeof($silence) > 0) {
         $this->SetFont('', 'B', 9);
         $silenceList = "";
         $this->SetX($x);
         $this->Cell($width, $linespace, "Note:", "TR", 'L', 2);
         foreach ($silence as $silences) {
             $silenceList .= $silences . ", ";
         }
         $this->SetX($x);
         $this->SetFont('', '', 9);
         $silenceList = substr_replace($silenceList, "", -2);
         $silenceList .= " has silence after track.";
         $this->MultiCell($width, $linespace, "      " . $silenceList, 'LRTB', 'L');
     }
 }
<?php

/**
 * Created by PhpStorm.
 * User: Davis
 * Date: 1/2/2016
 * Time: 5:39 PM
 */
require_once __DIR__ . '/shittalk_functions.php';
$file = "cfg/shittalk.cfg";
$myfile = fopen($file, "r") or die("Unable to open file!");
$fileContents = fread($myfile, filesize($file));
fclose($myfile);
$del = convert_smart_quotes(get_delimited($fileContents));
//an array of everything between quote marks. need to parse this
//UNCOMMENT FOR THIS TO RUN - IMPORTS OLD BINDS
//if (!empty($del)) {
//    for ($i = 0; $i < count($del); $i++) {
//
//        if (strpos($del[$i], 'say ') !== false) { //if "say " is the first part of the string
//            $fixedBind = str_replace('say ', '', $del[$i]);
//            createShittalkRow($fixedBind);
//
//        }
//    }
//}
function createShittalkRow($text)
{
    $text_escaped = mysql_escape_mimic(strip_double_quotes($text));
    $today = mysql_escape_mimic(date("Y-m-d H:i:s"));
    $sql = "INSERT INTO `shittalkDB`\n            (`text`, `date_created`, `custom`)\n            VALUES ('{$text_escaped}', '{$today}', 0);";
    die($res->getMessage());
}
// If nothing is found, send to object not found.
if ($res->numRows() < 1) {
    $t->assign('heading', "Error");
    $t->assign('message', "Did not find the object you were looking for.");
    $t->display('error.tpl');
    die;
}
// Assign vars to resonse
$response = array();
while ($row = $res->fetchRow()) {
    $response['obj_id'] = $row['id'];
    $response['obj_num'] = $row['objnum'];
    $response['objectName'] = convert_smart_quotes($row['name']);
    $response['objectDescription'] = convert_smart_quotes(allEntitiesDecode($row['notes'], ENT_COMPAT, "UTF-8"));
    $response['obj_order'] = $row['order_num'];
    $response['obj_img'] = $row['img_path'];
    // HACK to accommodate the current zoomer tool
    // dirs for filenames have spaces replaced with underscores for ZOOMs
    $lastSlash = strrpos($row['img_path'], "/") + 1;
    if ($lastSlash === false) {
        $path = substr($row['img_path'], 0, -4);
    } else {
        // Use up to slash, plus filename without extension where space converted to _.
        $path = substr($row['img_path'], 0, $lastSlash) . str_replace(" ", "_", substr($row['img_path'], $lastSlash, -4));
    }
    $response['obj_zoomDir'] = $path;
    // trims off .jpg
}
// Free the result
Example #17
0
<?php

$c = 'Français';
echo utf8_encode('Espa\\u00f1ol');
$g = convert_smart_quotes('Espa\\u00f1ol');
echo $g;
echo "<br>";
echo utf8_to_html($g);
function convert_smart_quotes($string)
{
    $search = array(chr(0xe2) . chr(0x80) . chr(0x98), chr(0xe2) . chr(0x80) . chr(0x99), chr(0xe2) . chr(0x80) . chr(0x9c), chr(0xe2) . chr(0x80) . chr(0x9d), chr(0xe2) . chr(0x80) . chr(0x93), chr(0xe2) . chr(0x80) . chr(0x94), chr(226) . chr(128) . chr(153), '’', '“', 'â€<9d>', 'â€"', '  ', 'Â', chr(145), chr(146), chr(147), chr(148), chr(151));
    $replace = array("'", "'", '"', '"', ' - ', ' - ', "'", "'", '"', '"', ' - ', ' ', '', "'", "'", '"', '"', '-');
    return str_replace($search, $replace, $string);
}
function utf8_to_html($data)
{
    return preg_replace(array('/ä/', '/ö/', '/ü/', '/é/', '/à/', '/’/', '/‘/', '/”/', '/–/', '/£/', '/Â/', '/è/'), array('&auml;', '&ouml;', '&uuml;', '&eacute;', '&agrave;', "'", "'", '"', '-', '&pound;', '', '&egrave;'), $data);
}
function sanitxt($sanitxt)
{
    // add a space between closing and opening tags
    $sanitxt = str_replace('><', '> <', $sanitxt);
    // remove HTML tags
    $sanitxt = strip_tags($sanitxt);
    // remove multiple spaces
    $sanitxt = preg_replace('/\\s+/', ' ', $sanitxt);
    // convert smart quotes into normal
    convert_smart_quotes($sanitxt);
    // replace quotes and ampersands with HTML chars (recommended)
    // and encode string to UTF-8. UTF-8 is default from PHP 5.4.0 only
    $sanitxt = htmlspecialchars($sanitxt, ENT_QUOTES, "UTF-8", FALSE);
    return $sanitxt;
}
Example #19
0
 function escape($arg)
 {
     if (!is_string($arg)) {
         return $arg;
     }
     //$this->error('error=>Non string supplied to escape function.', "function=>".__FUNCTION__, "line=>".__LINE__, "arguments=>" . var_export($arg, true));
     $arg = clean($arg);
     //$arg = addslashes($arg);
     $arg = convert_smart_quotes($arg);
     return $this->connection ? mysql_real_escape_string($arg) : $arg;
 }