/home/techb158/balacoffee.com/wp-content/plugins/coming-soon/app
Edit: /home/techb158/balacoffee.com/wp-content/plugins/coming-soon/app/functions-utils.php (269425B)
6 ) {
$ip = wp_strip_all_tags( $http_x_forwarder_for );
} elseif ( null !== $http_client_ip && strlen( $http_client_ip ) > 6 ) {
$ip = wp_strip_all_tags( $http_client_ip );
} elseif ( null !== $remote_addr && strlen( $remote_addr ) > 6 ) {
$ip = wp_strip_all_tags( $remote_addr );
}
if ( ! $ip ) {
$ip = '127.0.0.1';
}
return wp_strip_all_tags( $ip );
}
/**
* Update cookie length for bypass url
*
* @param int $expirein Cookie expiration time in seconds.
*/
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 expire cookie.
} else {
return $expirein;
}
}
/**
* Get roles
*/
function seedprod_lite_get_roles() {
global $wp_roles;
if ( ! isset( $wp_roles ) ) {
$wp_roles = new WP_Roles(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}
$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;
}
/**
* Get Youtube ID from url.
*
* @param string $url Youtube URL.
* @return string[]|false
*/
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' => __( 'Table of Contents', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'tableofcontents',
'id' => 68,
'icon' => '
',
),
array(
'name' => __( 'Spacer', 'coming-soon' ),
'is_pro' => false,
'cat' => 'common',
'type' => 'spacer',
'id' => 24,
'icon' => '
',
),
array(
'name' => __( ' Payment Button', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'stripepayment',
'id' => 32,
'icon' => '
',
),
array(
'name' => __( 'Giveaway', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'giveaway',
'id' => 32,
'icon' => '
',
),
array(
'name' => __( 'MyPayKit', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'mypaykit',
'id' => 33,
'icon' => '
',
),
array(
'name' => __( 'Contact Form', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'contact-form',
'id' => 23,
'icon' => '
',
),
array(
'name' => __( 'Envira Gallery', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'envira-gallery',
'id' => 25,
'icon' => '
',
),
array(
'name' => __( 'Custom HTML', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'custom-html',
'id' => 20,
'icon' => '
',
),
array(
'name' => __( 'Optin Form', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'optin-form',
'id' => 22,
'icon' => '
',
),
array(
'name' => __( 'Tabs', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'tabbedlayout',
'id' => 26,
'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,
'video' => 'A4m5hXUGiYg?start=20',
'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' => __( 'Video Pop Up', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'videopopup',
'id' => 83,
'icon' => '
',
),
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' => __( 'Before After Toggle', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'beforeaftertoggle',
'id' => 25,
'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' => __( 'Content Toggle', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'contenttoggle',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Pricing Table', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'pricingtable',
'id' => 44,
'icon' => '
',
),
array(
'name' => __( 'Business Reviews', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'businessreviews',
'id' => 42,
'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' => __( 'Search Form', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'searchform',
'id' => 52,
'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' => __( 'X (Twitter) Embed Tweet', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'twitterembedtweet',
'id' => 40,
'icon' => '
',
),
array(
'name' => __( 'X (Twitter) Embed Timeline', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'twitterembedtimeline',
'id' => 80,
'icon' => '
',
),
array(
'name' => __( 'X (Twitter) Tweet Button', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'twittertweetbutton',
'id' => 82,
'icon' => '
',
),
array(
'name' => __( 'X (Twitter) Follow Button', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'twitterfollowbutton',
'id' => 84,
'icon' => '
',
),
array(
'name' => __( 'Advanced Gallery', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'seedprodgallery',
'id' => 49,
'icon' => '
',
),
array(
'name' => __( 'Gallery', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'seedprodbasicgallery',
'id' => 50,
'icon' => '
',
),
array(
'name' => __( 'Business Hours', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'businesshours',
'id' => 23,
'icon' => '
',
),
array(
'name' => __( 'Team Member', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'teammembers',
'id' => 28,
'icon' => '
',
),
array(
'name' => __( 'Price List', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'pricelist',
'id' => 29,
'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' => '
',
),
array(
'name' => __( 'Posts', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'posts',
'id' => 136,
'icon' => '
',
),
array(
'name' => __( 'Posts', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'posts',
'id' => 47,
'icon' => '
',
),
array(
'name' => __( 'Alert', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'alertbox',
'id' => 10,
'icon' => '
',
),
// $wordpress_widgets.
array(
'name' => __( 'Post Title', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'posttitle',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Post Content', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postcontent',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Post Excerpt', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postexcerpt',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Featured Image', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postfeaturedimage',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Author Box', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postauthorbox',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Author Bio', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'authorbio',
'id' => 47,
'icon' => '
',
),
array(
'name' => __( 'Post Comments', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postcomments',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Post Navigation', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postnavigation',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Post Info', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'postinfo',
'id' => 43,
'icon' => '
',
),
array(
'name' => __( 'Archive Title', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'archivetitle',
'id' => 43,
'icon' => '
',
),
// array(
// 'name' => __('Template Tags', 'coming-soon'),
// 'is_pro' => true,
// 'cat' => 'templatetag',
// 'type' => 'templatetag',
// 'id' => 43,
// 'icon' => '
//
',
// ),
array(
'name' => __( 'Site Logo', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'sitelogo',
'id' => 81,
'icon' => '
',
),
array(
'name' => __( 'Template Parts', 'coming-soon' ),
'is_pro' => true,
'cat' => 'templatetag',
'type' => 'seedprodtemplateparts',
'id' => 47,
'icon' => '
',
),
array(
'name' => __( 'Menu Cart', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'menucart',
'id' => 51,
'icon' => '
',
),
array(
'name' => __( 'Product Title', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'producttitle',
'id' => 52,
'icon' => '
',
),
array(
'name' => __( 'Product Featured Image', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productfeaturedimage',
'id' => 53,
'icon' => '
',
),
array(
'name' => __( 'Product Price', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productprice',
'id' => 54,
'icon' => '
',
),
array(
'name' => __( 'Add To Cart', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'addtocart',
'id' => 55,
'icon' => '
',
),
array(
'name' => __( 'Product Meta', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productmeta',
'id' => 56,
'icon' => '
',
),
array(
'name' => __( 'Product Content', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productcontent',
'id' => 57,
'icon' => '
',
),
array(
'name' => __( 'Short Description', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'shortdescription',
'id' => 58,
'icon' => '
',
),
array(
'name' => __( 'Additional Information', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'additionalinformation',
'id' => 59,
'icon' => '
',
),
array(
'name' => __( 'Products Related', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productrelated',
'id' => 60,
'icon' => '
',
),
array(
'name' => __( 'Upsells', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'upsells',
'id' => 61,
'icon' => '
',
),
array(
'name' => __( 'Product Rating', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productrating',
'id' => 62,
'icon' => '
',
),
array(
'name' => __( 'Product Stock', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productstock',
'id' => 63,
'icon' => '
',
),
array(
'name' => __( 'Archive Products', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'archiveproducts',
'id' => 64,
'icon' => '
',
),
array(
'name' => __( 'Product Data Tabs', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productdatatabs',
'id' => 65,
'icon' => '
',
),
array(
'name' => __( 'Hotspot', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'hotspot',
'id' => 70,
'icon' => '
',
),
array(
'name' => __( 'Counter', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'counter',
'id' => 66,
'icon' => '
',
),
array(
'name' => __( 'Product Gallery Images', 'coming-soon' ),
'is_pro' => true,
'cat' => 'woocommercetemplatetag',
'type' => 'productgalleryimages',
'id' => 71,
'icon' => '
',
),
array(
'name' => __( 'Downloads Grid', 'coming-soon' ),
'is_pro' => true,
'cat' => 'edd',
'type' => 'edddownloadsgrid',
'id' => 72,
'icon' => '
',
),
array(
'name' => __( 'Cart', 'coming-soon' ),
'is_pro' => true,
'cat' => 'edd',
'type' => 'eddcart',
'id' => 73,
'icon' => '
',
),
array(
'name' => __( 'Checkout', 'coming-soon' ),
'is_pro' => true,
'cat' => 'edd',
'type' => 'eddcheckout',
'id' => 74,
'icon' => '
',
),
array(
'name' => __( 'Buy Now Button', 'coming-soon' ),
'is_pro' => true,
'cat' => 'edd',
'type' => 'eddbuynowbutton',
'id' => 75,
'icon' => '
',
),
array(
'name' => __( 'Download Title', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadtitle',
'id' => 76,
'icon' => '
',
),
array(
'name' => __( 'Download Featured Image', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadfeaturedimage',
'id' => 77,
'icon' => '
',
),
array(
'name' => __( 'Download Price', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadprice',
'id' => 78,
'icon' => '
',
),
array(
'name' => __( 'Download Content', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadcontent',
'id' => 79,
'icon' => '
',
),
array(
'name' => __( 'Download Add To Cart', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'eddaddtocart',
'id' => 80,
'icon' => '
',
),
array(
'name' => __( 'Download Excerpt', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadexcerpt',
'id' => 81,
'icon' => '
',
),
array(
'name' => __( 'Download Instructions', 'coming-soon' ),
'is_pro' => true,
'cat' => 'eddtemplatetag',
'type' => 'edddownloadinstructions',
'id' => 82,
'icon' => '
',
),
array(
'name' => __( 'Push Notifications', 'coming-soon' ),
'is_pro' => false,
'cat' => 'adv',
'type' => 'pushnotification',
'id' => 83,
'icon' => '
',
),
);
global $wp_widget_factory;
$all_widgets = $wp_widget_factory->widgets;
// print_r($all_widgets);
$wordpress_widgets = array();
$random_id = 300;
foreach ( $all_widgets as $k => $value ) {
if ( 'WP_Widget_Custom_HTML' !== $k ) {
$random_id = $random_id + 10;
$block_options[] = array(
'name' => $value->name,
'is_pro' => true,
'cat' => 'wpw',
'type' => 'wpwidgetblock-' . $k,
'base_id' => $value->id_base,
'id' => $random_id,
'icon' => '
',
);
}
}
// print_r($wordpress_widgets);
// filter out some options.
$theme_enabled = get_option( 'seedprod_theme_enabled' );
$theme_builder = seedprod_lite_cu( 'themebuilder' );
if ( ! empty( $theme_builder ) && ! empty( $theme_enabled ) ) {
$block_options[] = array(
'name' => __( 'Template Parts', 'coming-soon' ),
'is_pro' => true,
'cat' => 'adv',
'type' => 'seedprodtemplateparts',
'id' => 47,
'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, true ) ) {
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] ? __( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
't_city' => ( $exists[4] ? __( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
't_subcity' => ( $exists[5] ? __( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ), // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
);
}
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));
// $timezone_offset = $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 ) );
$timezone_offset = $time->format( 'P' );
$structure[ $label ][] = array(
'v' => $value,
'l' => $display . ' (' . $timezone_offset . ' GMT)',
);
}
$structure['UTC'][] = array(
'v' => 'UTC',
'l' => 'UTC',
);
return $structure;
}
/**
* Add to array if value does not exist
*
* @param array $arr The array to modify.
* @param string $key The key to add.
* @param mixed $value The value to add.
*/
function seedprod_lite_array_add( $arr, $key, $value ) {
if ( ! array_key_exists( $key, $arr ) ) {
$arr[ $key ] = $value;
}
return $arr;
}
/**
* Check per
*
* @param string $rper Permission to check.
*/
function seedprod_lite_cu( $rper = null ) {
if ( ! empty( $rper ) ) {
$uper = explode( ',', get_option( 'seedprod_per' ) );
if ( in_array( $rper, $uper, true ) ) {
return true;
} else {
return false;
}
} else {
$a = get_option( 'seedprod_a' );
if ( $a ) {
return true;
} else {
return false;
}
}
}
/**
* Upgrade link.
*
* @param string $medium Medium.
* @return string SeedProd Upgrade Link.
*/
function seedprod_lite_upgrade_link( $medium = 'link' ) {
$referrer = '';
$referred_by = get_option( 'seedprod_referred_by' );
if ( ! empty( $referred_by ) ) {
$referrer = '-' . $referred_by;
}
return apply_filters( 'seedprod_lite_upgrade_link', 'https://seedprod.com/lite-upgrade/?utm_source=WordPress' . $referrer . '&utm_campaign=liteplugin&utm_medium=' . sanitize_key( apply_filters( 'seedprod_lite_upgrade_link_medium', $medium ) ) );
}
/**
* Disable admin notices.
*
* @return void
*/
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'] );
}
}
$get_page = ! empty( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( null !== $get_page && strpos( $get_page, 'seedprod' ) !== false ) {
add_action( 'admin_print_scripts', 'seedprod_lite_disable_admin_notices' );
}
/**
* Generate plugin nonce.
*
* @return void
*/
function seedprod_lite_plugin_nonce() {
check_ajax_referer( 'seedprod_lite_plugin_nonce', 'nonce' );
if ( ! current_user_can( 'install_plugins' ) ) {
wp_send_json_error();
}
$plugin = ! empty( $_POST['plugin'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) : null;
$install_plugin_nonce = wp_create_nonce( 'install-plugin_' . sanitize_text_field( $plugin ) );
wp_send_json( $install_plugin_nonce );
}
/**
* Check if is dev URL.
*
* @param string $url URL being analysed.
* @return boolean $is_local_url Return true/false whether the URL is from a dev env or not.
*/
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 = wp_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;
}
/**
* Find fonts in doc.
*
* @param Array/Object $some_array An array/object containing possible fonts in the doc.
* @return array An array with fonts in the doc.
*/
function seedprod_lite_find_fonts_in_doc( $some_array ) {
if ( empty( $some_array ) ) {
return false;
}
$load_fonts = array();
$load_variants = array();
$iterator = new RecursiveIteratorIterator( new RecursiveArrayIterator( $some_array ), RecursiveIteratorIterator::SELF_FIRST );
foreach ( $iterator as $k => $v ) {
$indent = str_repeat( ' ', 10 * $iterator->getDepth() );
// Not at end: show key only.
// if ( $iterator->callHasChildren() ) {
// echo "$indent$k :
";
// At end: show key, value and path.
// }
if ( ! $iterator->callHasChildren() ) {
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 );
}
/**
* Construct font string.
*
* @param array $doc_settings Array of fonts in the doc.
* @return string $google_fonts_str Google fonts string.
*/
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 ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode
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 );
/**
* WP Post revision fields.
*
* @param array $fields List of fields to revision. Contains 'post_title', 'post_content', and 'post_excerpt' by default.
* @param array $post A post array being processed for insertion as a post revision.
* @return array $fields List of fields after revision.
*/
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;
} elseif ( ( ! empty( $post['post_content_filtered'] ) && strpos( $post['post_content'], 'sp-theme-template' ) !== false ) || strpos( $post['post_title'], 'Global CSS' ) !== false ) {
$fields['post_content_filtered'] = 'Content Filtered';
return $fields;
} elseif ( ! empty( $post['post_content_filtered'] ) && 'seedprod' === $post['post_type'] ) {
$fields['post_content_filtered'] = 'Content Filtered';
return $fields;
} elseif ( ! empty( $post['post_content_filtered'] ) && strpos( $post['post_content_filtered'], 'template_id' ) !== false ) {
$fields['post_content_filtered'] = 'Content Filtered';
return $fields;
} else {
return $fields;
}
}
add_filter( 'get_edit_post_link', 'seedprod_lite_filter_get_edit_post_link', 11, 3 );
/**
* Get edit post link.
*
* Filters the edit post link to point to SeedProd builder ONLY on frontend for:
* - Blog/posts page with SeedProd blog template (is_home)
* - Homepage with SeedProd theme template (is_front_page)
*
* NOTE: Does NOT filter admin area - the page_row_actions filter handles backend links.
*
* @param string $link Link(depreciated).
* @param integer|WP_Post $id Post ID or post object. Default is the global $post.
* @param string $context How to output the '&' character. Default '&'.
* @return string|null $link The edit post link for the given post.
*/
function seedprod_lite_filter_get_edit_post_link( $link, $id, $context ) {
// IMPORTANT: Only run on frontend, not in admin area.
// The page_row_actions filter in edit-with-seedprod-functions.php handles backend table links.
if ( is_admin() ) {
return $link;
}
// Only filter page post types.
if ( 'page' !== get_post_type( $id ) ) {
return $link;
}
// Blog/posts page: WordPress ignores page content here and renders
// the SeedProd blog template instead, so link to that template.
if ( is_home() ) {
$theme_enabled = get_option( 'seedprod_theme_enabled' );
if ( ! empty( $theme_enabled ) && function_exists( 'seedprod_lite_get_theme_template_by_type_condition' ) ) {
$template_id = seedprod_lite_get_theme_template_by_type_condition( 'page', true );
if ( ! empty( $template_id ) ) {
return admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $template_id . '#/setup/' . $template_id;
}
}
}
// PRIORITY: Check if this page is a SeedProd page FIRST.
// If it's a SeedProd page, link to the page itself (not the theme template).
$is_landing_page = get_post_meta( $id, '_seedprod_page', true );
$is_theme_page = get_post_meta( $id, '_seedprod_edited_with_seedprod', true );
if ( '1' === $is_landing_page || true === $is_landing_page || '1' === $is_theme_page || true === $is_theme_page ) {
// It's a SeedProd page - link to the page itself.
return admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $id . '#/setup/' . $id;
}
// NOT a SeedProd page - check if this is the homepage with a SeedProd theme template.
// On frontend, WordPress conditionals work properly, so we can use is_front_page().
if ( is_front_page() && absint( get_queried_object_id() ) === absint( $id ) ) {
$theme_enabled = get_option( 'seedprod_theme_enabled' );
if ( ! empty( $theme_enabled ) && function_exists( 'seedprod_lite_get_theme_template_by_type_condition' ) ) {
// Use existing function to find matching page template (returns just ID when $id = true).
$template_id = seedprod_lite_get_theme_template_by_type_condition( 'page', true );
if ( ! empty( $template_id ) ) {
return admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $template_id . '#/setup/' . $template_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;
}
}
/**
* Get expire times
*
* @return array Expire times.
*/
function seedprod_lite_get_expire_times() {
return array(
'1' => __( '1 Hour', 'coming-soon' ),
'2' => __( '2 Hours', 'coming-soon' ),
'3' => __( '3 Hours', 'coming-soon' ),
'4' => __( '4 Hours', 'coming-soon' ),
'5' => __( '5 Hours', 'coming-soon' ),
'6' => __( '6 Hours', 'coming-soon' ),
'7' => __( '7 Hours', 'coming-soon' ),
'8' => __( '8 Hours', 'coming-soon' ),
'9' => __( '9 Hours', 'coming-soon' ),
'10' => __( '10 Hours', 'coming-soon' ),
'11' => __( '11 Hours', 'coming-soon' ),
'12' => __( '12 Hours', 'coming-soon' ),
'13' => __( '13 Hours', 'coming-soon' ),
'14' => __( '14 Hours', 'coming-soon' ),
'15' => __( '15 Hours', 'coming-soon' ),
'16' => __( '16 Hours', 'coming-soon' ),
'17' => __( '17 Hours', 'coming-soon' ),
'18' => __( '18 Hours', 'coming-soon' ),
'19' => __( '19 Hours', 'coming-soon' ),
'20' => __( '20 Hours', 'coming-soon' ),
'21' => __( '21 Hours', 'coming-soon' ),
'22' => __( '22 Hours', 'coming-soon' ),
'23' => __( '23 Hours', 'coming-soon' ),
'24' => __( '1 Day', 'coming-soon' ),
'48' => __( '2 Days', 'coming-soon' ),
'72' => __( '3 Days', 'coming-soon' ),
'96' => __( '4 Days', 'coming-soon' ),
'120' => __( '5 Days', 'coming-soon' ),
'144' => __( '6 Days', 'coming-soon' ),
'168' => __( '7 Days', 'coming-soon' ),
'192' => __( '8 Days', 'coming-soon' ),
'216' => __( '9 Days', 'coming-soon' ),
'240' => __( '10 Days', 'coming-soon' ),
'264' => __( '11 Days', 'coming-soon' ),
'288' => __( '12 Days', 'coming-soon' ),
'312' => __( '13 Days', 'coming-soon' ),
'336' => __( '14 Days', 'coming-soon' ),
'360' => __( '15 Days', 'coming-soon' ),
'384' => __( '16 Days', 'coming-soon' ),
'408' => __( '17 Days', 'coming-soon' ),
'432' => __( '18 Days', 'coming-soon' ),
'456' => __( '19 Days', 'coming-soon' ),
'480' => __( '20 Days', 'coming-soon' ),
'504' => __( '21 Days', 'coming-soon' ),
'528' => __( '22 Days', 'coming-soon' ),
'552' => __( '23 Days', 'coming-soon' ),
'576' => __( '24 Days', 'coming-soon' ),
'600' => __( '25 Days', 'coming-soon' ),
'624' => __( '26 Days', 'coming-soon' ),
'648' => __( '27 Days', 'coming-soon' ),
'672' => __( '28 Days', 'coming-soon' ),
'696' => __( '29 Days', 'coming-soon' ),
'720' => __( '30 Days', 'coming-soon' ),
'8760' => __( '1 Year', 'coming-soon' ),
);
}
/**
* Get system info.
*
* @return string $return String with all the system info appended.
*/
function seedprod_lite_get_system_info() {
global $wpdb;
// Get theme info.
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version; //phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$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).
$server_version = ! empty( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '';
$return .= "\n" . '-- Webserver Configuration' . "\n\n";
$return .= 'PHP Version: ' . PHP_VERSION . "\n";
$return .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
$return .= 'Webserver Info: ' . $server_version . "\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_constant' ) ) {
rocket_define_donotminify_constant( 'true' );
}
}