edit_url = get_edit_post_link( $page->ID );
}
$pages_json = json_encode($pages);
$domain = "https://formfacade.com";
$url = $domain . "/wordpress/onboard.html";
$preview_url = '';
$admin_url = admin_url('admin.php?page=formfacade_dashboard');
$user = wp_get_current_user();
$user_details = array(
'email' => $user->user_email,
'displayName' => $user->display_name,
'siteName' => get_bloginfo('name'),
'siteDesc' => get_bloginfo('description'),
'siteURL' => get_site_url(),
'homeURL' => get_home_url(),
'emailHash' => md5($user->user_email),
'siteHash' => md5(get_site_url())
);
$user_json = json_encode($user_details);
// Handle form submission
if ( isset($_GET['pageId']) && isset($_GET['userId']) && isset($_GET['publishId'])) {
$page_id = intval($_GET['pageId']);
$url = $url . "?pageId=" . $page_id . "&userId=" . $_GET['userId'] . "&publishId=" . $_GET['publishId'];
$preview_url = get_permalink($page_id) . '?preview=true';
emebd_wordpress_script($page_id, $_GET['userId'], $_GET['publishId']);
}
?>
post_content;
if (strpos($existing_content, $publishId) === false) {
$block_content = '';
$block_content .= '';
$block_content .= '';
$block_content .= '';
$block_content .= '';
$block_content .= '';
$updated_content = $existing_content . "\n\n" . $block_content;
wp_update_post([ 'ID' => $pageId, 'post_content' => $updated_content, ]);
}
}
}
class FormFacade
{
function activate()
{
}
function deactivate()
{
echo 'FormFacade plugin deactivated';
}
function renderFacade($atts = [])
{
$id = sanitize_text_field($atts['id']);
$appearance = 'wordpress';
// Check for appearance attributes
if (array_key_exists('appearance', $atts)) {
$appearance = sanitize_text_field($atts['appearance']);
}
// Check for owner attributes
if (array_key_exists('owner', $atts)) {
$owner = sanitize_text_field($atts['owner']);
return '';
} else if ($id) {
return '';
} else {
return 'Invalid form id.
- For example, if the public url of your Google Form is: https://docs.google.com/forms/d/e/1FAIpQLSdN-M-uIQN8FfjAZul_BQi0MKYARV_vqNKFejV0QFomAjtdGg/viewform
- Your public id issssssssssss: 1FAIpQLSdN-M-uIQN8FfjAZul_BQi0MKYARV_vqNKFejV0QFomAjtdGg
- So, the short code that you need to add to your page will be:
[formfacade id=1FAIpQLSdN-M-uIQN8FfjAZul_BQi0MKYARV_vqNKFejV0QFomAjtdGg]
For Support Contact: support@formfacade.com
';
}
}
}
$formfacade = new FormFacade();
add_shortcode('formfacade', array($formfacade, 'renderFacade'));
?>