| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined( 'ABSPATH' ) || exit; | |
| 3 | - | |
| 4 | 2 | use function Timetics\timetics; |
| 5 | 3 | use Timetics\Core\Bookings\Booking; |
| 6 | 4 | use Timetics\Core\Integrations\Google\Client; |
| 7 | 5 | use Timetics\Core\Integrations\Google\Service\Calendar; |
| @@ -168,11 +166,11 @@ | ||
| 168 | 166 | * |
| 169 | 167 | * @return string |
| 170 | 168 | */ |
| 171 | 169 | function timetics_get_google_auth_url() { |
| 172 | - $local_url = site_url( 'timetics-integration/google-auth' ); | |
| 170 | + $client = timetics_get_google_client(); | |
| 173 | 171 | |
| 174 | - return wp_nonce_url( $local_url, 'timetics_auth_action', 'timetics_auth_nonce' ); | |
| 172 | + return $client->get_auth_url(); | |
| 175 | 173 | } |
| 176 | 174 | } |
| 177 | 175 | |
| 178 | 176 | if ( ! function_exists( 'timetics_get_posts' ) ) { |
| @@ -750,151 +748,6 @@ | ||
| 750 | 748 | } |
| 751 | 749 | } |
| 752 | 750 | |
| 753 | 751 | return $integration_names; |
| 754 | - } | |
| 755 | -} | |
| 756 | - | |
| 757 | -if ( ! function_exists( 'timetics_modules_list' ) ) { | |
| 758 | - /** | |
| 759 | - * Get the master list of Arraytics plugins for the About Us page. | |
| 760 | - * | |
| 761 | - * Each entry describes an external Arraytics plugin that can be | |
| 762 | - * installed/activated/deactivated from within the Timetics admin. | |
| 763 | - * | |
| 764 | - * @return array | |
| 765 | - */ | |
| 766 | - function timetics_modules_list(): array { | |
| 767 | - return [ | |
| 768 | - 'eventin' => [ | |
| 769 | - 'name' => 'eventin', | |
| 770 | - 'slug' => 'wp-event-solution', | |
| 771 | - 'type' => 'plugin', | |
| 772 | - 'upgrade' => false, | |
| 773 | - 'upgrade_link' => 'https://themewinter.com/eventin', | |
| 774 | - 'status' => 'on', | |
| 775 | - 'is_pro' => false, | |
| 776 | - 'title' => __( 'Eventin', 'timetics' ), | |
| 777 | - 'description' => __( 'Best Free WordPress Event Calendar Plugin to manage booking, registration, RSVPs, schedule recurring events and sell event tickets with WooCommerce.', 'timetics' ), | |
| 778 | - 'icon' => \Timetics\Core\Addon\Extension_Icon::get( 'eventin' ), | |
| 779 | - 'notice' => '', | |
| 780 | - 'demo_link' => 'https://product.themewinter.com/eventin', | |
| 781 | - 'settings_link' => '', | |
| 782 | - 'doc_link' => 'https://support.themewinter.com/docs/plugins/docs/eventin/', | |
| 783 | - ], | |
| 784 | - 'booktics' => [ | |
| 785 | - 'name' => 'booktics', | |
| 786 | - 'slug' => 'booktics', | |
| 787 | - 'type' => 'plugin', | |
| 788 | - 'upgrade' => false, | |
| 789 | - 'upgrade_link' => 'https://arraytics.com/booktics', | |
| 790 | - 'status' => 'on', | |
| 791 | - 'is_pro' => false, | |
| 792 | - 'title' => __( 'Booktics', 'timetics' ), | |
| 793 | - 'description' => __( 'The ultimate online booking plugin for WordPress — services, staff, schedules, and payments in one place.', 'timetics' ), | |
| 794 | - 'icon' => \Timetics\Core\Addon\Extension_Icon::get( 'booktics' ), | |
| 795 | - 'notice' => '', | |
| 796 | - 'demo_link' => 'https://arraytics.com/booktics', | |
| 797 | - 'settings_link' => '', | |
| 798 | - 'doc_link' => 'https://docs.arraytics.com/docs/booktics/', | |
| 799 | - ], | |
| 800 | - 'poptics' => [ | |
| 801 | - 'name' => 'poptics', | |
| 802 | - 'slug' => 'poptics', | |
| 803 | - 'type' => 'plugin', | |
| 804 | - 'upgrade' => false, | |
| 805 | - 'upgrade_link' => 'https://arraytics.com/poptics', | |
| 806 | - 'status' => 'on', | |
| 807 | - 'is_pro' => false, | |
| 808 | - 'title' => __( 'Poptics', 'timetics' ), | |
| 809 | - 'description' => __( 'Discover the ultimate popup mix with Poptics Popup Builder to boost your lead generation and sales conversions.', 'timetics' ), | |
| 810 | - 'icon' => \Timetics\Core\Addon\Extension_Icon::get( 'poptics' ), | |
| 811 | - 'notice' => '', | |
| 812 | - 'demo_link' => 'https://arraytics.com/poptics', | |
| 813 | - 'settings_link' => '', | |
| 814 | - 'doc_link' => 'https://docs.aethonic.com/docs/getting-started/intro/', | |
| 815 | - ], | |
| 816 | - 'wpcafe' => [ | |
| 817 | - 'name' => 'wpcafe', | |
| 818 | - 'slug' => 'wp-cafe', | |
| 819 | - 'type' => 'plugin', | |
| 820 | - 'upgrade' => false, | |
| 821 | - 'upgrade_link' => 'https://themewinter.com/wpcafe', | |
| 822 | - 'status' => 'on', | |
| 823 | - 'is_pro' => false, | |
| 824 | - 'title' => __( 'WPCafe', 'timetics' ), | |
| 825 | - 'description' => __( 'WPCafe — Restaurant plugin with Online Ordering, Delivery, Pickup, Food Menu, Reservations, and Table Management.', 'timetics' ), | |
| 826 | - 'icon' => \Timetics\Core\Addon\Extension_Icon::get( 'wpcafe' ), | |
| 827 | - 'notice' => '', | |
| 828 | - 'demo_link' => 'https://product.themewinter.com/wpcafe', | |
| 829 | - 'settings_link' => '', | |
| 830 | - 'doc_link' => 'https://support.themewinter.com/docs/plugins/docs/wp-cafe/', | |
| 831 | - ], | |
| 832 | - ]; | |
| 833 | - } | |
| 834 | -} | |
| 835 | - | |
| 836 | -if ( ! function_exists( 'timetics_extension' ) ) { | |
| 837 | - /** | |
| 838 | - * Get the Timetics Extension manager instance (tools-sdk). | |
| 839 | - * | |
| 840 | - * @return \Arraytics\ToolsSdk\Extension | |
| 841 | - */ | |
| 842 | - function timetics_extension(): \Arraytics\ToolsSdk\Extension { | |
| 843 | - return new \Arraytics\ToolsSdk\Extension( 'timetics_available_modules', timetics_modules_list() ); | |
| 844 | - } | |
| 845 | -} | |
| 846 | - | |
| 847 | -if ( ! function_exists( 'timetics_get_enabled_modules' ) ) { | |
| 848 | - /** | |
| 849 | - * Get list of enabled module slugs. | |
| 850 | - * | |
| 851 | - * @return array | |
| 852 | - */ | |
| 853 | - function timetics_get_enabled_modules(): array { | |
| 854 | - $modules = get_option( 'timetics_available_modules', [] ); | |
| 855 | - | |
| 856 | - if ( empty( $modules ) || ! is_array( $modules ) ) { | |
| 857 | - return []; | |
| 858 | - } | |
| 859 | - | |
| 860 | - $enabled = []; | |
| 861 | - | |
| 862 | - foreach ( $modules as $slug => $data ) { | |
| 863 | - if ( is_array( $data ) && isset( $data['status'] ) && 'on' === $data['status'] ) { | |
| 864 | - $enabled[] = $slug; | |
| 865 | - } elseif ( is_string( $data ) && 'on' === $data ) { | |
| 866 | - $enabled[] = $slug; | |
| 867 | - } | |
| 868 | - } | |
| 869 | - | |
| 870 | - return $enabled; | |
| 871 | - } | |
| 872 | -} | |
| 873 | - | |
| 874 | -if ( ! function_exists( 'timetics_format_email_datetime' ) ) { | |
| 875 | - /** | |
| 876 | - * Format date, time and day according to WordPress admin settings | |
| 877 | - * Used in email templates to display consistent date/time formats | |
| 878 | - * | |
| 879 | - * @param string $start_date Start date (Y-m-d format) | |
| 880 | - * @param string $start_time Start time (h:i a format) | |
| 881 | - * | |
| 882 | - * @return array Array with 'day', 'time', 'date' keys | |
| 883 | - */ | |
| 884 | - function timetics_format_email_datetime( $start_date, $start_time = '' ) { | |
| 885 | - $wp_date_format = get_option( 'date_format' ); | |
| 886 | - $wp_time_format = get_option( 'time_format' ); | |
| 887 | - | |
| 888 | - $datetime = $start_time | |
| 889 | - ? $start_date . ' ' . $start_time | |
| 890 | - : $start_date; | |
| 891 | - | |
| 892 | - $timestamp = strtotime( $datetime ); | |
| 893 | - | |
| 894 | - return [ | |
| 895 | - 'day' => date_i18n( 'l', $timestamp ), | |
| 896 | - 'time' => date_i18n( $wp_time_format, $timestamp ), | |
| 897 | - 'date' => date_i18n( $wp_date_format, $timestamp ), | |
| 898 | - ]; | |
| 899 | 752 | } |
| 900 | 753 | } |