/**
  * Renders the columns.
  *
  * @since 1.0.0
  * @param array $form 
  * @param string $column_name
  * @return string
  */
 public function column_default($form, $column_name)
 {
     switch ($column_name) {
         case 'id':
             $value = $form->ID;
             break;
         case 'shortcode':
             $value = '[wpforms id="' . $form->ID . '"]';
             break;
         case 'created':
             $value = get_the_date(get_option('date_format'), $form);
             break;
         case 'modified':
             $value = get_post_modified_time(get_option('date_format'), false, $form);
             break;
         case 'author':
             $author = get_userdata($form->post_author);
             $value = $author->display_name;
             break;
         case 'php':
             $value = '<code style="display:block;font-size:11px;">if( function_exists( \'wpforms_get\' ) ){ wpforms_get( ' . $form->ID . ' ); }</code>';
             break;
         default:
             $value = '';
     }
     return apply_filters('wpforms_overview_table_column_value', $value, $form, $column_name);
 }
 public function get_modified_date()
 {
     if (!$this->id) {
         return '';
     }
     return date_i18n(get_option('date_format'), get_post_modified_time('U', false, $this->id));
 }
	function get_the_modified_date($d = '') {
		if ( '' == $d )
			$the_time = get_post_modified_time(get_option('date_format'));
		else
			$the_time = get_post_modified_time($d);
		return apply_filters('get_the_modified_date', $the_time, $d);
	}
Example #4
0
 /**
  * Function to create sitemap.xml file in root directory
  *
  */
 public function create_sitemap($post_id, $post, $update)
 {
     // only create a site map if the post is new or no file exists
     if (wp_is_post_revision($post_id) || is_file($this->path())) {
         // return false;
     }
     $post_types = get_post_types(array('public' => true, 'publicly_queryable' => true));
     $nodes = array();
     $posts = \Timber::get_posts(array('numberposts' => -1, 'orderby' => array('type', 'modified'), 'post_type' => $post_types, 'order' => 'DESC', 'post_status' => 'publish'));
     foreach ($posts as &$post) {
         $nodes[] = array('loc' => $post->link, 'lastmod' => get_post_modified_time('c', false, $post), 'changefreq' => $this->get_post_change_frequency($post), 'priority' => $this->get_priority($post));
     }
     $taxonomies = get_taxonomies(array('public' => true, 'publicly_queryable' => true));
     $terms = \Timber::get_terms(array('taxonomy' => $taxonomies, 'hide_empty' => false));
     foreach ($terms as &$term) {
         $lastest_post = $term->get_post(array('numberposts' => 1));
         $nodes[] = array('loc' => get_term_link($term), 'lastmod' => get_post_modified_time('c', false, $lastest_post), 'changefreq' => $this->change_frequency, 'priority' => $this->get_priority($term));
     }
     $data = array('nodes' => $nodes);
     $sitemap = \Timber::compile('sitemap-xml.twig', $data);
     $path = $this->path();
     if ($fp = fopen($path, 'w')) {
         fwrite($fp, $sitemap);
         fclose($fp);
     }
 }
Example #5
0
 /**
  * Get things started
  *
  * @access public
  * @since 2.7
  * @return void/
  */
 public function __construct($sub_id)
 {
     global $ninja_forms_fields;
     // Bail if the sub doesn't exist.
     $sub = get_post($sub_id);
     if (!is_object($sub)) {
         return false;
     }
     // Set our sub id
     $this->sub_id = $sub_id;
     // Populate our fields
     $this->fields = array();
     $this->retrieve_fields();
     // Setup our form id var
     $this->form_id = $this->get_meta('_form_id');
     // Setup our action var
     $this->action = $this->get_meta('_action');
     // Setup our sequential id
     $this->seq_num = $this->get_meta('_seq_num');
     // Setup our user_id var
     $this->user_id = $sub->post_author;
     // Setup our date submitted var
     $this->date_submitted = get_the_time('Y-m-d G:i:s', $sub_id);
     // Setup our date modified var
     $this->date_modified = get_post_modified_time('Y-m-d G:i:s', false, $sub_id);
 }
Example #6
0
    public function widget($args, $instance)
    {
        query_posts(array('post_type' => 'resource', 'posts_per_page' => 10));
        ?>

                    <ul>
                    <?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                //Grab postmeta
                $post_meta = get_post_meta(get_the_ID());
                //print_r($post_meta); die();
                if ($post_meta[type][0] == 'External link') {
                    ?>

                    <li>
                    	<i class="fa fa-external-link" title="active"></i>
                        <h5><a href="<?php 
                    echo $post_meta[link_to_resource][0];
                    ?>
" target="_blank"><?php 
                    the_title();
                    ?>
</a></h5>
                        <p><span class="updated">Last updated <?php 
                    echo human_time_diff(get_post_modified_time('U', $post->ID), current_time('timestamp'));
                    ?>
 ago</span></p>
                    </li>
		    <?php 
                } else {
                    ?>

		    <li>
                    	<i class="fa fa-file" title="active"></i>
                        <h5><a href="<?php 
                    echo $post_meta[link_to_production_brief][0];
                    ?>
" target="_blank"><?php 
                    the_title();
                    ?>
</a></h5>
                        <p><span class="updated">Last updated <?php 
                    echo human_time_diff(get_post_modified_time('U', $post->ID), current_time('timestamp'));
                    ?>
 ago</span></p>
                    </li>
                    <?php 
                }
            }
            ?>

			</ul>

<?php 
        }
        wp_reset_query();
    }
Example #7
0
 function page_audit($new_status, $old_status, $post)
 {
     error_log("Test");
     if ($new_status == 'trash') {
         $uid = get_current_user_id();
         $post_id = $ip = $date = get_post_modified_time();
         error_log("uuid: {$uid}");
     }
 }
 public function listing_page__get_the_modified_date($the_date, $d = '')
 {
     if (!$this->listing_id) {
         return $the_date;
     }
     if (!$d) {
         $d = get_option('date_format');
     }
     //remove_filter( 'get_the_modified_date', array( &$this, 'listing_page__get_the_modified_date' ), 10, 2 );
     return get_post_modified_time($d, false, $this->listing_id, true);
 }
Example #9
0
 private function build_metadata()
 {
     $metadata = array('@context' => 'http://schema.org', '@type' => 'BlogPosting', 'mainEntityOfPage' => get_permalink($this->ID), 'headline' => get_the_title($this->ID), 'datePublished' => get_the_date('c', $this->ID), 'dateModified' => get_post_modified_time('c', false, $this->post), 'author' => array('@type' => 'Person', 'name' => $this->author->display_name), 'publisher' => array('@type' => 'Organization', 'name' => get_bloginfo('name')));
     $post_image_id = $this->get_post_image_id();
     if ($post_image_id) {
         $post_image = wp_get_attachment_image_src($post_image_id, 'full');
         if ($post_image) {
             $metadata['image'] = array('@type' => 'ImageObject', 'url' => $post_image[0], 'width' => $post_image[1], 'height' => $post_image[2]);
         }
     }
     return $metadata;
 }
Example #10
0
function RecentRevisions()
{
    global $wpdb;
    $widget_options = RecentRevisions_Options();
    $request = "SELECT {$wpdb->posts}.*, display_name as authorname " . "FROM {$wpdb->posts} LEFT JOIN {$wpdb->users} ON {$wpdb->posts}.post_author={$wpdb->users}.ID " . "WHERE (post_type='post' OR (post_type ='revision' AND post_name NOT LIKE '%-autosave')) " . "AND post_status IN('publish', 'inherit')";
    $request .= "ORDER BY post_modified_gmt DESC " . "LIMIT " . $widget_options['items'];
    $posts = $wpdb->get_results($request);
    // Use Date format of WP Preferences
    $date_format = get_option('date_format') . ' ' . get_option('time_format');
    if ($posts) {
        echo "\t\t\t\t<ul id='recent-revisions-list'>\n";
        foreach ($posts as $post) {
            $post_id = $post->post_type == 'post' ? $post->ID : $post->post_parent;
            //make the line
            $title = get_the_title($post_id);
            $post_meta = sprintf('%s', '<a href="post.php?post=' . $post_id . '&action=edit">' . ($title ? $title : __('(no title)')) . '</a> ');
            if ($widget_options['showauthor']) {
                $post_meta .= sprintf(__('by %s', 'recent-revisions'), '<strong>' . $post->authorname . '</strong> ');
            }
            if ($widget_options['showdatetime']) {
                //	$post_meta .= $post->post_modified_gmt;
                $post_meta .= sprintf(__('&#8212; %s', 'recent-revisions'), '' . get_post_modified_time($date_format, $widget_options['tz_gmt'], $post->ID, true));
                if ($widget_options['tz_gmt']) {
                    $post_meta .= ' GMT';
                }
            }
            if ($widget_options['showdiff']) {
                $request = "SELECT ID FROM {$wpdb->posts} WHERE post_type='revision' AND post_parent=" . $post_id . ' AND post_modified_gmt < "' . $post->post_modified_gmt . '" ORDER BY post_modified_gmt DESC LIMIT 1 ';
                $rev = $wpdb->get_row($request);
                if (is_null($rev)) {
                    // No previous revision found
                    $post_meta .= ' (' . __('new', 'recent-revisions') . ')';
                } else {
                    $prevId = $rev->ID;
                    $post_meta .= ' (<a href="revision.php?action=diff&post_type=page&right=' . $post->ID . '&left=' . $prevId . '">' . __('diff', 'recent-revisions') . '</a>)';
                }
            }
            //print it out
            ?>
<li class='post-meta'><?php 
            echo $post_meta;
            ?>
</li>
			<?php 
        }
        //end the line
        echo "</ul>\n";
        //but if you got no lines....
    } else {
        echo '<p>' . __("You don't have any revisions! Are revisions enabled in wp-config.php? Check that WP_POST_REVISIONS is true or >0. ", 'recent-revisions') . "</p>\n";
        //echo "<p> You don't have any revisions! Are revisions enabled in wp-config.php? Check that WP_POST_REVISIONS is true or >0. </p>\n";
    }
}
Example #11
0
 /**
  * Get all metadata for a post.
  *
  * @param \WP_Post $post The post.
  * @return array
  */
 public static function get_all_post_meta($post)
 {
     $tags = [['name' => 'description', 'content' => self::get_post_meta_description($post)], ['property' => 'og:locale', 'content' => get_locale()], ['property' => 'og:type', 'content' => 'article'], ['property' => 'og:title', 'content' => self::get_post_og_title($post)], ['property' => 'og:description', 'content' => self::get_post_og_description($post)], ['property' => 'og:url', 'content' => get_permalink($post->ID)], ['property' => 'og:site_name', 'content' => get_bloginfo('title')], ['property' => 'og:updated_time', 'content' => get_post_modified_time('c', true, $post)], ['name' => 'twitter:card', 'content' => self::get_twitter_card_type()], ['name' => 'twitter:title', 'content' => self::get_post_twitter_title($post)], ['name' => 'twitter:description', 'content' => self::get_post_twitter_description($post)]];
     $og_image = self::get_post_og_image($post);
     $twitter_image = self::get_post_twitter_image($post);
     if (!empty($og_image)) {
         $og_image_size = getimagesize($og_image);
         $tags = array_merge($tags, [['property' => 'og:image', 'content' => $og_image], ['property' => 'og:image:width', 'content' => $og_image_size[0]], ['property' => 'og:image:height', 'content' => $og_image_size[1]]]);
     }
     if (!empty($twitter_image)) {
         $twitter_image_size = getimagesize($twitter_image);
         $tags = array_merge($tags, [['name' => 'twitter:image', 'content' => $twitter_image], ['name' => 'twitter:image:width', 'content' => $twitter_image_size[0]], ['name' => 'twitter:image:height', 'content' => $twitter_image_size[1]]]);
     }
     $tags = array_merge($tags, Site::webmaster_tools());
     return ['title' => self::get_post_meta_title($post), 'tags' => $tags];
 }
 private function build_post_data()
 {
     $post_title = get_the_title($this->ID);
     $post_publish_timestamp = get_the_date('U', $this->ID);
     $post_modified_timestamp = get_post_modified_time('U', false, $this->post);
     $post_author = get_userdata($this->post->post_author);
     $this->add_data(array('post' => $this->post, 'post_id' => $this->ID, 'post_title' => $post_title, 'post_publish_timestamp' => $post_publish_timestamp, 'post_modified_timestamp' => $post_modified_timestamp, 'post_author' => $post_author));
     $metadata = array('@context' => 'http://schema.org', '@type' => 'BlogPosting', 'mainEntityOfPage' => $this->get('canonical_url'), 'publisher' => array('@type' => 'Organization', 'name' => $this->get('blog_name')), 'headline' => $post_title, 'datePublished' => date('c', $post_publish_timestamp), 'dateModified' => date('c', $post_modified_timestamp), 'author' => array('@type' => 'Person', 'name' => $post_author->display_name));
     $site_icon_url = $this->get('site_icon_url');
     if ($site_icon_url) {
         $metadata['publisher']['logo'] = array('@type' => 'ImageObject', 'url' => $site_icon_url, 'height' => self::SITE_ICON_SIZE, 'width' => self::SITE_ICON_SIZE);
     }
     $image_metadata = $this->get_post_image_metadata();
     if ($image_metadata) {
         $metadata['image'] = $image_metadata;
     }
     $this->add_data_by_key('metadata', apply_filters('amp_post_template_metadata', $metadata, $this->post));
 }
Example #13
0
function ubik_meta_date($format = '')
{
    // Get the time
    $published = get_post_time();
    $updated = get_post_modified_time();
    // Set the time zone offset
    $offset = (int) get_option('gmt_offset') * 60 * 60;
    if (empty($offset)) {
        $offset = 0;
    }
    // In case something goes horribly awry
    // Initialize variables
    $published_html = $updated_html = '';
    $published_class = 'published dt-published';
    // Microformats classes
    $updated_class = 'updated dt-updated';
    // No need to display updated when the timestamps are identical
    if ($published === $updated) {
        $updated = '';
    }
    // Grace period; allows for the used of the updated time instead of the published time when the difference is less than a specified time period (defaults to 3 hours)
    if (apply_filters('ubik_meta_date_grace_period', false) === true && !empty($updated)) {
        if ($updated - $published <= apply_filters('ubik_meta_date_grace_period_length', 10800)) {
            $published_class .= ' ' . $updated_class;
            $published = $updated;
            $updated = '';
        }
    }
    // Default format
    if (empty($format)) {
        $format = sprintf(_x('%1$s, %2$s', 'date, time', 'ubik'), get_option('date_format'), get_option('time_format'));
    }
    // Generate HTML output for both dates
    if (is_int($published)) {
        $published_display = apply_filters('ubik_meta_date_published', date($format, $published), $published);
        $published_html = '<time class="' . $published_class . '" itemprop="datePublished" datetime="' . date('c', $published - $offset) . '">' . $published_display . '</time>';
    }
    if (is_int($updated)) {
        $updated_display = apply_filters('ubik_meta_date_updated', date($format, $updated), $updated);
        $updated_html = '<time class="' . $updated_class . '" itemprop="dateModified" datetime="' . date('c', $updated - $offset) . '">' . $updated_display . '</time>';
    }
    // Populate the date array
    return apply_filters('ubik_meta_date', array('published' => apply_filters('ubik_meta_date_published_html', $published_html), 'updated' => apply_filters('ubik_meta_date_updated_html', $updated_html), 'published_raw' => $published, 'updated_raw' => $updated));
}
 /**
  * Retrieves page date the same way it is retrieved in native panel :
  * see /wp-admin/includes/class-wp-posts-list-table.php 
  */
 private static function get_page_modified($post)
 {
     global $mode;
     if ('0000-00-00 00:00:00' == $post->post_modified) {
         $t_time = $h_time = __('Unpublished');
         $time_diff = 0;
     } else {
         $t_time = get_post_modified_time(__('Y/m/d g:i:s A'), false, $post, true);
         $m_time = $post->post_modified;
         $time = get_post_modified_time('G', true, $post);
         $time_diff = time() - $time;
         if ($time_diff >= 0 && $time_diff < DAY_IN_SECONDS) {
             $h_time = sprintf(__('%s ago'), human_time_diff($time));
         } else {
             $h_time = mysql2date(__('Y/m/d'), $m_time);
         }
     }
     $page_date = '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, 'apm-last-modified', $mode) . '</abbr>';
     return $page_date;
 }
Example #15
0
/**
 * Retrieve the time at which the post was last modified.
 *
 * @since 2.0.0
 *
 * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
 * @return string
 */
function get_the_modified_time($d = '')
{
    if ('' == $d) {
        $the_time = get_post_modified_time(get_option('time_format'), null, null, true);
    } else {
        $the_time = get_post_modified_time($d, null, null, true);
    }
    return apply_filters('get_the_modified_time', $the_time, $d);
}
			<b><?php 
    self::_e('Latest Updates');
    ?>
</b> 
			<ul>
				<?php 
    foreach ($estimates->posts as $estimate_id) {
        ?>
					<li><a href="<?php 
        echo get_edit_post_link($estimate_id);
        ?>
"><?php 
        echo get_the_title($estimate_id);
        ?>
</a> &mdash; <?php 
        echo date_i18n(get_option('date_format'), get_post_modified_time('U', false, $estimate_id));
        ?>
</li>
				<?php 
    }
    ?>
			</ul>
		<?php 
} else {
    ?>
			<p>
				<b><?php 
    self::_e('Latest Updates');
    ?>
</b><br/>
				<?php 
 function check_sync()
 {
     // message
     if ($ids = acf_maybe_get($_GET, 'acfsynccomplete')) {
         // explode
         $ids = explode(',', $ids);
         $total = count($ids);
         if ($total == 1) {
             acf_add_admin_notice(sprintf(__('Field group synchronised. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>'));
         } else {
             acf_add_admin_notice(sprintf(_n('%s field group synchronised.', '%s field groups synchronised.', $total, 'acf'), $total));
         }
     }
     // vars
     $groups = acf_get_field_groups();
     // bail early if no field groups
     if (empty($groups)) {
         return;
     }
     // find JSON field groups which have not yet been imported
     foreach ($groups as $group) {
         // vars
         $local = acf_maybe_get($group, 'local', false);
         $modified = acf_maybe_get($group, 'modified', 0);
         $private = acf_maybe_get($group, 'private', false);
         // ignore DB / PHP / private field groups
         if ($local !== 'json' || $private) {
             // do nothing
         } elseif (!$group['ID']) {
             $this->sync[$group['key']] = $group;
         } elseif ($modified && $modified > get_post_modified_time('U', true, $group['ID'], true)) {
             $this->sync[$group['key']] = $group;
         }
     }
     // bail if no sync needed
     if (empty($this->sync)) {
         return;
     }
     // import field group
     if ($key = acf_maybe_get($_GET, 'acfsync')) {
         // disable JSON
         // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance
         acf_update_setting('json', false);
         // validate
         check_admin_referer('bulk-posts');
         // append fields
         if (acf_have_local_fields($key)) {
             $this->sync[$key]['fields'] = acf_get_local_fields($key);
         }
         // import
         $field_group = acf_import_field_group($this->sync[$key]);
         // redirect
         wp_redirect(admin_url($this->url . '&acfsynccomplete=' . $field_group['ID']));
         exit;
     } elseif (acf_maybe_get($_GET, 'action2') === 'acfsync') {
         // validate
         check_admin_referer('bulk-posts');
         // get ids
         $keys = acf_maybe_get($_GET, 'post');
         if (!empty($keys)) {
             // disable JSON
             // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance
             acf_update_setting('json', false);
             // vars
             $new_ids = array();
             foreach ($keys as $key) {
                 // append fields
                 if (acf_have_local_fields($key)) {
                     $this->sync[$key]['fields'] = acf_get_local_fields($key);
                 }
                 // import
                 $field_group = acf_import_field_group($this->sync[$key]);
                 // append
                 $new_ids[] = $field_group['ID'];
             }
             // redirect
             wp_redirect(admin_url($this->url . '&acfsynccomplete=' . implode(',', $new_ids)));
             exit;
         }
     }
     // filters
     add_filter('views_edit-acf-field-group', array($this, 'list_table_views'));
 }
Example #18
0
 static function get_the_field($parameters, $id = null)
 {
     $result = '';
     $field = $parameters['field'];
     if (!empty($parameters['id'])) {
         $id = $parameters['id'];
     }
     /*---------------------------------------------
      *
      * Option field
      *
      */
     if (!empty($parameters['option'])) {
         return self::get_option_field($field, $parameters['option']);
     }
     /*---------------------------------------------
      *
      * Attachment field
      *
      */
     if (!empty($parameters['type']) && $parameters['type'] == 'attachment' || CCS_Loop::$state['is_attachment_loop'] || CCS_Attached::$state['is_attachment_loop']) {
         return self::get_the_attachment_field($parameters);
         /*---------------------------------------------
          *
          * Array field
          *
          */
     } elseif (self::$state['is_array_field']) {
         $array = self::$state['current_field_value'];
         if (isset($array[$field])) {
             return $array[$field];
         } elseif ($field == 'value') {
             if (is_array($array)) {
                 $array = implode('', $array);
             }
             return $array;
         }
         // ACF gallery loop
     } elseif (class_exists('CCS_To_ACF') && CCS_To_ACF::$state['is_gallery_loop']) {
         return CCS_To_ACF::get_image_details_from_acf_gallery($parameters);
         /*---------------------------------------------
          *
          * Repeater or flexible content loop
          *
          */
     } elseif (empty($parameters['id']) && empty($parameters['name']) && class_exists('CCS_To_ACF') && CCS_To_ACF::$state['is_repeater_or_flex_loop']) {
         // If not inside relationship loop
         if (!CCS_To_ACF::$state['is_relationship_loop']) {
             // Get sub field
             if (function_exists('get_sub_field')) {
                 return get_sub_field($field);
             } else {
                 return null;
             }
         }
         /*---------------------------------------------
          *
          * Menu loop
          *
          */
     } elseif (CCS_Menu::$state['is_menu_loop']) {
         if (isset(CCS_Menu::$state['current_menu_object'][$field])) {
             return CCS_Menu::$state['current_menu_object'][$field];
         } else {
             if (!isset(CCS_Menu::$state['current_menu_object']['id'])) {
                 return;
             }
             // Get it from the post
             $id = CCS_Menu::$state['current_menu_object']['id'];
             CCS_Menu::$state['is_menu_loop'] = false;
             $result = do_shortcode('[field ' . $field . ' id=' . $id . ']');
             CCS_Menu::$state['is_menu_loop'] = true;
             return $result;
         }
     }
     if (!empty($id)) {
         $post_id = $id;
     } else {
         // Default
         $post_id = get_the_ID();
         /*      global $post;
               if (!empty($post)) {
                 $post_id = $post->ID;
               } */
     }
     if (empty($post_id)) {
         return null;
     }
     // No post ID
     $post = get_post($post_id);
     if (empty($post)) {
         return null;
     }
     // No post
     /*---------------------------------------------
      *
      * Prepare image attributes
      *
      */
     $image_fields = array('image', 'image-full', 'image-link', 'image-link-self', 'thumbnail', 'thumbnail-link', 'thumbnail-link-self', 'gallery');
     if ($field == 'thumbnail' && empty($parameters['size'])) {
         $parameters['size'] = 'thumbnail';
         // Default thumbnail
     }
     $attr = array();
     if (in_array($field, $image_fields)) {
         if (!empty($parameters['width']) || !empty($parameters['height'])) {
             $parameters['size'] = array((int) $parameters['width'], (int) $parameters['height']);
         }
         if (!empty($parameters['image_class'])) {
             $attr['class'] = $parameters['image_class'];
         }
         if (!empty($parameters['nopin'])) {
             $attr['nopin'] = $parameters['nopin'];
         }
         if (!empty($parameters['alt'])) {
             $attr['alt'] = $parameters['alt'];
         }
         //      if (!empty($parameters['title']))
         //        $attr['title'] = $parameters['title'];
     }
     // Custom field only?
     if (!empty($parameters['custom']) && $parameters['custom'] == 'true') {
         $custom = $field;
         $field = 'custom';
         // Skip predefined fields
     }
     /*---------------------------------------------
      *
      * Pre-defined fields
      *
      */
     switch ($field) {
         case 'id':
             $result = $post_id;
             break;
         case 'url':
             $result = get_permalink($post_id);
             break;
         case 'edit-url':
             $result = get_edit_post_link($post_id);
             break;
         case 'edit-link':
             $result = $post->post_title;
             break;
         case 'edit-link-self':
             $result = $post->post_title;
             break;
         case 'slug':
             $result = $post->post_name;
             break;
         case 'post-type':
             $result = $post->post_type;
             break;
         case 'post-type-name':
             $post_type = $post->post_type;
             $obj = get_post_type_object($post_type);
             $result = $obj->labels->singular_name;
             break;
         case 'post-type-plural':
             $post_type = $post->post_type;
             $obj = get_post_type_object($post_type);
             $result = $obj->labels->name;
             break;
         case 'post-status':
             $result = $post->post_status;
             if ($parameters['out'] !== 'slug') {
                 $result = ucwords($result);
             }
             break;
         case 'post-format':
             if (function_exists('get_post_format')) {
                 $result = get_post_format($post_id);
             }
             break;
         case 'post-format-name':
             if (function_exists('get_post_format')) {
                 $result = get_post_format($post_id);
                 $result = ucwords($result);
             }
             break;
         case 'post-format-link':
             if (function_exists('get_post_format')) {
                 $result = get_post_format($post_id);
                 $result = '<a href="' . get_post_format_link($result) . '">' . ucwords($result) . '</a>';
             }
             break;
         case 'post-format-url':
             if (function_exists('get_post_format')) {
                 $result = get_post_format_link(get_post_format($post_id));
             }
             break;
         case 'parent-id':
             $parent_id = isset($post->post_parent) ? $post->post_parent : 0;
             if (!empty($parent_id)) {
                 $result = $parent_id;
             }
             break;
         case 'parent-slug':
             $parent_id = isset($post->post_parent) ? $post->post_parent : 0;
             if (!empty($parent_id)) {
                 $post_data = get_post($parent_id);
                 if (!empty($post_data)) {
                     $result = isset($post_data->post_name) ? $post_data->post_name : '';
                 }
             }
             break;
         case 'link':
         case 'title-link':
         case 'title-link-out':
         case 'title':
             $result = $post->post_title;
             break;
         case 'author':
             $author_id = $post->post_author;
             $user = get_user_by('id', $author_id);
             if (!empty($parameters['meta'])) {
                 $result = get_the_author_meta($parameters['meta'], $author_id);
             } elseif (!empty($user)) {
                 $result = $user->display_name;
             }
             break;
         case 'author-id':
             $result = $post->post_author;
             break;
         case 'author-url':
             $result = get_author_posts_url($post->post_author);
             break;
         case 'author-login':
             $author_id = $post->post_author;
             $result = do_shortcode('[users id=' . $author_id . '][user name][/users]');
             break;
         case 'avatar':
             if (!empty($parameters['size'])) {
                 $result = get_avatar($post->post_author, $parameters['size']);
             } else {
                 $result = get_avatar($post->post_author);
             }
             break;
         case 'date':
             if (!empty($parameters['date_format'])) {
                 if ($parameters['date_format'] == 'relative') {
                     $result = CCS_Format::get_relative_date($post->post_date);
                 } else {
                     $result = mysql2date($parameters['date_format'], $post->post_date);
                 }
             } else {
                 // Default date format under Settings -> General
                 $result = mysql2date(get_option('date_format'), $post->post_date);
             }
             break;
         case 'modified':
             if (!empty($parameters['date_format'])) {
                 $result = get_post_modified_time($parameters['date_format'], $gmt = false, $post_id, $translate = true);
             } else {
                 // Default date format under Settings -> General
                 $result = get_post_modified_time(get_option('date_format'), $gmt = false, $post_id, $translate = true);
             }
             break;
         case 'image-full':
             $parameters['size'] = 'full';
         case 'image':
             // image
         // image
         case 'image-link':
             // image with link to post
         // image with link to post
         case 'image-link-self':
             // image with link to attachment page
             $parameters['size'] = isset($parameters['size']) && !empty($parameters['size']) ? $parameters['size'] : 'full';
             if (empty($attr['alt'])) {
                 $attr['alt'] = self::wp_get_featured_image_field($post_id, 'alt');
             }
             $result = get_the_post_thumbnail($post_id, $parameters['size'], $attr);
             break;
         case 'image-url':
             $parameters['size'] = isset($parameters['size']) && !empty($parameters['size']) ? $parameters['size'] : 'full';
             $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $parameters['size']);
             $result = $src['0'];
             // $result = wp_get_attachment_url(get_post_thumbnail_id($post_id));
             break;
         case 'image-title':
         case 'image-caption':
         case 'image-alt':
         case 'image-description':
             $image_field_name = substr($field, 6);
             // Remove "image-"
             $result = self::wp_get_featured_image_field($post_id, $image_field_name);
             break;
         case 'thumbnail':
             // thumbnail
         // thumbnail
         case 'thumbnail-link':
             // thumbnail with link to post
         // thumbnail with link to post
         case 'thumbnail-link-self':
             // thumbnail with link to attachment page
             $parameters['size'] = isset($parameters['size']) && !empty($parameters['size']) ? $parameters['size'] : 'thumbnail';
             if (empty($attr['alt'])) {
                 $attr['alt'] = self::wp_get_featured_image_field($post_id, 'alt');
             }
             $result = get_the_post_thumbnail($post_id, $parameters['size'], $attr);
             break;
         case 'thumbnail-url':
             $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'thumbnail');
             $result = $src['0'];
             break;
         case 'tags':
             $result = implode(' ', wp_get_post_tags($post_id, array('fields' => 'names')));
             break;
         case 'gallery':
             // Get specific image from gallery field
             if (class_exists('CCS_Gallery_Field')) {
                 // Check if gallery field is enabled
                 $attachment_ids = CCS_Gallery_Field::get_image_ids($post_id);
                 if (empty($parameters['num'])) {
                     $parameters['num'] = 1;
                 }
                 if (empty($parameters['size'])) {
                     $parameters['size'] = 'full';
                 }
                 $result = wp_get_attachment_image($attachment_ids[$parameters['num'] - 1], $parameters['size'], $icon = false, $attr);
             }
             break;
         case 'excerpt':
             // Get excerpt
             //        $result = get_the_excerpt();
             $result = $post->post_excerpt;
             if (empty($result)) {
                 // If empty, get it from post content
                 $result = $post->post_content;
                 if (empty($parameters['words']) && empty($parameters['length'])) {
                     self::$parameters['words'] = 25;
                 }
             }
             break;
         case 'debug':
             ob_start();
             echo '<pre>';
             print_r(get_post_custom($post_id));
             echo '</pre>';
             if (function_exists('acf_get_fields_by_id')) {
                 echo '<pre>';
                 print_r(acf_get_fields_by_id($post_id));
                 echo '</pre>';
             }
             $result = ob_get_clean();
             break;
         case 'loop-count':
             $result = CCS_Loop::$state['loop_count'];
             break;
         default:
             /*---------------------------------------------
              *
              * Custom field
              *
              */
             if (!empty($parameters['custom']) && $parameters['custom'] == 'true') {
                 $field = $custom;
             }
             $result = get_post_meta($post_id, $field, true);
             if (is_numeric($result) && !empty($parameters['return'])) {
                 if ($parameters['return'] == 'page-link') {
                     // ACF page link: get URL from post ID
                     $result = get_permalink($result);
                 } else {
                     // Get attachment field
                     $parameters['id'] = $result;
                     $parameters['field'] = $parameters['return'];
                     $result = self::get_the_attachment_field($parameters);
                 }
             } elseif (!empty($parameters['property']) && is_object($result)) {
                 $result = self::get_object_property($result, $parameters['property']);
             } elseif (!empty($parameters['currency']) || !empty($parameters['decimals']) || !empty($parameters['point']) || !empty($parameters['thousands'])) {
                 $currency = !empty($parameters['currency']) ? $parameters['currency'] : '';
                 $decimals = !empty($parameters['decimals']) ? $parameters['decimals'] : 2;
                 $point = !empty($parameters['point']) ? $parameters['point'] : '.';
                 $thousands = !empty($parameters['thousands']) ? $parameters['thousands'] : ',';
                 $result = CCS_Format::getCurrency($result, $currency, $decimals, $point, $thousands);
             }
             break;
     }
     return $result;
 }
Example #19
0
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php 
$query_args = array('post_type' => array('post', 'page', 'front-matter', 'part', 'chapter', 'back-matter'), 'post_status' => 'publish', 'orderby' => 'date', 'posts_per_page' => 50000);
query_posts($query_args);
if (have_posts()) {
    while (have_posts()) {
        the_post();
        // Skip example pages
        if ('page' == $post->post_type && 'sample-page' == $post->post_name) {
            continue;
        } elseif ('page' == $post->post_type && 'access-denied' == $post->post_name) {
            continue;
        } elseif ('post' == $post->post_type && 'hello-world' == $post->post_name) {
            continue;
        }
        ?>
		<url>
			<loc><?php 
        echo get_permalink($post->ID);
        ?>
</loc>
			<lastmod><?php 
        echo mysql2date('Y-m-d', get_post_modified_time('Y-m-d H:i:s', true), false);
        ?>
</lastmod>
		</url>
	<?php 
    }
}
?>
</urlset>
Example #20
0
function acf_write_json_field_group($field_group)
{
    // vars
    $path = acf_get_setting('save_json');
    $file = $field_group['key'] . '.json';
    // remove trailing slash
    $path = untrailingslashit($path);
    // bail early if dir does not exist
    if (!is_writable($path)) {
        return false;
    }
    // prepare for export
    $id = acf_extract_var($field_group, 'ID');
    $field_group = acf_prepare_field_group_for_export($field_group);
    // add modified time
    $field_group['modified'] = get_post_modified_time('U', true, $id, true);
    // write file
    $f = fopen("{$path}/{$file}", 'w');
    fwrite($f, acf_json_encode($field_group));
    fclose($f);
    // return
    return true;
}
 /**
  * Produce the column values for the custom columns we created
  */
 function action_manage_posts_custom_column($column_name, $ticket_id)
 {
     switch ($column_name) {
         case 'updated':
             $modified_gmt = get_post_modified_time('U', true, $ticket_id);
             echo sprintf(__('%s ago', 'supportflow'), human_time_diff($modified_gmt));
             break;
         case 'sf_excerpt':
             $replies = SupportFlow()->get_ticket_replies($ticket_id, array('posts_per_page' => 1, 'order' => 'ASC'));
             if (!isset($replies[0])) {
                 echo '—';
                 break;
             }
             $first_reply = $replies[0]->post_content;
             if (strlen($first_reply) > 50) {
                 $first_reply = substr($first_reply, 0, 50);
             }
             echo $first_reply;
             break;
         case 'customers':
             $customers = SupportFlow()->get_ticket_customers($ticket_id, array('fields' => 'emails'));
             if (empty($customers)) {
                 echo '—';
                 break;
             }
             foreach ($customers as $key => $customer_email) {
                 $args = array(SupportFlow()->customers_tax => SupportFlow()->get_email_hash($customer_email), 'post_type' => SupportFlow()->post_type);
                 $customer_photo = get_avatar($customer_email, 16);
                 $customer_link = '<a class="customer_link" href="' . esc_url(add_query_arg($args, admin_url('edit.php'))) . '">' . $customer_email . '</a>';
                 $customers[$key] = $customer_photo . '&nbsp;' . $customer_link;
             }
             echo implode('<br />', $customers);
             break;
         case 'status':
             $post_status = get_post_status($ticket_id);
             $args = array('post_type' => SupportFlow()->post_type, 'post_status' => $post_status);
             $status_name = get_post_status_object($post_status)->label;
             $filter_link = add_query_arg($args, admin_url('edit.php'));
             echo '<a href="' . esc_url($filter_link) . '">' . esc_html($status_name) . '</a>';
             break;
         case 'email':
             $email_account_id = get_post_meta($ticket_id, 'email_account', true);
             $email_accounts = SupportFlow()->extend->email_accounts->get_email_accounts();
             $args = array('post_type' => SupportFlow()->post_type, 'email_account' => $email_account_id);
             if (!isset($email_accounts[$email_account_id])) {
                 echo '—';
                 break;
             }
             $email_account_username = $email_accounts[$email_account_id]['username'];
             $filter_link = add_query_arg($args, admin_url('edit.php'));
             echo '<a href="' . esc_url($filter_link) . '">' . esc_html($email_account_username) . '</a>';
             break;
         case 'sf_replies':
             $replies = SupportFlow()->get_ticket_replies_count($ticket_id);
             echo '<div class="post-com-count-wrapper">';
             echo "<span class='replies-count'>{$replies}</span>";
             echo '</div>';
             break;
         case 'created':
             $created_time = get_the_time(get_option('time_format') . ' T', $ticket_id);
             $created_date = get_the_time(get_option('date_format'), $ticket_id);
             echo sprintf(__('%s<br />%s', 'supportflow'), $created_time, $created_date);
             break;
     }
 }
Example #22
0
/** Only include this file if a database upgrade is called for.
 *  Otherwise it can be safely ignored. */
function ec3_upgrade_posts()
{
    if (!function_exists('__ngettext')) {
        function __ngettext($single, $plural, $number, $domain = 'default')
        {
            if ($number == 1) {
                return __($single, $domain);
            } else {
                return __($plural, $domain);
            }
        }
    }
    global $ec3, $post, $wpdb;
    $ec3->advanced = false;
    $changed = ec3_upgrade_posts_apply();
    $query =& new WP_Query();
    $query->query('nopaging=1&cat=' . $ec3->event_category);
    $format = 'Y-m-d H:i:s';
    $now = time();
    $rownum = 0;
    ?>

  <?php 
    if ($changed) {
        ?>

   <div id="message" class="updated fade"><p><strong>
   <?php 
        $msg = __ngettext('Post upgraded.', '%d posts upgraded.', $changed, 'ec3');
        echo sprintf($msg, $changed);
        ?>
   </strong></p></div>

  <?php 
    }
    ?>

  <div class="wrap">
  <form method="post">
  <h2><?php 
    _e('Upgrade Event Posts (from version 3.0)', 'ec3');
    ?>
</h2>

  <?php 
    if ($query->have_posts()) {
        ?>

  <input type="hidden" name="ec3_action" value="upgrade_posts" />
  <table class="widefat">

        <thead>
        <tr>
           <th scope="col">OK</th>
           <th scope="col">Title</th>
           <th scope="col">Post date</th>
           <th scope="col">Event date</th>
        </tr>
        </thead>

   <?php 
        while ($query->have_posts()) {
            $query->the_post();
            ?>

     <?php 
            if (empty($post->ec3_schedule)) {
                $post_date = get_post_time();
                $post_modified_date = get_post_modified_time();
                $rownum++;
                if ($rownum % 2) {
                    $rowclass = 'alternate ';
                } else {
                    $rowclass = '';
                }
                if ($post_modified_date >= $now) {
                    $errstyle = 'background-color:#fcc';
                } else {
                    $errstyle = '';
                }
                ?>

       <tr class="<?php 
                echo $rowclass;
                ?>
">
          <td>
           <input type="checkbox" name="ec3_upgrade_<?php 
                the_ID();
                ?>
"
            value="1" checked="checked" />
          </td>
          <td title="Post ID: <?php 
                the_ID();
                ?>
">
           <a target="_blank" href="<?php 
                the_permalink();
                ?>
">
            <?php 
                the_title();
                ?>
           </a>
          </td>
          <td>
           <input type="text" name="ec3_postdate_<?php 
                the_ID();
                ?>
"
            style="<?php 
                echo $errstyle;
                ?>
"
            value="<?php 
                echo date($format, $post_modified_date);
                ?>
" />
          </td>
          <td>
           <input type="text" name="ec3_eventdate_<?php 
                the_ID();
                ?>
"
            value="<?php 
                echo date($format, $post_date);
                ?>
" />
          </td>
       </tr>

     <?php 
            }
            ?>
   <?php 
        }
        ?>
   <?php 
        if ($rownum == 0) {
            ?>

       <tr><td>No posts to upgrade.</td></tr>

   <?php 
        }
        ?>

  </table>

  <p class="submit">

    <?php 
        if ($rownum > 0) {
            ?>

       <input type="submit" name="ec3_upgrade_posts"
        value="<?php 
            _e('Upgrade Event Posts', 'ec3');
            ?>
" />
       <input type="submit" name="ec3_cancel_upgrade"
        value="<?php 
            _e("Don't Upgrade Posts");
            ?>
" />

    <?php 
        } else {
            update_option('ec3_upgrade_posts', 0);
            ?>

       <input type="submit" name="ec3_cancel_upgrade"
        value="<?php 
            _e('OK');
            ?>
 &raquo;" />

    <?php 
        }
        ?>

  </p>

  <?php 
    }
    ?>

  </form>
  </div>

<?php 
}
Example #23
0
 /**
  * Process conditionals for posts.
  *
  * @since 2.2.0
  */
 function process_conditionals()
 {
     if (empty($this->params)) {
         return;
     }
     if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
         return;
     }
     switch ($this->params[0]) {
         case $this->ENTRY_PATH:
             global $post;
             $post = wp_get_single_post($this->params[1]);
             $wp_last_modified = get_post_modified_time('D, d M Y H:i:s', true);
             $post = NULL;
             break;
         case $this->ENTRIES_PATH:
             $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0) . ' GMT';
             break;
         default:
             return;
     }
     $wp_etag = md5($wp_last_modified);
     @header("Last-Modified: {$wp_last_modified}");
     @header("ETag: {$wp_etag}");
     // Support for Conditional GET
     if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
         $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
     } else {
         $client_etag = false;
     }
     $client_last_modified = trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
     // If string is empty, return 0. If not, attempt to parse into a timestamp
     $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
     // Make a timestamp for our most recent modification...
     $wp_modified_timestamp = strtotime($wp_last_modified);
     if ($client_last_modified && $client_etag ? $client_modified_timestamp >= $wp_modified_timestamp && $client_etag == $wp_etag : $client_modified_timestamp >= $wp_modified_timestamp || $client_etag == $wp_etag) {
         status_header(304);
         exit;
     }
 }
Example #24
0
 /**
  * @internal
  * @param  string $time_format
  * @return string
  */
 function get_modified_time($time_format = '')
 {
     $tf = $time_format ? $time_format : get_option('time_format');
     $the_time = get_post_modified_time($tf, false, $this->ID, true);
     return apply_filters('get_the_modified_time', $the_time, $time_format);
 }
Example #25
0
/**
 * Retrieve the time at which the post was last modified.
 *
 * @since 2.0.0
 *
 * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
 * @return string
 */
function get_the_modified_time($d = '')
{
    if ('' == $d) {
        $the_time = get_post_modified_time(get_option('time_format'), null, null, true);
    } else {
        $the_time = get_post_modified_time($d, null, null, true);
    }
    /**
     * Filter the localized time a post was last modified.
     *
     * @since 2.0.0
     *
     * @param string $the_time The formatted time.
     * @param string $d        Format to use for retrieving the time the post was
     *                         written. Accepts 'G', 'U', or php date format. Defaults
     *                         to value specified in 'time_format' option.
     */
    return apply_filters('get_the_modified_time', $the_time, $d);
}
Example #26
0
 public function Sync_post($select, $where, $refguid, $limit)
 {
     global $wp, $wpdb;
     $where .= " AND {$wpdb->posts}.ID < " . $refguid;
     $querystr = $select . $where . " ORDER BY {$wpdb->posts}.ID ASC LIMIT " . $limit;
     $posts_list = $wpdb->get_results($querystr);
     error_log("Sync - " . $querystr);
     $struct = array();
     if (!$posts_list) {
         return $struct;
     }
     foreach ($posts_list as $post) {
         //error_log("post id ".$post['ID']);
         $post = get_object_vars($post);
         // Do we have permission to read this post?
         if (!json_check_post_permission($post, 'read')) {
             continue;
         }
         $post_data["guid"] = $post['ID'];
         $post_data["title"] = $post['post_title'];
         $post_data["description"] = strip_tags($post['post_content']);
         $authorid = get_the_author_id($post);
         $post_data["iconurl"] = get_avatar_url($authorid);
         //$post_data["icontime"] = $post['post_title'];
         $post_data["time"] = get_post_modified_time('U', false, $post, false);
         if (is_wp_error($post_data)) {
             continue;
         }
         //error_log("ajaay".serialize($post));
         $struct[] = $post_data;
     }
     return $struct;
 }
 function Prepare($ID = null)
 {
     //if (isset($this->PackageData['formatted'])) return $this;
     if ($ID == null) {
         $ID = $this->ID;
     }
     $vars = get_post($ID, ARRAY_A);
     $vars['title'] = stripcslashes($vars['post_title']);
     $vars['description'] = stripcslashes($vars['post_content']);
     $vars['description'] = wpautop(stripslashes($vars['description']));
     $vars['description'] = do_shortcode(stripslashes($vars['description']));
     $vars['excerpt'] = stripcslashes(strip_tags($vars['post_excerpt']));
     //Featured Image
     $src = wp_get_attachment_image_src(get_post_thumbnail_id($vars['ID']), 'full', false, '');
     $vars['preview'] = $src['0'];
     $vars['create_date'] = date_i18n(get_option('date_format'), strtotime(get_the_date(get_option('date_format'), $ID)));
     $vars['update_date'] = get_post_modified_time(get_option('date_format'), false, $ID, true);
     $vars['categories'] = get_the_term_list($vars['ID'], 'wpdmcategory', '', ', ', '');
     $data = self::metaData($vars['ID']);
     $vars = array_merge($vars, $data);
     $vars['files'] = get_post_meta($vars['ID'], '__wpdm_files', true);
     $vars['file_count'] = count($vars['files']);
     $vars['file_list'] = '';
     $vars['play_list'] = $vars['file_list'];
     $vars['play_button'] = '';
     $vars['file_list_extended'] = '';
     $vars['link_label'] = isset($vars['link_label']) ? $vars['link_label'] : __('Download', 'wpdmpro');
     $vars['page_link'] = "<a href='" . get_permalink($vars['ID']) . "'>{$vars['title']}</a>";
     $vars['page_url'] = get_permalink($vars['ID']);
     if (!isset($vars['btnclass'])) {
         $vars['btnclass'] = '[btnclass]';
     }
     $tags = get_the_tags($vars['ID']);
     $taghtml = "";
     if (is_array($tags)) {
         foreach ($tags as $tag) {
             $taghtml .= "<a class='btn btn-default btn-xs' style='margin:0 5px 5px 0' href=\"" . get_tag_link($tag->term_id) . "\"><i class='fa fa-tag'></i> &nbsp; " . $tag->name . "</a> &nbsp;";
         }
     }
     $vars['tags'] = $taghtml;
     if (count($vars['files']) > 1) {
         $vars['file_ext'] = 'zip';
     }
     if (is_array($vars['files']) && count($vars['files']) == 1) {
         $tmpdata = explode(".", $vars['files'][0]);
         $vars['file_ext'] = end($tmpdata);
     }
     $vars['file_size'] = self::Size($vars['ID']);
     $vars['audio_player'] = $vars['file_list'];
     $vars['audio_player_single'] = self::audioPlayer($vars, true);
     if (!isset($vars['icon']) || $vars['icon'] == '') {
         if (is_array($vars['files'])) {
             $ifn = @end($vars['files']);
             $ifn = @explode('.', $ifn);
             $ifn = @end($ifn);
         } else {
             $ifn = '_blank';
         }
         $vars['icon'] = '<img class="wpdm_icon" src="' . plugins_url('download-manager/assets/file-type-icons/') . (@count($vars['files']) <= 1 ? $ifn : 'zip') . '.png" onError=\'this.src="' . plugins_url('download-manager/assets/file-type-icons/_blank.png') . '";\' />';
     } else {
         if (!strpos($vars['icon'], '://')) {
             $vars['icon'] = '<img class="wpdm_icon"   src="' . plugins_url(str_replace('download-manager/file-type-icons/', 'download-manager/assets/file-type-icons/', $vars['icon'])) . '" />';
         } else {
             if (!strpos($vars['icon'], ">")) {
                 $vars['icon'] = '<img class="wpdm_icon"   src="' . str_replace('download-manager/file-type-icons/', 'download-manager/assets/file-type-icons/', $vars['icon']) . '" />';
             }
         }
     }
     if (isset($vars['preview']) && $vars['preview'] != '') {
         $vars['thumb'] = "<img title='' src='" . wpdm_dynamic_thumb($vars['preview'], array(400, 300)) . "'/>";
     } else {
         $vars['thumb'] = $vars['thumb_page'] = $vars['thumb_gallery'] = $vars['thumb_widget'] = "";
     }
     $k = 1;
     $vars['additional_previews'] = isset($vars['more_previews']) ? $vars['more_previews'] : array();
     $img = "<img id='more_previews_{$k}' title='' class='more_previews' src='" . wpdm_dynamic_thumb($vars['preview'], array(575, 170)) . "'/>\n";
     $tmb = "<a href='#more_previews_{$k}' class='spt'><img title='' src='" . wpdm_dynamic_thumb($vars['preview'], array(100, 45)) . "'/></a>\n";
     global $blog_id;
     if (defined('MULTISITE')) {
         $vars['thumb'] = str_replace(home_url('/files'), ABSPATH . 'wp-content/blogs.dir/' . $blog_id . '/files', $vars['thumb']);
     }
     $vars['link_label'] = apply_filters('wpdm_button_image', $vars['link_label'], $vars);
     $vars['link_label'] = $vars['link_label'] ? $vars['link_label'] : __('Download', 'wpdmpro');
     $vars['download_url'] = self::getDownloadURL($vars['ID'], '');
     $vars['download_link_popup'] = $vars['download_link_extended'] = $vars['download_link'] = "<a class='wpdm-download-link wpdm-download-locked {$vars['btnclass']}' rel='nofollow' href='#' onclick=\"location.href='{$vars['download_url']}';return false;\">{$vars['link_label']}</a>";
     if (self::userDownloadLimitExceeded($vars['ID'])) {
         $vars['download_url'] = '#';
         $vars['link_label'] = __('Download Limit Exceeded', 'wpdmpro');
         $vars['download_link_popup'] = $vars['download_link_extended'] = $vars['download_link'] = "<div class='alert alert-warning'><b>" . __('Download:', 'wpdmpro') . "</b><br/>{$vars['link_label']}</div>";
     } else {
         if (isset($vars['expire_date']) && $vars['expire_date'] != "" && strtotime($vars['expire_date']) < time()) {
             $vars['download_url'] = '#';
             $vars['link_label'] = __('Download was expired on', 'wpdmpro') . " " . date_i18n(get_option('date_format') . " h:i A", strtotime($vars['expire_date']));
             $vars['download_link'] = $vars['download_link_extended'] = $vars['download_link_popup'] = "<div class='alert alert-warning'><b>" . __('Download:', 'wpdmpro') . "</b><br/>{$vars['link_label']}</div>";
         } else {
             if (isset($vars['publish_date']) && $vars['publish_date'] != '' && strtotime($vars['publish_date']) > time()) {
                 $vars['download_url'] = '#';
                 $vars['link_label'] = __('Download will be available from ', 'wpdmpro') . " " . date_i18n(get_option('date_format') . " h:i A", strtotime($vars['publish_date']));
                 $vars['download_link'] = $vars['download_link_extended'] = "<div class='alert alert-warning'><b>" . __('Download:', 'wpdmpro') . "</b><br/>{$vars['link_label']}</div>";
             } else {
                 if (is_user_logged_in() && !self::userCanAccess($vars['ID'])) {
                     $vars['download_url'] = '#';
                     $vars['link_label'] = stripslashes(get_option('wpdm_permission_msg'));
                     $vars['download_link'] = $vars['download_link_extended'] = $vars['download_link_popup'] = "<div class='alert alert-danger'><b>" . __('Download:', 'wpdmpro') . "</b><br/>{$vars['link_label']}</div>";
                 } else {
                     if (!is_user_logged_in() && count(self::AllowedRoles($vars['ID'])) > 0 && !self::userCanAccess($vars['ID'])) {
                         $loginform = wpdm_login_form(array('redirect' => get_permalink($vars['ID'])));
                         if (get_option('_wpdm_hide_all', 0) == 1) {
                             return 'loginform';
                         }
                         $vars['download_url'] = home_url('/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
                         $vars['download_link'] = $vars['download_link_extended'] = stripcslashes(str_replace(array("[loginform]", "[this_url]"), array($loginform, get_permalink($vars['ID'])), get_option('wpdm_login_msg')));
                         $vars['download_link'] = $vars['download_link_extended'] = $vars['download_link_popup'] = get_option('__wpdm_login_form', 0) == 1 ? $loginform : $vars['download_link'];
                     } else {
                         if (self::isLocked($vars)) {
                             $vars['download_url'] = '#';
                             $vars['download_link'] = self::activeLocks($vars);
                             $vars['download_link_extended'] = self::activeLocks($vars, array('embed' => 1));
                             $vars['download_link_popup'] = self::activeLocks($vars, array('popstyle' => 'popup'));
                         }
                     }
                 }
             }
         }
     }
     //        if (!isset($vars['download_link_called'])) {
     //            $tmpvar = self::downloadLink($vars['ID'], 0, array('btnclass' => '[btnclass]')); //DownloadLink($vars, 0, array('btnclass' => '[btnclass]'));
     //            $tmpvar1 = self::downloadLink($vars['ID'], 1); //DownloadLink($vars, 1);
     //            $vars['download_link'] = $tmpvar;
     //            $vars['download_link_extended'] = $tmpvar1;
     //            $vars['download_link_called'] = 1;
     //        }
     if (!isset($vars['formatted'])) {
         $vars['formatted'] = 0;
     }
     ++$vars['formatted'];
     $vars = apply_filters('wpdm_after_prepare_package_data', $vars);
     $this->PackageData = $vars;
     foreach ($vars as $key => $val) {
         $this->{$key} = $val;
     }
     return $this;
 }
Example #28
0
                        ?>
" /><?php 
                    }
                    ?>
</th>
		<?php 
                    break;
                case 'modified':
                case 'date':
                    if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) {
                        $t_time = $h_time = __('Unpublished');
                    } else {
                        if ('modified' == $column_name) {
                            $t_time = get_the_modified_time(__('Y/m/d g:i:s A'));
                            $m_time = $post->post_modified;
                            $time = get_post_modified_time('G', true);
                        } else {
                            $t_time = get_the_time(__('Y/m/d g:i:s A'));
                            $m_time = $post->post_date;
                            $time = get_post_time('G', true);
                        }
                        if (abs(time() - $time) < 86400) {
                            if ('future' == $post->post_status) {
                                $h_time = sprintf(__('%s from now'), human_time_diff($time));
                            } else {
                                $h_time = sprintf(__('%s ago'), human_time_diff($time));
                            }
                        } else {
                            $h_time = mysql2date(__('Y/m/d'), $m_time);
                        }
                    }
Example #29
0
    the_title_rss();
    ?>
]]></title>
		<link rel="alternate" type="<?php 
    bloginfo_rss('html_type');
    ?>
" href="<?php 
    the_permalink_rss();
    ?>
" />
		<id><?php 
    the_guid();
    ?>
</id>
		<updated><?php 
    echo get_post_modified_time('Y-m-d\\TH:i:s\\Z', true);
    ?>
</updated>
		<published><?php 
    echo get_post_time('Y-m-d\\TH:i:s\\Z', true);
    ?>
</published>
		<?php 
    the_category_rss('atom');
    ?>
		<summary type="<?php 
    html_type_rss();
    ?>
"><![CDATA[<?php 
    the_excerpt_rss();
    ?>
 function column_default($post, $column_name)
 {
     switch ($column_name) {
         case 'id':
             return $post->ID;
         case 'post_title':
             // Will never happen, class method overrides.
             return $post->post_title;
         case 'snippet':
             return wp_trim_words($post->post_content, 55);
         case 'date':
             // Will never happen, class method overrides.
             $d = get_option('date_format');
             $t = get_option('time_format');
             return get_post_modified_time($d, 0, $post, 1) . ' @ ' . get_post_modified_time($t, 0, $post, 1);
         default:
             return print_r($post, true);
     }
 }