"Phone Button", // the name of the plugin 'developer_website' => "https://www.yydevelopment.com", // link to the developer website page 'plugin_review_page' => "https://wordpress.org/plugins/phone-button/#reviews", // link to the plugin support page 'plugin_support_link' => "https://wordpress.org/support/plugin/phone-button/", // link to the plugin review page 'plugin_donate_link' => "https://www.yydevelopment.com/coffee-break/?plugin=phone-button", // link to the plugin donate page 'company_plugins_page' => "https://www.yydevelopment.com/yydevelopment-wordpress-plugins/", // link to the main company plugins page 'icon_image_path' => plugins_url() . "/" . basename( dirname( __FILE__ ) ) . "/images/icon.png", // link to the plugin icon 'save_database_time_stamp_name' => "yydev_phone_btn_timestamp", // database input name to save data 'send_mail_in_days' => (30 * 60 * 60 * 24) + strtotime("now"), // the amount of time after we show the notice (4 months) ); // ================================================ // creating time stamp if it doesn't exists // ================================================ // loading the plugin version from the database $plugin_db_timestamp = get_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name']); // checking if the plugin version exists on the dabase // and checking if the database version equal to the plugin version $plugin_version if( empty($plugin_db_timestamp) ) { // update the plugin version in the database update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], $yydev_phone_btn_notice_info_array['send_mail_in_days']); $plugin_db_timestamp = get_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name']); } // if( empty($plugin_db_timestamp) ) { // add_action('plugins_loaded', 'my_awesome_plugin_check_version'); // ================================================ // ajax function for when the visitor click on the buttons // ================================================ // when the visitor want to stop getting the messages function yydev_phone_btn_stop_notice_forever() { // Verify nonce for security if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) { wp_die('Security check failed'); } // Check if user has proper capabilities if (!current_user_can('manage_options')) { wp_die('Insufficient permissions'); } global $yydev_phone_btn_notice_info_array; update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], 'stop'); wp_die(); // Use wp_die() instead of die() for WordPress AJAX } // function yydev_phone_btn_stop_notice_forever() { add_action( 'wp_ajax_yydev_phone_btn_stop_notice_forever', 'yydev_phone_btn_stop_notice_forever' ); // when the visitor ask to get the message in the future function yydev_phone_btn_stop_notice_for_now() { // Verify nonce for security if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'yydev_phone_btn_nonce')) { wp_die('Security check failed'); } // Check if user has proper capabilities if (!current_user_can('manage_options')) { wp_die('Insufficient permissions'); } global $yydev_phone_btn_notice_info_array; update_option($yydev_phone_btn_notice_info_array['save_database_time_stamp_name'], $yydev_phone_btn_notice_info_array['send_mail_in_days']); wp_die(); // Use wp_die() instead of die() for WordPress AJAX } // function yydev_phone_btn_stop_notice_for_now() { add_action( 'wp_ajax_yydev_phone_btn_stop_notice_for_now', 'yydev_phone_btn_stop_notice_for_now' ); // ================================================ // update the time stamp if the user click on one of the button // ================================================ // creating a function with admin notice output function yydev_phone_btn_admin_notice($notice_info_array) { global $yydev_phone_btn_notice_info_array; $plugin_name = $yydev_phone_btn_notice_info_array['plugin_name']; $developer_website = $yydev_phone_btn_notice_info_array['developer_website']; $plugin_review_page = $yydev_phone_btn_notice_info_array['plugin_review_page']; $plugin_support_link = $yydev_phone_btn_notice_info_array['plugin_support_link']; $plugin_donate_link = $yydev_phone_btn_notice_info_array['plugin_donate_link']; $company_plugins_page = $yydev_phone_btn_notice_info_array['company_plugins_page']; $icon_image_path = $yydev_phone_btn_notice_info_array['icon_image_path']; $save_database_time_stamp_name = $yydev_phone_btn_notice_info_array['save_database_time_stamp_name']; ?>