Skip to content

Commit

Permalink
use single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
corsacca committed Sep 13, 2022
1 parent 60e5fab commit df9b467
Show file tree
Hide file tree
Showing 15 changed files with 527 additions and 526 deletions.
16 changes: 8 additions & 8 deletions disciple-tools-facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function dt_facebook() {
/*
* Check if the Disciple.Tools theme is loaded and is the latest required version
*/
$is_theme_dt = class_exists( "Disciple_Tools" );
if ( $is_theme_dt && version_compare( $version, $dt_facebook_required_dt_theme_version, "<" ) ) {
$is_theme_dt = class_exists( 'Disciple_Tools' );
if ( $is_theme_dt && version_compare( $version, $dt_facebook_required_dt_theme_version, '<' ) ) {
add_action( 'admin_notices', 'dt_facebook_hook_admin_notice' );
add_action( 'wp_ajax_dismissed_notice_handler', 'dt_hook_ajax_notice_handler' );
return false;
Expand Down Expand Up @@ -275,7 +275,7 @@ function dt_facebook_hook_admin_notice() {
$wp_theme = wp_get_theme();
$current_version = $wp_theme->version;
$message = __( "'Disciple.Tools - Facebook' plugin requires 'Disciple.Tools' theme to work. Please activate 'Disciple.Tools' theme or make sure it is latest version.", 'disciple-tools-facebook' );
if ( strpos( $wp_theme->get_template(), "disciple-tools-theme" ) !== false || $wp_theme->name === "Disciple.Tools" ) {
if ( strpos( $wp_theme->get_template(), 'disciple-tools-theme' ) !== false || $wp_theme->name === 'Disciple.Tools' ) {
$message .= sprintf( esc_html__( 'Current Disciple.Tools version: %1$s, required version: %2$s', 'disciple-tools-facebook' ), esc_html( $current_version ), esc_html( $dt_facebook_required_dt_theme_version ) );
}
// Check if it's been dismissed...
Expand Down Expand Up @@ -303,11 +303,11 @@ function dt_facebook_hook_admin_notice() {
/**
* AJAX handler to store the state of dismissible notices.
*/
if ( !function_exists( "dt_hook_ajax_notice_handler" ) ){
if ( !function_exists( 'dt_hook_ajax_notice_handler' ) ){
function dt_hook_ajax_notice_handler(){
check_ajax_referer( 'wp_rest_dismiss', 'security' );
if ( isset( $_POST["type"] ) ){
$type = sanitize_text_field( wp_unslash( $_POST["type"] ) );
if ( isset( $_POST['type'] ) ){
$type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
update_option( 'dismissed-' . $type, true );
}
}
Expand All @@ -324,11 +324,11 @@ function dt_hook_ajax_notice_handler(){
* @see https://github.com/DiscipleTools/disciple-tools-version-control/wiki/How-to-Update-the-Starter-Plugin
*/
add_action( 'plugins_loaded', function (){
if ( is_admin() && !( is_multisite() && class_exists( "DT_Multisite" ) ) || wp_doing_cron() ){
if ( is_admin() && !( is_multisite() && class_exists( 'DT_Multisite' ) ) || wp_doing_cron() ){
if ( ! class_exists( 'Puc_v4_Factory' ) ) {
// find the Disciple.Tools theme and load the plugin update checker.
foreach ( wp_get_themes() as $theme ){
if ( $theme->get( 'TextDomain' ) === "disciple_tools" && file_exists( $theme->get_stylesheet_directory() . '/dt-core/libraries/plugin-update-checker/plugin-update-checker.php' ) ){
if ( $theme->get( 'TextDomain' ) === 'disciple_tools' && file_exists( $theme->get_stylesheet_directory() . '/dt-core/libraries/plugin-update-checker/plugin-update-checker.php' ) ){
require( $theme->get_stylesheet_directory() . '/dt-core/libraries/plugin-update-checker/plugin-update-checker.php' );
}
}
Expand Down
86 changes: 43 additions & 43 deletions includes/admin/admin-menu-and-tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function instance() {
*/
public function __construct() {

add_action( "admin_menu", array( $this, "register_menu" ) );
add_action( 'admin_menu', array( $this, 'register_menu' ) );

} // End __construct()

Expand Down Expand Up @@ -77,8 +77,8 @@ public function content() {
wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.' ) );
}

if ( isset( $_GET["tab"] ) ) {
$tab = sanitize_key( wp_unslash( $_GET["tab"] ) );
if ( isset( $_GET['tab'] ) ) {
$tab = sanitize_key( wp_unslash( $_GET['tab'] ) );
} else {
$tab = 'general';
}
Expand All @@ -99,15 +99,15 @@ class="nav-tab <?php ( $tab == 'log' || !isset( $tab ) ) ? esc_attr_e( 'nav-tab-

<?php
switch ( $tab ) {
case "general":
case 'general':
$object = new DT_Facebook_Tab_General();
$object->content();
break;
case "instructions":
case 'instructions':
$object = new DT_Facebook_Tab_Instructions();
$object->content();
break;
case "log":
case 'log':
$object = new DT_Facebook_Tab_Log();
$object->content();
break;
Expand Down Expand Up @@ -176,7 +176,7 @@ public function main_column() {
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( "Facebook Integration Settings", 'disciple_tools' ) ?></th>
<th><?php esc_html_e( 'Facebook Integration Settings', 'disciple_tools' ) ?></th>
</tr>
</thead>
<tbody>
Expand All @@ -198,13 +198,13 @@ public function right_column() {
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( "Information", 'disciple_tools' ) ?></th>
<th><?php esc_html_e( 'Information', 'disciple_tools' ) ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php esc_html_e( "Content", 'disciple_tools' ) ?>
<?php esc_html_e( 'Content', 'disciple_tools' ) ?>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -249,7 +249,7 @@ public function main_column() {
<!-- Box -->


<h1><?php esc_html_e( "Recent Logs", 'disciple_tools' ) ?></h1>
<h1><?php esc_html_e( 'Recent Logs', 'disciple_tools' ) ?></h1>
<table class="widefat striped">
<thead>
<tr>
Expand All @@ -259,17 +259,17 @@ public function main_column() {
</tr>
</thead>
<tbody>
<?php $log = array_reverse( get_option( "dt_facebook_error_logs", [] ) );
<?php $log = array_reverse( get_option( 'dt_facebook_error_logs', [] ) );
foreach ( $log as $l ): ?>
<tr>
<td>
<?php echo esc_html( dt_format_date( $l["time"], "long" ) ) ?>
<?php echo esc_html( dt_format_date( $l['time'], 'long' ) ) ?>
</td>
<td>
<?php echo esc_html( $l["type"] ?? "Error" ); ?>
<?php echo esc_html( $l['type'] ?? 'Error' ); ?>
</td>
<td>
<?php echo esc_html( $l["message"] ); ?>
<?php echo esc_html( $l['message'] ); ?>
</td>
</tr>
<?php endforeach; ?>
Expand All @@ -286,13 +286,13 @@ public function right_column() {
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( "Information", 'disciple_tools' ) ?></th>
<th><?php esc_html_e( 'Information', 'disciple_tools' ) ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php esc_html_e( "Content", 'disciple_tools' ) ?>
<?php esc_html_e( 'Content', 'disciple_tools' ) ?>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -360,14 +360,14 @@ public function main_column() {
<td>
2. Click the <strong>Add new app</strong> button
</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/add_new_app.png" ) ?>" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/add_new_app.png' ) ?>" /></td>
</tr>
<tr>
<td>
3. Select Business Integration
</td>
<td>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/select_business.png" ) ?>" height="300px" />
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/select_business.png' ) ?>" height="300px" />
</td>
</tr>

Expand All @@ -378,32 +378,32 @@ public function main_column() {
Add your business manage account if you have one already.
</td>
<td>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/create_app_name.png" ) ?>" height="500px" />
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/create_app_name.png' ) ?>" height="500px" />
</td>
</tr>
<tr>
<td>5. You should be on the "Add a Product screen." Click <strong>Set Up</strong> on the "Facebook Login" box</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/products.png" ) ?>" height="400px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/products.png' ) ?>" height="400px" /></td>
</tr>
<tr>
<td>6. Choose the <strong>Other</strong> option</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/login_type.png" ) ?>" height="200px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/login_type.png' ) ?>" height="200px" /></td>
</tr>
<tr>
<td>7. On the left click <strong>settings</strong> under <strong>Facebook Login</strong></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/other_type.png" ) ?>" height="400px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/other_type.png' ) ?>" height="400px" /></td>
</tr>
<tr>
<td>8. In the <strong>Valid OAuth Redirect URIs</strong> field add:
<br>
<br>
<strong><?php echo esc_url( $rest_url. "/auth" ); ?></strong>
<strong><?php echo esc_url( $rest_url. '/auth' ); ?></strong>
</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/oauth_redirect.png" ) ?>" height="400px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/oauth_redirect.png' ) ?>" height="400px" /></td>
</tr>
<tr>
<td>9. Save Changes</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/save_changes.png" ) ?>" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/save_changes.png' ) ?>" /></td>
</tr>
<tr>
<td>
Expand All @@ -413,7 +413,7 @@ public function main_column() {
<strong><?php echo esc_url( get_site_url() ); ?></strong>

</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/app_domain.png" ) ?>" height="250px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/app_domain.png' ) ?>" height="250px" /></td>
</tr>
<tr>
<td>
Expand All @@ -422,27 +422,27 @@ public function main_column() {
<br>
https://raw.githubusercontent.com/DiscipleTools/disciple-tools-facebook/master/privacy.md
</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/privacy_policy.png" ) ?>" height="250px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/privacy_policy.png' ) ?>" height="250px" /></td>
</tr>
<tr>
<td>12. Scroll down. Click <strong>Add Platform</strong>.</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/add_platform.png" ) ?>" width="500px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/add_platform.png' ) ?>" width="500px" /></td>
</tr>
<tr>
<td>13. Choose <strong>Website</strong>. </td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/platforms.png" ) ?>" height="250px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/platforms.png' ) ?>" height="250px" /></td>
</tr>
<tr>
<td>14. In "Site URL" put: <br><br> <strong><?php echo esc_url( get_site_url() ); ?></strong></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/site_url.png" ) ?>" width="500px" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/site_url.png' ) ?>" width="500px" /></td>
</tr>
<tr>
<td>15. Save Changes</td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/save_changes.png" ) ?>" /></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/save_changes.png' ) ?>" /></td>
</tr>
<tr>
<td>16. In Settings > Basic: Get the <strong>APP ID</strong> and the <strong>APP SECRET</strong></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/app_ids.png" ) ?>" height="250px"/></td>
<td><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/app_ids.png' ) ?>" height="250px"/></td>
</tr>

</table>
Expand All @@ -453,23 +453,23 @@ public function main_column() {
<h1 style="margin-top: 40px"><a id="login"></a>2. Login to connect Disciple.Tools to Facebook</h1>
<ul style="list-style-type: disc; padding-left:40px">
<li>Enter the <strong>APP ID</strong> and the <strong>APP SECRET</strong> in on the first tab and click <strong>Login with Facebook</strong></li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/login.png" ) ?>" />
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/login.png' ) ?>" />
<li>
Hit continue on this page: <br>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/confirm_login_1.png" ) ?>" height="250px" />
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/confirm_login_1.png' ) ?>" height="250px" />
</li>
<li>
And then press OK: <br>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/confirm_login_2.png" ) ?>" height="250px" />
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/confirm_login_2.png' ) ?>" height="250px" />
</li>
<li>
Add your email address so the Integration can let you know if there is an issue. Click <strong>Save Email</strong>
<br><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/save_email.png" ) ?>" />
<br><img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/save_email.png' ) ?>" />
</li>
<li>Check <strong>Sync contacts</strong> next to the pages you want to set up to import contacts from</li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/sync_contacts.png" ) ?>" height="200px"/>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/sync_contacts.png' ) ?>" height="200px"/>
<li>Click <strong>Save Pages Settings</strong></li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/save_pages_settings.png" ) ?>"/>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/save_pages_settings.png' ) ?>"/>
</ul>

<br>
Expand All @@ -481,11 +481,11 @@ public function main_column() {
<ul style="list-style-type: disc; padding-left:40px">
<li>Open <a href="https://business.facebook.com/settings" target="_blank">Business Settings</a></li>
<li>Under Accounts click <strong>Apps.</strong></li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/business_apps.png" ) ?>" height="250px"/>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/business_apps.png' ) ?>" height="250px"/>
<li>Click <strong>Add New App</strong> and select <strong>Add an App</strong></li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/business_add_app.png" ) ?>" height="250px"/>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/business_add_app.png' ) ?>" height="250px"/>
<li>Enter the Facebook App ID from the app you just created.</li>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . "assets/business_app_id.png" ) ?>" height="200px"/>
<img src="<?php echo esc_html( plugin_dir_url( __DIR__ ) . 'assets/business_app_id.png' ) ?>" height="200px"/>
</ul>
<p>We also suggest adding your page to business manage</p>

Expand All @@ -510,7 +510,7 @@ public function main_column() {
<p>How to set up cron jobs for your instance: <a href="https://developers.disciple.tools/hosting/cron/">CRON Documentation</a></p>

<p>
Note: You might have previously been using Uptime Robot to call <?php echo esc_html( $rest_url . "/dt-public/cron" ); ?>. <br>
Note: You might have previously been using Uptime Robot to call <?php echo esc_html( $rest_url . '/dt-public/cron' ); ?>. <br>
You can change it to point to the wp-cron.php hook. But we recommend using the system cron instead.
</p>

Expand All @@ -526,7 +526,7 @@ public function right_column() {
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( "Links", 'disciple_tools' ) ?></th>
<th><?php esc_html_e( 'Links', 'disciple_tools' ) ?></th>
</tr>
</thead>
<tbody>
Expand Down
Loading

0 comments on commit df9b467

Please sign in to comment.