PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/wp-ui/inc/wpui-helpers.php

https://gitlab.com/Blueprint-Marketing/interoccupy.net
PHP | 700 lines | 482 code | 138 blank | 80 comment | 67 complexity | c27b7066c04d7779c0024ea22f7698aa MD5 | raw file
  1. <?php
  2. /**
  3. * WP UI Helper functions
  4. *
  5. *
  6. * @since $Id$
  7. * @package wp-ui
  8. * @subpackage wpui-helper
  9. **/
  10. /**
  11. * Get the list of jQuery UI themes.
  12. */
  13. function wpui_get_jqui_themes_list()
  14. {
  15. return array(
  16. 'ui-lightness', 'ui-darkness', 'smoothness', 'start', 'redmond',
  17. 'sunny', 'overcast', 'le-frog', 'flick', 'pepper-grinder', 'eggplant',
  18. 'dark-hive', 'cupertino', 'south-street', 'blitzer', 'humanity',
  19. 'hot-sneaks', 'excite-bike', 'vader', 'dot-luv', 'mint-choc',
  20. 'black-tie', 'trontastic', 'swanky-purse'
  21. );
  22. } // END function wpui_get_jqui_themes_list
  23. /**
  24. * Get the list of CSS3 styles.
  25. */
  26. function wpui_get_css3_styles_list()
  27. {
  28. return array(
  29. 'wpui-light', 'wpui-blue', 'wpui-red', 'wpui-green', 'wpui-dark', 'wpui-quark',
  30. 'wpui-cyaat9', 'wpui-android', 'wpui-safle', 'wpui-alma', 'wpui-macish',
  31. 'wpui-achu', 'wpui-redmond', 'wpui-sevin', 'wpui-gene', 'wpui-narrow'
  32. );
  33. } // END function wpui_get_css3_styles_list
  34. /**
  35. * Is it windows?
  36. */
  37. function wpui_is_windows( ) {
  38. return (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
  39. }
  40. function wpui_adjust_path( $path ) {
  41. if ( wpui_is_windows() )
  42. $path = str_ireplace( '/', '\\', $path );
  43. return $path;
  44. }
  45. // function wpui_dir( $app='' ) {
  46. // $is_Windows = strtoupper( substr(php_uname('s'), 0, 3 )) == 'WIN';
  47. // $sep = $is_Windows ? '\\' : '/';
  48. // $path = WP_PLUGIN_DIR . $sep . basename( dirname( __FILE__ ) );
  49. // if ( $is_Windows && stristr( $app, '/' ) )
  50. // $app = str_replace('/', "\\", $app );
  51. // if ( $app != '' ) $path = $path . $sep . $app;
  52. // return $path;
  53. // }
  54. /**
  55. * Returns the WP UI directory path.
  56. *
  57. */
  58. function wpui_dir( $app='' ) {
  59. $path = str_replace( basename(dirname( __FILE__ )), '', dirname( __FILE__ ) );
  60. if ( $app != '' ) $path = $path . $app;
  61. if ( wpui_is_windows( ) )
  62. $path = wpui_adjust_path( $path );
  63. return $path;
  64. }
  65. /**
  66. * Plugin directory URL
  67. * Trailing slash? OH Yeah.
  68. */
  69. function wpui_url( $append='' ) {
  70. return plugins_url( '/wp-ui/' . $append );
  71. }
  72. /**
  73. * Check for custom themes, enqueue of list them if any.
  74. */
  75. function wpui_get_custom_themes_list( $values=false ) {
  76. $opts = get_option( 'wpUI_options' );
  77. $themes_list = array();
  78. if ( $opts[ 'jqui_custom_themes' ] == '' )
  79. return false;
  80. if ( $opts[ 'jqui_custom_themes' ] == '{}' )
  81. return $themes_list;
  82. $cust_themes = json_decode( $opts[ 'jqui_custom_themes' ], true );
  83. if ( $cust_themes !== null ) {
  84. $returnArray = ( ! $values ) ? array_keys( $cust_themes ) : $cust_themes;
  85. return $returnArray;
  86. }
  87. } // END wpui
  88. add_action('wp_ajax_WPUIstyles', 'choose_wpui_style');
  89. function choose_wpui_style() {
  90. echo wpui_get_file( wpui_url( 'js/wpui-choosestyles.php' ) );
  91. die();
  92. }
  93. add_action('wp_ajax_JQUIstyles', 'choose_jqui_style');
  94. function choose_jqui_style() {
  95. echo wpui_get_file( wpui_url( 'js/wpui-choose-jquistyles.php' ) );
  96. die();
  97. }
  98. add_action('wp_ajax_editorButtonsHelp', 'editor_buttons_help');
  99. function editor_buttons_help() {
  100. echo wpui_get_file( wpui_url( 'admin/wpui-help.php' ) );
  101. die();
  102. }
  103. add_action('wp_ajax_wpui_clean_cache', 'wpui_clean_cache_images_scripts');
  104. /**
  105. * Clean the cache. I mean empty it.
  106. */
  107. function wpui_clean_cache_images_scripts()
  108. {
  109. $upload_dir = wp_upload_dir();
  110. $cudir = wpui_adjust_path(preg_replace( '/(\d){4}\/(\d){2}/i' , '' , $upload_dir['path'] ) . 'wp-ui/cache');
  111. $upnonce = $_POST['Cnonce'];
  112. if ( ! wp_verify_nonce( $upnonce, 'wpui-cache-nonce' ) )
  113. return false;
  114. // if ( ! is_dir( $cudir ) ) {
  115. // echo "Cache directory, was not found in the following location. <pre>" . $cudir . '</pre>';
  116. // } else {
  117. try {
  118. system( '/bin/rm -rf ' . escapeshellarg( $cudir ) );
  119. // mkdir( $cudir, 0755 );
  120. if (!@mkdir($cudir, 0755)) {
  121. $error = error_get_last();
  122. echo "Error - <code>" . $error['message'] . '</code>. Try creating the directory manually with permissions ( 755 ).';
  123. } else {
  124. echo "Cache files were cleaned successfully.";
  125. }
  126. } catch( Exception $e ) {
  127. // echo "Error : " . $e->getMessage() . "\n";
  128. die ();
  129. }
  130. // }
  131. die();
  132. } // END wpui_clean_cache_images_scripts
  133. add_action('wp_ajax_wpui_clean_postmeta', 'wpui_clean_post_meta_fix_for_wpscetc');
  134. /**
  135. * Clean the old post meta last version. Removed in the next two
  136. */
  137. function wpui_clean_post_meta_fix_for_wpscetc()
  138. {
  139. $posts = get_posts('numberposts=-1&post_type=post&post_status=any');
  140. foreach( $posts as $post ) {
  141. delete_post_meta( $post->ID, 'wp-ui-load' );
  142. delete_post_meta( $post->ID, '_wp-ui-load' );
  143. }
  144. echo "Old Post meta information found were removed.";
  145. die();
  146. } // END wpui_clean_post_meta_fix_for_wpscetc
  147. function wpui_exception( $errnum, $errstr, $errfile, $errline ) {
  148. throw new ErrorException( $errstr, 0, $errnum, $errfile, $errline );
  149. }
  150. add_action('wp_ajax_jqui_css', 'wpui_search_for_stylesheets');
  151. /**
  152. * Documentation
  153. */
  154. function wpui_search_for_stylesheets()
  155. {
  156. $upload_dir = wp_upload_dir();
  157. $udir = wpui_adjust_path( WP_CONTENT_DIR . '/uploads/wp-ui/' );
  158. $_status = '';
  159. $someArr = false;
  160. file_exists( $udir ) || @mkdir( $udir, 0755 );
  161. if ( ! is_dir( $udir ) ) {
  162. $someArr = array();
  163. $someArr[ 'status' ] = 'error';
  164. $someArr[ 'description' ] = __( 'The folder wp-ui was not found and could not be created. Please check the uploads folder permissions.', 'wp-ui' );
  165. $someArr[ 'link' ] = $udir;
  166. echo json_encode( $someArr );
  167. die();
  168. }
  169. $upnonce = $_POST['upNonce'];
  170. if ( ! wp_verify_nonce( $upnonce, 'wpui-jqui-custom-themes' ) )
  171. wp_die( 'Just what do you think you\'re doing, Dave?' );
  172. $results = wpui_jqui_dirs( $udir );
  173. echo $results;
  174. die();
  175. } // END wpui_search_for_stylesheets
  176. // Helper function. uses wp_remote_get()
  177. function wpui_get_file( $url, $args=array(), $output='return' ) {
  178. $response = wp_remote_get( $url, $args );
  179. if ( is_wp_error( $response ) ) {
  180. echo '<pre>';
  181. var_export($response);
  182. echo '</pre>';
  183. echo __( 'Failed to load File. Double check URL or maybe the installation didn\'t go well?', 'wp-ui' );
  184. } else {
  185. if ( $response[ 'body' ] ) {
  186. if ( $output == 'echo' ) echo $response[ 'body' ];
  187. else return $response[ 'body' ];
  188. }
  189. }
  190. }
  191. add_action('wp_ajax_wpui_query_posts', 'wpui_query_posts');
  192. /**
  193. * Get the posts for display on the editor screen.
  194. */
  195. function wpui_query_posts()
  196. {
  197. $pts = get_post_types( array( 'public' => true ), 'objects' );
  198. $pt_names = array_keys( $pts );
  199. $args = array();
  200. $nonce = $_POST[ '_ajax_post_nonce' ];
  201. if ( ! wp_verify_nonce( $nonce, 'wpui-editor-post-nonce' ) )
  202. return;
  203. else
  204. $retStr = '<!--secure-->';
  205. if ( isset( $_POST[ 'search' ] ) )
  206. $args[ 's' ] = stripslashes( $_POST[ 'search' ] );
  207. $args[ 'posts_per_page' ] = ( isset( $_POST[ 'number' ] ) ) ? $_POST[ 'number' ] : 5;
  208. if ( isset( $_POST[ 'page' ] ) && isset( $_POST[ 'number' ] ) && (! isset( $_POST[ 'search' ] ) || $_POST[ 'search' ] == '' ) )
  209. $args[ 'offset' ] = $_POST['page'] > 1 ? ($_POST['number'] * $_POST['page']) : 0;
  210. $args['post_type'] = 'any';
  211. $wpui_posts = get_posts( $args );
  212. foreach( $wpui_posts as $post ) {
  213. $title = ( $post->post_title != '' ) ? $post->post_title : 'Untitled Post';
  214. $retStr .= '<li>';
  215. $retStr .= '<a href="#" title="' . $title . '" rel="post-' . $post->ID . '">' . $post->post_title . '</a><span class="info">';
  216. if ( 'post' == $post->post_type ) {
  217. $retStr .= mysql2date( __( 'Y/m/d' ), $post->post_date );
  218. } else {
  219. $retStr .= $pts[ $post->post_type ]->labels->singular_name;
  220. }
  221. $retStr .= '</span></li>';
  222. }
  223. echo $retStr;
  224. die();
  225. } // END wpui_query_posts
  226. add_action('wp_ajax_wpui_query_meta', 'wpui_query_meta');
  227. /**
  228. * Query categories and tags
  229. */
  230. function wpui_query_meta()
  231. {
  232. $type = ( ! isset( $_POST['type'] ) ) ? 'cat' : $_POST['type' ];
  233. $sear = ( isset( $_POST['search'] ) ) ? $_POST[ 'search' ] : false;
  234. $nonce = $_POST[ '_ajax_tax_nonce' ];
  235. if ( ! wp_verify_nonce( $nonce, 'wpui-editor-tax-nonce' ) )
  236. return;
  237. else
  238. $retStr = '<!--secure-->';
  239. // $retStr = '';
  240. if ( $type == 'cat' ) {
  241. $getArr = get_categories();
  242. foreach( $getArr as $get ) {
  243. if ( $sear && ( strpos( $get->category_nicename, $sear ) === FALSE ) ) continue;
  244. $retStr .= '<li><a href="#" title="Select the category ' . $get->category_nicename . '" rel="cat-' . $get->term_id . '">' . $get->category_nicename . ' <span class="wpui-post-count">' . $get->count . '</span></a></li>';
  245. }
  246. } elseif ( $type == 'tag' ) {
  247. $getArr = get_tags();
  248. foreach( $getArr as $get ) {
  249. if ( $sear && ( strpos( $get->name, $sear ) === FALSE ) ) continue;
  250. $retStr .= '<li><a href="#" title="select the tag ' . $get->name . '" rel="tag-' . $get->term_id . '">' . $get->name. ' <span class="wpui-post-count">' . $get->count . '</span></a></li>';
  251. }
  252. } elseif ( $type == 'recent' ) {
  253. $getArr = get_posts( array( "posts_per_page" => 5 ) );
  254. $retStr .= '<li class="no-select"><strong>Recent posts - Click insert button to continue.</strong></li>';
  255. foreach( $getArr as $get ) {
  256. $retStr .= '<li class="no-select"><a href="#">' . $get->post_title . '</a></li>';
  257. }
  258. } elseif ( $type == 'popular' ) {
  259. $getArr = get_posts( array( 'orderby' => 'comment_count' ) );
  260. $retStr .= '<li class="no-select"><strong>Popular posts - Click insert button to continue.</strong></li>';
  261. foreach( $getArr as $get ) {
  262. $retStr .= '<li class="no-select"><a href="#">' . $get->post_title . '</a></li>';
  263. }
  264. } elseif ( $type == 'random' ) {
  265. $getArr = get_posts( array( 'orderby' => 'rand' , 'posts_per_page' => 5 ) );
  266. $retStr .= '<li class="no-select"><strong>Random posts - Click insert button to continue.</strong></li>';
  267. foreach( $getArr as $get ) {
  268. $retStr .= '<li class="no-select"><a href="#">' . $get->post_title . '</a></li>';
  269. }
  270. }
  271. echo $retStr;
  272. die();
  273. } // END wpui_query_meta
  274. add_action( 'wp_ajax_wpui_validate_feed', 'wpui_validate_feed' );
  275. /**
  276. * Check if the given feed exists.
  277. */
  278. function wpui_validate_feed() {
  279. $options = get_option( 'wpui_options' );
  280. if ( ! isset( $_POST ) ) die( "-1" );
  281. $data = array();
  282. if ( ! isset( $_POST[ 'feed_url' ] ) ) {
  283. $data['status'] = 'error';
  284. $data['description'] = "Parameter feed_url required.";
  285. echo json_encode( $data );
  286. die( "-1" );
  287. }
  288. $feedURL = $_POST[ 'feed_url' ];
  289. $getFeed = @fetch_feed( $feedURL );
  290. if ( is_wp_error( $getFeed ) ) {
  291. $data[ 'status' ] = 'error';
  292. $data[ 'description' ] = 'Not a valid Feed URL';
  293. echo json_encode( $data );
  294. } else {
  295. $data['status'] = 'success';
  296. $data[ 'description'] = 'This is valid RSS 2.0 Feed.';
  297. echo json_encode( $data );
  298. }
  299. die();
  300. } // END function wpui_validate_feed
  301. /**
  302. * Get the theme options.
  303. */
  304. function get_wpui_option( $value ) {
  305. $options = get_option( 'wpUI_options' );
  306. if ( isset( $options[$value] ) )
  307. return $options[$value];
  308. else
  309. return false;
  310. } // END FUNCTION get_wpui_option.
  311. /**
  312. * Set options via AJAX.
  313. */
  314. add_action( 'wp_ajax_wpui_setopts', 'set_wpui_option' );
  315. function set_wpui_option( $value ) {
  316. $options = get_option( 'wpUI_options' );
  317. $nonce = $_POST[ 'nonce' ];
  318. if ( ! isset( $_POST[ 'option' ] ) || ! wp_verify_nonce( $nonce, 'wpui-setopts-nonce' ) )
  319. die( "-1" );
  320. if ( ! isset( $_POST[ 'option' ] ) || ! current_user_can( 'manage_options' ) ) die( '-1' );
  321. $ajaxOpts = $_POST[ 'option' ];
  322. foreach( $ajaxOpts as $key=>$value ) {
  323. echo 'Option "' . $key . '" set to ' . $value;
  324. $options[ $key ] = $value;
  325. }
  326. update_option( 'wpUI_options', $options );
  327. die();
  328. }
  329. /**
  330. * Get the css3 styles.
  331. */
  332. add_action('wp_ajax_selectstyles_list', 'wpui_selectstyles_list');
  333. function wpui_selectstyles_list() {
  334. $results = wpui_get_css3_styles_list();
  335. if ( is_array( $results ) ) {
  336. echo json_encode( $results );
  337. } else {
  338. _e( '404', 'wp-ui' );
  339. }
  340. die();
  341. }
  342. /**
  343. * WP UI get skins list.
  344. */
  345. function wpui_get_skins_list() {
  346. $wpui_skins = array(
  347. 'startoptgroup1'=> 'WP UI CSS3 Themes',
  348. );
  349. // $css3_list =
  350. $css3_list = wpui_get_css3_styles_list();
  351. foreach ( $css3_list as $list=>$css ) {
  352. $wpui_skins[ $css ] = ucwords( str_ireplace( '-', ' ', $css ) );
  353. }
  354. $wpui_skins['endoptgroup1'] = '';
  355. $wpui_skins[ 'startoptgroup2'] = 'jQuery UI Themes';
  356. $jq_list = wpui_get_jqui_themes_list();
  357. foreach ( $jq_list as $list=>$jq ) {
  358. $wpui_skins[ $jq ] = ucwords( str_ireplace( '-', ' ', $jq ) );
  359. }
  360. $wpui_skins['endoptgroup2'] = '';
  361. return apply_filters( 'wpui_get_skins_list', $wpui_skins );
  362. } // END function wpui_get_skins_list
  363. add_filter( 'wpui_get_skins_list', 'wpui_add_custom_skins' );
  364. function wpui_add_custom_skins( $skins ) {
  365. $opts = get_option( 'wpUI_options' );
  366. if ( ! $skins || ! is_array( $skins ) || ! isset( $opts ) ) return $skins;
  367. if ( ! empty( $opts[ 'jqui_custom_themes' ] ) ) {
  368. $customs = json_decode( $opts[ 'jqui_custom_themes'], true );
  369. if ( ! is_array( $customs ) || empty( $customs ) ) return $skins;
  370. $customs = array_keys( $customs );
  371. $skins[ 'startoptgroup3' ] = __( 'Custom themes', 'wp-ui' );
  372. foreach ( $customs as $key=>$value ) {
  373. $dName = ucwords( str_ireplace( '-', ' ', $value ) );
  374. $skins[ $value ] = $dName;
  375. }
  376. $skins = array_merge( $skins, apply_filters( 'wpui_custom_skins', array() ) );
  377. $skins[ 'endoptgroup3'] = '';
  378. } // end isset for custom themes.
  379. return $skins;
  380. }
  381. /**
  382. * Is the wordpress version less than 3.3? Really? Is this necessary? Uh.
  383. */
  384. function wpui_less_33( $version='3.3' ) {
  385. $version = floatval( $version );
  386. return ( floatval( get_bloginfo( 'version' ) ) < $version );
  387. }
  388. add_action('admin_notices', 'add_wpui_update_notification');
  389. /**
  390. * Notify the user to verify the options after update.
  391. */
  392. function add_wpui_update_notification( $output )
  393. {
  394. $opts = get_option( 'wpUI_options' );
  395. if ( isset( $opts[ 'version'] ) ) return;
  396. global $pagenow;
  397. echo '<div class="error update-nag"><p>';
  398. if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpUI-options' ) {
  399. echo sprintf( __( 'Options need a manual save. Please click %1$sSave options%2$s to do so.', 'wp-ui' ), '<b>', '</b>' );
  400. } else {
  401. echo sprintf( __( '%1$sImportant : WP UI Options%2$s tables structure has been changed and requires a manual save. Please take a moment to %3$sVisit Options page%4$s', 'wp-ui' ), '<b>', '</b>', '<a href="' . admin_url( 'options-general.php?page=wpUI-options' ) . '">', '</a>' );
  402. /* echo '<p>Important : <b>WP UI</b> Option tables structure has been changed and requires a manual save. <a href="' . admin_url( 'options-general.php?page=wpUI-options' ) . '">Visit Options page</a></p>';*/
  403. }
  404. echo '</p></div>';
  405. } // END add_wpui_update_notification
  406. function wpui_jqui_dirs( $dir, $format='array' ) {
  407. $valid = array();
  408. $is_Windows = strtoupper( substr(php_uname('s'), 0, 3 )) == 'WIN';
  409. $someArr = array();
  410. $ndir = ( $is_Windows ) ? str_ireplace( '/', '\\', $dir ) : $dir;
  411. if ( ! is_dir( $dir ) ){
  412. $someArr[ 'status' ] = 'error';
  413. $someArr[ 'description' ] = __( 'No directory found.', 'wp-ui' );
  414. $someArr[ 'link' ] = $ndir;
  415. return json_encode( $someArr );
  416. }
  417. try {
  418. $it = new DirectoryIterator( $dir );
  419. } catch ( Exception $e ) {
  420. $someArr[ 'status' ] = 'error';
  421. $someArr[ 'description' ] = $e->getMessage();
  422. $someArr[ 'link' ] = $ndir;
  423. return json_encode( $someArr );
  424. }
  425. $abspath = ABSPATH;
  426. $i = 0;
  427. foreach( $it as $fi ) {
  428. if ( $fi->isDir() &&
  429. ! $fi->isDot() )
  430. {
  431. $itt = new DirectoryIterator( $fi->getPathname() );
  432. foreach( $itt as $fii ) {
  433. if ( $fii->isFile() ) {
  434. if( 'css' == substr( $fii->getFilename() , -3 ) ) {
  435. $valid[ $fi->getBasename() ] = $fii->getPathName();
  436. $i++;
  437. }
  438. }
  439. }
  440. $i++;
  441. }
  442. } ksort( $valid );
  443. foreach( $valid as $key=>$value ) {
  444. if ( $is_Windows ) $abspath = str_ireplace( '/', '\\', ABSPATH );
  445. $valURL = str_ireplace( $abspath, '', $value );
  446. $valURL = ( $is_Windows ) ? str_ireplace( '\\', '/', $valURL ) : $valURL;
  447. $valid[ $key ] = get_bloginfo('wpurl') . '/' . $valURL;
  448. }
  449. if ( empty( $valid ) ) {
  450. $someArr[ 'status' ] = 'error';
  451. $someArr[ 'description' ] = __( 'No themes found inside folder.', 'wp-ui' );
  452. $someArr[ 'link' ] = $ndir;
  453. } else {
  454. $someArr[ 'status' ] = 'success';
  455. $someArr[ 'links' ] = $valid;
  456. }
  457. return json_encode( $someArr );
  458. // if ( $format == 'array' ) {
  459. // return $valid;
  460. // } else {
  461. // }
  462. } // END update CSS dirs.
  463. add_shortcode('wimg', 'wpui_img_shortcode' );
  464. function wpui_img_shortcode( $atts, $content=null ) {
  465. extract( shortcode_atts( array(
  466. 'title' => false,
  467. ), $atts ) );
  468. if ( ! $title ) return false;
  469. $img = wpui_get_media_item( $title );
  470. if ( ! is_array( $img ) ) return false;
  471. $output = '<img src="' . $img[ 'image' ] . '" title="' . $img[ 'title' ] . '">';
  472. return $output;
  473. } //
  474. function wpui_get_media_item( $title ) {
  475. $get_media_items = array(
  476. 'post_type' => 'attachment',
  477. 'post_mime_type' =>'image',
  478. 'post_status' => 'inherit',
  479. 'posts_per_page' => -1,
  480. );
  481. $output = array(
  482. 'image' => '',
  483. 'title' => '',
  484. 'size' => array()
  485. );
  486. $media_items = new WP_Query( $get_media_items );
  487. $images = array();
  488. $i = 0;
  489. foreach ( $media_items->posts as $image ) {
  490. if ( $i > 0 ) break;
  491. if ( $image->post_title != $title ) continue;
  492. else {
  493. $output[ 'image' ] .= $image->guid;
  494. $output[ 'title' ] .= $image->post_title;
  495. break;
  496. }
  497. $i++;
  498. }
  499. return $output;
  500. } // function get_media_item.
  501. /**
  502. * Get clean id format string.
  503. *
  504. * @return void
  505. * @author Kavin Gray
  506. **/
  507. function wpui_get_id( $str )
  508. {
  509. return preg_replace( array( '/\s{1,}/m', '/[^\-A-Za-z0-9\s_]/m' ), array( '_','' ) , trim( strtolower( $str ) ) );
  510. }
  511. /**
  512. * Get a Miscellaneous option.
  513. *
  514. * @return void
  515. * @author Kavin Gray
  516. **/
  517. function wpui_misc_opt( $name )
  518. {
  519. $miscs = get_wpui_option('misc_options');
  520. $miscs = explode( "\n", $miscs);
  521. for ( $i = 0; $i < count( $miscs ); $i++ ) {
  522. $temp_arr = explode( '=', $miscs[ $i ] );
  523. unset( $miscs[ $i ] );
  524. $miscs[ $temp_arr[ 0 ] ] = $temp_arr[ 1 ];
  525. }
  526. if ( isset( $miscs[ $name ] ) ) return $miscs[ $name ];
  527. else return false;
  528. }
  529. ?>