6 ) { $ip = strip_tags( $_SERVER['HTTP_X_FORWARDED_FOR'] ); } elseif ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) and strlen( $_SERVER['HTTP_CLIENT_IP'] ) > 6 ) { $ip = strip_tags( $_SERVER['HTTP_CLIENT_IP'] ); } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) and strlen( $_SERVER['REMOTE_ADDR'] ) > 6 ) { $ip = strip_tags( $_SERVER['REMOTE_ADDR'] ); }//endif if ( ! $ip ) { $ip = '127.0.0.1'; } return strip_tags( $ip ); } /** * Update cookie length for bypass url */ function seedprod_lite_change_wp_cookie_logout( $expirein ) { global $seed_cspv5_bypass_expires; if ( ! empty( $seed_cspv5_bypass_expires ) ) { return $seed_cspv5_bypass_expires; // Modify the exire cookie } else { return $expirein; } } /** * Get roles */ function seedprod_lite_get_roles() { global $wp_roles; if ( ! isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); } $roles = $wp_roles->get_names(); if ( is_multisite() ) { $roles['superadmin'] = __( 'SuperAdmin', 'coming-soon' ); } $roles['anyoneloggedin'] = __( 'Anyone Logged In', 'coming-soon' ); return $roles; } /** * Get Enviroment */ function seedprod_lite_is_localhost() { // $localhost = array('127.0.0.1','::1'); // $is_localhost = false; // if (in_array($_SERVER['REMOTE_ADDR'], $localhost) || !empty($_GET['debug'])) { // $is_localhost = true; // } $is_localhost = false; if ( defined( 'SEEDPROD_LOCAL_JS' ) ) { $is_localhost = true; } return $is_localhost; } // YouTube video ID function seedprod_lite_youtube_id_from_url( $url ) { $pattern = '%^# Match any youtube URL (?:https?://)? # Optional scheme. Either http or https (?:www\.)? # Optional www subdomain (?: # Group host alternatives youtu\.be/ # Either youtu.be, | youtube\.com # or youtube.com (?: # Group path alternatives /embed/ # Either /embed/ | /v/ # or /v/ | /watch\?v= # or /watch\?v= ) # End path alternatives. ) # End host alternatives. ([\w-]{10,12}) # Allow 10-12 for 11 char youtube id. $%x'; $result = preg_match( $pattern, $url, $matches ); if ( false !== $result ) { if ( isset( $matches[1] ) ) { return $matches[1]; } } return false; } /** * Entry Options */ function seedprod_lite_block_options() { $block_options = array( array( 'name' => __( 'Column', 'coming-soon' ), 'is_pro' => false, 'cat' => 'layout', 'type' => 'column', 'id' => 1, 'icon' => '', ), // array('name'=>__('2 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'2-col', 'id'=>2), // array('name'=>__('3 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'3-col', 'id'=>3), // array('name'=>__('4 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'4-col', 'id'=>4), // array('name'=>__('5 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'5-col', 'id'=>5), // array('name'=>__('6 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'6-col', 'id'=>6), // array('name'=>__('Left Sidebar','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'left-sidebar', 'id'=>7), // array('name'=>__('Right Sidebar','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'right-sidebar', 'id'=>8), // array('name'=>__('6 Column','coming-soon'),'is_pro'=> false ,'cat'=>'layout','type'=>'6-col', 'id'=>6), array( 'name' => __( 'Headline', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'header', 'id' => 9, 'icon' => ' ', ), //array('name'=>__('Sub Headline','coming-soon'),'is_pro'=> false,'cat'=>'common','type'=>'sub-header', 'id'=>10, 'icon' => 'fas fa-heading'), array( 'name' => __( 'Text', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'text', 'id' => 11, 'icon' => '', ), array( 'name' => __( 'List', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'bullet-list', 'id' => 12, 'icon' => '', ), array( 'name' => __( 'Button', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'button', 'id' => 13, 'icon' => '', ), array( 'name' => __( 'Image', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'image', 'id' => 14, 'icon' => '', ), array( 'name' => __( 'Video', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'video', 'id' => 15, 'icon' => '', ), array( 'name' => __( 'Divider', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'divider', 'id' => 17, 'icon' => ' ', ), array( 'name' => __( 'Spacer', 'coming-soon' ), 'is_pro' => false, 'cat' => 'common', 'type' => 'spacer', 'id' => 24, 'icon' => '', ), array( 'name' => __( 'Giveaway', 'coming-soon' ), 'is_pro' => false, 'cat' => 'adv', 'type' => 'giveaway', 'id' => 32, 'icon' => ' ', ), array( 'name' => __( 'Contact Form', 'coming-soon' ), 'is_pro' => false, 'cat' => 'adv', 'type' => 'contact-form', 'id' => 23, 'icon' => '', ), array( 'name' => __( 'Optin Form', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'optin-form', 'id' => 22, 'icon' => '', ), array( 'name' => __( 'Countdown', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'countdown', 'id' => 16, 'icon' => ' ', ), array( 'name' => __( 'Social Profiles', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'social-profiles', 'id' => 18, 'icon' => '', ), array( 'name' => __( 'Social Sharing', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'social-sharing', 'id' => 19, 'icon' => '', ), //array('name'=>__('Form','coming-soon'),'is_pro'=> false ,'cat'=>'adv','type'=>'form', 'id'=>25, 'icon' => 'far fa-envelope'), array( 'name' => __( 'Animated Headline', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'animatedheadline', 'id' => 11, 'icon' => ' ', ), array( 'name' => __( 'Progress Bar', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'progress-bar', 'id' => 24, 'icon' => ' ', ), array( 'name' => __( 'Icon', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'icon', 'id' => 24, 'icon' => '', ), array( 'name' => __( 'Testimonials', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'testimonial', 'id' => 34, 'icon' => ' ', ), array( 'name' => __( 'Image Carousel', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'imagecarousel', 'id' => 45, 'icon' => ' ', ), array( 'name' => __( 'Image Box', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'feature', 'id' => 24, 'icon' => ' ', ), array( 'name' => __( 'Icon Box', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'iconfeature', 'id' => 26, 'icon' => ' ', ), array( 'name' => __( 'Nav Menu', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'nav', 'id' => 25, 'icon' => '', ), array( 'name' => __( 'Pricing Table', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'pricingtable', 'id' => 44, 'icon' => ' ', ), array( 'name' => __( 'Anchor', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'anchor', 'id' => 30, 'icon' => '', ), array( 'name' => __( 'Star Rating', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'starrating', 'id' => 31, 'icon' => '', ), array( 'name' => __( 'Accordion', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'accordion', 'id' => 34, 'icon' => '', ), array( 'name' => __( 'Shortcode', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'shortcode', 'id' => 21, 'icon' => '', ), array( 'name' => __( 'Login Form', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'login', 'id' => 33, 'icon' => ' ', ), array( 'name' => __( 'Google Maps', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'googlemaps', 'id' => 50, 'icon' => '', ), array( 'name' => __( 'Facebook Like', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'facebooklike', 'id' => 35, 'icon' => ' ', ), array( 'name' => __( 'Facebook Comments', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'facebookcomments', 'id' => 36, 'icon' => ' ', ), array( 'name' => __( 'Facebook Page', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'facebookpage', 'id' => 37, 'icon' => ' ', ), array( 'name' => __( 'Facebook Embed', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'facebookembed', 'id' => 38, 'icon' => ' ', ), array( 'name' => __( 'Twitter Embed Tweet', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'twitterembedtweet', 'id' => 40, 'icon' => ' ', ), array( 'name' => __( 'Twitter Embed Timeline', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'twitterembedtimeline', 'id' => 80, 'icon' => ' ', ), array( 'name' => __( 'Twitter Tweet Button', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'twittertweetbutton', 'id' => 82, 'icon' => ' ', ), array( 'name' => __( 'Twitter Follow Button', 'coming-soon' ), 'is_pro' => true, 'cat' => 'adv', 'type' => 'twitterfollowbutton', 'id' => 84, 'icon' => ' ', ), array( 'name' => __( 'Custom HTML', 'coming-soon' ), 'is_pro' => false, 'cat' => 'adv', 'type' => 'custom-html', 'id' => 20, 'icon' => ' ', ), array( 'name' => __( 'Add To Cart', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wcaddtocart', 'id' => 34, 'icon' => ' ', ), array( 'name' => __( 'Checkout', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wccheckout', 'id' => 35, 'icon' => ' ', ), array( 'name' => __( 'Cart', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wccart', 'id' => 36, 'icon' => ' ', ), array( 'name' => __( 'Products Grid', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wccustomproductsgrid', 'id' => 37, 'icon' => ' ', ), array( 'name' => __( 'Recent Products', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wcrecentproductsgrid', 'id' => 42, 'icon' => ' ', ), array( 'name' => __( 'Sale Products', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wcsaleproductsgrid', 'id' => 40, 'icon' => ' ', ), array( 'name' => __( 'Best Selling Products', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wcbestsellingproductsgrid', 'id' => 41, 'icon' => ' ', ), array( 'name' => __( 'Featured Products', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wcfeaturedproductsgrid', 'id' => 39, 'icon' => ' ', ), array( 'name' => __( 'Top Rated Products', 'coming-soon' ), 'is_pro' => true, 'cat' => 'wc', 'type' => 'wctopratedproductsgrid', 'id' => 43, 'icon' => ' ', ), ); return $block_options; } /** * Get times */ function seedprod_lite_get_default_timezone() { $general_settings = get_option( 'seedprod_settings' ); $timezone = 'UTC'; if ( ! empty( $general_settings ) ) { $general_settings = json_decode( $general_settings ); if ( ! empty( $general_settings->default_timezone ) ) { $timezone = $general_settings->default_timezone; } } return $timezone; } /** * Get times */ function seedprod_lite_get_times() { $times = array(); $times[] = array( 'v' => '', 'l' => __( 'Select Time', 'coming-soon' ), ); $times[] = array( 'v' => '00:00', 'l' => '12:00 A.M.', ); $times[] = array( 'v' => '00:30', 'l' => '12:30 A.M.', ); $times[] = array( 'v' => '01:00', 'l' => '1:00 A.M.', ); $times[] = array( 'v' => '01:30', 'l' => '1:30 A.M.', ); $times[] = array( 'v' => '02:00', 'l' => '2:00 A.M.', ); $times[] = array( 'v' => '02:30', 'l' => '2:30 A.M.', ); $times[] = array( 'v' => '03:00', 'l' => '3:00 A.M.', ); $times[] = array( 'v' => '03:30', 'l' => '3:30 A.M.', ); $times[] = array( 'v' => '04:00', 'l' => '4:00 A.M.', ); $times[] = array( 'v' => '04:30', 'l' => '4:30 A.M.', ); $times[] = array( 'v' => '05:00', 'l' => '5:00 A.M.', ); $times[] = array( 'v' => '05:30', 'l' => '5:30 A.M.', ); $times[] = array( 'v' => '06:00', 'l' => '6:00 A.M.', ); $times[] = array( 'v' => '06:30', 'l' => '6:30 A.M.', ); $times[] = array( 'v' => '07:00', 'l' => '7:00 A.M.', ); $times[] = array( 'v' => '07:30', 'l' => '7:30 A.M.', ); $times[] = array( 'v' => '08:00', 'l' => '8:00 A.M.', ); $times[] = array( 'v' => '08:30', 'l' => '8:30 A.M.', ); $times[] = array( 'v' => '09:00', 'l' => '9:00 A.M.', ); $times[] = array( 'v' => '09:30', 'l' => '9:30 A.M.', ); $times[] = array( 'v' => '10:00', 'l' => '10:00 A.M.', ); $times[] = array( 'v' => '10:30', 'l' => '10:30 A.M.', ); $times[] = array( 'v' => '11:00', 'l' => '11:00 A.M.', ); $times[] = array( 'v' => '11:30', 'l' => '11:30 A.M.', ); $times[] = array( 'v' => '12:00', 'l' => '12:00 P.M.', ); $times[] = array( 'v' => '12:30', 'l' => '12:30 P.M.', ); $times[] = array( 'v' => '13:00', 'l' => '1:00 P.M.', ); $times[] = array( 'v' => '13:30', 'l' => '1:30 P.M.', ); $times[] = array( 'v' => '14:00', 'l' => '2:00 P.M.', ); $times[] = array( 'v' => '14:30', 'l' => '2:30 P.M.', ); $times[] = array( 'v' => '15:00', 'l' => '3:00 P.M.', ); $times[] = array( 'v' => '15:30', 'l' => '3:30 P.M.', ); $times[] = array( 'v' => '16:00', 'l' => '4:00 P.M.', ); $times[] = array( 'v' => '16:30', 'l' => '4:30 P.M.', ); $times[] = array( 'v' => '17:00', 'l' => '5:00 P.M.', ); $times[] = array( 'v' => '17:30', 'l' => '5:30 P.M.', ); $times[] = array( 'v' => '18:00', 'l' => '6:00 P.M.', ); $times[] = array( 'v' => '18:30', 'l' => '6:30 P.M.', ); $times[] = array( 'v' => '19:00', 'l' => '7:00 P.M.', ); $times[] = array( 'v' => '19:30', 'l' => '7:30 P.M.', ); $times[] = array( 'v' => '20:00', 'l' => '8:00 P.M.', ); $times[] = array( 'v' => '20:30', 'l' => '8:30 P.M.', ); $times[] = array( 'v' => '21:00', 'l' => '9:00 P.M.', ); $times[] = array( 'v' => '21:30', 'l' => '9:30 P.M.', ); $times[] = array( 'v' => '22:00', 'l' => '10:00 P.M.', ); $times[] = array( 'v' => '22:30', 'l' => '10:30 P.M.', ); $times[] = array( 'v' => '23:00', 'l' => '11:00 P.M.', ); $times[] = array( 'v' => '23:30', 'l' => '11:30 P.M.', ); return $times; } /** * Check per */ function seedprod_lite_get_api_key() { $seedprod_api_key = ''; if ( defined( 'SEEDPROD_API_KEY' ) ) { $seedprod_api_key = SEEDPROD_API_KEY; } if ( empty( $seedprod_api_key ) ) { $seedprod_api_key = get_option( 'seedprod_api_key ' ); } return $seedprod_api_key; } /** * Get timezones */ function seedprod_lite_get_timezones() { // timezones $zonen = array(); $continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' ); foreach ( timezone_identifiers_list() as $zone ) { $zone = explode( '/', $zone ); if ( ! in_array( $zone[0], $continents ) ) { continue; } // This determines what gets set and translated - we don't translate Etc/* strings here, they are done later $exists = array( 0 => ( isset( $zone[0] ) && $zone[0] ), 1 => ( isset( $zone[1] ) && $zone[1] ), 2 => ( isset( $zone[2] ) && $zone[2] ), ); $exists[3] = ( $exists[0] && 'Etc' !== $zone[0] ); $exists[4] = ( $exists[1] && $exists[3] ); $exists[5] = ( $exists[2] && $exists[3] ); $zonen[] = array( 'continent' => ( $exists[0] ? $zone[0] : '' ), 'city' => ( $exists[1] ? $zone[1] : '' ), 'subcity' => ( $exists[2] ? $zone[2] : '' ), 't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ), 't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), 't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ), ); } usort( $zonen, '_wp_timezone_choice_usort_callback' ); $structure = array(); foreach ( $zonen as $key => $zone ) { // Build value in an array to join later $value = array( $zone['continent'] ); if ( empty( $zone['city'] ) ) { // It's at the continent level (generally won't happen) $display = $zone['t_continent']; } else { // It's inside a continent group // Continent optgroup if ( ! isset( $zonen[ $key - 1 ] ) || $zonen[ $key - 1 ]['continent'] !== $zone['continent'] ) { $label = $zone['t_continent']; //$structure[] = $label ; } // Add the city to the value $value[] = $zone['city']; // get offset // $timezone = $label.'/'.str_replace(' ', '_', $zone['t_city']); // $time = new \DateTime('now', new DateTimeZone($timezone)); // $timezoneOffset = $time->format('P'); $display = $zone['t_city']; if ( ! empty( $zone['subcity'] ) ) { // Add the subcity to the value $value[] = $zone['subcity']; $display .= ' - ' . $zone['t_subcity']; } } // Build the value $value = join( '/', $value ); // get offset $time = new \DateTime( 'now', new DateTimeZone( $value ) ); $timezoneOffset = $time->format( 'P' ); $structure[ $label ][] = array( 'v' => $value, 'l' => $display . ' (' . $timezoneOffset . ' GMT)', ); } $structure['UTC'][] = array( 'v' => 'UTC', 'l' => 'UTC', ); return $structure; } /** * Add to array if value does not exist */ function seedprod_lite_array_add( $arr, $key, $value ) { if ( ! array_key_exists( $key, $arr ) ) { $arr[ $key ] = $value; } return $arr; } /** * Check per */ function seedprod_lite_cu( $rper = null ) { if ( ! empty( $rper ) ) { $uper = explode( ',', get_option( 'seedprod_per' ) ); if ( in_array( $rper, $uper ) ) { return true; } else { return false; } } else { $a = get_option( 'seedprod_a' ); if ( $a ) { return true; } else { return false; } } } function seedprod_lite_upgrade_link( $medium = 'link' ) { return apply_filters( 'seedprod_lite_upgrade_link', 'https://seedprod.com/lite-upgrade/?utm_source=WordPress&utm_campaign=liteplugin&utm_medium=' . sanitize_key( apply_filters( 'seedprod_lite_upgrade_link_medium', $medium ) ) ); } function seedprod_lite_disable_admin_notices() { global $wp_filter; if ( is_user_admin() ) { if ( isset( $wp_filter['user_admin_notices'] ) ) { unset( $wp_filter['user_admin_notices'] ); } } elseif ( isset( $wp_filter['admin_notices'] ) ) { unset( $wp_filter['admin_notices'] ); } if ( isset( $wp_filter['all_admin_notices'] ) ) { unset( $wp_filter['all_admin_notices'] ); } } if ( ! empty( $_GET['page'] ) && strpos( $_GET['page'], 'seedprod' ) !== false ) { add_action( 'admin_print_scripts', 'seedprod_lite_disable_admin_notices' ); } function seedprod_lite_plugin_nonce() { check_ajax_referer( 'seedprod_lite_plugin_nonce', 'nonce' ); if ( ! current_user_can( 'install_plugins' ) ) { wp_send_json_error(); } $install_plugin_nonce = wp_create_nonce( 'install-plugin_' . sanitize_text_field( $_POST['plugin'] ) ); wp_send_json( $install_plugin_nonce ); } function seedprod_lite_is_dev_url( $url = '' ) { $is_local_url = false; // Trim it up $url = strtolower( trim( $url ) ); // Need to get the host...so let's add the scheme so we can use parse_url if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) { $url = 'http://' . $url; } $url_parts = parse_url( $url ); $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false; if ( ! empty( $url ) && ! empty( $host ) ) { if ( false !== ip2long( $host ) ) { if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) { $is_local_url = true; } } elseif ( 'localhost' === $host ) { $is_local_url = true; } $tlds_to_check = array( '.local', ':8888', ':8080', ':8081', '.invalid', '.example', '.test' ); foreach ( $tlds_to_check as $tld ) { if ( false !== strpos( $host, $tld ) ) { $is_local_url = true; break; } } if ( substr_count( $host, '.' ) > 1 ) { $subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' ); foreach ( $subdomains_to_check as $subdomain ) { $subdomain = str_replace( '.', '(.)', $subdomain ); $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) { $is_local_url = true; break; } } } } return $is_local_url; } function seedprod_lite_find_fonts_in_doc( $someArray ) { if ( empty( $someArray ) ) { return false; } $load_fonts = array(); $load_variants = array(); $iterator = new RecursiveIteratorIterator( new RecursiveArrayIterator( $someArray ), RecursiveIteratorIterator::SELF_FIRST ); foreach ( $iterator as $k => $v ) { $indent = str_repeat( ' ', 10 * $iterator->getDepth() ); // Not at end: show key only if ( $iterator->hasChildren() ) { //echo "$indent$k :
"; // At end: show key, value and path } else { for ( $p = array(), $i = 0, $z = $iterator->getDepth(); $i <= $z; $i++ ) { $p[] = $iterator->getSubIterator( $i )->key(); } $path = implode( ',', $p ); //echo "$indent$k : $v : path -> $path
"; // get font if ( stripos( $k, 'font' ) !== false && stripos( $k, 'variant' ) === false && ! empty( $v ) && strpos( $v, ',' ) === false && stripos( $k, 'fontSize' ) === false ) { $load_fonts[] = array( 'k' => $k, 'v' => $v, 'p' => $path, ); } // get variant if ( stripos( $k, 'font' ) !== false && stripos( $k, 'variant' ) !== false && ! empty( $v ) && strpos( $v, ',' ) === false ) { $load_variants[] = array( 'k' => $k, 'v' => $v, 'p' => $path, ); } } } return array_merge( $load_fonts, $load_variants ); } function seedprod_lite_construct_font_str( $doc_settings ) { $fonts = seedprod_lite_find_fonts_in_doc( $doc_settings ); $myfonts = array(); $myvariants = array(); if ( ! empty( $fonts ) ) { foreach ( $fonts as $k => $v ) { if ( stripos( $v['k'], 'font' ) !== false && stripos( $v['k'], 'variant' ) === false ) { if ( empty( $myfonts[ $v['v'] ] ) ) { $myfonts[ $v['v'] ] = array(); } foreach ( $fonts as $k2 => $v2 ) { if ( $v['p'] . 'Variant' === $v2['p'] ) { $myfonts[ $v['v'] ][] = $v2['v']; } } } } foreach ( $myfonts as $k3 => $v3 ) { $myfonts[ $k3 ] = array_unique( $v3 ); } } $google_fonts_str = ''; if ( ! empty( $myfonts ) ) { $google_fonts_str = 'https://fonts.googleapis.com/css?family='; $c = 1; foreach ( $myfonts as $k4 => $v4 ) { $end = '|'; if ( count( $myfonts ) == $c ) { $end = ''; } $google_fonts_str .= urlencode( $k4 ); if ( ! empty( $v4 ) ) { $google_fonts_str .= ':' . implode( ',', $v4 ); } $google_fonts_str .= $end; $c++; } $google_fonts_str .= '&display=swap'; } return $google_fonts_str; } add_filter( '_wp_post_revision_fields', 'seedprod_lite_wp_post_revision_fields', 11, 2 ); function seedprod_lite_wp_post_revision_fields( $fields, $post ) { if ( ! empty( $post['post_content_filtered'] ) && strpos( $post['post_content'], 'sp-page' ) !== false ) { $fields['post_content_filtered'] = 'Content Filtered'; return $fields; } else { return $fields; } } add_filter( 'page_row_actions', 'seedprod_lite_filter_page_row_actions', 11, 2 ); function seedprod_lite_filter_page_row_actions( $actions, $post ) { $has_settings = get_post_meta( $post->ID, '_seedprod_page', true ); if ( ! empty( $has_settings ) ) { $id = $post->ID; $actions['edit_seedprod'] = sprintf( '%2$s', admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $id . '#/setup/' . $id, __( 'Edit with SeedProd', 'seedprod' ) ); // unset($actions['inline hide-if-no-js']); } return $actions; } //add_filter( 'get_edit_post_link', 'seedprod_lite_filter_get_edit_post_link', 11, 3 ); function seedprod_lite_filter_get_edit_post_link( $link, $id, $context ) { $has_settings = get_post_meta( $id, '_seedprod_page', true ); if ( ! empty( $has_settings ) ) { $link = admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $id . '#/setup/' . $id; } return $link; } /** * Dismiss Settings Lite CTA */ function seedprod_lite_dismiss_settings_lite_cta() { if ( check_ajax_referer( 'seedprod_lite_dismiss_settings_lite_cta' ) ) { if ( ! empty( $_POST['dismiss'] ) ) { update_option( 'seedprod_dismiss_settings_lite_cta', true ); $response = array( 'status' => 'true', ); } // Send Response wp_send_json( $response ); exit; } } /** * Dismiss Lite Banners */ function seedprod_lite_dismiss_upsell() { if ( check_ajax_referer( 'seedprod_lite_dismiss_upsell' ) ) { if ( ! empty( $_POST['id'] ) ) { $ts = time(); update_option( 'seedprod_dismiss_upsell_' . absint($_POST['id']), $ts ); $response = array( 'status' => 'true', ); } // Send Response wp_send_json( $response ); exit; } } function seedprod_lite_get_expire_times() { return array( '1' => '1 Hour', '2' => '2 Hours', '3' => '3 Hours', '4' => '4 Hours', '5' => '5 Hours', '6' => '6 Hours', '7' => '7 Hours', '8' => '8 Hours', '9' => '9 Hours', '10' => '10 Hours', '11' => '11 Hours', '12' => '12 Hours', '13' => '13 Hours', '14' => '14 Hours', '15' => '15 Hours', '16' => '16 Hours', '17' => '17 Hours', '18' => '18 Hours', '19' => '19 Hours', '20' => '20 Hours', '21' => '21 Hours', '21' => '22 Hours', '23' => '23 Hours', '24' => '1 Day', '48' => '2 Days', '72' => '3 Days', '96' => '4 Days', '120' => '5 Days', '144' => '6 Days', '168' => '7 Days', '192' => '8 Days', '216' => '9 Days', '240' => '10 Days', '264' => '11 Days', '288' => '12 Days', '312' => '13 Days', '336' => '14 Days', '360' => '15 Days', '384' => '16 Days', '408' => '17 Days', '432' => '18 Days', '456' => '19 Days', '480' => '20 Days', '504' => '21 Days', '528' => '22 Days', '552' => '23 Days', '576' => '24 Days', '600' => '25 Days', '624' => '26 Days', '648' => '27 Days', '672' => '28 Days', '696' => '29 Days', '720' => '30 Days', '8760' => '1 Year', ); } function seedprod_lite_get_system_info() { global $wpdb; // Get theme info. $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version; $return = '### Begin System Info ###' . "\n\n"; // WPForms info. $return .= '-- SeedProd Info' . "\n\n"; // Now the basics... $return .= "\n" . '-- Site Info' . "\n\n"; $return .= 'Site URL: ' . site_url() . "\n"; $return .= 'Home URL: ' . home_url() . "\n"; $return .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; // WordPress configuration. $return .= "\n" . '-- WordPress Configuration' . "\n\n"; $return .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; $return .= 'Language: ' . ( defined( 'WPLANG' ) && WPLANG ? WPLANG : 'en_US' ) . "\n"; $return .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; $return .= 'Active Theme: ' . $theme . "\n"; $return .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; // Only show page specs if front page is set to 'page'. if ( get_option( 'show_on_front' ) === 'page' ) { $front_page_id = get_option( 'page_on_front' ); $blog_page_id = get_option( 'page_for_posts' ); $return .= 'Page On Front: ' . ( 0 != $front_page_id ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; $return .= 'Page For Posts: ' . ( 0 != $blog_page_id ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; } $return .= 'ABSPATH: ' . ABSPATH . "\n"; $return .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; $return .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; $return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; $return .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; // @todo WPForms configuration/specific details. $return .= "\n" . '-- WordPress Uploads/Constants' . "\n\n"; $return .= 'WP_CONTENT_DIR: ' . ( defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR ? WP_CONTENT_DIR : 'Disabled' : 'Not set' ) . "\n"; $return .= 'WP_CONTENT_URL: ' . ( defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL ? WP_CONTENT_URL : 'Disabled' : 'Not set' ) . "\n"; $return .= 'UPLOADS: ' . ( defined( 'UPLOADS' ) ? UPLOADS ? UPLOADS : 'Disabled' : 'Not set' ) . "\n"; $uploads_dir = wp_upload_dir(); $return .= 'wp_uploads_dir() path: ' . $uploads_dir['path'] . "\n"; $return .= 'wp_uploads_dir() url: ' . $uploads_dir['url'] . "\n"; $return .= 'wp_uploads_dir() basedir: ' . $uploads_dir['basedir'] . "\n"; $return .= 'wp_uploads_dir() baseurl: ' . $uploads_dir['baseurl'] . "\n"; // Get plugins that have an update. $updates = get_plugin_updates(); // Must-use plugins. // NOTE: MU plugins can't show updates! $muplugins = get_mu_plugins(); if ( count( $muplugins ) > 0 && ! empty( $muplugins ) ) { $return .= "\n" . '-- Must-Use Plugins' . "\n\n"; foreach ( $muplugins as $plugin => $plugin_data ) { $return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } } // WordPress active plugins. $return .= "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option( 'active_plugins', array() ); foreach ( $plugins as $plugin_path => $plugin ) { if ( ! in_array( $plugin_path, $active_plugins, true ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } // WordPress inactive plugins. $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ( $plugins as $plugin_path => $plugin ) { if ( in_array( $plugin_path, $active_plugins, true ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } if ( is_multisite() ) { // WordPress Multisite active plugins. $return .= "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); foreach ( $plugins as $plugin_path ) { $plugin_base = plugin_basename( $plugin_path ); if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $plugin = get_plugin_data( $plugin_path ); $return .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } } // Server configuration (really just versions). $return .= "\n" . '-- Webserver Configuration' . "\n\n"; $return .= 'PHP Version: ' . PHP_VERSION . "\n"; $return .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $return .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n"; // PHP configs... now we're getting to the important stuff. $return .= "\n" . '-- PHP Configuration' . "\n\n"; $return .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; $return .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; $return .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; $return .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; $return .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; $return .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; $return .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; // PHP extensions and such. $return .= "\n" . '-- PHP Extensions' . "\n\n"; $return .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; $return .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; $return .= 'SOAP Client: ' . ( class_exists( 'SoapClient', false ) ? 'Installed' : 'Not Installed' ) . "\n"; $return .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; // Session stuff. $return .= "\n" . '-- Session Configuration' . "\n\n"; $return .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; // The rest of this is only relevant if session is enabled. if ( isset( $_SESSION ) ) { $return .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; $return .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; $return .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; $return .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; $return .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; } $return .= "\n" . '### End System Info ###'; return $return; } /** * If site uses WP Rocket, disable minify for CSS & JS */ function seedprod_lite_wprocket_disable_minify() { if ( function_exists( 'rocket_define_donotminify_constants' ) ) { rocket_define_donotminify_constants( 'true' ); } }