本文整理汇总了PHP中mysql2date函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql2date函数的具体用法?PHP mysql2date怎么用?PHP mysql2date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql2date函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: eventbrite_format_time
function eventbrite_format_time()
{
$start = eventbrite_event_start()->local;
$end = eventbrite_event_end()->local;
$event_time = sprintf('%s <br> %s - %s <br> %s - %s', esc_html(mysql2date('l', $start)) . 's', esc_html(mysql2date('g:i A', $start)), esc_html(mysql2date('g:i A', $end)), esc_html(mysql2date('F j', $start)), esc_html(mysql2date('F j Y', $end)));
return $event_time;
}
开发者ID:nick-benoit14,项目名称:eventbrite-api,代码行数:7,代码来源:eventbrite-displayblock.php
示例2: column_default
/** ************************************************************************
* Recommended. This method is called when the parent class can't find a method
* specifically build for a given column. Generally, it's recommended to include
* one method for each column you want to render, keeping your package class
* neat and organized. For example, if the class needs to process a column
* named 'title', it would first see if a method named $this->column_title()
* exists - if it does, that method will be used. If it doesn't, this one will
* be used. Generally, you should try to use custom column methods as much as
* possible.
*
* Since we have defined a column_title() method later on, this method doesn't
* need to concern itself with any column with a name of 'title'. Instead, it
* needs to handle everything else.
*
* For more detailed insight into how columns are handled, take a look at
* WP_List_Table::single_row_columns()
*
* @param array $item A singular item (one full row's worth of data)
* @param array $column_name The name/slug of the column to be processed
* @return string Text or HTML to be placed inside the column <td>
**************************************************************************/
function column_default($item, $column_name)
{
switch ($column_name) {
case 'order_id':
case 'buyer_userid':
case 'buyer_name':
case 'PaymentMethod':
case 'eBayPaymentStatus':
case 'CheckoutStatus':
case 'CompleteStatus':
case 'status':
return $item[$column_name];
case 'total':
return number_format($item[$column_name], 2, ',', '.');
case 'date_created':
case 'LastTimeModified':
// use date format from wp
$date = mysql2date(get_option('date_format'), $item[$column_name]);
$time = mysql2date('H:i', $item[$column_name]);
return sprintf('%1$s <br><span style="color:silver">%2$s</span>', $date, $time);
default:
return print_r($item, true);
//Show the whole array for troubleshooting purposes
}
}
开发者ID:booklein,项目名称:wpbookle,代码行数:46,代码来源:EbayOrdersTable.php
示例3: sys_recent_posts
function sys_recent_posts($atts, $content = null)
{
extract(shortcode_atts(array('limit' => '2', 'description' => '40', 'cat_id' => '23', 'thumb' => 'true', 'postdate' => ''), $atts));
$out = '<div class="widget_postslist sc">';
$out .= '<ul>';
global $wpdb;
$myposts = get_posts("numberposts={$limit}&offset=0&cat={$cat_id}");
foreach ($myposts as $post) {
$post_date = $post->post_date;
$post_date = mysql2date('F j, Y', $post_date, false);
$out .= "<li>";
if ($thumb == "true") {
$thumbid = get_post_thumbnail_id($post->ID);
$imgsrc = wp_get_attachment_image_src($thumbid, array(9999, 9999));
$out .= '<div class="thumb"><a href="' . get_permalink($post->ID) . '" title="' . $post->post_title . '">';
if ($thumbid) {
$out .= atp_resize('', $imgsrc['0'], '50', '50', 'imgborder', '');
} else {
//$out .= '<img class="imgborder" src="'.THEME_URI.'/images/no-image.jpg'.'" alt="' .$post->post_title. '" />';
}
$out .= '</a></div>';
}
$out .= '<div class="pdesc"><a href="' . get_permalink($post->ID) . '" rel="bookmark">' . $post->post_title . '</a>';
if ($postdate == "true") {
$out .= '<div class="w-postmeta"><span>' . $post_date . '</span></div>';
} else {
$out .= '<p>' . wp_html_excerpt($post->post_content, $description, '...') . '</p>';
}
$out .= '</div></li>';
}
$out .= '</ul></div>';
return $out;
wp_reset_query();
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:34,代码来源:recentposts.php
示例4: wp_link_query
/**
* Performs post queries for internal linking.
*
* @since 3.1.0
*
* @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
* @return array Results.
*/
function wp_link_query($args = array())
{
$pts = get_post_types(array('publicly_queryable' => true), 'objects');
$pt_names = array_keys($pts);
$query = array('post_type' => $pt_names, 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'post_date', 'posts_per_page' => 20);
$args['pagenum'] = isset($args['pagenum']) ? absint($args['pagenum']) : 1;
if (isset($args['s'])) {
$query['s'] = $args['s'];
}
$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ($args['pagenum'] - 1) : 0;
// Do main query.
$get_posts = new WP_Query();
$posts = $get_posts->query($query);
// Check if any posts were found.
if (!$get_posts->post_count) {
return false;
}
// Build results.
$results = array();
foreach ($posts as $post) {
if ('post' == $post->post_type) {
$info = mysql2date(__('Y/m/d'), $post->post_date);
} else {
$info = $pts[$post->post_type]->labels->singular_name;
}
$results[] = array('ID' => $post->ID, 'title' => trim(esc_html(strip_tags(get_the_title($post)))), 'permalink' => get_permalink($post->ID), 'info' => $info);
}
return $results;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:37,代码来源:internal-linking.php
示例5: get_oembed_response
/**
* @param string $url
* @param string $format
* @param int $maxwidth
* @param int $maxheight
* @param string $callback
*
* @return array|WP_JSON_Response|WP_Error
*/
public function get_oembed_response($url, $format = 'json', $maxwidth = 640, $maxheight = 420, $callback = '')
{
if ('json' !== $format) {
return new WP_Error('json_oembed_invalid_format', __('Format not supported.'), array('status' => 501));
}
$id = Helper::url_to_postid($url);
if (0 === $id || !in_array(get_post_type($id), $this->type)) {
return new WP_Error('json_oembed_invalid_url', __('Invalid URL.'), array('status' => 404));
}
if (320 > $maxwidth || 180 > $maxheight) {
return new WP_Error('json_oembed_invalid_dimensions', __('Not implemented.'), array('status' => 501));
}
/** @var array $post */
$post = get_post($id, ARRAY_A);
// Link headers (see RFC 5988)
$response = new WP_JSON_Response();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', $post['post_modified_gmt']) . 'GMT');
$post = $this->prepare_response($post, $maxwidth, $maxheight);
if (is_wp_error($post)) {
return $post;
}
$response->link_header('alternate', get_permalink($id), array('type' => 'text/html'));
$response->set_data($post);
if ('' !== $callback) {
$_GET['_jsonp'] = $callback;
}
return $response;
}
开发者ID:Steadroy,项目名称:wptalents,代码行数:37,代码来源:Oembed_Provider.php
示例6: setup_postdata_custom
/**
* Set up global post data.
*
* @since 1.5.0
*
* @param object $post Post data.
* @uses do_action_ref_array() Calls 'the_post'
* @return bool True when finished.
*/
function setup_postdata_custom($post)
{
global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
$id = (int) $post->ID;
$authordata = get_userdata($post->post_author);
$currentday = mysql2date('d.m.y', $post->post_date, false);
$currentmonth = mysql2date('m', $post->post_date, false);
$numpages = 1;
$multipage = 0;
$page = get_query_var('page');
if (!$page) {
$page = 1;
}
if (is_single() || is_page() || is_feed()) {
$more = 1;
}
$content = $post->post_content;
$pages = array($post->post_content);
/**
* Fires once the post data has been setup.
*
* @since 2.8.0
*
* @param WP_Post &$post The Post object (passed by reference).
*/
do_action_ref_array('the_post', array(&$post));
return true;
}
开发者ID:a-i-ko93,项目名称:ipl-foodblog,代码行数:37,代码来源:body_content.php
示例7: Red_Item
function Red_Item($values, $type = '', $match = '')
{
if (is_object($values)) {
foreach ($values as $key => $value) {
$this->{$key} = $value;
}
if ($this->match_type) {
$this->match = Red_Match::create($this->match_type, $this->action_data);
$this->match->id = $this->id;
$this->match->action_code = $this->action_code;
}
if ($this->action_type) {
$this->action = Red_Action::create($this->action_type, $this->action_code);
$this->match->action = $this->action;
} else {
$this->action = Red_Action::create('nothing', 0);
}
if ($this->last_access == '0000-00-00 00:00:00') {
$this->last_access = 0;
} else {
$this->last_access = mysql2date('U', $this->last_access);
}
} else {
$this->url = $values;
$this->type = $type;
$this->match = $match;
}
}
开发者ID:santikrass,项目名称:apache,代码行数:28,代码来源:redirect.php
示例8: set_custom_field_data
/**
* Filter the date and time fields.
*
* @param mixed $value
* @param string $key
* @param array $data
* @return mixed
* @access public
* @since 1.0.0
*/
public function set_custom_field_data($value, $key, $data)
{
switch ($key) {
case 'date':
if (isset($data['post_date'])) {
$value = mysql2date('l, F j, Y', $data['post_date']);
}
break;
case 'time':
if (isset($data['post_date'])) {
$value = mysql2date('H:i A', $data['post_date']);
}
break;
case 'status':
if (isset($data['post_status'])) {
$value = $this->statuses[$data['post_status']];
}
break;
case 'address':
$value = str_replace('<br/>', PHP_EOL, charitable_get_donation($data['donation_id'])->get_donor_address());
break;
case 'phone':
$value = charitable_get_donation($data['donation_id'])->get_donor()->get_donor_meta('phone');
break;
case 'donation_gateway':
$value = charitable_get_donation($data['donation_id'])->get_gateway_object()->get_name();
break;
}
return $value;
}
开发者ID:rafecolton,项目名称:Charitable,代码行数:40,代码来源:class-charitable-export-donations.php
示例9: email_back
function email_back($id)
{
global $wpdb, $email_send_comment;
$reply_id = mysql_escape_string($_REQUEST['comment_reply_ID']);
$post_id = mysql_escape_string($_REQUEST['comment_post_ID']);
if ($reply_id == 0 || $_REQUEST["email"] != get_settings('admin_email') && !isset($_REQUEST['comment_email_back'])) {
return;
}
$comment = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_ID='{$id}' LIMIT 0, 1");
$reply_comment = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_ID='{$reply_id}' LIMIT 0, 1");
$post = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID='{$post_id}' LIMIT 0, 1");
$comment = $comment[0];
$reply_comment = $reply_comment[0];
$post = $post[0];
$title = $post->post_title;
$author = $reply_comment->comment_author;
$url = get_permalink($post_id);
$to = $reply_comment->comment_author_email;
if ($to == "") {
return;
}
$subject = "The author replied your comment at [" . get_bloginfo() . "]'" . $title;
$date = mysql2date('Y.m.d H:i', $reply_comment->comment_date);
$message = "\r\n\t<div>\r\n\t\t<p>Dear {$author}:<p>\r\n\t\t<p>{$comment->comment_content}</p>\r\n\t\t<div style='color:grey;'><small>{$date}, your comment at " . get_bloginfo() . "<a href='{$url}#comment-{$id}'>{$title}</a>: </small>\r\n\t\t\t<blockquote>\r\n\t\t\t\t<p>{$reply_comment->comment_content}</p>\r\n\t\t\t</blockquote>\r\n\t\t</div>\r\n\t</div>";
// strip out some chars that might cause issues, and assemble vars
$site_name = get_bloginfo();
$site_email = get_settings('admin_email');
$charset = get_settings('blog_charset');
$headers = "From: \"{$site_name}\" <{$site_email}>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=\"{$charset}\"\n";
$email_send_comment = "Email notification has sent to " . $to . " with subject '" . $subject . "'";
return wp_mail($to, $subject, $message, $headers);
}
开发者ID:sontv1003,项目名称:vtcacademy,代码行数:34,代码来源:comment-reply.php
示例10: render
public function render($user)
{
global $wp_locale;
echo '<tr>';
echo '<th><label for="' . $this->_id . '">' . $this->_params['label'] . '</label></th>';
echo '<td>';
$time_adj = current_time('timestamp');
$date = $this->_value($user);
$jj = $date ? mysql2date('d', $date, false) : gmdate('d', $time_adj);
$mm = $date ? mysql2date('m', $date, false) : gmdate('m', $time_adj);
$aa = $date ? mysql2date('Y', $date, false) : gmdate('Y', $time_adj);
$month = '<label><span class="screen-reader-text">' . __('Month') . '</span><select id="' . $this->_id . '_mm" name="' . $this->_name . '[mm]"' . ">\n";
for ($i = 1; $i < 13; $i = $i + 1) {
$monthnum = zeroise($i, 2);
$monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected($monthnum, $mm, false) . '>';
$month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext) . "</option>\n";
}
$month .= '</select></label>';
$day = '<label><span class="screen-reader-text">' . __('Day') . '</span><input type="text" id="' . $this->_id . '_jj" name="' . $this->_name . '[jj]" value="' . $jj . '" size="2" maxlength="2"' . ' autocomplete="off" /></label>';
$year = '<label><span class="screen-reader-text">' . __('Year') . '</span><input type="text" id="' . $this->_id . '_aa" name="' . $this->_name . '[aa]" value="' . $aa . '" size="4" maxlength="4"' . ' autocomplete="off" /></label>';
echo $day . $month . $year;
echo $this->_description();
echo '</td>';
echo '</tr>';
}
开发者ID:adriend,项目名称:morepress,代码行数:26,代码来源:Date.php
示例11: tool_html_time
function tool_html_time($p = array())
{
/* Info
Takes a databasefield datevalue like 20130227 or
a date/time value like 2013022701230 and
returns a formated time tag.
*/
$p += array('field' => false, 'format' => 'd.m.Y', 'timezone' => false);
if ($p['field']) {
$date_time = str_split($p['field'], 8);
$date_arr = str_split($date_time[0], 2);
if (!isset($date_time[1])) {
$date_time[1] = '';
}
$time_arr = str_split(str_pad($date_time[1], 6, '0', STR_PAD_RIGHT), 2);
$mysql2date_input_format = $date_arr[0] . $date_arr[1] . '-' . $date_arr[2] . '-' . $date_arr[3] . ' ' . $time_arr[0] . ':' . $time_arr[0] . ':' . $time_arr[0];
$timestamp = mysql2date('U', $mysql2date_input_format);
// use custom timezone
if ($p['timezone']) {
$timezone_default = date_default_timezone_get();
date_default_timezone_set($p['timezone']);
}
$time = date('c', $timestamp);
$text = date($p['format'], $timestamp);
// define default timezone
if ($p['timezone']) {
date_default_timezone_set($timezone_default);
}
return '<time datetime="' . $time . '">' . $text . '</time>';
} else {
return false;
}
}
开发者ID:kikinangulo,项目名称:wordpress-toolset,代码行数:34,代码来源:index.php
示例12: html
public function html($meta, $repeatable = null)
{
global $wp_locale;
is_array($meta);
$name = is_null($repeatable) ? $this->_name : $this->_name . '[' . $repeatable . ']';
$id = is_null($repeatable) ? $this->_id : $this->_id . '_' . $repeatable;
echo '<tr>';
echo '
<th scope="row">
<label for="' . $id . '_jj">' . $this->_label . '</label>
</th>
<td>
';
$jj = $meta ? mysql2date('d', $meta, false) : '';
$mm = $meta ? mysql2date('m', $meta, false) : '';
$aa = $meta ? mysql2date('Y', $meta, false) : '';
$month = '<label><span class="screen-reader-text">' . __('Month') . '</span><select id="' . $id . '_mm" name="' . $name . '[mm]"' . ' ' . $this->_inputAttr() . '>';
$month .= "\t\t\t" . '<option value="" data-text="" ' . selected('', $mm, false) . '>';
$month .= "--</option>\n";
for ($i = 1; $i < 13; $i = $i + 1) {
$monthnum = zeroise($i, 2);
$monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected($monthnum, $mm, false) . '>';
$month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext) . "</option>\n";
}
$month .= '</select></label>';
$day = '<label><span class="screen-reader-text">' . __('Day') . '</span><input type="number" min="1" max="31" id="' . $id . '_jj" name="' . $name . '[jj]" value="' . $jj . '" size="2" maxlength="2"' . ' autocomplete="off" ' . $this->_inputAttr() . '></label>';
$year = '<label><span class="screen-reader-text">' . __('Year') . '</span><input type="number" id="' . $id . '_aa" name="' . $name . '[aa]" value="' . $aa . '" size="4" maxlength="4"' . ' autocomplete="off" ' . $this->_inputAttr() . '></label>';
echo $day . $month . $year;
if (!empty($this->_description)) {
echo '<p class="description">' . $this->_description . '</p>';
}
echo '</td>';
echo '</tr>';
}
开发者ID:daidais,项目名称:morepress,代码行数:35,代码来源:Date.php
示例13: get_ranking
/**
* Retrieve ranking
*
* Overrides the $type to set to 'post', then passes through to the post
* endpoints.
*
* @see WP_JSON_Posts::get_posts()
*/
public function get_ranking($filter = array(), $context = 'view')
{
$ids = sga_ranking_get_date($filter);
$posts_list = array();
foreach ($ids as $id) {
$posts_list[] = get_post($id);
}
$response = new WP_JSON_Response();
if (!$posts_list) {
$response->set_data(array());
return $response;
}
// holds all the posts data
$struct = array();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT');
foreach ($posts_list as $post) {
$post = get_object_vars($post);
// Do we have permission to read this post?
if (!$this->check_read_permission($post)) {
continue;
}
$response->link_header('item', json_url('/posts/' . $post['ID']), array('title' => $post['post_title']));
$post_data = $this->prepare_post($post, $context);
if (is_wp_error($post_data)) {
continue;
}
$struct[] = $post_data;
}
$response->set_data($struct);
return $response;
}
开发者ID:kantan2015,项目名称:simple-ga-ranking,代码行数:39,代码来源:wp-rest-api.class.php
示例14: cforms2_dashboard
function cforms2_dashboard()
{
global $wpdb, $cformsSettings;
if (!current_user_can('track_cforms')) {
return;
}
$WHERE = '';
for ($i = 0; $i < $cformsSettings['global']['cforms_formcount']; $i++) {
$no = $i == 0 ? '' : $i + 1;
if ($cformsSettings['form' . $no]['cforms' . $no . '_dashboard'] == '1') {
$WHERE .= "'{$no}',";
}
}
if ($WHERE != '') {
$WHERE = "WHERE form_id in (" . substr($WHERE, 0, -1) . ")";
} else {
return;
}
$entries = $wpdb->get_results("SELECT * FROM {$wpdb->cformssubmissions} {$WHERE} ORDER BY sub_date DESC LIMIT 0,5");
$content .= "<style>\n" . "img.dashboardIcon{\n" . "vertical-align: middle;\n" . "margin-right: 6px;\n" . "}\n" . "</style>\n" . "<ul>";
if (count($entries) > 0) {
foreach ($entries as $entry) {
$dateConv = mysql2date(get_option('date_format'), $entry->sub_date);
$content .= '<li><img class="dashboardIcon" alt="" src="' . plugin_dir_url(__FILE__) . 'images/cformsicon.png">' . "<a title=\"" . __('click for details', 'cforms2') . "\" href='admin.php?page=" . plugin_dir_path(plugin_basename(__FILE__)) . "/cforms-database.php&d-id={$entry->id}#entry{$entry->id}'>{$entry->email}</a> " . __('via', 'cforms2') . " <strong>" . $cformsSettings['form' . $entry->form_id]['cforms' . $entry->form_id . '_fname'] . "</strong>" . " on " . $dateConv . "</li>";
}
} else {
$content .= '<li>' . __('No entries yet', 'cforms2') . '</li>';
}
$content .= "</ul><p class=\"youhave\"><a href='admin.php?page=" . plugin_dir_path(plugin_basename(__FILE__)) . "/cforms-database.php'>" . __('Visit the cforms tracking page for all entries ', 'cforms2') . " »</a> </p>";
echo $content;
}
开发者ID:pabloe01,项目名称:Rawsonenmovimiento,代码行数:31,代码来源:lib_dashboard.php
示例15: cupid_result_search_callback
/**
* Created by PhpStorm.
* User: hoantv
* Date: 2015-01-17
* Time: 2:09 PM
*/
function cupid_result_search_callback()
{
ob_start();
function cupid_search_title_filter($where, &$wp_query)
{
global $wpdb;
if ($keyword = $wp_query->get('search_prod_title')) {
$where .= ' AND ((' . $wpdb->posts . '.post_title LIKE \'%' . $wpdb->esc_like($keyword) . '%\'';
$where .= ' OR ' . $wpdb->posts . '.post_excerpt LIKE \'%' . $wpdb->esc_like($keyword) . '%\'';
$where .= ' OR ' . $wpdb->posts . '.post_content LIKE \'%' . $wpdb->esc_like($keyword) . '%\'))';
}
return $where;
}
$keyword = $_REQUEST['keyword'];
if ($keyword) {
$search_query = array('search_prod_title' => $keyword, 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'post_type' => array('post', 'cupid_classes'), 'nopaging' => true);
add_filter('posts_where', 'cupid_search_title_filter', 10, 2);
$search = new WP_Query($search_query);
remove_filter('posts_where', 'cupid_search_title_filter', 10, 2);
$newdata = array();
if ($search && count($search->post) > 0) {
foreach ($search->posts as $post) {
$shortdesc = $post->post_excerpt;
$newdata[] = array('id' => $post->ID, 'title' => $post->post_title, 'guid' => get_permalink($post->ID), 'date' => mysql2date('M d Y', $post->post_date), 'shortdesc' => $shortdesc);
}
} else {
$newdata[] = array('id' => -1, 'title' => __('Sorry, but nothing matched your search terms. Please try again with different keywords.', 'cupid'), 'guid' => '', 'date' => null, 'shortdesc' => '');
}
ob_end_clean();
echo json_encode($newdata);
}
die;
// this is required to return a proper result
}
开发者ID:adwleg,项目名称:site,代码行数:40,代码来源:search-ajax-action.php
示例16: get
public function get()
{
$license = $this->get_license();
$downloads = $this->get_downloads();
$config = ["alwaysShowHours" => true, "alwaysShowControls" => true, "chaptersVisible" => true, "permalink" => get_permalink($this->post->ID), "publicationDate" => mysql2date("c", $this->post->post_date), "title" => get_the_title($this->post->ID), "subtitle" => wptexturize(convert_chars(trim($this->episode->subtitle))), "summary" => nl2br(wptexturize(convert_chars(trim($this->episode->summary)))), "poster" => $this->episode->cover_art_with_fallback()->setWidth(500)->url(), "show" => ['title' => $this->podcast->title, 'subtitle' => $this->podcast->subtitle, 'summary' => $this->podcast->summary, 'poster' => $this->podcast->cover_art()->setWidth(500)->url(), 'url' => \Podlove\get_landing_page_url()], "license" => ["name" => $license['name'], "url" => $license['url']], "downloads" => $downloads, "duration" => $this->episode->get_duration(), "features" => ["current", "progress", "duration", "tracks", "fullscreen", "volume"], "chapters" => json_decode($this->episode->get_chapters('json')), "languageCode" => $this->podcast->language];
return $config;
}
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:7,代码来源:player_config.php
示例17: publication_query
/**
* Search for publications.
*
* @param array $args
* @return array
*/
private function publication_query($args = array())
{
$query = array('post_type' => 'seoslides-slideset', 'suppress_filters' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'post_date', 'posts_per_page' => 20);
$args['pagenum'] = isset($args['pagenum']) ? absint($args['pagenum']) : 1;
if (isset($args['s'])) {
$query['s'] = $args['s'];
}
$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ($args['pagenum'] - 1) : 0;
// Run the query
$get_posts = new WP_Query();
$posts = $get_posts->query($query);
$results = array();
if (0 === $get_posts->post_count) {
return $results;
}
// Populate results
foreach ($posts as $post) {
// Get the embed ID for the first slide in the presentation
$slideset = new SEOSlides_Slideset($post->ID);
/** @var SEOSlides_Embed $embed */
$embed = SEOSlides_Module_Provider::get('SEOSlides Embed');
$embed_id = $embed->get_embed_unique_id($post->ID, $slideset->first_slide()->slug);
$embed_url = $embed->get_embed_url($post->ID, $slideset->first_slide()->slug);
$shortcode = '[seoslides embed_id="' . $embed_id . '"';
$shortcode .= ' script_src="' . preg_replace('/\\/(slides|embeds)\\//', '/embed-script/', $embed_url) . '"';
$shortcode .= ' overview_src="' . get_permalink($post) . '"';
$shortcode .= ' title="' . get_the_title($post) . '"';
$shortcode .= ' site_src="' . get_home_url() . '"';
$shortcode .= ' site_title="' . get_bloginfo('name') . '"';
$shortcode .= ' /]';
$results[] = array('ID' => $post->ID, 'title' => trim(esc_html(strip_tags(get_the_title($post)))), 'shortcode' => esc_attr($shortcode), 'info' => mysql2date(__('Y/m/d'), $post->post_date));
}
return $results;
}
开发者ID:Neminath,项目名称:lastmile,代码行数:40,代码来源:SEOSlides_TinyMCE.php
示例18: jl_brd_dashboard_recent_drafts
function jl_brd_dashboard_recent_drafts($drafts = false)
{
if (!$drafts) {
$drafts_query = new WP_Query(array('post_type' => 'any', 'post_status' => array('draft', 'pending'), 'posts_per_page' => 150, 'orderby' => 'modified', 'order' => 'DESC'));
$drafts =& $drafts_query->posts;
}
if ($drafts && is_array($drafts)) {
$list = array();
foreach ($drafts as $draft) {
$url = get_edit_post_link($draft->ID);
$title = _draft_or_post_title($draft->ID);
$last_id = get_post_meta($draft->ID, '_edit_last', true);
$last_user = get_userdata($last_id);
$last_modified = '<i>' . esc_html($last_user->display_name) . '</i>';
$item = '<h4><a href="' . $url . '" title="' . sprintf(__('Edit ?%s?'), esc_attr($title)) . '">' . esc_html($title) . '</a>' . '<abbr> ' . $draft->post_status . ' ' . $draft->post_type . '</abbr>' . '<abbr style="display:block;margin-left:0;">' . sprintf(__('Last edited by %1$s on %2$s at %3$s'), $last_modified, mysql2date(get_option('date_format'), $draft->post_modified), mysql2date(get_option('time_format'), $draft->post_modified)) . '</abbr></h4>';
if ($the_content = preg_split('#\\s#', strip_shortcodes(strip_tags($draft->post_content), 11, PREG_SPLIT_NO_EMPTY))) {
$item .= '<p>' . join(' ', array_slice($the_content, 0, 10)) . (10 < count($the_content) ? '…' : '') . '</p>';
}
$list[] = $item;
}
?>
<ul>
<li><?php
echo join("</li>\n<li>", $list);
?>
</li>
</ul>
<?php
} else {
_e('There are no drafts at the moment');
}
}
开发者ID:aarontgrogg,项目名称:aarontgrogg,代码行数:32,代码来源:better-recent-drafts.php
示例19: get_related
public function get_related($id = '', $filter = array(), $context = 'view')
{
$option = get_option('sirp_options');
$num = !empty($filter['num']) ? (int) $filter['num'] : (int) $option['display_num'];
$ids = sirp_get_related_posts_id_api($num, $id);
$posts_list = array();
foreach ($ids as $id) {
$posts_list[] = get_post($id['ID']);
}
$response = new WP_JSON_Response();
if (!$posts_list) {
$response->set_data(array());
return $response;
}
$struct = array();
$response->header('Last-Modified', mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT');
foreach ($posts_list as $post) {
$post = get_object_vars($post);
if (!$this->check_read_permission($post)) {
continue;
}
$response->link_header('item', json_url('/posts/' . $post['ID']), array('title' => $post['post_title']));
$post_data = $this->prepare_post($post, $context);
if (is_wp_error($post_data)) {
continue;
}
$struct[] = $post_data;
}
$response->set_data($struct);
return $response;
}
开发者ID:Anawaz,项目名称:Simple-Related-Posts,代码行数:31,代码来源:wp-rest-api.php
示例20: ipad_html
function ipad_html($post)
{
global $ml_html_banners_enable;
$ml_html_banners_enable = get_option("ml_html_banners_enable");
$prefiltered_html = ml_filters_get_filtered($post->post_content);
$prefiltered_html = str_replace("\n", "<p></p>", $prefiltered_html);
$html = str_get_html($prefiltered_html);
$img_tags = $html->find('img');
$iframe_tags = $html->find('iframe');
$object_tags = $html->find('object');
$embed_tags = $html->find('embed');
$tags = array_merge($img_tags, $iframe_tags, $object_tags, $embed_tags);
$scripts = $html->find('script');
//on center, with specific width and no height
foreach ($tags as $e) {
//no width or height
if (isset($e->width)) {
$e->width = null;
}
if (isset($e->height)) {
$e->height = null;
}
$e->style = "max-width:520px;margin-top:20px;margin-bottom:20px;";
if ($e->tag == "iframe" || $e->tag == "object" || $e->tag == "embed") {
//should be a video
$e->width = 500;
$e->height = 300;
}
//center
$e->outertext = "<center><div class=\"wp2android_media\">" . $e->outertext . "</div></center><p></p>";
}
foreach ($scripts as $s) {
$s->outertext = "";
}
//JAVASCRIPT INCLUDES
//HEAD
$header = "<head>" . $header_js;
$header .= "<meta name=\"viewport\" content=\"width=device-width; minimum-scale=1.0; maximum-scale=1.0;\" />";
$header .= "<link rel=\"StyleSheet\" href=\"" . plugin_dir_url(__FILE__) . "css/ipad.css\" type=\"text/css\" media=\"screen\">";
$header .= "<link rel=\"StyleSheet\" href=\"" . plugin_dir_url(__FILE__) . "css/ipad_portrait.css\" type=\"text/css\" media=\"screen\" id=\"orient_css\">";
$header .= ml_filters_header($post->postID);
$header .= "</head>";
$init_html = "<html manifest=\"" . plugin_dir_url(__FILE__ + "../") . "manifest.php\">" . $header;
$title = "<h1 class='title' align='left'>" . $post->post_title . "</h1>";
$author = get_author_name($post->post_author);
$text_author = "";
if (strcmp($author, "admin") != 0) {
if (strcmp($author, "") != 0) {
$text_author = " • " . get_author_name($post->post_author);
}
}
if (get_post_type($post->ID) != "page") {
$title .= "<p class='details'>" . mysql2date('F j Y', $post->post_date) . "" . $text_author . "</p><p> </p>";
}
$final_html = $init_html;
$final_html .= "<body><div id=\"content\">";
$final_html .= $spaces;
$final_html .= $title . $html->save() . $spaces . "<br/><br/><br/><br/><br/><br/><br/><br/></div></body></html>";
return $final_html;
}
开发者ID:apppressers,项目名称:apppressers.github.io,代码行数:60,代码来源:html_ipad_html.php
注:本文中的mysql2date函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论