fix names
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Dec 2014 16:11:19 +0000 (11:11 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Dec 2014 16:11:19 +0000 (11:11 -0500)
use single case name to keep confusion from entering

models/block.php

index 8fcfb30..c0baf44 100644 (file)
@@ -81,13 +81,13 @@ class glm_models_block
 
     public function metaBoxCallBack($post)
     {
-        $glm_blocks_url     = ($post)
+        $glm_block_url     = ($post)
             ? get_post_meta($post->ID, 'glm_block_url', true)
             : '';
-        $glm_blocks_ext_url = ($post)
+        $glm_block_ext_url = ($post)
             ? get_post_meta($post->ID, 'glm_block_ext_url', true)
             : '';
-        $glm_blocks_page    = ($post)
+        $glm_block_page    = ($post)
             ? get_post_meta($post->ID, 'glm_block_page', true)
             : '';
         include $this->pluginDirName . 'views/admin/metaBoxes.php';
@@ -128,12 +128,18 @@ class glm_models_block
         );
         $blocks = get_posts($args);
         foreach ($blocks as $block) {
+            $block->externalUrl = false;
             $custom                   = get_post_custom($block->ID);
             if ($custom['glm_block_url'][0] == 'page') {
                 $block->url = get_permalink($custom['glm_block_page'][0]);
             }
             if ($custom['glm_block_url'][0] == 'url') {
-                $block->url = $custom['glm_block_ext_url'][0];
+                if ($custom['glm_block_ext_url'][0] != '') {
+                    $block->url = (preg_match('/^http:\/\//', $custom['glm_block_ext_url'][0]))
+                        ? $custom['glm_block_ext_url'][0]
+                        : 'http://' . $custom['glm_block_ext_url'][0];
+                    $block->externalUrl = true;
+                }
             }
             $block->thumbnail         = get_the_post_thumbnail(
                 $block->ID, array(298, 228), array('class' => 'aligncenter')