Plugin Directory

Changeset 180401


Ignore:
Timestamp:
12/07/2009 04:13:44 AM (16 years ago)
Author:
thened
Message:
 
Location:
vodpod-embedder
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • vodpod-embedder/trunk/readme.txt

    r176583 r180401  
    55Requires at least: 2.8
    66Tested up to: 2.8.6
    7 Stable tag: 0.2
     7Stable tag: 0.3
    88
    99Vodpod Embedder is a plugin that allows you to easily embed videos from Vodpod from the Add Media and Add Video tabs.
     
    4444
    4545== Changelog ==
    46 
     46= 0.3 =
     47Saving settings works properly.
    4748= 0.2 =
    4849*Combined all of the php files into vodpod_embedder.php and switched the code to use the Plugin Settings API.
  • vodpod-embedder/trunk/vodpod_embedder.php

    r176574 r180401  
    44Description: Allows browsing of Vodpod collections and embedding from inside Wordpress
    55Author: Ned Watson
    6 Version: 0.2
     6Version: 0.3
    77Author URI: http://1080d.com/code/vodpod-plugin
    88*/
     
    2222//Here is where we add our settings.
    2323function register_vodpodsettings() { // whitelist options
    24     //This is the one setting we want to keep track of.
    25     register_setting('vodpod_embedder_options', 'vodpod_embedder', 'vodpod_embedder_validate');
     24
     25
     26    register_setting('vodpod_embedder', 'vodpod_embedder_options', 'vodpod_embedder_validate');
    2627    //And this is our section, named vodpod_options. I've titled it Vodpod Settings. A little confusing I guess.
    2728    //Then we run vodpod_settings_validate to check our input.
     29   
     30   
     31    //This is the one setting we want to keep track of.
    2832    //add_settings_section('vodpod_embedder_options', 'Vodpod Settings', '', 'vodpod_embedder');
    2933   
     
    3943    <div class="wrap">
    4044    <h2>Vodpod Embedder Settings</h2>
    41     <?php do_settings_sections('vodpod_embedder');?>
    4245    <form method="post" action="options.php">
    4346    <?php
     47    settings_fields('vodpod_embedder');
     48    do_settings_sections('vodpod_embedder');
    4449    //This is very important.
    45     settings_fields('vodpod_embedder_options');
    4650    //
    4751    ?>
     
    5862//Form input field here.
    5963function vodpod_embedder_api_field() {
    60     $options= get_option('vodpod_embedder');
     64    $options = get_option('vodpod_embedder_options', true);
    6165    $api_key = $options['api_key'];
    62     echo "<input type='text' id='vodpod_embedder_api_key' name='vodpod_embedder[api_key]' value='{$api_key}' size='40' />";
     66    echo "<input type='text' id='vodpod_embedder_api_key' name='vodpod_embedder_options[api_key]' value='{$options[api_key]}' size='40' />";
    6367}
    6468function vodpod_embedder_validate($input) {
    6569    if(! preg_match('/^[a-z0-9]*$/', $input['api_key'])) {
    66         $input['api_key'] = '';
     70        $newinput['api_key'] = '';
    6771        }
    68     return $input;
     72        else
     73        {
     74            $newinput[api_key] = $input[api_key];
     75        }
     76    return $newinput;
    6977
    7078}
Note: See TracChangeset for help on using the changeset viewer.