8889841cPKQ[4Ơ%%WordPressRouter.phpnu[originalBaseUrl = $this->router->getBaseUrl(); $this->router->setBaseUrl($this->router->getNetworkUrl()); } } public function unSetMultiSite() { if (is_multisite()) { $this->router->setBaseUrl($this->originalBaseUrl); } } }PKMb[5rGeneratorWordPressLoader.phpnu[options['0'] = n2_('All'); $terms = get_terms('post_tag'); if (count($terms)) { foreach ($terms as $term) { $this->options[$term->term_id] = '- ' . $term->name; } } } } PKMb[M6O0"Posts/Elements/PostsTaxonomies.phpnu[options['0'] = n2_('All'); $taxonomyNames = get_object_taxonomies($this->postType); if ($this->skip) { $skip = array( 'category', 'post_tag' ); } else { $skip = array(); } foreach ($taxonomyNames as $taxonomyName) { if (!in_array($taxonomyName, $skip)) { $terms = get_terms(array( 'taxonomy' => $taxonomyName )); if (count($terms)) { $taxonomy = get_taxonomy($taxonomyName); $options = array(); foreach ($terms as $term) { $options[$taxonomy->name . $this->postSeparator . $term->term_id] = '- ' . $term->name; } $this->optgroup[$taxonomy->label] = $options; } } } } /** * @param string $postType */ public function setPostType($postType) { $this->postType = $postType; } public function setPostSeparator($postSeparator) { $this->postSeparator = $postSeparator; } public function setSkip($skip) { $this->skip = $skip; } } PKMb[BJ~~$Posts/Elements/PostsCustomFields.phpnu[options['0'] = n2_('Nothing'); $metaKeys = $this->generate_meta_keys(); foreach ($metaKeys as $metaKey) { $this->options[$metaKey] = $metaKey; } } function generate_meta_keys() { global $wpdb; $query = "SELECT DISTINCT($wpdb->postmeta.meta_key) FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id WHERE $wpdb->posts.post_type = '%s' ORDER BY $wpdb->postmeta.meta_key ASC"; $meta_keys = $wpdb->get_col($wpdb->prepare($query, $this->postType)); return $meta_keys; } /** * @param string $postType */ public function setPostType($postType) { $this->postType = $postType; } }PKMb[cJ((Posts/Elements/PostsOptions.phpnu[options['0'] = n2_('Nothing'); foreach ($options as $option => $value) { $this->options[$option] = $option; } } }PKMb[NFQQ Posts/Elements/PostsMetaKeys.phpnu[options['0'] = n2_('Nothing'); $metaKeys = $this->generate_meta_keys(); foreach ($metaKeys as $metaKey) { $this->options[$metaKey] = $metaKey; } } function generate_meta_keys() { global $wpdb; $query = "SELECT DISTINCT($wpdb->postmeta.meta_key) FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id ORDER BY $wpdb->postmeta.meta_key ASC"; $meta_keys = $wpdb->get_results($query, ARRAY_A); $return = array(); foreach ($meta_keys as $num => $array) { if (!empty($array['meta_key'])) { $return[] = $array['meta_key']; } } return $return; } }PKMb[`a!Posts/Elements/PostsPostTypes.phpnu[options['0'] = n2_('All'); $postTypes = get_post_types(); foreach ($postTypes as $postType) { $this->options[$postType] = $postType; } } }PKMb[zRR"Posts/Elements/PostsCategories.phpnu[ 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false ); $categories = get_categories($args); $new = array(); foreach ($categories as $a) { $new[$a->category_parent][] = $a; } $list = array(); $options = $this->createTree($list, $new, 0); $this->options['0'] = n2_('All'); if (count($options)) { foreach ($options as $option) { $this->options[$option->cat_ID] = ' - ' . $option->treename; } } } } PKMb[d\\"Posts/Sources/PostsCustomPosts.phpnu[postType = $post_type; parent::__construct($group, $name, $label); } public function getPostType() { return $this->postType; } public function getDescription() { return sprintf(n2_('Creates slides from the following post type: %1$s.'), $this->postType); } private function checkKeywords($variable) { switch ($variable) { case 'current_date': $variable = current_time('mysql'); break; case 'current_date_timestamp': $variable = current_time('timestamp'); break; default: break; } return $variable; } public function renderFields($container) { $filterGroup = new ContainerTable($container, 'filter-group', n2_('Filter')); $filter = $filterGroup->createRow('filter'); new PostsTaxonomies($filter, 'taxonomies', n2_('Taxonomies'), 0, array( 'postType' => $this->postType, 'postSeparator' => '|*|' )); new Select($filter, 'taxonomies_relation', n2_('Relation'), 'OR', array( 'options' => array( 'OR' => 'OR', 'AND' => 'AND' ) )); $ids = $filterGroup->createRow('ids'); new Textarea($ids, 'ids', n2_('Post IDs to display'), '', array( 'width' => 150, 'height' => 150, 'tipLabel' => n2_('Post IDs to display'), 'tipDescription' => sprintf(n2_('You can make your generator display only the posts with the set ID. No other post will be fetched, even if they match the set filters. %1$s Write one ID per line.'), '
') )); new Textarea($ids, 'exclude_ids', n2_('Exclude posts'), '', array( 'width' => 150, 'height' => 150, 'tipLabel' => n2_('Exclude posts'), 'tipDescription' => sprintf(n2_('The selected post IDs won\'t appear in the generator, even if they they match the set filters. %1$s Write one ID per line.'), '
') )); $status = $filterGroup->createRow('status'); $statuses = get_post_stati(); $statuses += array( 'any' => 'any', 'unset' => 'unset', ); new Select($status, 'poststatus', n2_('Post status'), 'publish', array( 'options' => $statuses )); $postMetaGroup = $filterGroup->createRowGroup('postmetaGroup', n2_('Post meta comparison')); $postMeta = $postMetaGroup->createRow('postmeta'); new PostsCustomFields($postMeta, 'postmetakey', n2_('Field name'), 0, array( 'postType' => $this->postType, 'tipLabel' => n2_('Field name'), 'tipDescription' => n2_('Only show posts, where the given meta key is equal to the given meta value.'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1900-wordpress-custom-posts-generator#post-meta-comparison' )); new Select($postMeta, 'postmetacompare', n2_('Compare method'), '=', array( 'options' => array( '=' => '=', '!=' => '!=', '>' => '>', '>=' => '>=', '<' => '<', '<=' => '<=', 'LIKE' => 'LIKE', 'NOT LIKE' => 'NOT LIKE', 'IN' => 'IN', 'NOT IN' => 'NOT IN', 'BETWEEN' => 'BETWEEN', 'NOT BETWEEN' => 'NOT BETWEEN', 'REGEXP' => 'REGEXP', 'NOT REGEXP' => 'NOT REGEXP', 'RLIKE' => 'RLIKE', 'EXISTS' => 'EXISTS', 'NOT EXISTS' => 'NOT EXISTS' ) )); new Text($postMeta, 'postmetavalue', n2_('Field value')); new Select($postMeta, 'postmetatype', n2_('Field type'), 'CHAR', array( 'options' => array( 'CHAR' => 'CHAR', 'NUMERIC' => 'NUMERIC', 'DATE' => 'DATE', 'DATETIME' => 'DATETIME', 'TIME' => 'TIME', 'BINARY' => 'BINARY', 'DECIMAL' => 'DECIMAL', 'SIGNED' => 'SIGNED', 'UNSIGNED' => 'UNSIGNED' ) )); $postMetaMore = $filterGroup->createRow('postmeta-more'); new Textarea($postMetaMore, 'postmetakeymore', n2_('Meta comparison'), '', array( 'tipLabel' => n2_('Meta comparison'), 'tipDescription' => sprintf(n2_('You can create other comparisons based on the previous "Post Meta Comparison" options. Use the following format: name||compare||value||type%1$s%1$s Example:%1$spublished||=||yes||CHAR%1$s%1$sWrite one comparison per line.'), '
'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1900-wordpress-custom-posts-generator#post-meta-comparison', 'width' => 300, 'height' => 100 )); $option = $filterGroup->createRow('option'); new PostsOptions($option, 'postoption', n2_('Post option'), '0', array( 'tipLabel' => n2_('Post option'), 'tipDescription' => n2_('Posts can have options, like a post can be "sticky" or not. You can choose to only display posts, which are selected to be IN or NOT IN this option.') )); new Select($option, 'postoptionin', n2_('Post relationship with selected option'), '0', array( 'options' => array( 0 => 'IN', 1 => 'NOT IN' ) )); $dateGroup = $filterGroup->createRowGroup('dateGroup', n2_('Date configuration')); $date = $filterGroup->createRow('date'); new OnOff($date, 'identifydatetime', n2_('Identify datetime'), 0, array( 'tipLabel' => n2_('Identify datetime'), 'tipDescription' => n2_('Our system tries to identify the date and time in your variables.') )); new Text($date, 'datetimeformat', n2_('Datetime format'), 'm-d-Y H:i:s', array( 'tipLabel' => n2_('Datetime format'), 'tipDescription' => sprintf(n2_('You can use any %1$sPHP date format%2$s.'), '', '') )); new Textarea($date, 'translatedate', n2_('Translate dates'), "from||to\nMonday||Monday\njan||jan", array( 'tipLabel' => n2_('Translate dates'), 'tipDescription' => sprintf(n2_('Write one per line in the following format: from||to %1$s E.g.: Monday||Montag'), '
'), 'width' => 300, 'height' => 200 )); $replaceGroup = $filterGroup->createRowGroup('replaceGroup', n2_('Replace variables')); $variables = $filterGroup->createRow('variables'); new Text($variables, 'timestampvariables', n2_('Timestamp variables'), '', array( 'tipLabel' => n2_('Replace timestamp variables'), 'tipDescription' => sprintf(n2_('The "Datetime format" will be used to create dates from the given timestamp containing variables. %1$s Separate them with comma.'), '
') )); new Text($variables, 'filevariables', n2_('File variables'), '', array( 'tipLabel' => n2_('Replace file variables'), 'tipDescription' => sprintf(n2_('If you have IDs of files, you can replace those variables with the urls of the files instead. %1$s Separate them with comma.'), '
') )); new Text($variables, 'uniquevariable', n2_('Remove duplicate results'), '', array( 'tipLabel' => n2_('Remove duplicate results'), 'tipDescription' => n2_('You can remove results based on one variable\'s uniqueness. For example if you want the images to be unique, you could write the "image" variable into this field (without quotemarks).') )); $orderGroup = new ContainerTable($container, 'order-group', n2_('Order')); $order = $orderGroup->createRow('order'); new GeneratorOrder($order, 'postsorder', 'post_date|*|desc', array( 'options' => array( 'none' => n2_('None'), 'post_date' => n2_('Post date'), 'ID' => 'ID', 'title' => n2_('Title'), 'post_modified' => n2_('Modification date'), 'rand' => n2_('Random'), 'post__in' => n2_('Given IDs'), 'menu_order' => n2_('Menu order') ) )); $metaOrder = $orderGroup->createRow('meta-order'); new PostsCustomFields($metaOrder, 'meta_order_key', n2_('Custom field name'), 0, array( 'tipLabel' => n2_('Custom field name'), 'tipDescription' => n2_('If it\'s set, this will be used instead of the \'Field\' value.'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1900-wordpress-custom-posts-generator#custom-field-name', 'postType' => $this->postType )); new Radio($metaOrder, 'meta_orderby', n2_('Order'), 'meta_value_num', array( 'options' => array( 'meta_value_num' => n2_('Numeric'), 'meta_value' => n2_('Alphabetic') ) )); } protected function _getData($count, $startIndex) { global $post, $wp_query; $tmpPost = $post; $identifyDateTime = $this->data->get('identifydatetime', 0); if (has_filter('the_content', 'siteorigin_panels_filter_content')) { $siteorigin_panels_filter_content = true; remove_filter('the_content', 'siteorigin_panels_filter_content'); } else { $siteorigin_panels_filter_content = false; } $taxonomies = array_diff(explode('||', $this->data->get('taxonomies', '')), array( '', 0 )); if (count($taxonomies)) { $tax_array = array(); foreach ($taxonomies as $tax) { $parts = explode('|*|', $tax); if (!is_array(@$tax_array[$parts[0]]) || !in_array($parts[1], $tax_array[$parts[0]])) { $tax_array[$parts[0]][] = $parts[1]; } } $tax_query = array(); foreach ($tax_array as $taxonomy => $terms) { $tax_query[] = array( 'taxonomy' => $taxonomy, 'terms' => $terms, 'field' => 'id' ); } $tax_query['relation'] = $this->data->get('taxonomies_relation', 'OR'); } else { $tax_query = ''; } list($orderBy, $order) = Common::parse($this->data->get('postsorder', 'post_date|*|desc')); $compare = array(); $compare_value = $this->data->get('postmetacompare', ''); if (!empty($compare_value)) { $compare = array('compare' => $compare_value); } $postMetaKey = $this->data->get('postmetakey', '0'); if (!empty($postMetaKey)) { $postMetaValue = $this->data->get('postmetavalue', ''); $postMetaValue = $this->checkKeywords($postMetaValue); $getPostMeta = array( 'meta_query' => array( array( 'key' => $postMetaKey, 'type' => $this->data->get('postmetatype', 'CHAR') ) + $compare ) ); if ($compare_value != 'EXISTS' && $compare_value != 'NOT EXISTS') { $getPostMeta['meta_query'][0]['value'] = $postMetaValue; } } else { $getPostMeta = array(); } $metaMore = $this->data->get('postmetakeymore', ''); if (!empty($metaMore) && $metaMore != 'field_name||compare_method||field_value') { $metaMoreValues = explode(PHP_EOL, $metaMore); foreach ($metaMoreValues as $metaMoreValue) { $metaMoreValue = trim($metaMoreValue); if ($metaMoreValue != 'field_name||compare_method||field_value') { $metaMoreArray = explode('||', $metaMoreValue); if (count($metaMoreArray) >= 2) { $compare = array('compare' => $metaMoreArray[1]); $key_query = array( 'key' => $metaMoreArray[0] ); if (!empty($metaMoreArray[2])) { $key_query += array( 'value' => $this->checkKeywords($metaMoreArray[2]) ); } if (!empty($metaMoreArray[3])) { $key_query += array( 'type' => $metaMoreArray[3] ); } $getPostMeta['meta_query'][] = $key_query + $compare; } } } } $post_status = explode(",", $this->data->get('poststatus', 'publish')); $meta_order_key = $this->data->get('meta_order_key'); $meta_key = ''; if (!empty($meta_order_key)) { $orderBy = $this->data->get('meta_orderby', 'meta_value_num'); $meta_key = $meta_order_key; } $getPosts = array( 'include' => '', 'exclude' => '', 'meta_key' => $meta_key, 'meta_value' => '', 'post_type' => $this->postType, 'post_mime_type' => '', 'post_parent' => '', 'post_status' => $post_status, 'suppress_filters' => false, 'offset' => $startIndex, 'posts_per_page' => $count, 'tax_query' => $tax_query ); if ($orderBy != 'none') { $getPosts += array( 'orderby' => $orderBy, 'order' => $order, 'ignore_custom_sort' => true ); } $getPosts = array_merge($getPosts, $getPostMeta); $ids = array_diff($this->getIDs(), array(0)); if (count($ids) > 0) { $getPosts += array( 'post__in' => $ids ); } $exclude_ids = array_diff($this->getIDs('exclude_ids'), array(0)); if (count($exclude_ids) > 0) { $getPosts += array( 'post__not_in' => $exclude_ids ); } $post_option = $this->data->get('postoption', 0); if (!empty($post_option)) { $post_option_in = $this->data->get('postoptionin', 0); switch ($post_option_in) { case 0: $getPosts += array( 'post__in' => get_option($post_option) ); break; case 1: $getPosts += array( 'post__not_in' => get_option($post_option) ); break; } } $posts = get_posts($getPosts); $data = array(); $timestampVariables = array_map('trim', explode(',', $this->data->get('timestampvariables', ''))); $fileVariables = array_map('trim', explode(',', $this->data->get('filevariables', ''))); $datetimeformat = $this->data->get('datetimeformat', 'm-d-Y H:i:s'); for ($i = 0; $i < count($posts); $i++) { $record = array(); $post = $posts[$i]; setup_postdata($post); $wp_query->post = $post; $record['id'] = $post->ID; $record['url'] = get_permalink(); $record['title'] = apply_filters('the_title', get_the_title(), $post->ID); $record['content'] = get_the_content(); $record['description'] = GeneratorGroupPosts::removeShortcodes($record['content']); $record['author_name'] = $record['author'] = get_the_author(); $userID = get_the_author_meta('ID'); $record['author_url'] = get_author_posts_url($userID); $record['author_avatar'] = get_avatar_url($userID); if ($identifyDateTime) { $record['date'] = get_the_date('Y-m-d H:i:s'); $record['modified'] = get_the_modified_date('Y-m-d H:i:s'); } else { $record['date'] = get_the_date(); $record['modified'] = get_the_modified_date(); } $thumbnail_id = get_post_thumbnail_id($post->ID); $record['featured_image'] = wp_get_attachment_image_url($thumbnail_id, 'full'); if (!$record['featured_image']) { $record['featured_image'] = ''; } else { $thumbnail_meta = get_post_meta($thumbnail_id, '_wp_attachment_metadata', true); if (isset($thumbnail_meta['sizes'])) { $sizes = GeneratorGroupPosts::getImageSizes($thumbnail_id, $thumbnail_meta['sizes']); $record = array_merge($record, $sizes); } $record['alt'] = ''; $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (isset($alt)) { $record['alt'] = $alt; } } $record['thumbnail'] = $record['image'] = $record['featured_image']; $record['url_label'] = 'View'; $record = array_merge($record, GeneratorGroupPosts::extractPostMeta(get_post_meta($post->ID))); $taxonomies = get_post_taxonomies($post->ID); $args = array( 'orderby' => 'parent', 'order' => 'ASC', 'fields' => 'all' ); foreach ($taxonomies as $taxonomy) { $post_terms = wp_get_object_terms($post->ID, $taxonomy, $args); $taxonomy = str_replace('-', '', $taxonomy); for ($j = 0; $j < count($post_terms); $j++) { $record[$taxonomy . '_' . ($j + 1)] = $post_terms[$j]->name; $record[$taxonomy . '_' . ($j + 1) . '_ID'] = $post_terms[$j]->term_id; $record[$taxonomy . '_' . ($j + 1) . '_description'] = $post_terms[$j]->description; } } $record = array_merge($record, GeneratorGroupPosts::getACFData($post->ID)); if (isset($record['primarytermcategory'])) { $primary = get_category($record['primarytermcategory']); $record['primary_category_name'] = $primary->name; $record['primary_category_link'] = get_category_link($primary->cat_ID); } $record['excerpt'] = get_the_excerpt(); if (!empty($timestampVariables)) { foreach ($timestampVariables as $timestampVariable) { if (isset($record[$timestampVariable])) { $record[$timestampVariable] = date($datetimeformat, intval($record[$timestampVariable])); } } } if (!empty($fileVariables)) { foreach ($fileVariables as $fileVariable) { if (isset($record[$fileVariable])) { $record[$fileVariable] = wp_get_attachment_url($record[$fileVariable]); } } } $record = apply_filters('smartslider3_posts_customposts_data', $record); $data[$i] = &$record; unset($record); } $unique_variable = $this->data->get('uniquevariable', ''); if (!empty($unique_variable)) { $count = count($data); $unique_helper = array(); for ($i = 0; $i < $count; $i++) { if (!in_array($data[$i][$unique_variable], $unique_helper)) { $unique_helper[] = $data[$i][$unique_variable]; } else { unset($data[$i]); } } $data = array_values($data); } if ($siteorigin_panels_filter_content) { add_filter('the_content', 'siteorigin_panels_filter_content'); } $wp_query->post = $tmpPost; wp_reset_postdata(); if ($identifyDateTime) { $translate_dates = $this->data->get('translatedate', ''); $translateValue = explode(PHP_EOL, $translate_dates); $translate = array(); if (!empty($translateValue)) { foreach ($translateValue as $tv) { $translateArray = explode('||', $tv); if (!empty($translateArray) && count($translateArray) == 2) { $translate[$translateArray[0]] = $translateArray[1]; } } } for ($i = 0; $i < count($data); $i++) { foreach ($data[$i] as $key => $value) { if ($this->isDate($value)) { $data[$i][$key] = $this->translate($this->formatDate($value, $datetimeformat), $translate); } } } } return $data; } protected function isDate($value) { if (!$value) { return false; } else { $date = date_parse($value); if ($date['error_count'] == 0 && $date['warning_count'] == 0) { return checkdate($date['month'], $date['day'], $date['year']); } else { return false; } } } protected function formatDate($date, $format) { return date($format, strtotime($date)); } protected function translate($from, $translate) { if (!empty($translate) && !empty($from)) { foreach ($translate as $key => $value) { $from = str_replace($key, trim($value), $from); } } return $from; } } PKMb[?%Posts/Sources/PostsAllCustomPosts.phpnu[createRow('filter'); new Textarea($filter, 'ids', n2_('Post or Page IDs'), '', array( 'width' => 280, 'height' => 160, 'tipLabel' => n2_('Post or Page IDs'), 'tipDescription' => sprintf(n2_('You can write the ID of the page you want to show in your generator. %1$s Write one ID per line.'), '
') )); } protected function _getData($count, $startIndex) { global $post, $wp_query; $tmpPost = $post; if (has_filter('the_content', 'siteorigin_panels_filter_content')) { $siteorigin_panels_filter_content = true; remove_filter('the_content', 'siteorigin_panels_filter_content'); } else { $siteorigin_panels_filter_content = false; } $i = 0; $data = array(); foreach ($this->getIDs() as $id) { $record = array(); $post = get_post($id); if (!$post) continue; setup_postdata($post); $wp_query->post = $post; $record['id'] = $post->ID; $record['url'] = get_permalink(); $record['title'] = apply_filters('the_title', get_the_title(), $post->ID); $record['description'] = $record['content'] = GeneratorGroupPosts::removeShortcodes(get_the_content()); $record['author_name'] = $record['author'] = get_the_author(); $userID = get_the_author_meta('ID'); $record['author_url'] = get_author_posts_url($userID); $record['author_avatar'] = get_avatar_url($userID); $record['date'] = get_the_date(); $record['modified'] = get_the_modified_date(); $record = array_merge($record, GeneratorGroupPosts::getCategoryData($post->ID)); $thumbnail_id = get_post_thumbnail_id($post->ID); $record['featured_image'] = wp_get_attachment_image_url($thumbnail_id, 'full'); if (!$record['featured_image']) { $record['featured_image'] = ''; } else { $thumbnail_meta = get_post_meta($thumbnail_id, '_wp_attachment_metadata', true); if (isset($thumbnail_meta['sizes'])) { $sizes = GeneratorGroupPosts::getImageSizes($thumbnail_id, $thumbnail_meta['sizes']); $record = array_merge($record, $sizes); } $record['alt'] = ''; $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (isset($alt)) { $record['alt'] = $alt; } } $record['thumbnail'] = $record['image'] = $record['featured_image']; $record['url_label'] = 'View post'; $record = array_merge($record, GeneratorGroupPosts::getACFData($post->ID)); $record = array_merge($record, GeneratorGroupPosts::extractPostMeta(get_post_meta($post->ID))); if (isset($record['primarytermcategory'])) { $primary = get_category($record['primarytermcategory']); $record['primary_category_name'] = $primary->name; $record['primary_category_link'] = get_category_link($primary->cat_ID); } $record['excerpt'] = get_the_excerpt(); $record = apply_filters('smartslider3_posts_postsbyids_data', $record); $data[$i] = &$record; unset($record); $i++; } if ($siteorigin_panels_filter_content) { add_filter('the_content', 'siteorigin_panels_filter_content'); } $wp_query->post = $tmpPost; wp_reset_postdata(); return $data; } }PKMb[ΕEEPosts/Sources/PostsPosts.phpnu[createRow('filter'); new PostsCategories($filter, 'postscategory', n2_('Categories'), 0); new PostsTags($filter, 'posttags', n2_('Tags'), 0); new PostsTaxonomies($filter, 'postcustomtaxonomy', n2_('Taxonomies'), 0, array( 'postType' => 'post', 'skip' => true )); $posts = $filterGroup->createRow('posts'); new Filter($posts, 'poststicky', n2_('Sticky'), 0); new OnOff($posts, 'postshortcode', n2_('Remove shortcodes'), 1, array( 'relatedFieldsOn' => array( 'generatorpostshortcodevariables' ), 'tipLabel' => n2_('Remove shortcodes'), 'tipDescription' => n2_('You can remove shortcodes from variables to avoid 3rd party content rendering in your slider.') )); new Text($posts, 'postshortcodevariables', n2_('Remove from variables'), 'description, content, excerpt', array( 'tipLabel' => n2_('Remove from variables'), 'tipDescription' => n2_('Write the name of the variables you want to remove the shortcodes from. Separate new variables with a comma and space. E.g. description, content') )); $date = $filterGroup->createRow('date'); new Textarea($date, 'customdates', n2_('Custom date variables'), "variable||PHP date format\nmodified||Ymd\ndate||F j, Y, g:i a\nstarted||F\nended||D", array( 'tipLabel' => n2_('Custom date variables'), 'tipDescription' => sprintf(n2_('You can create custom date variables from your existing date variables. Write each variable to a new line and use the following format: variable||format. %3$s The "variable" should be an existing variable. Based on this existing variable, we create a new one with the "_datetime" suffix. (E.g. date_datetime.) %3$s The "format" can be any %1$sPHP date format%2$s.'), '', '', '
'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1891-wordpress---posts-generator', 'width' => 300, 'height' => 100 )); new Textarea($date, 'translatecustomdates', n2_('Translate custom dates'), "from||to\nMonday||Monday\njan||jan", array( 'tipLabel' => n2_('Translate custom dates'), 'tipDescription' => sprintf(n2_('You can translate the content of the newly created variables. %1$s Use the following format: from||to. Eg.: Monday||Montag'), '
'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1891-wordpress---posts-generator', 'width' => 300, 'height' => 100 )); new Select($date, 'datefunction', n2_('Date function'), 'date_i18n', array( 'tipLabel' => n2_('Date function'), 'tipDescription' => n2_('This function will be used to format these custom date variables. Usually the date_i18n works, but if your date will be off a little bit, then try out the other one.'), 'tipLink' => 'https://smartslider.helpscoutdocs.com/article/1891-wordpress---posts-generator', 'options' => array( 'date_i18n' => 'date_i18n', 'date' => 'date' ) )); $orderGroup = new ContainerTable($container, 'order-group', n2_('Order')); $order = $orderGroup->createRow('order'); new GeneratorOrder($order, 'postscategoryorder', 'post_date|*|desc', array( 'options' => array( 'none' => n2_('None'), 'post_date' => n2_('Post date'), 'ID' => 'ID', 'title' => n2_('Title'), 'post_modified' => n2_('Modification date'), 'rand' => n2_('Random'), 'comment_count' => n2_('Comment count'), 'menu_order' => n2_('Menu order') ) )); } private function translate($from, $translate) { if (!empty($translate) && !empty($from)) { foreach ($translate as $key => $value) { $from = str_replace($key, $value, $from); } } return $from; } private function linesToArray($lines) { $value = preg_split('/$\R?^/m', $lines); $data = array(); if (!empty($value)) { foreach ($value as $v) { $array = explode('||', $v); if (!empty($array) && count($array) == 2) { $data[$array[0]] = trim($array[1]); } } } return $data; } private function isTimeStamp($timestamp) { return ((string)(int)$timestamp === $timestamp) && ($timestamp <= PHP_INT_MAX) && ($timestamp >= ~PHP_INT_MAX); } public function getPostType() { return $this->postType; } public function filterName($name) { return $name . Translation::getCurrentLocale(); } function get_string_between($str, $startDelimiter, $endDelimiter) { $contents = array(); $startDelimiterLength = strlen($startDelimiter); $endDelimiterLength = strlen($endDelimiter); $startFrom = $contentStart = $contentEnd = 0; while (false !== ($contentStart = strpos($str, $startDelimiter, $startFrom))) { $contentStart += $startDelimiterLength; $contentEnd = strpos($str, $endDelimiter, $contentStart); if (false === $contentEnd) { break; } $contents[] = substr($str, $contentStart, $contentEnd - $contentStart); $startFrom = $contentEnd + $endDelimiterLength; } return $contents; } protected function _getData($count, $startIndex) { global $post, $wp_query; $tmpPost = $post; list($orderBy, $order) = Common::parse($this->data->get('postscategoryorder', 'post_date|*|desc')); $allTags = $this->data->get('posttags', ''); $tax_query = ''; if (!empty($allTags)) { $tags = explode('||', $allTags); if (!in_array('0', $tags)) { $tax_query = array( array( 'taxonomy' => 'post_tag', 'terms' => $tags, 'field' => 'id' ) ); } } $allTerms = $this->data->get('postcustomtaxonomy', ''); if (!empty($allTerms)) { $terms = explode('||', $allTerms); if (!in_array('0', $terms)) { $termarray = array(); foreach ($terms as $key => $value) { $term = explode("_x_", $value); if (array_key_exists($term[0], $termarray)) { $termarray[$term[0]][] = $term[1]; } else { $termarray[$term[0]] = array(); $termarray[$term[0]][] = $term[1]; } } $term_helper = array(); foreach ($termarray as $taxonomy => $termids) { $term_helper[] = array( 'taxonomy' => $taxonomy, 'terms' => $termids, 'field' => 'id' ); } if (!empty($tax_query)) { array_unshift($tax_query, array('relation' => 'AND')); } else { $tax_query = array('relation' => 'AND'); } $tax_query = array_merge($tax_query, $term_helper); } } $postsFilter = array( 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => false, 'offset' => $startIndex, 'posts_per_page' => $count, 'tax_query' => $tax_query ); if ($orderBy != 'none') { $postsFilter += array( 'orderby' => $orderBy, 'order' => $order, 'ignore_custom_sort' => true ); } $categories = (array)Common::parse($this->data->get('postscategory')); if (!in_array(0, $categories)) { $postsFilter['category'] = implode(',', $categories); } $poststicky = $this->data->get('poststicky'); switch ($poststicky) { case 1: $postsFilter += array( 'post__in' => get_option('sticky_posts') ); break; case -1: $postsFilter += array( 'post__not_in' => get_option('sticky_posts') ); break; } if (has_filter('the_content', 'siteorigin_panels_filter_content')) { $siteorigin_panels_filter_content = true; remove_filter('the_content', 'siteorigin_panels_filter_content'); } else { $siteorigin_panels_filter_content = false; } $posts = get_posts($postsFilter); $custom_dates = $this->linesToArray($this->data->get('customdates', '')); $translate = $this->linesToArray($this->data->get('translatecustomdates', '')); $date_function = $this->data->get('datefunction', 'date_i18n'); if ($this->data->get('postshortcode', 1)) { $remove_shortcode = array_map('trim', explode(',', $this->data->get('postshortcodevariables', 'description, content, excerpt'))); } else { $remove_shortcode = null; } $data = array(); for ($i = 0; $i < count($posts); $i++) { $record = array(); $post = $posts[$i]; setup_postdata($post); $wp_query->post = $post; $record['id'] = $post->ID; $record['url'] = get_permalink(); $record['title'] = apply_filters('the_title', get_the_title(), $post->ID); $record['content'] = get_the_content(); $record['description'] = $record['content']; if (class_exists('ET_Builder_Plugin')) { if (strpos($record['description'], 'et_pb_slide background_image') !== false) { $et_slides = $this->get_string_between($record['description'], 'et_pb_slide background_image="', '"'); for ($j = 0; $j < count($et_slides); $j++) { $record['et_slide' . $j] = $et_slides[$j]; } } if (strpos($record['description'], 'background_url') !== false) { $et_backgrounds = $this->get_string_between($record['description'], 'background_url="', '"'); for ($j = 0; $j < count($et_backgrounds); $j++) { $record['et_background' . $j] = $et_backgrounds[$j]; } } if (strpos($record['description'], 'logo_image_url') !== false) { $et_logoImages = $this->get_string_between($record['description'], 'logo_image_url="', '"'); for ($j = 0; $j < count($et_logoImages); $j++) { $record['et_logoImage' . $j] = $et_logoImages[$j]; } } if (strpos($record['description'], 'slider-content') !== false) { $et_contents = $this->get_string_between($record['description'], 'slider-content">', '

'); for ($j = 0; $j < count($et_contents); $j++) { $record['et_content' . $j] = $et_contents[$j]; } } } $record['slug'] = $post->post_name; $record['author_name'] = $record['author'] = get_the_author(); $userID = get_the_author_meta('ID'); $record['author_url'] = get_author_posts_url($userID); $record['author_avatar'] = get_avatar_url($userID); $record['date'] = get_the_date('Y-m-d H:i:s'); $record['modified'] = get_the_modified_date('Y-m-d H:i:s'); $record = array_merge($record, GeneratorGroupPosts::getCategoryData($post->ID)); $thumbnail_id = get_post_thumbnail_id($post->ID); $record['featured_image'] = wp_get_attachment_image_url($thumbnail_id, 'full'); if (!$record['featured_image']) { $record['featured_image'] = ''; } else { $thumbnail_meta = get_post_meta($thumbnail_id, '_wp_attachment_metadata', true); if (isset($thumbnail_meta['sizes'])) { $sizes = GeneratorGroupPosts::getImageSizes($thumbnail_id, $thumbnail_meta['sizes']); $record = array_merge($record, $sizes); } $record['alt'] = ''; $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (isset($alt)) { $record['alt'] = $alt; } } $record['thumbnail'] = $record['image'] = $record['featured_image']; $record['url_label'] = 'View post'; $tags = wp_get_post_tags($post->ID); for ($j = 0; $j < count($tags); $j++) { $record['tag_' . ($j + 1)] = $tags[$j]->name; } $record = array_merge($record, GeneratorGroupPosts::getACFData($post->ID)); $record = array_merge($record, GeneratorGroupPosts::extractPostMeta(get_post_meta($post->ID))); if (isset($record['primarytermcategory'])) { $primary = get_category($record['primarytermcategory']); $record['primary_category_name'] = $primary->name; $record['primary_category_link'] = get_category_link($primary->cat_ID); } $record['excerpt'] = get_the_excerpt(); $record['comment_count'] = $post->comment_count; $record['guid'] = $post->guid; if (!empty($custom_dates)) { foreach ($custom_dates as $custom_date_key => $custom_date_format) { if (array_key_exists($custom_date_key, $record)) { if ($this->isTimeStamp($record[$custom_date_key])) { $date = $record[$custom_date_key]; } else { $date = strtotime($record[$custom_date_key]); } if ($date_function == 'date_i18n') { $record[$custom_date_key . '_datetime'] = $this->translate(date_i18n($custom_date_format, $date), $translate); } else { $record[$custom_date_key . '_datetime'] = $this->translate(date($custom_date_format, $date), $translate); } } } } /** * We used 'Y-m-d H:i:s' date format, so we can get the hour, minute and second for custom date variables. * but we need to set the date and modified variables back to the WordPress default date_format. */ $record['date'] = get_the_date(); $record['modified'] = get_the_modified_date(); if (!empty($remove_shortcode)) { foreach ($remove_shortcode as $variable) { if (isset($record[$variable])) { $record[$variable] = GeneratorGroupPosts::removeShortcodes($record[$variable]); } } } $record = apply_filters('smartslider3_posts_posts_data', $record); $data[$i] = &$record; unset($record); } if ($siteorigin_panels_filter_content) { add_filter('the_content', 'siteorigin_panels_filter_content'); } $wp_query->post = $tmpPost; wp_reset_postdata(); return $data; } }PKMb[ $$Posts/GeneratorGroupPosts.phpnu[ $value) { if (is_array($value) || is_object($value)) { $datas = array_merge($datas, self::getElementorTextEditors($value)); } else { if (isset($array['widgetType'])) { self::$ElementorWidgetType = $array['widgetType']; } if ($key == 'editor' && self::$ElementorWidgetType == 'text-editor') { self::$ElementorCount++; $datas[$key . self::$ElementorCount] = $value; } } } return $datas; } public static function resetElementorHelpers() { self::$ElementorCount = 0; self::$ElementorWidgetType = ''; } public static function extractPostMeta($post_meta, $pre = '') { $record = array(); if (count($post_meta) && is_array($post_meta) && !empty($post_meta)) { $excluded_metas = array( 'hc-editor-mode', 'techline-sidebar' ); foreach ($excluded_metas as $excluded_meta) { if (isset($post_meta[$excluded_meta])) { unset($post_meta[$excluded_meta]); } } foreach ($post_meta as $key => $value) { if (count($value) && is_array($value) && !empty($value)) { foreach ($value as $v) { if (!empty($v) && !is_array($v) && !is_object($v)) { $key = str_replace(array( '_', '-' ), array( '', '' ), $key); $key = $pre . $key; if (array_key_exists($key, $record)) { $key = 'meta' . $key; } if (is_serialized($v)) { $unserialize_values = unserialize($v); $unserialize_count = 1; if (!empty($unserialize_values) && is_array($unserialize_values)) { foreach ($unserialize_values as $unserialize_value) { if (!empty($unserialize_value) && is_string($unserialize_value)) { $record['us_' . $key . $unserialize_count] = $unserialize_value; $unserialize_count++; } else if (is_array($unserialize_value)) { foreach ($unserialize_value as $u_v) { if (is_string($u_v)) { $record['us_' . $key . $unserialize_count] = $u_v; $unserialize_count++; } } } } } } else { $record[$key] = $v; } } } } } if (!empty($record['elementordata'])) { $elementordatas = json_decode($record['elementordata']); foreach ($elementordatas as $elementordata) { foreach (self::getElementorTextEditors($elementordata) as $elementorKey => $elementorVal) { $record[$elementorKey] = $elementorVal; } } } self::resetElementorHelpers(); } return $record; } public static function getACFData($postID, $pre = '') { $record = array(); if (class_exists('acf')) { $fields = get_fields($postID); if (is_array($fields) && !empty($fields) && count($fields)) { foreach ($fields as $k => $v) { $type = self::getACFType($k, $postID); $k = str_replace('-', '', $k); $k = $pre . $k; while (isset($record[$k])) { $k = 'acf_' . $k; } if (!is_array($v) && !is_object($v)) { if ($type['type'] == "image" && is_numeric($type["value"])) { $thumbnail_meta = wp_get_attachment_metadata($type["value"]); $src = wp_get_attachment_image_src($v, $thumbnail_meta['file']); $v = $src[0]; } $record[$k] = $v; } else if (!is_object($v)) { if (isset($v['url'])) { $record[$k] = $v['url']; } else if (is_array($v)) { foreach ($v as $v_v => $k_k) { if (is_array($k_k) && isset($k_k['url'])) { $record[$k . $v_v] = $k_k['url']; } } } } if ($type['type'] == "image" && (is_numeric($type["value"]) || is_array($type['value']))) { if (is_array($type['value'])) { $sizes = self::getImageSizes($type["value"]["id"], $type["value"]["sizes"], $k); } else { $thumbnail_meta = wp_get_attachment_metadata($type["value"]); $sizes = self::getImageSizes($type["value"], $thumbnail_meta['sizes'], $k); } $record = array_merge($record, $sizes); } } } } return $record; } public static function getACFType($key, $post_id) { $type = get_field_object($key, $post_id); return $type; } public static function getImageSizes($thumbnail_id, $sizes, $prefix = false) { $data = array(); if (!$prefix) { $prefix = ""; } else { $prefix = $prefix . "_"; } foreach ($sizes as $size => $image) { $imageSrc = wp_get_attachment_image_src($thumbnail_id, $size); $data[$prefix . 'image_' . self::clearSizeName($size)] = $imageSrc[0]; } return $data; } public static function clearSizeName($size) { return preg_replace("/-/", "_", $size); } public static function removeShortcodes($variable) { return preg_replace('#\[[^\]]+\]#', '', $variable); } public static function getCategoryData($postID) { $record = array(); $category = get_the_category($postID); if (isset($category[0])) { $record['category_name'] = $category[0]->name; $record['category_link'] = get_category_link($category[0]->cat_ID); $record['category_slug'] = $category[0]->slug; } else { $record['category_name'] = ''; $record['category_link'] = ''; $record['category_slug'] = ''; } $j = 0; if (is_array($category) && count($category) > 1) { foreach ($category as $cat) { $record['category_name_' . $j] = $cat->name; $record['category_link_' . $j] = get_category_link($cat->cat_ID); $record['category_slug_' . $j] = $cat->slug; $j++; } } else { $record['category_name_0'] = $record['category_name']; $record['category_link_0'] = $record['category_link']; $record['category_slug_0'] = $record['category_slug']; } return $record; } }PKQ[4Ơ%%WordPressRouter.phpnu[PKMb[5rhGeneratorWordPressLoader.phpnu[PKMb[5)vv%pPosts/Elements/PostsAllTaxonomies.phpnu[PKMb[#;U;Posts/Elements/PostsTags.phpnu[PKMb[M6O0"Posts/Elements/PostsTaxonomies.phpnu[PKMb[BJ~~$_Posts/Elements/PostsCustomFields.phpnu[PKMb[cJ((1Posts/Elements/PostsOptions.phpnu[PKMb[NFQQ Posts/Elements/PostsMetaKeys.phpnu[PKMb[`a!IPosts/Elements/PostsPostTypes.phpnu[PKMb[zRR"Posts/Elements/PostsCategories.phpnu[PKMb[d\\"\"Posts/Sources/PostsCustomPosts.phpnu[PKMb[?%RPosts/Sources/PostsAllCustomPosts.phpnu[PKMb[!Posts/Sources/PostsPostsByIDs.phpnu[PKMb[ΕEEPosts/Sources/PostsPosts.phpnu[PKMb[ $$Posts/GeneratorGroupPosts.phpnu[PK