本文整理汇总了PHP中Meta::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Meta::get方法的具体用法?PHP Meta::get怎么用?PHP Meta::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Meta
的用法示例。
在下文中一共展示了Meta::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_post_view
function set_post_view($ID)
{
$count = Meta::get($ID, 'post_views_count');
if (empty($count)) {
add_post_meta($ID, 'post_views_count', 1);
} else {
update_post_meta($ID, 'post_views_count', $count++);
}
}
示例2: slhb_set_title
function slhb_set_title($post_id, $post, $update)
{
$dateStr = Meta::get($post_id, 'match_date');
$title = $dateStr . ' - ' . Meta::get($post_id, 'match_team_dom') . ' - ' . Meta::get($post_id, 'match_team_ext');
$date = date($dateStr);
//This temporarily removes filter to prevent infinite loops
remove_action('save_post_slhb_match', __FUNCTION__);
wp_update_post(array('ID' => $post_id, 'post_title' => $title, 'match_date' => $date));
//redo filter
add_action('save_post_slhb_match', __FUNCTION__, 10, 3);
}
示例3: testGeneral
public function testGeneral()
{
$meta = new Meta();
$this->assertEmpty($meta->get('first'));
$this->assertNotEmpty($meta->render());
$this->assertNotEmpty($meta->getVars());
$vars = ['test1', 'test2'];
$meta->setVars($vars);
$this->assertEquals($vars, $meta->getVars());
$this->assertNotEmpty($meta->render());
}
示例4: getCurrent
public static function getCurrent()
{
$team = get_queried_object();
#add custom properties
$bannerId = Meta::get($team->ID, 'profile', $single = true);
$image_attributes = wp_get_attachment_image_src($bannerId, "full");
if ($image_attributes) {
$image_attributes[0];
$team->banner = $image_attributes[0];
}
return $team;
}
示例5: getNextMatch
/**
* Return only the last match played, with additional informations (teams and scores included)
*
* @return Match Object
*/
public static function getNextMatch()
{
$matchs = MatchModel::getNextMatchs(1);
if (count($matchs) == 1) {
$match = $matchs[0];
$matchId = $match->ID;
$match->match_date = Meta::get($matchId, 'match_date');
$match->match_team_dom = Meta::get($matchId, 'match_team_dom');
$match->match_team_ext = Meta::get($matchId, 'match_team_ext');
return $match;
}
}
示例6: formatFileInfo
/**
* Formats the file info to be returned as OPDS to the client
*
* @param \OCP\Files\FileInfo $i
* @return array formatted file info
*/
public static function formatFileInfo(\OCP\Files\FileInfo $i)
{
$entry = array();
$entry['id'] = $i['fileid'];
$entry['mtime'] = $i['mtime'];
$entry['name'] = $i->getName();
$entry['type'] = $i['type'];
if ($i['type'] === 'file') {
$entry['mimetype'] = $i['mimetype'];
$entry['humansize'] = \OC_Helper::humanFileSize($i['size']);
$entry['meta'] = Meta::get($i['fileid']);
}
return $entry;
}
示例7: getPopularBooks
/**
* Returns an array of 3 popular books excepted
* the one that is promoted.
*
* @param int $id ID of a book to ignore for cross references.
* @return array
*/
public function getPopularBooks($id)
{
$books = array();
$query = new WP_Query(array('post_type' => $this->slug, 'posts_per_page' => 3, 'post__not_in' => array($id), 'post_status' => 'publish', 'orderby' => 'rand'));
$results = $query->get_posts();
foreach ($results as $book) {
$b = new stdClass();
// Title
$b->title = $book->post_title;
// Featured image
$b->image = get_the_post_thumbnail($book->ID);
// Color
$b->color = Meta::get($book->ID, 'color');
// Excerpt
$b->excerpt = $book->post_excerpt;
// Permalink
$b->link = get_permalink($book->ID);
// Add the book object
$books[] = $b;
}
return $books;
}
示例8: servePreview
/**
* @brief offer preview for download
*
* if no preview exists for this file, send icon instead
*
* @param string $path full path to file
* @param string type type of preview requested
*/
public static function servePreview($path, $type)
{
\OCP\User::checkLoggedIn();
\OC::$server->getSession()->close();
$i = \OC\Files\Filesystem::getFileInfo($path, false);
/* check for predefined cover, if found replace $path with that of cover file */
$meta = Meta::get($i['fileid']);
if ($meta['cover']) {
$path = pathinfo($path)['dirname'] . '/' . $meta['cover'];
$i = \OC\Files\Filesystem::getFileInfo($path, false);
}
if (\OC::$server->getPreviewManager()->isMimeSupported($i['mimetype'])) {
$preview = new \OC\Preview(\OC_User::getUser(), 'files');
$preview->setFile($path);
switch ($type) {
case 'cover':
$preview->setMaxX(Config::getApp('cover-x', '200'));
$preview->setMaxY(Config::getApp('cover-y', '200'));
break;
case 'thumbnail':
$preview->setMaxX(Config::getApp('thumb-x', '36'));
$preview->setMaxY(Config::getApp('thumb-y', '36'));
break;
}
$preview->showPreview();
} else {
// no preview, serve icon instead
$scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http';
header("Location: " . $scheme . "://" . $_SERVER['HTTP_HOST'] . \OC_Helper::mimetypeIcon($i->getMimeType()));
/* Note: relative URL should be enough (RFC7231) but some OPDS clients
* (especially those in dedicated book readers) might not support them
*
* header("Location: " . \OC_Helper::mimetypeIcon($i->getMimeType()));
*/
}
}
示例9: themosis_is_template
/**
* A function that checks if we are using a page template.
*
* @param array $name Template properties.
* @return boolean True: use of a template. False: no template.
*/
function themosis_is_template(array $name = [])
{
$queriedObject = get_queried_object();
if (is_a($queriedObject, 'WP_Post') && 'page' === $queriedObject->post_type) {
// Sanitized value
$template = Meta::get($queriedObject->ID, '_themosisPageTemplate');
// If no template selected, just return;
if ($template === 'none') {
return false;
}
// If template...
if (isset($template) && !empty($template)) {
/*-----------------------------------------------------------------------*/
// If the page template name is defined within the routes array, handle
// the template
/*-----------------------------------------------------------------------*/
if (in_array($template, $name)) {
return true;
}
}
return false;
}
}
示例10: wp_get_attachment_image_src
@include('header')
@loop
<!-- BOOK PROMO -->
<div id="bks-promo" style="background-color: {{ Meta::get(Loop::id(), 'color') }};">
<div class="wrapper">
<div class="promo-wrapper">
<div class="promo-container">
<h1>{{ Loop::title() }}</h1>
<h5>By {{ Meta::get(Loop::id(), 'author') }}</h5>
<a href="#" class="big-button">Buy book</a>
</div>
<div class="promo-media">
<?php
$image = wp_get_attachment_image_src(Meta::get(Loop::id(), 'promo-image'), 'book-promo');
?>
<img src="{{ $image[0] }}" alt="Demo Book" width="399" height="435">
</div>
</div>
</div>
</div>
<!-- END BOOK PROMO -->
<!-- BOOK CONTENT -->
<div class="wrapper">
<div id="book--container">
<div class="bks-title-box">
<h1>Content</h1>
</div>
<div id="book--content">
{{ Loop::content() }}
</div>
示例11: setSourceFile
/**
* Set source file.
*
* @param [[@doctodo param_type:sourceFile]] $sourceFile [[@doctodo param_description:sourceFile]]
*
* @return [[@doctodo return_type:setSourceFile]] [[@doctodo return_description:setSourceFile]]
*/
public function setSourceFile($sourceFile)
{
$this->_meta = Meta::get($this->interface, $sourceFile);
return $this;
}
示例12: about
/**
* Handle about page request.
*
* @param \WP_Post $post
* @return mixed
*/
public function about($post)
{
return View::make('pages.about', array('members' => Meta::get($post->ID, 'collaborators')));
}