Jake Vanderwerf
2026-08-28 a9654f00c8fbc9934289d761843ddd071025013f
inc/integrations/services/InstagramOld.php
@@ -5,9 +5,11 @@
 */
namespace JVBase\integrations\services;
use Exception;
use JVBase\integrations\Integrations;
use JVBase\meta\Meta;
use WP_Error;
use WP_Post;
if (!defined('ABSPATH')) {
   exit;
@@ -257,7 +259,7 @@
   /**
    * Handle post save - queue Instagram post creation
    */
   public function handleTheSavePost(int $postID, \WP_Post $post, bool $update, array $settings): void
   public function handleTheSavePost(int $postID, WP_Post $post, bool $update, array $settings): void
   {
      if (!$this->hasOAuthCredentials()) {
@@ -280,23 +282,16 @@
   /**
    * Process queued operations
    */
   public function processOperation(\WP_Error|array $result, object $operation, array $data): \WP_Error|array
   public function processOperation(WP_Error|array $result, object $operation, array $data): WP_Error|array
   {
      $base = strtolower($this->service_name) . '_';
      $insta = (array_key_exists('user', $data)) ? new self((int)$data['user']) : $this;
      switch ($operation->type) {
         case $base . 'create_post':
            return $insta->processCreatePost($data);
         case $base . 'create_story':
            return $insta->processCreateStory($data);
         case $base . 'delete_post':
            return $insta->processDeletePost($data);
         default:
            return $result;
      }
      return match ($operation->type) {
         $base . 'create_post' => $insta->processCreatePost($data),
         $base . 'create_story' => $insta->processCreateStory($data),
         $base . 'delete_post' => $insta->processDeletePost($data),
         default => $result,
      };
   }
   private function processDeletePost(array $data): array
@@ -382,7 +377,7 @@
   /**
    * Build caption for Instagram post
    */
   private function buildCaption(\WP_Post $post): string
   private function buildCaption(WP_Post $post): string
   {
      $caption_parts = [];
@@ -410,7 +405,7 @@
            $default = preg_split('/[\s,]+/', $this->post_settings['default_hashtags']);
            foreach ($default as $tag) {
               $tag = trim($tag);
               if (strpos($tag, '#') !== 0) {
               if (!str_starts_with($tag, '#')) {
                  $tag = '#' . $tag;
               }
               $hashtags[] = $tag;