@ 2017-04-23T15:10:55Z <?php
/* ============== ListingPro create pages ============ */
add_action('admin_init','check_pages_live');
if (!function_exists('check_pages_live')) {
function check_pages_live(){
if ( class_exists( 'Redux' ) ) {
global $listingpro_options;
global $opt_name;
$opt_name = 'listingpro_options';
$pricing_plan = $listingpro_options['pricing-plan'];
$submit_listing = $listingpro_options['submit-listing'];
$listing_author = $listingpro_options['listing-author'];
if(empty($pricing_plan) && empty($submit_listing) && empty($listing_author) && empty($payment_checkout) && empty($payment_fail)){
create_page_if_null('Dashboard', '', 'listing-author');
create_page_if_null('Submit Your Listing', '[vc_row row_type="row_full_center_content" bg_color="#eff3f6" bg_repeat="no-repeat" bg_attatch="scroll"][vc_column][listingpro_submit title="Add your Listing" subtitle="Add details about your listing"][/vc_column][/vc_row]', 'submit-listing');
create_page_if_null('Edit Your Listing', '[vc_row row_type="row_full_center_content" bg_color="#eff3f6" bg_repeat="no-repeat" bg_attatch="scroll"][vc_column][listingpro_edit title="Edit your Listing" subtitle="Edit details about your listing"][/vc_column][/vc_row]', 'edit-listing');
create_page_if_null('Select Your Plan', '[vc_row row_type="row_full_center_content" bg_color="#eff3f6" bg_repeat="no-repeat" bg_attatch="scroll"][vc_column][listingpro_pricing title="Add your Listing" subtitle="Add details about your listing"][/vc_column][/vc_row]', 'pricing-plan');
create_page_if_null('Select Payment Gateway', '[vc_row row_type="row_full_center_content" bg_color="#eff3f6" bg_repeat="no-repeat" bg_attatch="scroll"][vc_column][listingpro_p_gateways][/vc_column][/vc_row]', 'payment-gateway');
create_page_if_null('Payment Success', '', 'payment-success');
create_page_if_null('Payment Fail', '', 'payment-fail');
create_page_if_null('Payment Checkout', '[vc_row row_type="row_full_center_content" bg_color="#eff3f6" bg_repeat="no-repeat" bg_attatch="scroll"][vc_column][listingpro_checkout title="See listings and pay" subtitle="Select your listings and payment method to proceed"][/vc_column][/vc_row]', 'payment-checkout');
}
}
}
}
add_action('admin_init','check_set_options');
if (!function_exists('check_set_options')) {
function check_set_options(){
$counter = 0;
if ( class_exists( 'Redux' ) ) {
global $listingpro_options;
global $opt_name;
$opt_name = 'listingpro_options';
$pricing_plan = $opt_name['pricing-plan'];
$submit_listing = $opt_name['submit-listing'];
$edit_listing = $opt_name['edit-listing'];
$listing_author = $opt_name['listing-author'];
$payment_checkout = $opt_name['payment-checkout'];
if(empty($listing_author)){
if( get_page_by_title('Dashboard') != NULL ) {
$page = get_page_by_title('Dashboard');
$permalink = get_permalink($page->ID);
$status = get_post_status( $page->ID );
if($status == 'publish'){
Redux::setOption( $opt_name, 'listing-author', $permalink);
}
}
}
if(empty($submit_listing)){
if( get_page_by_title('Submit Your Listing') != NULL ) {
$page = get_page_by_title('Submit Your Listing');
$permalink = get_permalink($page->ID);
$status = get_post_status( $page->ID );
if($status == 'publish'){
Redux::setOption( $opt_name, 'submit-listing', $permalink);
}
}
}
if(empty($edit_listing)){
if( get_page_by_title('Edit Your Listing') != NULL ) {
$page = get_page_by_title('Edit Your Listing');
$permalink = get_permalink($page->ID);
$status = get_post_status( $page->ID );
if($status == 'publish'){
Redux::setOption( $opt_name, 'edit-listing', $permalink);
}
}
}
if(empty($pricing_plan)){
if( get_page_by_title('Select Your Plan') != NULL ) {
$page = get_page_by_title('Select Your Plan');
$permalink = get_permalink($page->ID);
$status = get_post_status( $page->ID );
if($status == 'publish'){
Redux::setOption( $opt_name, 'pricing-plan', $permalink);
}
}
}
if(empty($payment_checkout)){
if( get_page_by_title('Payment Checkout') != NULL ) {
$page = get_page_by_title('Payment Checkout');
$permalink = $page->ID;
$status = get_post_status( $page->ID );
if($status == 'publish'){
Redux::setOption( $opt_name, 'payment-checkout', $permalink);
}
}
}
}
}
}
if (!function_exists('create_page_if_null')) {
function create_page_if_null($target,$content,$slug) {
if( get_page_by_title($target) == NULL ) {
listingpro_create_pages($target,$content,$slug);
}
}
}
if (!function_exists('listingpro_create_pages')) {
function listingpro_create_pages($pageName,$content,$slug) {
$createPage = array(
'post_title' => $pageName,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page',
'post_name' => $slug
);
if($slug == 'listing-author'){
$createPage = array(
'post_title' => $pageName,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page',
'post_name' => $slug,
'page_template' => 'template-dashboard.php'
);
}
if($slug == 'payment-success'){
$createPage = array(
'post_title' => $pageName,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page',
'post_name' => $slug,
'page_template' => 'templates/template-payment-thankyou.php'
);
}
if($slug == 'payment-fail'){
$createPage = array(
'post_title' => $pageName,
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'page',
'post_name' => $slug,
'page_template' => 'templates/template-payment-cancel.php'
);
}
// Insert the post into the database
wp_insert_post( $createPage );
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 Fatal error: Uncaught Error: Call to undefined function add_action() in /in/2lSLv:6
Stack trace:
#0 {main}
thrown in /in/2lSLv on line 6
Process exited with code 255 . Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Call to undefined function add_action() in /in/2lSLv:6
Stack trace:
#0 {main}
thrown in /in/2lSLv on line 6
Process exited with code 255 . preferences:dark mode live preview
157.91 ms | 401 KiB | 186 Q