Changeset 180401
- Timestamp:
- 12/07/2009 04:13:44 AM (16 years ago)
- Location:
- vodpod-embedder
- Files:
-
- 6 added
- 2 edited
-
tags/0.3 (added)
-
tags/0.3/readme.txt (added)
-
tags/0.3/screenshot-1.jpg (added)
-
tags/0.3/vodpod.css (added)
-
tags/0.3/vodpod.js (added)
-
tags/0.3/vodpod_embedder.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vodpod_embedder.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vodpod-embedder/trunk/readme.txt
r176583 r180401 5 5 Requires at least: 2.8 6 6 Tested up to: 2.8.6 7 Stable tag: 0. 27 Stable tag: 0.3 8 8 9 9 Vodpod Embedder is a plugin that allows you to easily embed videos from Vodpod from the Add Media and Add Video tabs. … … 44 44 45 45 == Changelog == 46 46 = 0.3 = 47 Saving settings works properly. 47 48 = 0.2 = 48 49 *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 4 4 Description: Allows browsing of Vodpod collections and embedding from inside Wordpress 5 5 Author: Ned Watson 6 Version: 0. 26 Version: 0.3 7 7 Author URI: http://1080d.com/code/vodpod-plugin 8 8 */ … … 22 22 //Here is where we add our settings. 23 23 function 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'); 26 27 //And this is our section, named vodpod_options. I've titled it Vodpod Settings. A little confusing I guess. 27 28 //Then we run vodpod_settings_validate to check our input. 29 30 31 //This is the one setting we want to keep track of. 28 32 //add_settings_section('vodpod_embedder_options', 'Vodpod Settings', '', 'vodpod_embedder'); 29 33 … … 39 43 <div class="wrap"> 40 44 <h2>Vodpod Embedder Settings</h2> 41 <?php do_settings_sections('vodpod_embedder');?>42 45 <form method="post" action="options.php"> 43 46 <?php 47 settings_fields('vodpod_embedder'); 48 do_settings_sections('vodpod_embedder'); 44 49 //This is very important. 45 settings_fields('vodpod_embedder_options');46 50 // 47 51 ?> … … 58 62 //Form input field here. 59 63 function vodpod_embedder_api_field() { 60 $options = get_option('vodpod_embedder');64 $options = get_option('vodpod_embedder_options', true); 61 65 $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' />"; 63 67 } 64 68 function vodpod_embedder_validate($input) { 65 69 if(! preg_match('/^[a-z0-9]*$/', $input['api_key'])) { 66 $ input['api_key'] = '';70 $newinput['api_key'] = ''; 67 71 } 68 return $input; 72 else 73 { 74 $newinput[api_key] = $input[api_key]; 75 } 76 return $newinput; 69 77 70 78 }
Note: See TracChangeset
for help on using the changeset viewer.