Exemplo n.º 1
0
 /**
  * Filters the length of the returned excerpt.
  *
  * @return int
  */
 function excerpt_length()
 {
     global $suf_excerpt_custom_length;
     if (suffusion_admin_check_integer($this->post_excerpt_length)) {
         return $this->post_excerpt_length;
     } else {
         if (suffusion_admin_check_integer($suf_excerpt_custom_length)) {
             return $suf_excerpt_custom_length;
         } else {
             return 55;
         }
     }
 }
Exemplo n.º 2
0
/**
 * Returns the count for the number of posts to be displayed as full posts.
 *
 * @return int
 */
function suffusion_get_full_content_count()
{
    global $suffusion, $suf_category_fc_number, $suf_author_fc_number, $suf_tag_fc_number, $suf_search_fc_number, $suf_archive_fc_number, $suf_index_fc_number, $suf_pop_fc_number, $suf_fc_view_first_only;
    global $suffusion_cpt_post_id;
    if (isset($suffusion_cpt_post_id)) {
        $not_first_page_only = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_full_posts_fp_only', true);
        if (!$not_first_page_only && is_paged()) {
            return 0;
        }
        $full_post_count = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_full_posts', true);
        $total_posts = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_total_posts', true);
        if (!$total_posts || !is_integer($total_posts)) {
            $total_posts = get_option('posts_per_page');
        }
        if (suffusion_admin_check_integer($full_post_count) && $full_post_count > $total_posts) {
            return $total_posts;
        } else {
            if (suffusion_admin_check_integer($full_post_count)) {
                return $full_post_count;
            } else {
                return 0;
            }
        }
    }
    if ($suf_fc_view_first_only == 'first' && is_paged()) {
        return 0;
    }
    if (!isset($suffusion) || is_null($suffusion)) {
        $suffusion = new Suffusion();
    }
    $context = $suffusion->get_context();
    $full_post_count = 0;
    if (in_array('category', $context)) {
        $full_post_count = (int) $suf_category_fc_number;
    } else {
        if (in_array('author', $context)) {
            $full_post_count = (int) $suf_author_fc_number;
        } else {
            if (in_array('tag', $context)) {
                $full_post_count = (int) $suf_tag_fc_number;
            } else {
                if (in_array('search', $context)) {
                    $full_post_count = (int) $suf_search_fc_number;
                } else {
                    if (in_array('date', $context)) {
                        $full_post_count = (int) $suf_archive_fc_number;
                    } else {
                        if (in_array('custom-type', $context)) {
                            //
                        } else {
                            if (in_array('home', $context) || in_array('blog', $context)) {
                                $full_post_count = (int) $suf_index_fc_number;
                            } else {
                                if (in_array('page', $context)) {
                                    if (in_array('posts.php', $context)) {
                                        $full_post_count = (int) $suf_pop_fc_number;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $full_post_count;
}
Exemplo n.º 3
0
function suffusion_get_numeric_size_from_field($val, $default)
{
    $ret = $default;
    if (substr(trim($val), -2) == "px") {
        $test_str = trim(substr(trim($val), 0, strlen(trim($val)) - 2));
        if (suffusion_admin_check_integer($test_str)) {
            $ret = (int) $test_str;
        }
    } else {
        if (suffusion_admin_check_integer(trim($val))) {
            $ret = (int) trim($val);
        }
    }
    return $ret;
}
 function get_custom_tiled_layout_css($widths)
 {
     global $suf_tile_image_box_height, $suf_tile_title_alignment;
     $ret = "\r\n#ie6 table.suf-tiles { width: " . (suffusion_admin_check_integer($widths['main-col']) ? $widths['main-col'] - 25 . 'px' : '96%') . " }\r\n.suf-tile-image { height: " . suffusion_admin_get_size_from_field($suf_tile_image_box_height, "100px") . "; }\r\nh2.suf-tile-title { text-align: {$suf_tile_title_alignment}; }";
     return $ret;
 }
Exemplo n.º 5
0
/**
 * Function used to control the number of words to be returned in a category block excerpt
 * @param  $length
 * @return int
 */
function suffusion_excerpt_length_cat_block($length)
{
    global $suf_mag_catblocks_excerpt_length, $suf_excerpt_custom_length;
    if (suffusion_admin_check_integer($suf_mag_catblocks_excerpt_length)) {
        return $suf_mag_catblocks_excerpt_length;
    } else {
        if (suffusion_admin_check_integer($suf_excerpt_custom_length)) {
            return $suf_excerpt_custom_length;
        } else {
            return $length;
        }
    }
}