コード例 #1
0
ファイル: api.php プロジェクト: mautematico/mobilepress
 /**
  * Creates thumbnails for all images in a post / page
  *
  * @package MobilePress
  * @since 1.2
  */
 function mopr_thumbnails($content)
 {
     if (preg_match_all('#<img.+?src=\\"(.*?)\\"(.*?) \\/>#s', $content, $matches, PREG_SET_ORDER)) {
         foreach ($matches as $match) {
             $image_url = $match[1];
             $image_thumb = '<img src="' . mopr_create_thumbnail($image_url) . '" />';
             $content = preg_replace('#<img.+?src=\\"' . $image_url . '\\"(.*?) \\/>#s', $image_thumb, $content);
         }
     }
     return $content;
 }
コード例 #2
0
ファイル: search.php プロジェクト: mautematico/mobilepress
		<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>

		<div class="post">
			<?php 
        if (mopr_get_option('show_thumbnails') && has_post_thumbnail()) {
            $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
            ?>
			<a href="<?php 
            the_permalink();
            ?>
" class="thumbnail"><img src="<?php 
            echo mopr_create_thumbnail($thumbnail_url[0], 0, 50, 50);
            ?>
" /></a>
			<?php 
        }
        ?>
			<h2 class="title"><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
" accesskey="<?php 
        echo $access_key;
        $access_key++;
        ?>
コード例 #3
0
function setesm_postdisplay_m($postid = 0, $ast = 0, $astc = 0)
{
    global $page;
    $noreg = get_post_meta($postid, 'No Registration', $single = true);
    if ($noreg != null) {
        $bypassreg = 1;
    }
    if (isset($_COOKIE['esmpass'])) {
        $bypassreg = 1;
    }
    /* Check if the user is on page gt 1 and not logged in */
    global $page;
    if ($bypassreg == 1 or is_user_logged_in()) {
        $showpagecontent = 1;
    } else {
        if (in_category(array(139, 127)) and !$bypassreg == 1 or in_category(array(139, 127)) and !is_user_logged_in()) {
            $showpagecontent = 0;
        } else {
            if (in_category(array(163, 166, 167)) and $page > 1) {
                $showpagecontent = 0;
            } else {
                if ($astused > 1) {
                    $showpagecontent = 0;
                } else {
                    //let them in
                    $showpagecontent = 1;
                }
            }
        }
    }
    ?>
 


		<div id="title">
		
        	<h2><?php 
    if (in_category(array(19, 20, 21))) {
        echo 'Press Release: ';
    }
    the_title();
    ?>
</h2>
		</div>
        <div class="postmeta">

		<?php 
    $SubTitle = get_post_meta($postid, 'Sub Title', $single = true);
    if ($SubTitle != null) {
        echo '<span class="subtitle">' . $SubTitle . '</span></br>';
        the_time('F jS, Y');
        echo '</br>';
    }
    ?>
        
		<?php 
    if (function_exists('gkl_postavatar')) {
        echo '<div style="float:left; margin-right:5px;">';
        gkl_postavatar(postavatar);
        echo '</div>';
    }
    ?>
        <?php 
    $PageByLine = get_post_meta($postid, 'Byline', $single = true);
    if ($PageByLine != null) {
        echo $PageByLine . '<br/>';
    } else {
        echo '<span class="byline">';
    }
    if (in_category(29)) {
        echo '<a href="' . get_category_link(29) . '">' . 'Read more news from Around the Web </a></span>';
    } elseif (in_category(126)) {
        echo '<a href="' . get_category_link(126) . '">' . 'View more Sites of the Week </a></span>';
    } elseif (in_category(19)) {
        echo '<a href="' . get_category_link(19) . '">' . 'View more Press Releases </a></span>';
    } elseif (in_category(20)) {
        echo '<a href="' . get_category_link(20) . '">' . 'View more Partner Press Releases</a></span>';
    } elseif (in_category(21)) {
        echo '<a href="' . get_category_link(21) . '">' . 'View more Press Releases from Technology Providers</a></span>';
    } else {
        ?>
 Read more by <?php 
        $AltAuthorName = get_post_meta($postid, 'Alt Author Read More Name', $single = true);
        $AltAuthorLink = get_post_meta($postid, 'Alt Author Read More Link', $single = true);
        $AltDate = get_post_meta($postid, 'Alt Date', $single = true);
        if ($AltAuthorName != null) {
            if ($AltAuthorName == 'hide' or $AltAuthorName == '0') {
                //delete the line
            } else {
                if ($AltAuthorLink != null) {
                    echo '<a href="' . $AuthorLink . '" title="' . $AltAuthorName . '" rel="author">' . $AltAuthorName . '</a>';
                } else {
                    echo $AltAuthorName;
                }
            }
        } else {
            the_author_posts_link();
        }
    }
    ?>
   
		</div>
		<div class="post">


<?php 
    if ($astc > 1) {
        ?>
<div id="title">
<h2>Table of Contents</h2>
</div>

<?php 
        echo '<div class="toc"><h3>' . get_cat_name($astc) . '</h3>';
        $e = 1;
        $query5 = new WP_Query();
        $query5->query('posts_per_page=-1&cat=' . $astc);
        while ($query5->have_posts()) {
            $query5->the_post();
            ?>
		<p><a href="<?php 
            the_permalink();
            echo '?ast=' . $ast . '&astc=' . $astc;
            ?>
" rel="bookmark"><?php 
            the_title();
            ?>
</a></p>
	<?php 
            $e++;
        }
        wp_reset_query();
        ?>
   </div>
<?php 
    }
    ?>


		
		<?php 
    if (has_post_thumbnail()) {
        $thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
        ?>
            <a href="<?php 
        the_permalink();
        ?>
" class="thumbnail"><img src="<?php 
        echo mopr_create_thumbnail($thumbnail_url[0], 0, 50, 50);
        ?>
" /></a>
            <?php 
    }
    ?>

            <?php 
    if ($showpagecontent == 1) {
        the_content();
        $ContactName = get_post_meta($postid, 'Contact Name', $single = true);
        $ContactEmail = get_post_meta($postid, 'Contact Email', $single = true);
        $ContactPhone = get_post_meta($postid, 'Contact Phone', $single = true);
        $ContactURL = get_post_meta($postid, 'Contact URL', $single = true);
        if ($ContactURL != null) {
            if (!preg_match("#^http://www\\.[a-z0-9-_.]+\\.[a-z]{2,4}\$#i", $ContactURL)) {
                $ContactURL = 'http://' . $ContactURL;
            }
        }
        $GrantOrg = get_post_meta($postid, 'Grant Org', $single = true);
        if ($ContactName != null || $ContactEmail != null || $ContactPhone != null || $ContactURL != null || $GrantOrg != null) {
            ?>
			<blockquote>
			<strong>Contact Information</strong><hr />
			<ul>
			<?php 
            $Eligibility = get_post_meta($postid, 'Eligibility', $single = true);
            $GrantDeadline = get_post_meta($postid, 'Grant Deadline', $single = true);
            $GrantHeadline = get_post_meta($postid, 'Grant Headline', $single = true);
            $GrantValue = get_post_meta($postid, 'Grant Value', $single = true);
            if ($GrantOrg != null) {
                echo '<li><strong>Grant Organization: </strong>' . $GrantOrg . '</li>';
            }
            if ($ContactName != null) {
                echo '<li><strong>Contact Name: </strong>' . $ContactName . '</li>';
            }
            if ($ContactPhone != null) {
                echo '<li><strong>Contact Phone: </strong>' . $ContactPhone . '</li>';
            }
            if ($ContactEmail != null) {
                echo '<li><strong>Contact Email: </strong>' . $ContactEmail . '</li>';
            }
            if ($ContactURL != null) {
                echo '<li><strong>Contact URL: </strong><a href="' . $ContactURL . '" target="_blank" alt="Grant Link">' . substr($ContactURL, 0, 30) . '</a>...</li>';
            }
            if ($Eligibility != null) {
                echo '<li><strong>Eligibility: </strong>' . $Eligibility . '</li>';
            }
            if ($GrantDeadline != null) {
                $grantdatetime = date_create($GrantDeadline);
                echo '<li><strong>Grant Deadline: </strong>' . $grantdatetime->format('l F jS, Y') . '</li>';
            }
            if ($GrantValue != null) {
                echo '<li><strong>Grant Value: </strong>' . $GrantValue . '</li>';
            }
            echo '</ul></blockquote>';
        }
        // make sure any advanceded content gets cleared
        echo '<div class="clear"></div>';
        // Display pagination
        echo '<div align="left" style="border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; width:100%; float:left; font-size:20px; font-weight:bold; line-height:30px;">';
        if ($ast > 1) {
            enhanced_link_pages(array('blink' => '', 'alink' => '&nbsp;', 'before' => '<strong>Pages:</strong> ', 'after' => '', 'next_or_number' => 'next', 'afterhref' => 'ast=' . $ast . '&astc=' . $astc));
        } else {
            enhanced_link_pages(array('blink' => '', 'alink' => '&nbsp;', 'before' => '<div class="pagelinks">Pages: ', 'after' => '</div>', 'next_or_number' => 'next'));
        }
        echo '</div>';
        // Post Widget
        gab_dynamic_sidebar('PostWidget');
        ?>
			

<div style="clear:both;"></div> 
	
<div style="clear:both"></div>
						
							
<?php 
    } else {
        ?>
						
<p><?php 
        print string_limit_words(get_the_excerpt(), 35);
        ?>
...</p>

<div style="border:#CCCCCC solid 1px; padding:10px;">
<form action="<?php 
        echo get_option('home');
        ?>
/wp-login.php" method="post">
<table style="width:100%;">
<tr><td colspan="2"><p><strong>Free registration required to continue reading this article.</strong></p></td></tr>
<tr><td style="width:45%; padding-right:10px; border-right:1px solid #666">

Register today and receive free access to all our news and resources and the ability to customize your news by topic with My eSchool News.<br /><br />
<a href="<?php 
        echo get_option('home');
        ?>
/wp-login.php?action=register&redirect_to=?redirect_to=<?php 
        echo urlencode(get_permalink());
        ?>
" style="text-decoration:underline;"><strong>Register now.</strong></a>
</td>
<td style="width:55%; padding-left:10px">
Already a member? Log in 

<div>Username: <input type="text" name="log" id="log" value="" /></div>
<div>Password:&nbsp <input name="pwd" id="pwd" type="password" value="" /></div>
<input type="submit" name="submit" value="Login" class="button">
<input name="rememberme" id="rememberme" type="hidden" checked="checked" value="forever">
<input type="hidden" name="redirect_to" value="<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
">
<br />
<a href="<?php 
        echo get_option('home');
        ?>
/wp-login.php?action=lostpassword" target="_blank">Lost Password?</a>
	

</td></tr></table>
</form>	
</div>		
<?php 
    }
    //end showpagecontent check
    ?>
		</div>


</div>

				

<?php 
}