Plugin Directory

Changeset 412626


Ignore:
Timestamp:
07/20/2011 03:14:45 PM (15 years ago)
Author:
kcfried
Message:
  • Optimized page meta into a single array
  • Streamlined/cleaned up miscecllaneous code
  • Added "Defer to Global" in page menu settings
  • Perfected page level override logic
Location:
fanpage-connect/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fanpage-connect/trunk/fanpage-connect-meta.php

    r410279 r412626  
    33    <?php if($this->plugin_activated): ?>
    44
    5     <input type="hidden" id="_fbfp_cookie" name="_fbfp_cookie" value="true">
    6 
    75    <label>Make this page a FanPage?</label>
    8     <select id="_fbfp_isfanpage" name="_fbfp_isfanpage">
    9     <?php if($isfanpage == "true"): ?>
     6    <select id="_fbfp_isfanpage" name="_fbfp[isfanpage]">
     7    <?php if($meta['isfanpage'] == "true"): ?>
    108    <option value="false">No</option>
    119    <option value="true" selected="selected">Yes</option>
     
    1917    </p>
    2018
    21     <?php if($isfanpage == "true"): ?>
     19    <?php if($meta['isfanpage'] == "true"): ?>
    2220    <div id="fpc_other_meta">
    2321    <?php else: ?>
     
    2725        <div class="fpc-menu-header" id="hdr-app-settings">Facebook Application Settings</div>
    2826        <div class="fpc-menu" id="fpc-app-settings">
    29             <label for="_fbfp_appid">Facebook Application ID:</label>
     27            <label for="_fbfp[appid]">Facebook Application ID:</label>
    3028            <p>
    31                 <input type="text" id="_fbfp_appid" name="_fbfp_appid" value="<?php echo $fbappid; ?>">
     29                <input type="text" id="_fbfp[appid]" name="_fbfp[appid]" value="<?php echo $meta['appid']; ?>">
    3230                <div class="desc">
    3331                    Enter the Application ID of your Facebook Application. Learn how to create your Facebook application
     
    3634            </p>
    3735
    38             <label for="_fbfp_appsecret">Facebook Application Secret:</label>
     36            <label for="_fbfp[appsecret]">Facebook Application Secret:</label>
    3937            <p>
    40                 <input type="text" id="_fbfp_appsecret" name="_fbfp_appsecret" value="<?php echo $fbappsecret; ?>">
     38                <input type="text" id="_fbfp[appsecret]" name="_fbfp[appsecret]" value="<?php echo $meta['appsecret']; ?>">
    4139                <div class="desc">Enter the Application Secret of your Facebook Application.</div>
    4240            </p>
     
    4543        <div class="fpc-menu-header" id="hdr-menu-settings">Menu Settings</div>
    4644        <div class="fpc-menu" id="fpc-menu-settings">
    47             <label for="_fbfp_use_menu">Use Menu In Page?</label>
    48             <select id="_fbfp_use_menu" name="_fbfp_use_menu">
    49             <?php if($pg_use_menu == "true") { ?>
     45            <label for="_fbfp[use_menu]">Use Menu In Page?</label>
     46            <select id="_fbfp[use_menu]" name="_fbfp[use_menu]">
     47            <?php if($meta['use_menu'] == "true") { ?>
     48            <option value="defer">Defer to Global</option>
    5049            <option value="false">No</option>
    5150            <option value="true" selected="selected">Yes</option>
     51            <?php } elseif($meta['use_menu'] == "false") { ?>
     52            <option value="defer">Defer to Global</option>
     53            <option value="false" selected="selected">No</option>
     54            <option value="true">Yes</option>
    5255            <?php } else { ?>
    53             <option value="false" selected="selected">No</option>
     56            <option value="defer" selected="selected">Defer to Global</option>
     57            <option value="false">No</option>
    5458            <option value="true">Yes</option>
    5559            <?php } ?>
     
    6165            </p>
    6266
    63             <label for="_fbfp_show_menu">Display Menu</label>
    64             <select id="_fbfp_show_menu" name="_fbfp_show_menu">
    65             <?php if($pg_show_menu == "liked" || $pg_show_menu == '' || is_null($pg_show_menu)) { ?>
     67            <label for="_fbfp[show_menu]">Display Menu:</label>
     68            <select id="_fbfp[show_menu]" name="_fbfp[show_menu]">
     69            <?php if($meta['show_menu'] == "liked") { ?>
     70            <option value="defer">Defer to Global</option>
    6671            <option value="always">Always</option>
    6772            <option value="liked" selected="selected">Only When &quot;Liked&quot;</option>
     73            <?php } elseif($meta['show_menu'] == "always") { ?>
     74            <option value="defer">Defer to Global</option>
     75            <option value="always" selected="selected">Always</option>
     76            <option value="liked">Only When &quot;Liked&quot;</option>
    6877            <?php } else { ?>
     78            <option value="defer">Defer to Global</option>
    6979            <option value="always" selected="selected">Always</option>
    7080            <option value="liked">Only When &quot;Liked&quot;</option>
     
    8090        <div class="fpc-menu-header" id="hdr-css-settings">CSS Settings</div>
    8191        <div class="fpc-menu" id="fpc-css-settings">
    82             <label for="_fbfp_csslink">Custom CSS link:</label>
     92            <label for="_fbfp[csslink]">Custom CSS link:</label>
    8393            <p>
    84                 <input type="text" id="_fbfp_csslink" name="_fbfp_csslink" value="<?php echo $fbcsslink; ?>">
     94                <input type="text" id="_fbfp[csslink]" name="_fbfp[csslink]" value="<?php echo $meta['csslink']; ?>">
    8595                <div class="desc">Enter the URL of the CSS file you'd like to use on your fanpage.</div>
    8696            </p>
    8797
    88             <label for="_fbfp_css">Custom CSS:</label>
     98            <label for="_fbfp[css]">Custom CSS:</label>
    8999            <p>
    90                 <textarea id="_fbfp_css" name="_fbfp_css"><?php echo $fbcss; ?></textarea>
     100                <textarea id="_fbfp[css]" name="_fbfp[css]"><?php echo $meta['css']; ?></textarea>
    91101                <div class="desc">Copy and paste any CSS you'd like to use on your fanpage. This will be loaded after any other CSS file</div>
    92102            </p>
     
    95105        <div class="fpc-menu-header" id="hdr-hdrftr-settings">Header/Footer Content</div>
    96106        <div class="fpc-menu" id="fpc-hdrftr-settings">
    97             <label for="_fbfp_header">Custom Header Content:</label>
     107            <label for="_fbfp[header]">Custom Header Content:</label>
    98108            <p>
    99                 <textarea id="_fbfp_header" name="_fbfp_header"><?php echo $fbheadercontent; ?></textarea>
     109                <textarea id="_fbfp[header]" name="_fbfp[header]"><?php echo $meta['header']; ?></textarea>
    100110                <div class="desc">Paste any custom header content here. It'll be displayed in the &lt;div id="header"&gt; div.</div>
    101111            </p>
    102112
    103             <label for="_fbfp_footer">Custom Footer Content:</label>
     113            <label for="_fbfp[footer]">Custom Footer Content:</label>
    104114            <p>
    105                 <textarea id="_fbfp_footer" name="_fbfp_footer"><?php echo $fbfootercontent; ?></textarea>
     115                <textarea id="_fbfp[footer]" name="_fbfp[footer]"><?php echo $meta['footer']; ?></textarea>
    106116                <div class="desc">Paste any custom footer content here. It'll be displayed in the &lt;div id="footer"&gt; div.</div>
    107117            </p>
     
    111121        <div class="fpc-menu" id="fpc-misc-settings">
    112122
    113             <label for="_fbfp_show_comments">Display Comments</label>
    114             <select id="_fbfp_show_comments" name="_fbfp_show_comments">
    115             <?php if($pg_show_comments == "liked" || $pg_show_comments == '' || is_null($pg_show_comments)) { ?>
     123            <label for="_fbfp[show_comments]">Display Comments:</label>
     124            <select id="_fbfp[show_comments]" name="_fbfp[show_comments]">
     125            <?php if($meta['show_comments'] == "liked" || $meta['show_comments'] == '' || is_null($meta['show_comments'])) { ?>
    116126            <option value="always">Always</option>
    117127            <option value="liked" selected="selected">Only When &quot;Liked&quot;</option>
     
    127137            </p>
    128138
    129             <label for="_fbfp_template">Custom Template:</label>
    130             <p>
    131                 <?php echo $this->fpc_get_templates($fbtemplate); ?>
    132             </p>
     139            <label for="_fbfp[template]">Custom Template:</label>
     140            <?php echo $this->fpc_get_templates($meta['template']); ?>
    133141
    134142        </div>
  • fanpage-connect/trunk/fanpage-connect-options.php

    r410279 r412626  
    132132                        <td>
    133133                            <select id="fpogtype" name="fpogtype">
    134                             <option value="Chose a type">Chose a type</option>
     134                            <option value="">Chose a type</option>
    135135                            <option value="activity">activity</option>
    136136                            <option value="actor">actor</option>
  • fanpage-connect/trunk/fanpage-connect.php

    r410279 r412626  
    33Plugin Name: Fanpage Connect FREE
    44Plugin URI: http://www.fanpageconnect.com
    5 Version: v1.3.1
    6 Author: <a href="http://www.fanpageconnect.com">Pat Friedl, Chris Friedl, Bryan Batson</a>
     5Version: v1.3.2
     6Author: Pat Friedl, Chris Friedl, Bryan Batson
    77Description: Fanpage Connect is the WordPress plugin that allows you to create an administer your Facebook fan pages directly from WordPress.
    88
     
    3535        var $fbappid;
    3636        var $fbappsecret;
    37         var $fbcookie;
    38         var $fbautofit;
    3937        var $fbcsslink;
    4038        var $fbcss;
     
    6058
    6159        // other variables
    62         var $use_menu;
    63         var $show_menu;
    6460        var $link_luv;
    6561        var $fb_error;
     
    8177
    8278            if (!defined('FPC_PLUGIN_VERSION'))
    83                 define('FPC_PLUGIN_VERSION','1.3.1');
     79                define('FPC_PLUGIN_VERSION','1.3.2');
    8480
    8581            global $post;
     
    8783            // pre-empt all other content
    8884            add_action('wp',array(&$this, 'dofbpage'),1);
    89 
    90             // get post and find google fonts
    91             add_action('save_post', array(&$this, 'fpc_setup_google_fonts'));
    9285
    9386            // add admin menu
     
    129122            $this->g_fpogimg = $options['fpogimg'];
    130123            $this->g_fpogname = $options['fpogname'];
     124
    131125            $this->domain = $this->get_domain();
    132126
    133             if($this->g_use_menu == '' || is_null($this->g_use_menu)) { $this->g_use_menu = false; }
    134             if($this->g_show_menu == '' || is_null($this->g_show_menu)) { $this->g_show_menu = 'liked'; }
    135             if($this->link_luv == '' || is_null($this->link_luv)) { $this->link_luv = 1; }
     127            if(empty($this->g_use_menu)) { $this->g_use_menu = false; }
     128            if(empty($this->g_show_menu)) { $this->g_show_menu = 'liked'; }
     129            if(empty($this->link_luv)) { $this->link_luv = 1; }
    136130
    137131        } // end function FanpageConnect
     
    144138            global $post;
    145139
    146             $this->isfanpage = $this->get_value(get_post_meta($post->ID, '_fbfp_isfanpage', true),false);
     140            $this->convert_old_meta($post->ID);
     141            $page_meta = get_post_meta($post->ID, '_fbfp', true);
     142            $this->isfanpage = $page_meta['isfanpage'];
    147143            $pos = strpos($_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'],'wp-admin/edit.php',0);
    148             $parmPrefix = (strpos($this->g_fp_url,'?') === false)? '?' : '&';
    149             $link_luv_url = 'http://www.fanpageconnect.com';
    150144
    151145            if ((is_page() || is_object($post)) && $this->isfanpage == 'true' && $pos === false) {
    152146
    153                 // change - get meta as an array, forget forcing values - next version!
    154                 $this->fbappid = $this->get_value(get_post_meta($post->ID, '_fbfp_appid', true),'');
    155                 $this->fbappsecret = $this->get_value(get_post_meta($post->ID, '_fbfp_appsecret', true),'');
    156                 $this->fbcookie = $this->get_value(get_post_meta($post->ID, '_fbfp_cookie', true),true);
    157                 $this->fbcsslink = $this->get_value(get_post_meta($post->ID, '_fbfp_csslink', true),'');
    158                 $this->fbcss = $this->get_value(get_post_meta($post->ID, '_fbfp_css', true),'');
    159                 $this->fbtemplate = $this->get_value(get_post_meta($post->ID, '_fbfp_template', true),'');
    160                 $this->fbheadercontent = $this->get_value(get_post_meta($post->ID, '_fbfp_header', true),'');
    161                 $this->fbfootercontent = $this->get_value(get_post_meta($post->ID, '_fbfp_footer', true),'');
    162                 $this->use_menu = $this->get_value(get_post_meta($post->ID, '_fbfp_use_menu',true),false);
    163                 $this->show_menu = $this->get_value(get_post_meta($post->ID, '_fbfp_show_menu',true),'liked');
    164                 $this->show_comments = $this->get_value(get_post_meta($post->ID, '_fbfp_show_comments',true),'liked');
    165                 $this->google_fonts = $this->get_value(get_post_meta($post->ID, '_fbfp_goole_fonts', true),'');
     147                $parmPrefix = (strpos($this->g_fp_url,'?') === false)? '?' : '&';
     148                $link_luv_url = 'http://www.fanpageconnect.com';
     149
     150                // free variables
     151                $this->fbappid = $page_meta['appid'];
     152                $this->fbappsecret = $page_meta['appsecret'];
     153                $this->fbcsslink = $page_meta['csslink'];
     154                $this->fbcss = $page_meta['css'];
     155                $this->fbtemplate = $page_meta['template'];
     156                $this->fbheadercontent = $page_meta['header'];
     157                $this->fbfootercontent = $page_meta['footer'];
     158                $this->show_comments = $page_meta['show_comments'];
     159                $this->google_fonts = $page_meta['google_fonts'];
     160
     161                $this->get_overrides($page_meta);
    166162
    167163                // send a header for IE
     
    176172                  'appId'  => $this->fbappid,
    177173                  'secret' => $this->fbappsecret,
    178                   'cookie' => $this->fbcookie
     174                  'cookie' => TRUE
    179175                ));
    180176
     
    245241<meta property="fb:admins" content="<?php echo $this->fbappid; ?>">
    246242<title><?php bloginfo('name'); ?> - <?php is_home() ? bloginfo('description') : wp_title(''); ?></title>
    247 <?php if($this->g_fp_url != '' && $this->fbappid != ''){ ?><script type="text/javascript">if(parent.frames.length <= 0){window.location = "<?php echo $this->g_fp_url.$parmPrefix.'sk=app_'.$this->fbappid; ?>";}</script><?php } ?>
     243<?php if(!empty($this->g_fp_url) && !empty($this->fbappid)){ ?><script type="text/javascript">if(parent.frames.length <= 0){window.location = "<?php echo $this->g_fp_url.$parmPrefix.'sk=app_'.$this->fbappid; ?>";}</script><?php } ?>
    248244<?php wp_head(); ?>
    249245<link rel="stylesheet" href="<?php echo FPC_PLUGIN_URL; ?>/css/wp.css" type="text/css" media="screen" />
    250246<link rel="stylesheet" href="<?php echo FPC_PLUGIN_URL; ?>/css/default.css" type="text/css" media="screen" />
    251 <?php if($this->google_fonts != ''){ ?><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=<?php echo $this->google_fonts; ?>" type="text/css"><?php } ?>
    252 <?php if($this->fbtemplate != ''){ ?><link rel="stylesheet" href="<?php echo FPC_PLUGIN_URL; ?>/templates/<?php echo $this->fbtemplate;?>/default.css" type="text/css" media="screen" /><?php } ?>
    253 <?php if($this->fbcsslink != ''){?><link rel="stylesheet" href="<?php echo $this->fbcsslink; ?>" type="text/css" media="screen" /><?php } ?>
    254 <?php if($this->fbcss != ''){?><style type="text/css"><?php echo $this->fbcss; ?></style><?php } ?>
     247<?php if(!empty($this->google_fonts)){ ?><link rel="stylesheet" href="http://fonts.googleapis.com/css?family=<?php echo $this->google_fonts; ?>" type="text/css"><?php } ?>
     248<?php if(!empty($this->fbtemplate)){ ?><link rel="stylesheet" href="<?php echo FPC_PLUGIN_URL; ?>/templates/<?php echo $this->fbtemplate;?>/default.css" type="text/css" media="screen" /><?php } ?>
     249<?php if(!empty($this->fbcsslink)){?><link rel="stylesheet" href="<?php echo $this->fbcsslink; ?>" type="text/css" media="screen" /><?php } ?>
     250<?php if(!empty($this->fbcss)){?><style type="text/css"><?php echo $this->fbcss; ?></style><?php } ?>
    255251<?php if($this->g_autofit == 'true'){ ?>
    256252<style type="text/css">
     
    273269            <div id="fpc-header">
    274270                <?php echo do_shortcode(shortcode_unautop($this->fbheadercontent)); ?>
    275                 <?php if($this->g_menu_name != "" && $this->use_menu == 'true') { ?>
    276                     <?php if(($this->show_menu == 'liked' && $this->page_liked) || $this->show_menu == 'always'){ ?>
     271                <?php if(!empty($this->g_menu_name) && $this->g_use_menu == 'true') { ?>
     272                    <?php if(($this->g_show_menu == 'liked' && $this->page_liked) || $this->g_show_menu == 'always'){ ?>
    277273                        <div id="fpc-menu">
    278274                            <?php wp_nav_menu(array('menu' => $this->g_menu_name,'container_class' => 'menu-header')); ?>
     
    367363        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    368364        */
    369 
    370365        /*
    371366        display content if page not liked
     
    412407        } // end fpc_font
    413408
    414         // process post and add google fonts
     409        /*
     410        process post and add google fonts
     411        */
    415412        function fpc_setup_google_fonts($postID) {
     413            $fonts_to_include = '';
    416414            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    417415                return $postID;
     
    419417                $the_post = get_post($postID);
    420418                if($the_post){
    421                     $fonts_to_include = '';
    422419                    $the_content = $the_post->post_content;
    423420                    $pattern = '/\\[font[^\\"\\\'\\]]+face=["\\\']([^"\']+)["\\\']/i';
     
    426423                        $fonts_to_include = str_replace(" ","+",join("|", array_unique($matches[1])));
    427424                    }
    428                     if($fonts_to_include != ''){
    429                         update_post_meta($postID, "_fbfp_goole_fonts",$fonts_to_include);
    430                     } else {
    431                         delete_post_meta($postID, "_fbfp_goole_fonts");
    432                     }
    433                 }
    434             }
     425                }
     426            }
     427            return $fonts_to_include;
    435428        } // end fpc_setup_google_fonts
    436429        /*
     
    441434
    442435        /*
    443         meta content values - if empty, return a set value
    444         */
    445         function get_value($a,$b) {
    446             $a = trim($a);
    447             if($a == "") {
    448                 return $b;
    449             } else {
    450                 return $a;
    451             }
    452         } // end get_value
     436        use page overrides, if any on menus, etc
     437        */
     438        function get_overrides($m)
     439        {
     440            $this->g_use_menu = (!empty($m['use_menu']) && $m['use_menu'] != 'defer')? $m['use_menu'] : $this->g_use_menu;
     441            $this->g_show_menu = (!empty($m['show_menu']) && $m['show_menu'] != 'defer')? $m['show_menu'] : $this->g_show_menu;
     442        }
     443
     444        /*
     445        convert old individual meta data into the newer array
     446        */
     447        function convert_old_meta($id)
     448        {
     449            $old_meta_test = get_post_meta($id, '_fbfp_isfanpage', true);
     450            if($old_meta_test != ''){
     451                $new_meta = array();
     452
     453                // free meta
     454                $new_meta['isfanpage'] = get_post_meta($id, '_fbfp_isfanpage', true);
     455                $new_meta['appid'] = get_post_meta($id, '_fbfp_appid', true);
     456                $new_meta['appsecret'] = get_post_meta($id, '_fbfp_appsecret', true);
     457                $new_meta['csslink'] = get_post_meta($id, '_fbfp_csslink', true);
     458                $new_meta['css'] = get_post_meta($id, '_fbfp_css', true);
     459                $new_meta['template'] = get_post_meta($id, '_fbfp_template', true);
     460                $new_meta['header'] = get_post_meta($id, '_fbfp_header', true);
     461                $new_meta['footer'] = get_post_meta($id, '_fbfp_footer', true);
     462                $new_meta['use_menu'] = get_post_meta($id, '_fbfp_use_menu',true);
     463                $new_meta['show_menu'] = get_post_meta($id, '_fbfp_show_menu',true);
     464                $new_meta['show_comments'] = get_post_meta($id, '_fbfp_show_comments',true);
     465                $new_meta['google_font'] = get_post_meta($id, '_fbfp_goole_fonts', true);
     466
     467                update_post_meta($id, '_fbfp', $new_meta);
     468
     469                // nuke the old meta
     470                delete_post_meta($id, '_fbfp_isfanpage');
     471                delete_post_meta($id, '_fbfp_autofit');
     472                delete_post_meta($id, '_fbfp_debug');
     473                delete_post_meta($id, '_fbfp_appid');
     474                delete_post_meta($id, '_fbfp_appsecret');
     475                delete_post_meta($id, '_fbfp_cookie');
     476                delete_post_meta($id, '_fbfp_csslink');
     477                delete_post_meta($id, '_fbfp_css');
     478                delete_post_meta($id, '_fbfp_template');
     479                delete_post_meta($id, '_fbfp_header');
     480                delete_post_meta($id, '_fbfp_footer');
     481                delete_post_meta($id, '_fbfp_use_menu');
     482                delete_post_meta($id, '_fbfp_show_menu');
     483                delete_post_meta($id, '_fbfp_show_comments');
     484                delete_post_meta($id, '_fbfp_goole_fonts');
     485            }
     486        }
    453487
    454488        /*
     
    474508        function fpc_show_box() {
    475509            global $post;
     510            // convert old meta
     511            $this->convert_old_meta($post->ID);
    476512            // get meta data for the form
    477             $isfanpage = get_post_meta($post->ID, '_fbfp_isfanpage', true);
    478             $fbappid = get_post_meta($post->ID, '_fbfp_appid', true);
    479             $fbappsecret = get_post_meta($post->ID, '_fbfp_appsecret', true);
    480             $fbcookie = get_post_meta($post->ID, '_fbfp_cookie', true);
    481             $fbcsslink = get_post_meta($post->ID, '_fbfp_csslink', true);
    482             $fbcss = get_post_meta($post->ID, '_fbfp_css', true);
    483             $fbtemplate = get_post_meta($post->ID, '_fbfp_template', true);
    484             $fbheadercontent = get_post_meta($post->ID, '_fbfp_header', true);
    485             $fbfootercontent = get_post_meta($post->ID, '_fbfp_footer', true);
    486             $pg_use_menu = get_post_meta($post->ID, '_fbfp_use_menu', true);
    487             $pg_show_menu = get_post_meta($post->ID, '_fbfp_show_menu', true);
    488             $pg_show_comments = get_post_meta($post->ID, '_fbfp_show_comments', true);
    489 
    490             if($pg_use_menu == '' || is_null($pg_use_menu)) { $pg_use_menu = $this->g_use_menu; }
    491             if($pg_show_menu == '' || is_null($pg_show_menu)) { $pg_show_menu = $this->g_show_menu; }
     513            $meta = get_post_meta($post->ID, '_fbfp', true);
     514            // show the page
    492515            include(FPC_PLUGIN_DIR . '/fanpage-connect-meta.php');
    493516            echo '<input type="hidden" id="fpc_nonce" name="fpc_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';
     
    509532            if($has_dirs)
    510533            {
    511                 $out .= '<select id="_fbfp_template" name="_fbfp_template">';
     534                $out .= '<select id="_fbfp[template]" name="_fbfp[template]">';
    512535                if($t == ''){
    513536                    $out .= '<option value="" selected="selected"></option>';
     
    546569                return $post_id;
    547570            }
    548 
    549571            // check autosave
    550572            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    551573              return $post_id;
    552574            }
    553 
    554575            // check user permissions
    555576            if ('page' == $_POST['post_type']) {
     
    560581                return $post_id;
    561582            }
    562 
    563             // save the data - need some cleanup here - make the options an array...
    564             // get the OLD meta
    565             $isfanpage = get_post_meta($post_id, '_fbfp_isfanpage', true);
    566             $fbappid = get_post_meta($post_id, '_fbfp_appid', true);
    567             $fbappsecret = get_post_meta($post_id, '_fbfp_appsecret', true);
    568             $fbcookie = get_post_meta($post_id, '_fbfp_cookie', true);
    569             $fbcsslink = get_post_meta($post_id, '_fbfp_csslink', true);
    570             $fbcss = get_post_meta($post_id, '_fbfp_css', true);
    571             $fbtemplate = get_post_meta($post_id, '_fbfp_template', true);
    572             $fbheadercontent = get_post_meta($post_id, '_fbfp_header', true);
    573             $fbfootercontent = get_post_meta($post_id, '_fbfp_footer', true);
    574             $pg_use_menu = get_post_meta($post_id, '_fbfp_use_menu', true);
    575             $pg_show_menu = get_post_meta($post_id, '_fbfp_show_menu', true);
    576             $pg_show_comments = get_post_meta($post_id, '_fbfp_show_comments', true);
    577 
    578             // get NEW meta
    579             $new_isfanpage = $_POST['_fbfp_isfanpage'];
    580             $new_fbappid = trim($_POST['_fbfp_appid']);
    581             $new_fbappsecret = trim($_POST['_fbfp_appsecret']);
    582             $new_fbcookie = $_POST['_fbfp_cookie'];
    583             $new_fbcsslink = trim($_POST['_fbfp_csslink']);
    584             $new_fbcss = trim($_POST['_fbfp_css']);
    585             $new_fbtemplate = $_POST['_fbfp_template'];
    586             $new_fbheadercontent = trim($_POST['_fbfp_header']);
    587             $new_fbfootercontent = trim($_POST['_fbfp_footer']);
    588             $new_pg_use_menu = trim($_POST['_fbfp_use_menu']);
    589             $new_pg_show_menu = $_POST['_fbfp_show_menu'];
    590             $new_pg_show_comments = $_POST['_fbfp_show_comments'];
    591 
    592             $this->fpc_meta_update($post_id,$isfanpage, $new_isfanpage, '_fbfp_isfanpage');
    593             $this->fpc_meta_update($post_id,$fbappid, $new_fbappid, '_fbfp_appid');
    594             $this->fpc_meta_update($post_id,$fbappsecret, $new_fbappsecret, '_fbfp_appsecret');
    595             $this->fpc_meta_update($post_id,$fbcookie, $new_fbcookie, '_fbfp_cookie');
    596             $this->fpc_meta_update($post_id,$fbcsslink, $new_fbcsslink, '_fbfp_csslink');
    597             $this->fpc_meta_update($post_id,$fbcss, $new_fbcss, '_fbfp_css');
    598             $this->fpc_meta_update($post_id,$fbtemplate, $new_fbtemplate, '_fbfp_template');
    599             $this->fpc_meta_update($post_id,$fbheadercontent, $new_fbheadercontent, '_fbfp_header');
    600             $this->fpc_meta_update($post_id,$fbfootercontent, $new_fbfootercontent, '_fbfp_footer');
    601             $this->fpc_meta_update($post_id,$pg_use_menu, $new_pg_use_menu, '_fbfp_use_menu');
    602             $this->fpc_meta_update($post_id,$pg_show_menu, $new_pg_show_menu, '_fbfp_show_menu');
    603             $this->fpc_meta_update($post_id,$pg_show_comments, $new_pg_show_comments, '_fbfp_show_comments');
    604 
     583            // get old and new meta
     584            $old_meta = get_post_meta($post_id, '_fbfp', true);
     585            $new_meta = array();
     586            // assign the new meta
     587            if ($_POST['_fbfp']) {
     588              foreach ($_POST['_fbfp'] as $key => $value) {
     589                $new_meta[$key] = trim($value);
     590              }
     591            }
     592            // check for google fonts
     593            $new_meta['google_fonts'] = $this->fpc_setup_google_fonts($post_id);
     594
     595            // save, update or delete the meta
     596            if ($new_meta && $new_meta != $old_meta) {
     597                update_post_meta($post_id, '_fbfp', $new_meta);
     598            } elseif ('' == $new_meta && $old_meta) {
     599                delete_post_meta($post_id, '_fbfp');
     600            }
    605601            return $post_id;
    606602        } // end fpc_meta_save
    607 
    608         /*
    609         update the meta data
    610         */
    611         function fpc_meta_update($post_id,$old,$new,$n) {
    612           if($new && $new != $old) {
    613               update_post_meta($post_id, $n, $new);
    614           } elseif ($new == '' && $old) {
    615               delete_post_meta($post_id, $n, $old);
    616           }
    617         } // end fpc_meta_update
    618603
    619604        /*
     
    644629            // get saved options
    645630            $saved = get_option($this->FanpageConnect_DB_option);
    646 
    647631            // assign options
    648632            if(!empty($saved))
     
    653637                }
    654638            }
    655 
    656639            //update options if necessary
    657640            if($saved != $options)
     
    659642                update_option($this->FanpageConnect_DB_option,$options);
    660643            }
    661 
    662644            // return the options
    663645            return $options;
     
    689671                $options['fpogimg'] = $_POST['fpogimg'];
    690672                $options['fpogname'] = $_POST['fpogname'];
    691 
    692673
    693674                update_option($this->FanpageConnect_DB_option, $options);
  • fanpage-connect/trunk/readme.txt

    r410362 r412626  
    66Requires at least: 3.0
    77Tested up to: 3.2.1
    8 Stable tag: 1.3.1
     8Stable tag: 1.3.2
    99
    1010Fanpage Connect is the WordPress plugin that allows you to create an administer your Facebook fan pages directly from WordPress.
     
    1616Now you can power your Facebook Fan Page with your WordPress blog. In ONE click.
    1717
     18http://vimeo.com/26673379
     19
    1820Leverage the world&#146;s most powerful blog engine and the social behemoth that is Facebook to maximize your business or brand&#146;s exposure!
    1921
     
    2325
    2426Keep your website looking like your website and your fan page looking like your fan page. Fanpage Connect works with any theme seamlessly and installs on your WordPress site in just a few clicks.
     27
     28== Features ==
     29* No coding required - if you can edit a WordPress page, you can create Facebook Fan Pages
     30* Turn any WordPress page into a Facebook Fan Page in minutes!
     31* Use WordPress Custom Menus in your fan pages.
     32* Use the included templates to change the look of your fan page or add your own.
     33* Create high converting fan pages by easily creating a "Fan Gate" to get your visitors to "like" the page to see more content.
     34* Create even better looking fan pages with over 150 Google Web Fonts!
     35* Include Facebook Comments by just enabling comments in our page
     36* Add a high converting "Fan Gate" shortcodes with an easy "pick n click" interface in the editor
     37* Add Facebook Open Graph tags for easy Facebook integration
    2538
    2639== Upgrade to Fanpage Connect Pro ==
     
    3346* Add your ClickBank ID to turn the &quot;Link Luv&quot; into a money making affiliate link
    3447* Filter Removal for Header, content and Footer. Allows you to keep plugins from altering your content
    35 * Redirect to a different URL after being &quot;Liked&quot; - even more fan gate control
     48* Redirect to a different URL after being &quot;Liked&quot; - even more Fan Gate control
    3649* Opt-In form box and shortcode to easily add opt-in forms, videos or other custom content
    3750* Hide Selections of Content for N days - good for one time offers, coupon codes after &quot;like&quot;, etc
     
    4356* Shortcode for the high conversion Multi-friend Inviter!
    4457* Shortcode for Facebook Activity Feed
     58* Shortcode for Google Plus 1 button
    4559* Full point n' click interface in the visual editor - no need to type your shortcodes
    4660* Widgetized areas in the content and footer
     
    5064* Unlimited pages and NO monthly fees like those other guys!
    5165
    52 For more information visit: <a href="http://www.fanpageconnect.com/pro" target="_blank">http://www.FanpageConnect.com/pro</a>
    53 
    54 == Features ==
    55 * No coding required - if you can edit a WordPress page, you can create Facebook Fan Pages
    56 * Turn any WordPress page into a Facebook Fan Page in minutes!
    57 * Use WordPress custom Menus in your fan pages.
    58 * Use the included templates to change the look of your fan page or add your own.
    59 * Create high converting fan pages by easily creating a "fan gate" to get your visitors to "like" the page to see more content.
    60 * Create even better looking fan pages with over 150 Google Web Fonts!
    61 * Include Facebook Comments by just enabling comments in our page
    62 * Add "fan gate" shortcodes with an easy "pick n click" interface in the editor
    63 * Add Facebook Open Graph tags for easy Facebook integration
     66For more information visit: <a href="http://www.fanpageconnect.com/pro" target="_blank">www.FanpageConnect.com/pro</a>
    6467
    6568== Installation ==
     
    8184
    8285= Is This Plugin Supported? =
    83 Absolutely! Visit <a href="http://www.fanpageconnect.com" target="_blank">http://www.fanpageconnect.com</a> for support and tutorial videos, or visit our fan page at <a href="http://fb.me/FanpageConnect" target="_blank">http://fb.me/FanpageConnect</a>
     86Absolutely! Visit <a href="http://www.fanpageconnect.com" target="_blank">www.fanpageconnect.com</a> for support and tutorial videos, or visit our fan page at <a href="http://www.facebook.com/FanpageConnect" target="_blank">http://fb.me/FanpageConnect</a>
    8487
    8588= Will this plugin work with my theme? =
     
    102105
    103106= I installed the plugin, but my site doesn&#146;t look any different in Facebook! =
    104 We&#146;ve got some cool, step by step videos on our fan page, so pop on over to <a href="http://fb.me/FanpageConenct" target="_blank">http://fb.me/FanpageConenct</a> to get the 411 on creating rocking fan pages!
     107We&#146;ve got some cool, step by step videos on our fan page, so pop on over to <a href="http://fb.me/FanpageConenct" target="_blank">http://fb.me/FanpageConenct</a> to get the 411 on creating rockin&#146; fan pages!
    105108
    106109== Screenshots ==
     
    112115== Upgrade Notice ==
    113116
    114 = 1.3.1 =
     117= 1.3.2 =
    115118More updates. Please upgrade!
    116119
    117120== Changelog ==
     121= 1.3.2 =
     122* Optimized page meta into a single array
     123* Streamlined/cleaned up miscecllaneous code
     124* Added "Defer to Global" in page menu settings
     125* Perfected page level override logic
     126
    118127= 1.3.1 =
    119128* Added global Open Graph settings for fan pages
Note: See TracChangeset for help on using the changeset viewer.