This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Pull $username, $password, $client_id, $client_secret from the options table | |
| $connection = new \RebuildTexasMigrations\Core\Connection( $username, $password, $client_id, $client_secret ); | |
| $connection->connect(); | |
| if ( ! $connection->is_connected() ) { | |
| wp_send_json_error( esc_html__( 'An error occurred while connecting to the Salesforce API. Please check your username and password and try again.', 'rebuild-migration' ) ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "dataCells": [ | |
| { | |
| "escapedLabel": "Aransas Pass Chamber of Commerce - Mar 2018", | |
| "label": "Aransas Pass Chamber of Commerce - Mar 2018", | |
| "value": "Aransas Pass Chamber of Commerce - Mar 2018" | |
| }, | |
| { | |
| "label": "a0q1I000000xh0Y", | |
| "value": "a0q1I000000xh0YQAQ" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $image_url = 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'; | |
| if ( km_remote_image_file_exists( $url ) ) { | |
| echo 'The remote image exists! Hooray!'; | |
| } else { | |
| echo 'The remote image does not exist. Boooooo.'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Check if a remote image file exists. | |
| * | |
| * @param string $url The url to the remote image. | |
| * @return bool Whether the remote image exists. | |
| */ | |
| function km_remote_image_file_exists( $url ) { | |
| $response = wp_remote_head( $url ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Limit a Pages post collection request to only users with the required permissions. | |
| * | |
| * @author Kellen Mace | |
| * | |
| * @param array $args Key value array of query var to query value. | |
| * | |
| * @return array $args Key value array of query var to query value, possibly modified. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Class to access pages via the REST API. | |
| * | |
| * @author Kellen Mace | |
| * | |
| * @see WP_REST_Posts_Controller | |
| * @see WP_REST_Controller | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Set up a custom REST API controller class for the Page post type. | |
| * | |
| * @author Kellen Mace | |
| * | |
| * @param array $args The post type arguments. | |
| * @param string $name The name of the post type. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Require the file that contains the KM_Download_Remote_Image class. | |
| require_once plugin_dir_path( __FILE__ ) . 'inc/class-download-remote-image.php'; | |
| /** | |
| * Download a remote image, insert it into the media library | |
| * and set it as a post's featured image. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This class handles downloading a remote image file and inserting it | |
| * into the WP Media Library. | |
| * | |
| * Usage: | |
| * $download_remote_image = new KM_Download_Remote_Image( $url ); | |
| * $attachment_id = $download_remote_image->download(); | |
| * |