How to use generate method of in class

Best Atoum code snippet using in.generate

post-meta.php

Source:post-meta.php Github

copy

Full Screen

...8if (! defined('ABSPATH')) {9 exit; // Exit if accessed directly.10}1112if (! function_exists('generate_content_nav')) {13 /**14 * Display navigation to next/previous pages when applicable.15 *16 * @since 0.117 *18 * @param string $nav_id The id of our navigation.19 */20 function generate_content_nav($nav_id)21 {22 if (! apply_filters('generate_show_post_navigation', true)) {23 return;24 }2526 global $wp_query, $post;2728 // Don't print empty markup on single pages if there's nowhere to navigate.29 if (is_single()) {30 $previous = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', true);31 $next = get_adjacent_post(false, '', false);3233 if (! $next && ! $previous) {34 return;35 }36 }3738 // Don't print empty markup in archives if there's only one page.39 if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {40 return;41 }4243 $nav_class = (is_single()) ? 'post-navigation' : 'paging-navigation'; ?>44 <nav id="<?php echo esc_attr($nav_id); ?>" class="<?php echo esc_attr($nav_class); ?>">45 <span class="screen-reader-text"><?php esc_html_e('Post navigation', 'generatepress'); ?></span>4647 <?php if (is_single()) : // navigation links for single posts.4849 $post_navigation_args = apply_filters('generate_post_navigation_args', array(50 'previous_format' => '<div class="nav-previous">' . generate_get_svg_icon('arrow') . '<span class="prev" title="' . esc_attr__('Previous', 'generatepress') . '">%link</span></div>',51 'next_format' => '<div class="nav-next">' . generate_get_svg_icon('arrow') . '<span class="next" title="' . esc_attr__('Next', 'generatepress') . '">%link</span></div>',52 'link' => '%title',53 'in_same_term' => apply_filters('generate_category_post_navigation', false),54 'excluded_terms' => '',55 'taxonomy' => 'category',56 ));5758 previous_post_link(59 $post_navigation_args['previous_format'],60 $post_navigation_args['link'],61 $post_navigation_args['in_same_term'],62 $post_navigation_args['excluded_terms'],63 $post_navigation_args['taxonomy']64 );6566 next_post_link(67 $post_navigation_args['next_format'],68 $post_navigation_args['link'],69 $post_navigation_args['in_same_term'],70 $post_navigation_args['excluded_terms'],71 $post_navigation_args['taxonomy']72 ); elseif (is_home() || is_archive() || is_search()) : // navigation links for home, archive, and search pages.7374 if (get_next_posts_link()) : ?>75 <div class="nav-previous">76 <?php generate_do_svg_icon('arrow'); ?>77 <span class="prev" title="<?php esc_attr_e('Previous', 'generatepress'); ?>"><?php next_posts_link(__('Older posts', 'generatepress')); ?></span>78 </div>79 <?php endif;8081 if (get_previous_posts_link()) : ?>82 <div class="nav-next">83 <?php generate_do_svg_icon('arrow'); ?>84 <span class="next" title="<?php esc_attr_e('Next', 'generatepress'); ?>"><?php previous_posts_link(__('Newer posts', 'generatepress')); ?></span>85 </div>86 <?php endif;8788 if (function_exists('the_posts_pagination')) {89 the_posts_pagination(array(90 'mid_size' => apply_filters('generate_pagination_mid_size', 1),91 'prev_text' => apply_filters('generate_previous_link_text', __('&larr; Previous', 'generatepress')),92 'next_text' => apply_filters('generate_next_link_text', __('Next &rarr;', 'generatepress')),93 ));94 }9596 /**97 * generate_paging_navigation hook.98 *99 * @since 0.1100 */101 do_action('generate_paging_navigation');102103 endif; ?>104 </nav><!-- #<?php echo esc_html($nav_id); ?> -->105 <?php106 }107}108109if (! function_exists('generate_modify_posts_pagination_template')) {110 add_filter('navigation_markup_template', 'generate_modify_posts_pagination_template', 10, 2);111 /**112 * Remove the container and screen reader text from the_posts_pagination()113 * We add this in ourselves in generate_content_nav()114 *115 * @since 1.3.45116 *117 * @param string $template The default template.118 * @param string $class The class passed by the calling function.119 * @return string The HTML for the post navigation.120 */121 function generate_modify_posts_pagination_template($template, $class)122 {123 if (! empty($class) && false !== strpos($class, 'pagination')) {124 $template = '<div class="nav-links">%3$s</div>';125 }126127 return $template;128 }129}130131/**132 * Output requested post meta.133 *134 * @since 2.3135 *136 * @param string $item The post meta item we're requesting137 * @return The requested HTML.138 */139function generate_do_post_meta_item($item)140{141 if ('date' === $item) {142 $date = apply_filters('generate_post_date', true);143144 $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';145146 if (get_the_time('U') !== get_the_modified_time('U')) {147 $time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>' . $time_string;148 }149150 $time_string = sprintf(151 $time_string,152 esc_attr(get_the_date('c')),153 esc_html(get_the_date()),154 esc_attr(get_the_modified_date('c')),155 esc_html(get_the_modified_date())156 );157158 // If our date is enabled, show it.159 if ($date) {160 echo apply_filters(161 'generate_post_date_output',162 sprintf( // WPCS: XSS ok, sanitization ok.163 '<span class="posted-on">%1$s<a href="%2$s" title="%3$s" rel="bookmark">%4$s</a></span> ',164 apply_filters('generate_inside_post_meta_item_output', '', 'date'),165 esc_url(get_permalink()),166 esc_attr(get_the_time()),167 $time_string168 ),169 $time_string170 );171 }172 }173174 if ('author' === $item) {175 $author = apply_filters('generate_post_author', true);176177 if ($author) {178 echo apply_filters(179 'generate_post_author_output',180 sprintf(181 '<span class="byline">%1$s<span class="author vcard" %5$s><a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span></span> ',182 apply_filters('generate_inside_post_meta_item_output', '', 'author'),183 esc_url(get_author_posts_url(get_the_author_meta('ID'))),184 /* translators: 1: Author name */185 esc_attr(sprintf(__('View all posts by %s', 'generatepress'), get_the_author())),186 esc_html(get_the_author()),187 generate_get_microdata('post-author')188 )189 );190 }191 }192193 if ('categories' === $item) {194 $categories = apply_filters('generate_show_categories', true);195196 $term_separator = apply_filters('generate_term_separator', _x(', ', 'Used between list items, there is a space after the comma.', 'generatepress'), 'categories');197 $categories_list = get_the_category_list($term_separator);198199 if ($categories_list && $categories) {200 echo apply_filters(201 'generate_category_list_output',202 sprintf(203 '<span class="cat-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.204 esc_html_x('Categories', 'Used before category names.', 'generatepress'),205 $categories_list,206 apply_filters('generate_inside_post_meta_item_output', '', 'categories')207 )208 );209 }210 }211212 if ('tags' === $item) {213 $tags = apply_filters('generate_show_tags', true);214215 $term_separator = apply_filters('generate_term_separator', _x(', ', 'Used between list items, there is a space after the comma.', 'generatepress'), 'tags');216 $tags_list = get_the_tag_list('', $term_separator);217218 if ($tags_list && $tags) {219 echo apply_filters(220 'generate_tag_list_output',221 sprintf(222 '<span class="tags-links">%3$s<span class="screen-reader-text">%1$s </span>%2$s</span> ', // WPCS: XSS ok, sanitization ok.223 esc_html_x('Tags', 'Used before tag names.', 'generatepress'),224 $tags_list,225 apply_filters('generate_inside_post_meta_item_output', '', 'tags')226 )227 );228 }229 }230231 if ('comments-link' === $item) {232 $comments = apply_filters('generate_show_comments', true);233234 if ($comments && ! post_password_required() && (comments_open() || get_comments_number())) {235 echo '<span class="comments-link">';236 echo apply_filters('generate_inside_post_meta_item_output', '', 'comments-link');237 comments_popup_link(__('Leave a comment', 'generatepress'), __('1 Comment', 'generatepress'), __('% Comments', 'generatepress'));238 echo '</span> ';239 }240 }241242 /**243 * generate_post_meta_items hook.244 *245 * @since 2.4246 */247 do_action('generate_post_meta_items', $item);248}249250add_filter('generate_inside_post_meta_item_output', 'generate_do_post_meta_prefix', 10, 2);251/**252 * Add svg icons or text to our post meta output.253 *254 * @since 2.4255 */256function generate_do_post_meta_prefix($output, $item)257{258 if ('author' === $item) {259 $output = __('by', 'generatepress') . ' ';260 }261262 if ('categories' === $item) {263 $output = generate_get_svg_icon('categories');264 }265266 if ('tags' === $item) {267 $output = generate_get_svg_icon('tags');268 }269270 if ('comments-link' === $item) {271 $output = generate_get_svg_icon('comments');272 }273274 return $output;275}276277if (! function_exists('generate_posted_on')) {278 /**279 * Prints HTML with meta information for the current post-date/time and author.280 *281 * @since 0.1282 */283 function generate_posted_on()284 {285 $items = apply_filters('generate_header_entry_meta_items', array(286 'date',287 'author',288 ));289290 foreach ($items as $item) {291 generate_do_post_meta_item($item);292 }293 }294}295296if (! function_exists('generate_entry_meta')) {297 /**298 * Prints HTML with meta information for the categories, tags.299 *300 * @since 1.2.5301 */302 function generate_entry_meta()303 {304 $items = apply_filters('generate_footer_entry_meta_items', array(305 'categories',306 'tags',307 'comments-link',308 ));309310 foreach ($items as $item) {311 generate_do_post_meta_item($item);312 }313 }314}315316if (! function_exists('generate_excerpt_more')) {317 add_filter('excerpt_more', 'generate_excerpt_more');318 /**319 * Prints the read more HTML to post excerpts.320 *321 * @since 0.1322 *323 * @param string $more The string shown within the more link.324 * @return string The HTML for the more link.325 */326 function generate_excerpt_more($more)327 {328 return apply_filters('generate_excerpt_more_output', sprintf(329 ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s %4$s</a>',330 the_title_attribute('echo=0'),331 esc_url(get_permalink(get_the_ID())),332 __('Read more', 'generatepress'),333 '<span class="screen-reader-text">' . get_the_title() . '</span>'334 ));335 }336}337338if (! function_exists('generate_content_more')) {339 add_filter('the_content_more_link', 'generate_content_more');340 /**341 * Prints the read more HTML to post content using the more tag.342 *343 * @since 0.1344 *345 * @param string $more The string shown within the more link.346 * @return string The HTML for the more link347 */348 function generate_content_more($more)349 {350 return apply_filters('generate_content_more_link_output', sprintf(351 '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s%4$s</a></p>',352 the_title_attribute('echo=0'),353 esc_url(get_permalink(get_the_ID()) . apply_filters('generate_more_jump', '#more-' . get_the_ID())),354 __('Read more', 'generatepress'),355 '<span class="screen-reader-text">' . get_the_title() . '</span>'356 ));357 }358}359360if (! function_exists('generate_post_meta')) {361 add_action('generate_after_entry_title', 'generate_post_meta');362 /**363 * Build the post meta.364 *365 * @since 1.3.29366 */367 function generate_post_meta()368 {369 $post_types = apply_filters('generate_entry_meta_post_types', array(370 'post',371 ));372373 if (in_array(get_post_type(), $post_types)) : ?>374 <div class="entry-meta">375 <?php generate_posted_on(); ?>376 </div><!-- .entry-meta -->377 <?php endif;378 }379}380381if (! function_exists('generate_footer_meta')) {382 add_action('generate_after_entry_content', 'generate_footer_meta');383 /**384 * Build the footer post meta.385 *386 * @since 1.3.30387 */388 function generate_footer_meta()389 {390 $post_types = apply_filters('generate_footer_meta_post_types', array(391 'post',392 ));393394 if (in_array(get_post_type(), $post_types)) : ?>395 <footer class="entry-meta">396 <?php397 generate_entry_meta();398399 if (is_single()) {400 generate_content_nav('nav-below');401 } ?>402 </footer><!-- .entry-meta -->403 <?php endif;404 }405} ...

Full Screen

Full Screen

images.php

Source:images.php Github

copy

Full Screen

...7 * @since 1.10.08 *9 * @return array10 */11function generate_blog_get_image_sizes() {12 $sizes = get_intermediate_image_sizes();1314 $new_sizes = array(15 'full' => 'full',16 );1718 foreach ( $sizes as $key => $name ) {19 $new_sizes[ $name ] = $name;20 }2122 return $new_sizes;23}2425add_filter( 'generate_page_header_default_size', 'generate_blog_set_featured_image_size' );26/**27 * Set our featured image sizes.28 *29 * @since 1.10.030 *31 * @param string $size The existing size.32 * @return string The new size.33 */34function generate_blog_set_featured_image_size( $size ) {35 $settings = wp_parse_args(36 get_option( 'generate_blog_settings', array() ),37 generate_blog_get_defaults()38 );3940 if ( ! is_singular() ) {41 $size = $settings['post_image_size'];42 }4344 if ( is_single() ) {45 $size = $settings['single_post_image_size'];46 }4748 if ( is_page() ) {49 $size = $settings['page_post_image_size'];50 }5152 $atts = generate_get_blog_image_attributes();5354 if ( ! empty( $atts ) ) {55 $values = array(56 $atts['width'],57 $atts['height'],58 $atts['crop'],59 );6061 $image_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID(), 'full' ), $values );6263 if ( $image_src && $image_src[3] && apply_filters( 'generate_use_featured_image_size_match', true ) ) {64 return $values;65 } else {66 return $size;67 }68 }6970 return $size;71}7273if ( ! function_exists( 'generate_get_blog_image_attributes' ) ) {74 /**75 * Build our image attributes76 *77 * @since 0.178 */79 function generate_get_blog_image_attributes() {80 $settings = wp_parse_args(81 get_option( 'generate_blog_settings', array() ),82 generate_blog_get_defaults()83 );8485 if ( is_singular() ) {86 if ( is_singular( 'page' ) ) {87 $single = 'page_';88 } else {89 $single = 'single_';90 }91 } else {92 $single = '';93 }9495 $ignore_crop = array( '', '0', '9999' );9697 $atts = array(98 'width' => ( in_array( $settings["{$single}post_image_width"], $ignore_crop ) ) ? 9999 : absint( $settings["{$single}post_image_width"] ),99 'height' => ( in_array( $settings["{$single}post_image_height"], $ignore_crop ) ) ? 9999 : absint( $settings["{$single}post_image_height"] ),100 'crop' => ( in_array( $settings["{$single}post_image_width"], $ignore_crop ) || in_array( $settings["{$single}post_image_height"], $ignore_crop ) ) ? false : true101 );102103 // If there's no height or width, empty the array104 if ( 9999 == $atts[ 'width' ] && 9999 == $atts[ 'height' ] ) {105 $atts = array();106 }107108 return apply_filters( 'generate_blog_image_attributes', $atts );109 }110}111112if ( ! function_exists( 'generate_blog_setup' ) ) {113 add_action( 'wp', 'generate_blog_setup', 50 );114 /**115 * Setup our blog functions and actions116 *117 * @since 0.1118 */119 function generate_blog_setup() {120 $settings = wp_parse_args(121 get_option( 'generate_blog_settings', array() ),122 generate_blog_get_defaults()123 );124125 // Move our featured images to above the title126 if ( 'post-image-above-header' == $settings['post_image_position'] ) {127 remove_action( 'generate_after_entry_header', 'generate_post_image' );128 add_action( 'generate_before_content', 'generate_post_image' );129130 // If we're using the Page Header add-on, move those as well131 if ( function_exists('generate_page_header_post_image') ) {132 remove_action( 'generate_after_entry_header', 'generate_page_header_post_image' );133 add_action( 'generate_before_content', 'generate_page_header_post_image' );134 }135 }136137 $page_header_content = false;138 if ( function_exists( 'generate_page_header_get_options' ) ) {139 $options = generate_page_header_get_options();140 if ( '' !== $options[ 'content' ] ) {141 $page_header_content = true;142 }143144 // If our Page Header has no content, remove it145 // This will allow the Blog add-on to add an image for us146 if ( ! $page_header_content && is_singular() ) {147 remove_action( 'generate_before_content', 'generate_page_header' );148 remove_action( 'generate_after_entry_header', 'generate_page_header' );149 remove_action( 'generate_after_header', 'generate_page_header' );150 }151 }152153 // Remove the core theme featured image154 // I would like to filter instead one day155 remove_action( 'generate_after_header', 'generate_featured_page_header' );156 remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );157158 $location = generate_blog_get_singular_template();159160 if ( $settings[$location . '_post_image'] && is_singular() && ! $page_header_content ) {161 if ( 'below-title' == $settings[$location . '_post_image_position'] ) {162 add_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );163 }164165 if ( 'inside-content' == $settings[$location . '_post_image_position'] ) {166 add_action( 'generate_before_content', 'generate_blog_single_featured_image' );167 }168169 if ( 'above-content' == $settings[$location . '_post_image_position'] ) {170 add_action( 'generate_after_header', 'generate_blog_single_featured_image' );171 }172 }173 }174}175176add_filter( 'generate_featured_image_output', 'generate_blog_featured_image' );177/**178 * Remove featured image if set or using WooCommerce.179 *180 * @since 1.5181 * @return string The image HTML182 */183function generate_blog_featured_image( $output ) {184 $settings = wp_parse_args(185 get_option( 'generate_blog_settings', array() ),186 generate_blog_get_defaults()187 );188189 if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings['post_image'] ) {190 return false;191 }192193 return $output;194}195196/**197 * Build our featured images for single posts and pages.198 *199 * This function is way more complicated than it could be so it can200 * ensure compatibility with the Page Header add-on.201 *202 * @since 1.5203 *204 * @return string The image HTML205 */206function generate_blog_single_featured_image() {207 $settings = wp_parse_args(208 get_option( 'generate_blog_settings', array() ),209 generate_blog_get_defaults()210 );211212 $image_id = get_post_thumbnail_id( get_the_ID(), 'full' );213214 if ( function_exists( 'generate_page_header_get_image' ) && generate_page_header_get_image( 'ID' ) ) {215 if ( intval( $image_id ) !== generate_page_header_get_image( 'ID' ) ) {216 $image_id = generate_page_header_get_image( 'ID' );217 }218 }219220 $location = generate_blog_get_singular_template();221222 if ( ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) || ! $settings[$location . '_post_image'] || ! $image_id ) {223 return false;224 }225226 $image_html = apply_filters( 'post_thumbnail_html',227 wp_get_attachment_image( $image_id, apply_filters( 'generate_page_header_default_size', 'full' ), '',228 array(229 'itemprop' => 'image',230 )231 ),232 get_the_ID(),233 $image_id,234 apply_filters( 'generate_page_header_default_size', 'full' ),235 ''236 );237238 $location = generate_blog_get_singular_template();239240 $classes = array(241 is_page() ? 'page-header-image' : null,242 is_singular() && ! is_page() ? 'page-header-image-single' : null,243 'above-content' == $settings[$location . '_post_image_position'] ? 'grid-container grid-parent' : null,244 );245246 $image_html = apply_filters( 'generate_single_featured_image_html', $image_html );247248 echo apply_filters( 'generate_single_featured_image_output', sprintf(249 '<div class="featured-image %2$s">250 %1$s251 </div>',252 $image_html,253 implode( ' ', $classes )254 ), $image_html );255}256257add_filter( 'generate_blog_image_attributes', 'generate_blog_page_header_image_atts' );258/**259 * Filter our image attributes in case we're using differents atts in our Page Header260 *261 * @since 1.5262 *263 * @param array $atts Our existing image attributes.264 * @return array Image attributes265 */266function generate_blog_page_header_image_atts( $atts ) {267 if ( ! function_exists( 'generate_page_header_get_options' ) ) {268 return $atts;269 }270271 if ( ! is_singular() ) {272 return $atts;273 }274275 $options = generate_page_header_get_options();276277 if ( 'enable' == $options[ 'image_resize' ] ) {278 $ignore_crop = array( '', '0', '9999' );279280 $atts = array(281 'width' => ( in_array( $options[ 'image_width' ], $ignore_crop ) ) ? 9999 : absint( $options[ 'image_width' ] ),282 'height' => ( in_array( $options[ 'image_height' ], $ignore_crop ) ) ? 9999 : absint( $options[ 'image_height' ] ),283 'crop' => ( in_array( $options[ 'image_width' ], $ignore_crop ) || in_array( $options[ 'image_height' ], $ignore_crop ) ) ? false : true284 );285 }286287 return $atts;288}289290add_filter( 'generate_single_featured_image_html', 'generate_blog_page_header_link' );291/**292 * Add our Page Header link to our featured image if set.293 *294 * @since 1.5295 *296 * @param string $image_html Our existing image HTML.297 * @return string Our new image HTML.298 */299function generate_blog_page_header_link( $image_html ) {300 if ( ! function_exists( 'generate_page_header_get_options' ) ) {301 return $image_html;302 }303304 $options = generate_page_header_get_options();305306 if ( ! empty( $options['image_link'] ) ) {307 return '<a href="' . esc_url( $options[ 'image_link' ] ) . '"' . apply_filters( 'generate_page_header_link_target', '' ) . '>' . $image_html . '</a>';308 } else {309 return $image_html;310 }311} ...

Full Screen

Full Screen

class-site-restore.php

Source:class-site-restore.php Github

copy

Full Screen

...25 return self::$instance;26 }2728 public function __construct() {29 add_action( 'wp_ajax_generate_restore_theme_options', array( $this, 'theme_options' ) );30 add_action( 'wp_ajax_generate_restore_site_options', array( $this, 'site_options' ) );31 add_action( 'wp_ajax_generate_restore_content', array( $this, 'content' ) );32 add_action( 'wp_ajax_generate_restore_plugins', array( $this, 'plugins' ) );33 add_action( 'wp_ajax_generate_restore_widgets', array( $this, 'widgets' ) );34 add_action( 'wp_ajax_generate_restore_css', array( $this, 'css' ) );35 add_action( 'wp_ajax_generate_restore_site_clean_up', array( $this, 'clean_up' ) );36 }3738 public function theme_options() {39 check_ajax_referer( 'generate_sites_nonce', 'nonce' );4041 if ( ! current_user_can( 'manage_options' ) ) {42 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );43 return; // Just in case.44 }4546 $backup_data = get_option( '_generatepress_site_library_backup', array() );4748 if ( ! empty( $backup_data ) ) {4950 if ( ! empty( $backup_data['theme_options']['mods'] ) ) {51 remove_theme_mods();52 }5354 if ( ! empty( $backup_data['theme_options']['options'] ) ) {55 $option_keys = array(56 'generate_settings',57 'generate_background_settings',58 'generate_blog_settings',59 'generate_hooks',60 'generate_page_header_settings',61 'generate_secondary_nav_settings',62 'generate_spacing_settings',63 'generate_menu_plus_settings',64 'generate_woocommerce_settings',65 );6667 foreach ( $option_keys as $key ) {68 delete_option( $key );69 }70 }7172 $modules = generatepress_get_site_premium_modules();7374 foreach ( $modules as $name => $key ) {75 delete_option( $key );76 }7778 if ( ! empty( $backup_data['modules'] ) ) {79 foreach ( (array) $backup_data['modules'] as $name => $key ) {80 update_option( $key, 'activated' );81 }82 }8384 // Theme options.85 foreach ( $backup_data['theme_options']['mods'] as $key => $val ) {86 // Only allow valid theme mods.87 if ( ! in_array( $key, GeneratePress_Sites_Helper::get_theme_mods() ) ) {88 GeneratePress_Sites_Helper::log( 'Bad theme mod key: ' . $key );89 continue;90 }9192 set_theme_mod( $key, $val );93 }9495 foreach ( $backup_data['theme_options']['options'] as $key => $val ) {96 // Only allow valid options.97 if ( ! in_array( $key, GeneratePress_Sites_Helper::get_theme_settings() ) ) {98 GeneratePress_Sites_Helper::log( 'Bad theme setting key: ' . $key );99 continue;100 }101102 update_option( $key, $val );103 }104 }105106 wp_send_json( __( 'Theme options restored.', 'gp-premium' ) );107108 die();109 }110111 public function site_options() {112 check_ajax_referer( 'generate_sites_nonce', 'nonce' );113114 if ( ! current_user_can( 'manage_options' ) ) {115 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );116 return; // Just in case.117 }118119 $backup_data = get_option( '_generatepress_site_library_backup', array() );120121 if ( ! empty( $backup_data ) ) {122 foreach ( $backup_data['site_options'] as $key => $val ) {123 if ( in_array( $key, ( array ) generatepress_sites_disallowed_options() ) ) {124 GeneratePress_Sites_Helper::log( 'Disallowed option: ' . $key );125 continue;126 }127128 if ( 'nav_menu_locations' === $key || 'custom_logo' === $key ) {129 set_theme_mod( $key, $val );130 } else {131 update_option( $key, $val );132 }133 }134 }135136 wp_send_json( __( 'Site options restored.', 'gp-premium' ) );137138 die();139 }140141 public function content() {142 check_ajax_referer( 'generate_sites_nonce', 'nonce' );143144 if ( ! current_user_can( 'manage_options' ) ) {145 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );146 return; // Just in case.147 }148149 $backup_data = get_option( '_generatepress_site_library_backup', array() );150151 if ( ! empty( $backup_data ) ) {152 global $wpdb;153 $post_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_generatepress_sites_imported_post'" );154 $term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_generatepress_sites_imported_term'" );155156 foreach ( $post_ids as $id ) {157 wp_delete_post( $id, true );158 }159 }160161 wp_send_json( __( 'Content restored.', 'gp-premium' ) );162163 die();164 }165166 public function plugins() {167 check_ajax_referer( 'generate_sites_nonce', 'nonce' );168169 if ( ! current_user_can( 'manage_options' ) ) {170 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );171 return; // Just in case.172 }173174 $backup_data = get_option( '_generatepress_site_library_backup', array() );175176 if ( ! empty( $backup_data['plugins'] ) && ! empty( $backup_data['site_options'] ) ) {177 update_option( 'active_plugins', $backup_data['plugins'] );178 }179180 wp_send_json( __( 'Plugins restored.', 'gp-premium' ) );181182 die();183 }184185 public function widgets() {186 check_ajax_referer( 'generate_sites_nonce', 'nonce' );187188 if ( ! current_user_can( 'manage_options' ) ) {189 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );190 return; // Just in case.191 }192193 $backup_data = get_option( '_generatepress_site_library_backup', array() );194195 if ( ! empty( $backup_data['widgets'] ) ) {196 update_option( 'sidebars_widgets', $backup_data['widgets'] );197 }198199 wp_send_json( __( 'Widgets restored.', 'gp-premium' ) );200201 die();202 }203204 public function css() {205 check_ajax_referer( 'generate_sites_nonce', 'nonce' );206207 if ( ! current_user_can( 'manage_options' ) ) {208 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );209 return; // Just in case.210 }211212 $backup_data = get_option( '_generatepress_site_library_backup', array() );213214 if ( ! empty( $backup_data ) ) {215 $css = '';216 $current_css = wp_get_custom_css_post();217218 if ( isset( $current_css->post_content ) ) {219 // Remove existing library CSS.220 $current_css->post_content = preg_replace( '#(/\\* GeneratePress Site CSS \\*/).*?(/\\* End GeneratePress Site CSS \\*/)#s', '', $current_css->post_content );221 }222223 if ( ! empty( $backup_data['css'] ) ) {224 $current_css->post_content .= $backup_data['css'];225 }226227 wp_update_custom_css_post( $current_css->post_content );228 }229230 wp_send_json( __( 'CSS restored.', 'gp-premium' ) );231232 die();233 }234235 public function clean_up() {236 check_ajax_referer( 'generate_sites_nonce', 'nonce' );237238 if ( ! current_user_can( 'manage_options' ) ) {239 wp_send_json_error( __( 'You are not allowed to perform this action', 'gp-premium' ) );240 return; // Just in case.241 }242243 delete_option( 'generate_dynamic_css_output' );244 delete_option( 'generate_dynamic_css_cached_version' );245 delete_option( '_generatepress_site_library_backup' );246247 wp_send_json( __( 'Completed clean-up.', 'gp-premium' ) );248249 die();250 }251}252253GeneratePress_Sites_Restore::get_instance(); ...

Full Screen

Full Screen

generate

Using AI Code Generation

copy

Full Screen

1$in = new in();2$in->generate();3$in = new in();4$in->generate();5$in = new in();6$in->generate();7$in = new in();8$in->generate();9$in = new in();10$in->generate();11$in = new in();12$in->generate();13$in = new in();14$in->generate();15$in = new in();16$in->generate();17$in = new in();18$in->generate();19$in = new in();20$in->generate();21$in = new in();22$in->generate();23$in = new in();24$in->generate();25$in = new in();26$in->generate();27$in = new in();28$in->generate();29$in = new in();30$in->generate();31$in = new in();32$in->generate();33$in = new in();34$in->generate();35$in = new in();36$in->generate();

Full Screen

Full Screen

generate

Using AI Code Generation

copy

Full Screen

1require_once 'in.php';2$in = new in();3$in->generate();4require_once 'out.php';5$out = new out();6$out->generate();7require_once 'in.php';8$in = new in();9$in->generate();10require_once 'out.php';11$out = new out();12$out->generate();13require_once 'in.php';14$in = new in();15$in->generate();16require_once 'out.php';17$out = new out();18$out->generate();19require_once 'in.php';20$in = new in();21$in->generate();22require_once 'out.php';23$out = new out();24$out->generate();25require_once 'in.php';26$in = new in();27$in->generate();28require_once 'out.php';29$out = new out();30$out->generate();31require_once 'in.php';32$in = new in();33$in->generate();34require_once 'out.php';35$out = new out();36$out->generate();37require_once 'in.php';38$in = new in();39$in->generate();40require_once 'out.php';41$out = new out();42$out->generate();43require_once 'in.php';44$in = new in();45$in->generate();

Full Screen

Full Screen

generate

Using AI Code Generation

copy

Full Screen

1$in = new in();2echo $in->generate('input', 'text', 'name', 'value', 'class');3$in = new in();4echo $in->generate('input', 'text', 'name', 'value', 'class');5$in = new in();6echo $in->generate('input', 'text', 'name', 'value', 'class');7$in = new in();8echo $in->generate('input', 'text', 'name', 'value', 'class');9$in = new in();10echo $in->generate('input', 'text', 'name', 'value', 'class');11$in = new in();12echo $in->generate('input', 'text', 'name', 'value', 'class');13$in = new in();14echo $in->generate('input', 'text', 'name', 'value', 'class');15$in = new in();16echo $in->generate('input', 'text', 'name', 'value', 'class');17$in = new in();18echo $in->generate('input', 'text', 'name', 'value', 'class');19$in = new in();20echo $in->generate('input', 'text', 'name', 'value', 'class');21$in = new in();22echo $in->generate('input', 'text', 'name', 'value', 'class');23$in = new in();24echo $in->generate('input', 'text', 'name', 'value', 'class

Full Screen

Full Screen

generate

Using AI Code Generation

copy

Full Screen

1";2for ($i=0; $i<10; $i++)3{4echo $obj->generate()."5";6}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger generate code on LambdaTest Cloud Grid

Execute automation tests with generate on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful