Video code now respects http:// or lack thereof, adding if necessary
authorlaury <laury@gaslightmedia.com>
Fri, 22 Jul 2016 17:09:45 +0000 (13:09 -0400)
committerlaury <laury@gaslightmedia.com>
Fri, 22 Jul 2016 17:09:45 +0000 (13:09 -0400)
models/admin/management/videos.php
setup/adminHooks.php

index cc06d80..8dd48f8 100644 (file)
@@ -55,6 +55,12 @@ class GlmMembersAdmin_management_videos
         $this->config = $config;
 
     }
+    
+    public function addScheme($url, $scheme = 'http://')
+    {
+        return parse_url($url, PHP_URL_SCHEME) === null ?
+        $scheme . $url : $url;
+    }
 
     /*
      * Perform Model Action
@@ -113,9 +119,11 @@ class GlmMembersAdmin_management_videos
         if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') {
             $option = $_REQUEST['option'];
         }
+        
 
         switch($option) {
         case 'transfer_videos':
+            
             $resultMessage = '<pre>$_REQUEST: ' . print_r($_REQUEST, true) . '</pre>';
             $sql = "
             SELECT id,descr,video_url
@@ -133,8 +141,10 @@ class GlmMembersAdmin_management_videos
                         // match 0 is the whole iframe
                         $iframeCode = $matches[0];
                         // from the first matched element get the src attribute
+                        echo "TEST". $this->addScheme($srcMatches[0])."TESTEND";
                         if ( preg_match( '%youtube.com/embed/([^?"]*)%', $matches[1], $srcMatches ) ) {
                             echo '<pre>$srcMatches: ' . print_r($srcMatches, true) . '</pre>';
+                            
                         }
                         $sqlUpdate = "
                         UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info
index 23a750a..1e86d66 100644 (file)
@@ -105,12 +105,5 @@ if(!empty($locations))
 //    }
 //}
 
-if (!function_exists('addScheme')) {
-    function addScheme($url, $scheme = 'http://')
-    {
-      return parse_url($url, PHP_URL_SCHEME) === null ?
-        $scheme . $url : $url;
-    }
-}
  
 ?>
\ No newline at end of file