public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'taxonomy-list';
     }
     // If a taxonomy wasn't passed in, assume the first taxonomy associated with the post type.
     if (!isset($data['taxonomy'])) {
         $post_object_taxonomies = get_object_taxonomies($this->post_object);
         $this->taxonomy = array_shift($post_object_taxonomies);
     } else {
         $this->taxonomy = $data['taxonomy'];
     }
     $this->before_list = isset($data['before-list']) ? $data['before-list'] : '';
     $this->separator = isset($data['separator']) ? $data['separator'] : ', ';
     $this->after_list = isset($data['after-list']) ? $data['after-list'] : '';
     $this->include_links = isset($data['include-links']) ? $data['include-links'] : true;
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     if (true === $this->include_links) {
         $this->content = get_the_term_list($this->post_object->ID, $this->taxonomy, $this->before_list, $this->separator, $this->after_list);
     } else {
         $terms_arr = get_the_terms($this->post_object->ID, $this->taxonomy);
         $term_names_arr = array();
         if (!empty($terms_arr)) {
             foreach ($terms_arr as $term_obj) {
                 $term_names_arr[] = '<span class="name">' . $term_obj->name . '</span>';
             }
             $terms_list = implode($this->separator, $term_names_arr);
             $this->content = $this->before_list . $terms_list . $this->after_list;
         } else {
             $this->content = '';
         }
     }
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'backgroundVideo';
     }
     $this->tag = 'div';
     $this->vide_bg = array();
     if (!empty($data['mp4'])) {
         $this->vide_bg['mp4'] = $data['mp4'];
     }
     if (!empty($data['webm'])) {
         $this->vide_bg['webm'] = $data['webm'];
     }
     if (!empty($data['jpg'])) {
         $this->vide_bg['jpg'] = $data['jpg'];
     }
     // Set the vide bg.
     // Could probably check this closer if we need to, i.e., check and make sure we have a video file.
     if (!empty($this->vide_bg)) {
         $this->attributes['data-vide-bg'] = implode(', ', $this->vide_bg);
     }
     // Set the vide options.
     if (!empty($data['vide-options'])) {
         $this->vide_options = implode(', ', $data['vide-options']);
     } else {
         $this->vide_options = 'autoplay: true, posterType: jpg, loop: true, muted: true, position: left top';
     }
     $this->attributes['data-vide-options'] = $this->vide_options;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     $this->tag = 'div';
     if (!isset($data['address_data'])) {
         return;
     }
     $address_pieces = array();
     if (isset($data['address_data']['street_address']) && !empty($data['address_data']['street_address'])) {
         $address_pieces[] = '<span itemprop="streetAddress">' . $data['address_data']['street_address'] . '</span>';
     }
     if (isset($data['address_data']['city']) && !empty($data['address_data']['city'])) {
         $address_pieces[] = '<span itemprop="addressLocality">' . $data['address_data']['city'] . '</span>';
     }
     if (isset($data['address_data']['state']) && !empty($data['address_data']['state'])) {
         $address_pieces[] = ', <span itemprop="addressRegion">' . $data['address_data']['state'] . '</span>';
     }
     if (isset($data['address_data']['zip_code']) && !empty($data['address_data']['zip_code'])) {
         $address_pieces[] = ' <span itemprop="postalCode">' . $data['address_data']['zip_code'] . '</span>';
     }
     if (isset($data['address_data']['country']) && !empty($data['address_data']['country'])) {
         $address_pieces[] = ', <span itemprop="addressCountry">' . $data['address_data']['country'] . '</span>';
     }
     $address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">' . implode('', $address_pieces) . '</div>';
     $this->content = $address;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'posttitle';
     }
     $this->tag = isset($data['tag']) ? $data['tag'] : 'h2';
     $this->content = get_the_title($this->post_object);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'excerpt';
     }
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     $this->tag_type = 'false_without_content';
     $this->content = isset($this->post_object->post_excerpt) ? $this->post_object->post_excerpt : '';
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'email-share';
     }
     $this->tag = 'a';
     $this->attributes['href'] = $this->share_href($data);
     $this->attributes['target'] = $this->link_target($data);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'link';
     }
     $this->tag = 'a';
     if (isset($data['href'])) {
         $this->attributes['href'] = $data['href'];
     }
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'post-thumbnail';
     }
     $this->size = isset($data['size']) ? $data['size'] : 'post-thumbnail';
     $this->attr = isset($data['attr']) ? $data['attr'] : array();
     $this->tag = isset($data['tag']) ? $data['tag'] : 'div';
     $this->content = call_user_func('get_the_post_thumbnail', $this->post_object, $this->size, $this->attr);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'post-term-link-single';
     }
     $this->tag = 'a';
     $this->tag_type = 'false_without_content';
     $this->taxonomy = $data['taxonomy'];
     $this->get_term();
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'category-list';
     }
     $this->separator = isset($data['separator']) ? $data['separator'] : ', ';
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     $this->prefix = isset($data['prefix']) ? $data['prefix'] : '<strong>Categories:</strong> ';
     $this->suffix = isset($data['suffix']) ? $data['suffix'] : '';
     $this->content = $this->prefix . get_the_category_list($this->separator, '', $this->post_object) . $this->suffix;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     $this->name = 'postclass';
     $this->tag = isset($data['tag']) ? $data['tag'] : 'article';
     $this->tag_type = 'split';
     $classes = array();
     if (isset($data['attributes']['class'])) {
         $classes = $data['attributes']['class'];
     }
     $this->attributes['class'] = get_post_class($classes, $this->post_object->ID);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'post-author-link';
     }
     $author_id = $this->post_object->post_author;
     $author_name = get_the_author_meta('display_name', $author_id);
     $author_url = get_author_posts_url($author_id);
     $this->tag = 'a';
     $this->attributes['href'] = $author_url;
     $this->content = $author_name;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     $post_id = $this->post_object->ID;
     self::setEventFunctions($data);
     $this->event_start_date = call_user_func_array($this->event_functions['start_date_function'], $this->event_functions['date_function_arguments']);
     $this->event_end_date = call_user_func_array($this->event_functions['end_date_function'], $this->event_functions['date_function_arguments']);
     $this->event_all_day = call_user_func($this->event_functions['all_day_function'], $post_id);
     self::setDateType();
     self::setDateFormat();
     $this->content = $this->event_date_formatted;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'postdate';
     }
     $format = 'F j, Y';
     if (isset($data['date_format'])) {
         $format = $data['date_format'];
     }
     $this->prefix = isset($data['prefix']) ? $data['prefix'] : '<strong>Published:</strong> ';
     $this->suffix = isset($data['suffix']) ? $data['suffix'] : '';
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     $this->content = $this->prefix . get_the_date($format, $this->post_object) . $this->suffix;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if (empty($this->name)) {
         $this->name = 'comment-number';
     }
     $this->prefix = isset($data['prefix']) ? $data['prefix'] : '';
     $this->suffix = isset($data['suffix']) ? $data['suffix'] : '';
     $comment_count = 0;
     if (isset($this->post_object)) {
         $comment_count = get_comments_number($this->post_object->ID);
     }
     $this->tag = 'div';
     $this->content = $this->prefix . $comment_count . $this->suffix;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'post-author';
     }
     if (isset($data['post'])) {
         $author_id = $data['post']->post_author;
     }
     $this->tag = isset($data['tag']) ? $data['tag'] : 'p';
     $this->prefix = isset($data['prefix']) ? $data['prefix'] : 'By: ';
     $this->suffix = isset($data['suffix']) ? $data['suffix'] : '.';
     $author = get_the_author_meta('display_name', $author_id);
     $this->content = $this->prefix . $author . $this->suffix;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'loop';
     }
     if ('' === $this->tag) {
         $this->tag = 'div';
     }
     if (isset($data['array']) && isset($data['format'])) {
         foreach ($data['array'] as $loop_item) {
             $this->content .= vsprintf($data['format'], $loop_item);
         }
     }
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'site-title';
     }
     if (!isset($this->link_data['name'])) {
         $this->link_data['name'] = $this->name . '-link';
     }
     $this->link_data['content'] = get_bloginfo('site_title');
     $this->link = new FrontPageLink($this->link_data);
     $this->link->get_markup();
     $this->tag = isset($data['tag']) ? $data['tag'] : 'h2';
     $this->content = $this->link->markup;
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'menu';
     }
     $this->tag = isset($data['tag']) ? $data['tag'] : 'nav';
     if (isset($data['menu'])) {
         $this->menu = $data['menu'];
     } elseif (isset($data['menu-args']['menu'])) {
         $this->menu = $data['menu-args']['menu'];
     }
     $menu_args = ['menu' => $this->menu, 'echo' => false, 'container' => ''];
     if (isset($data['menu-args'])) {
         $menu_args = wp_parse_args($menu_args, $data['menu-args']);
     }
     $this->content = wp_nav_menu($menu_args);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' === $this->name) {
         $this->name = 'list-pages';
     }
     $this->tag = isset($data['tag']) ? $data['tag'] : 'ul';
     // Set up default list args.
     $list_args_defaults_arr = ['post_type' => 'page', 'echo' => 0, 'title_li' => ''];
     // Parse supplied args from the organism setup.
     if (isset($data['list_args'])) {
         $list_args_arr = wp_parse_args($data['list_args'], $list_args_defaults_arr);
     } else {
         $list_args_arr = $list_args_defaults_arr;
     }
     /**
      * list_pages_list_args.
      *
      * A generic filter for site-wide use.
      *
      * @since 0.5.0
      *
      * @param array $list_args_arr An array of list arguments.
      */
     $list_args_arr = apply_filters('list_pages_list_args', $list_args_arr);
     Atom::add_debug_entry('Filter', 'list_pages_list_args');
     /**
      * $this->name_list_pages_list_args.
      *
      * An atom-specific wp_list_categories args filter.
      *
      * @since 0.5.0
      *
      * @param array $list_args_arr An array of list arguments.
      */
     $list_args_arr_filter = $this->name . '_list_pages_list_args';
     $list_args_arr = apply_filters($list_args_arr_filter, $list_args_arr);
     Atom::add_debug_entry('Filter', $list_args_arr_filter);
     // Assign the resolved args to the object.
     $this->list_args = $list_args_arr;
     $this->content = wp_list_pages($this->list_args);
 }
 public function __construct($data)
 {
     parent::__construct($data);
     $this->name = '';
     if ('' == $this->name) {
         $this->name = 'content-source-link';
     }
     $this->name = 'content-source-link';
     $this->tag_type = 'false_without_content';
     // If there's a link, we can set the tag, href, and target.
     if (isset($data['href'])) {
         $this->tag = 'a';
         $this->attributes['href'] = site_url() . $data['href'];
         $this->attributes['target'] = '_blank';
     } else {
         $this->tag = 'div';
     }
     if (isset($data['type'])) {
         if ('h' === $data['type']) {
             $this->flag_type = 'Hardcoded';
             $this->attributes['class'][] = 'hardcoded';
         }
         if ('d' === $data['type']) {
             $this->flag_type = 'Dynamic';
             $this->attributes['class'][] = 'dynamic';
         }
         if ('e' === $data['type']) {
             $this->flag_type = 'Editable';
             $this->attributes['class'][] = 'editable';
         }
     }
     if (isset($data['parent'])) {
         $this->attributes['data-parent'] = $data['parent'];
     }
     $this->attributes['title'] = isset($data['title']) ? $data['title'] : '';
     $this->content = '<span class="content">' . $this->content . ':</span> <span class="type">' . $this->flag_type . '</span>';
 }
 public function __construct($data)
 {
     parent::__construct($data);
     if ('' == $this->name) {
         $this->name = 'image';
     }
     // wp_get_attachment_image gives us an image tag, so the atom passes its attributes on to that function.
     $this->tag_type = 'content-only';
     // Convert any classes to a string. We do this because the $attr variable of wp_get_attachment_image is set
     // to take a single-dimensional array, not a multi-dimensional array.
     if (isset($this->attributes['class']) && is_array($this->attributes['class']) && !empty($this->attributes['class'])) {
         $this->attributes['class'] = implode(' ', $this->attributes['class']);
     }
     // Set up attachment ID
     $this->attachment_id = '';
     if (isset($data['image_object']) && is_object($data['image_object'])) {
         $this->attachment_id = $data['image_object']->ID;
     }
     if (empty($this->attachment_id) && isset($data['image_object']) && is_array($data['image_object'])) {
         $this->attachment_id = $data['image_object']['ID'];
     }
     // Set up attachment ID if it isn't set yet. This gives us flexibility for ACF fields.
     if (empty($this->attachment_id) && isset($data['attachment_id'])) {
         $this->attachment_id = $data['attachment_id'];
     }
     // Set the image size
     $this->image_size = '';
     if (!empty($data['size'])) {
         $this->image_size = $data['size'];
     }
     // Set up icon argument
     $this->icon = false;
     if (!empty($data['icon'])) {
         $this->icon = $data['icon'];
     }
     // Attributes will have already been handled in the main AtomTemplate class.
 }