Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $themename = "uTeli";
- $shortname = "qf";
- // Create theme options
- $options = array (
- array( "desc" => __('<h2 style="margin-top:20px;">Modificar Logo</h2>'),
- "type" => "nothing"),
- array( "name" => __('Logo'),
- "desc" => __('Resolución 240x53'),
- "id" => $shortname."_logo",
- "std" => "",
- "type" => "upload"),
- array( "desc" => __('<h2 style="margin-top:30px;">Modificar Favicon</h2>'),
- "type" => "nothing"),
- array( "name" => __('Favicon'),
- "desc" => __('Resolución 16x16'),
- "id" => $shortname."_favicon",
- "std" => "",
- "type" => "upload"),
- array( "desc" => __('<h2>Header<i> <span style="font-size:12px; font-weight:500;">(Meta tags, Analytics, etc)</span></i></h2>'),
- "type" => "nothing"),
- array( "name" => __('Head'),
- "desc" => __('Codigos que van antes de cerrar </head>'),
- "id" => $shortname."_head",
- "std" => __(""),
- "type" => "textarea",
- "options" => array( "rows" => "5",
- "cols" => "100") ),
- array( "desc" => __('<h2>Body<i> <span style="font-size:12px; font-weight:500;">(Infolink, Whos amung, etc)</span></i></h2>'),
- "type" => "nothing"),
- array( "name" => __('Body'),
- "desc" => __('Codigos que van antes de cerrar </body>'),
- "id" => $shortname."_body",
- "std" => __(""),
- "type" => "textarea",
- "options" => array( "rows" => "5",
- "cols" => "100") ),
- array( "desc" => __('<h2>Footer<i> <span style="font-size:12px; font-weight:500;">(Texto del Footer)</span></i></h2>'),
- "type" => "nothing"),
- array( "name" => __('Texto Footer'),
- "desc" => __('Texto de Pie de Pagina'),
- "id" => $shortname."_tfooter",
- "std" => __(""),
- "type" => "textarea",
- "options" => array( "rows" => "5",
- "cols" => "100") ),);
- function mytheme_add_admin() {
- global $themename, $shortname, $options;
- if ( $_GET['page'] == basename(__FILE__) ) {
- if ( 'save' == $_REQUEST['action'] ) {
- foreach ($options as $value) {
- update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
- foreach ($options as $value) {
- if( $value['type'] == 'upload' )
- {
- $overrides = array( 'test_form' => false);
- $upload = wp_handle_upload( $_FILES[ $value['id'] ], $overrides );
- if( isset( $upload['url'] ) )
- {
- update_option( $value['id'], $upload['url'] );
- }
- }
- elseif( isset( $_REQUEST[ $value['id'] ] ) )
- {
- update_option( $value['id'], $_REQUEST[ $value['id'] ] );
- }
- }
- header("Location: admin.php?page=functions.php&saved=true");
- die;
- } else if( 'reset' == $_REQUEST['action'] ) {
- foreach ($options as $value) {
- delete_option( $value['id'] ); }
- header("Location: admin.php?page=functions.php&reset=true");
- die;
- } else if ( 'reset_widgets' == $_REQUEST['action'] ) {
- $null = null;
- update_option('sidebars_widgets',$null);
- header("Location: admin.php?page=functions.php&reset=true");
- die;
- }
- }
- add_theme_page($themename." Options", "Tekilaz! Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
- }
- function mytheme_admin() {
- global $themename, $shortname, $options;
- if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' '.__('settings saved.','twentyten').'</strong></p></div>';
- if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' '.__('settings reset.','twentyten').'</strong></p></div>';
- if ( $_REQUEST['reset_widgets'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' '.__('widgets reset.','twentyten').'</strong></p></div>';
- ?>
- <div id="wrap">
- <?php if ( function_exists('screen_icon') ) screen_icon(); ?>
- <h2><?php echo $themename; ?> Options</h2>
- <form method="post" action="" enctype="multipart/form-data">
- <table class="form-table">
- <?php foreach ($options as $value) {
- switch ( $value['type'] ) {
- case 'text':
- ?>
- <tr valign="top">
- <th scope="row"><label for="<?php echo $value['id']; ?>"><?php echo __($value['name'],'twentyten'); ?></label></th>
- <td>
- <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_option( $value['id'] ) != "") { echo get_option( $value['id'] ); } else { echo $value['std']; } ?>" />
- <?php echo __($value['desc'],'twentyten'); ?>
- </td>
- </tr>
- <?php
- break;
- case 'textarea':
- $ta_options = $value['options'];
- ?>
- <tr valign="top">
- <th scope="row"><label for="<?php echo $value['id']; ?>"><?php echo __($value['name'],'twentyten'); ?></label></th>
- <td><textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="<?php echo $ta_options['rows']; ?>"><?php
- if( get_option($value['id']) != "") {
- echo __(stripslashes(get_option($value['id'])),'twentyten');
- }else{
- echo __($value['std'],'twentyten');
- }?></textarea><br /><?php echo __($value['desc'],'twentyten'); ?></td>
- </tr>
- <?php
- break;
- case 'nothing':
- $ta_options = $value['options'];
- ?>
- </table>
- <?php echo __($value['desc'],'twentyten'); ?>
- <table class="form-table">
- <?php
- break;
- case 'upload':
- ?>
- <tr>
- <th>Imagen Actual:</th>
- <td><?php if($img = get_option($value['id'])){ echo "<img src='$img'; />";}else{ echo "<i>Ninguna</i> ";} ?> </td>
- </tr>
- <tr valign="top">
- <th scope="row"><label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label></th>
- <td><input type="file" name="<?php echo $value['id'] ?>" size="40" /><input type="hidden" name="<?php echo $value['id'] ?>" value="<?php if($img = get_option($value['id'])){ echo $img;} ?>" /> <i><?php echo __($value['desc'],'twentyten'); ?></i></td>
- </tr>
- <?php
- break;
- default:
- break;
- }
- }
- ?>
- </table>
- <table>
- <tr>
- <td><p class="submit">
- <input name="save" type="submit" value="<?php _e('Save changes','twentyten'); ?>" />
- <input type="hidden" name="action" value="save" />
- </p>
- <td>
- </form>
- <td>
- <form method="post" action="">
- <p class="submit">
- <input name="reset" type="submit" value="<?php _e('Reset','twentyten'); ?>" />
- <input type="hidden" name="action" value="reset" />
- </p>
- </form>
- </td>
- </tr>
- </table>
- <p>© <a href="http://quick-flip.com/uTeli/">uTeli Theme.</a></p>
- </div>
- <?php
- }
- add_action('admin_menu' , 'mytheme_add_admin');
- /**
- * TwentyTen functions and definitions
- *
- * Sets up the theme and provides some helper functions. Some helper functions
- * are used in the theme as custom template tags. Others are attached to action and
- * filter hooks in WordPress to change core functionality.
- *
- * The first function, twentyten_setup(), sets up the theme by registering support
- * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
- *
- * When using a child theme (see http://codex.wordpress.org/Theme_Development and
- * http://codex.wordpress.org/Child_Themes), you can override certain functions
- * (those wrapped in a function_exists() call) by defining them first in your child theme's
- * functions.php file. The child theme's functions.php file is included before the parent
- * theme's file, so the child theme functions would be used.
- *
- * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
- * to a filter or action hook. The hook can be removed by using remove_action() or
- * remove_filter() and you can attach your own function to the hook.
- *
- * We can remove the parent theme's hook only after it is attached, which means we need to
- * wait until setting up the child theme:
- *
- * <code>
- * add_action( 'after_setup_theme', 'my_child_theme_setup' );
- * function my_child_theme_setup() {
- * // We are providing our own filter for excerpt_length (or using the unfiltered value)
- * remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
- * ...
- * }
- * </code>
- *
- * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
- *
- * @package uTeli Theme
- * @copyrights Temalia.net, EliasSierra.com, Quick-Flip.com
- * @url http://uteli.temalia.net
- */
- /**
- * Set the content width based on the theme's design and stylesheet.
- *
- * Used to set the width of images and content. Should be equal to the width the theme
- * is designed for, generally via the style.css stylesheet.
- */
- if ( ! isset( $content_width ) )
- $content_width = 640;
- /** Tell WordPress to run twentyten_setup() when the 'after_setup_theme' hook is run. */
- add_action( 'after_setup_theme', 'twentyten_setup' );
- if ( ! function_exists( 'twentyten_setup' ) ):
- /**
- * Sets up theme defaults and registers support for various WordPress features.
- *
- * Note that this function is hooked into the after_setup_theme hook, which runs
- * before the init hook. The init hook is too late for some features, such as indicating
- * support post thumbnails.
- *
- * To override twentyten_setup() in a child theme, add your own twentyten_setup to your child theme's
- * functions.php file.
- *
- * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
- * @uses register_nav_menus() To add support for navigation menus.
- * @uses add_custom_background() To add support for a custom background.
- * @uses add_editor_style() To style the visual editor.
- * @uses load_theme_textdomain() For translation/localization support.
- * @uses add_custom_image_header() To add support for a custom header.
- * @uses register_default_headers() To register the default custom header images provided with the theme.
- * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_setup() {
- // This theme styles the visual editor with editor-style.css to match the theme style.
- add_editor_style();
- // Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
- add_theme_support( 'post-formats', array( 'aside', 'gallery', 'video', 'link', 'quote' ) );
- // This theme uses post thumbnails
- add_theme_support( 'post-thumbnails' );
- // Add default posts and comments RSS feed links to head
- add_theme_support( 'automatic-feed-links' );
- // Make theme available for translation
- // Translations can be filed in the /languages/ directory
- load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' );
- $locale = get_locale();
- $locale_file = TEMPLATEPATH . "/languages/$locale.php";
- if ( is_readable( $locale_file ) )
- require_once( $locale_file );
- // This theme uses wp_nav_menu() in one location.
- register_nav_menus( array(
- 'primary' => __( 'Menu Principal', 'twentyten' ),
- 'secondary' => __( 'Menu Footer', 'twentyten' ),
- ) );
- }
- endif;
- /**
- * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
- *
- * To override this in a child theme, remove the filter and optionally add
- * your own function tied to the wp_page_menu_args filter hook.
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_page_menu_args( $args ) {
- $args['show_home'] = true;
- return $args;
- }
- add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
- /**
- * Sets the post excerpt length to 40 characters.
- *
- * To override this length in a child theme, remove the filter and add your own
- * function tied to the excerpt_length filter hook.
- *
- * @since Twenty Ten 1.0
- * @return int
- */
- function twentyten_excerpt_length( $length ) {
- return 25;
- }
- add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
- /**
- * Returns a "Continue Reading" link for excerpts
- *
- * @since Twenty Ten 1.0
- * @return string "Continue Reading" link
- */
- function twentyten_continue_reading_link() {
- return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>';
- }
- /**
- * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().
- *
- * To override this in a child theme, remove the filter and add your own
- * function tied to the excerpt_more filter hook.
- *
- * @since Twenty Ten 1.0
- * @return string An ellipsis
- function twentyten_auto_excerpt_more( $more ) {
- return ' …' . twentyten_continue_reading_link();
- }
- add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
- /**
- * Adds a pretty "Continue Reading" link to custom post excerpts.
- *
- * To override this link in a child theme, remove the filter and add your own
- * function tied to the get_the_excerpt filter hook.
- *
- * @since Twenty Ten 1.0
- * @return string Excerpt with a pretty "Continue Reading" link
- */
- function twentyten_custom_excerpt_more( $output ) {
- if ( has_excerpt() && ! is_attachment() ) {
- $output .= twentyten_continue_reading_link();
- }
- return $output;
- }
- add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
- /**
- * Remove inline styles printed when the gallery shortcode is used.
- *
- * Galleries are styled by the theme in Twenty Ten's style.css. This is just
- * a simple filter call that tells WordPress to not use the default styles.
- *
- * @since Twenty Ten 1.2
- */
- add_filter( 'use_default_gallery_style', '__return_false' );
- /**
- * Deprecated way to remove inline styles printed when the gallery shortcode is used.
- *
- * This function is no longer needed or used. Use the use_default_gallery_style
- * filter instead, as seen above.
- *
- * @since Twenty Ten 1.0
- * @deprecated Deprecated in Twenty Ten 1.2 for WordPress 3.1
- *
- * @return string The gallery style filter, with the styles themselves removed.
- */
- function twentyten_remove_gallery_css( $css ) {
- return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
- }
- // Backwards compatibility with WordPress 3.0.
- if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
- add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
- if ( ! function_exists( 'twentyten_comment' ) ) :
- /**
- * Template for comments and pingbacks.
- *
- * To override this walker in a child theme without modifying the comments template
- * simply create your own twentyten_comment(), and that function will be used instead.
- *
- * Used as a callback by wp_list_comments() for displaying the comments.
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_comment( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- switch ( $comment->comment_type ) :
- case '' :
- ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
- <div id="comment-<?php comment_ID(); ?>">
- <div class="comment-author vcard">
- <?php echo get_avatar( $comment, 40 ); ?>
- <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
- </div><!-- .comment-author .vcard -->
- <?php if ( $comment->comment_approved == '0' ) : ?>
- <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
- <br />
- <?php endif; ?>
- <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
- <?php
- /* translators: 1: date, 2: time */
- printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
- ?>
- </div><!-- .comment-meta .commentmetadata -->
- <div class="comment-body"><?php comment_text(); ?></div>
- <div class="reply">
- <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
- </div><!-- .reply -->
- </div><!-- #comment-## -->
- <?php
- break;
- case 'pingback' :
- case 'trackback' :
- ?>
- <li class="post pingback">
- <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
- <?php
- break;
- endswitch;
- }
- endif;
- /**
- * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
- *
- * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
- * function tied to the init hook.
- *
- * @since Twenty Ten 1.0
- * @uses register_sidebar
- */
- function twentyten_widgets_init() {
- // Area 1, located at the top of the sidebar.
- register_sidebar( array(
- 'name' => __( 'Primary Widget Area', 'twentyten' ),
- 'id' => 'primary-widget-area',
- 'description' => __( 'The primary widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Secondary Widget Area', 'twentyten' ),
- 'id' => 'secondary-widget-area',
- 'description' => __( 'The secondary widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 3, located in the footer. Empty by default.
- register_sidebar( array(
- 'name' => __( 'First Footer Widget Area', 'twentyten' ),
- 'id' => 'first-footer-widget-area',
- 'description' => __( 'The first footer widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 4, located in the footer. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Second Footer Widget Area', 'twentyten' ),
- 'id' => 'second-footer-widget-area',
- 'description' => __( 'The second footer widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 5, located in the footer. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Third Footer Widget Area', 'twentyten' ),
- 'id' => 'third-footer-widget-area',
- 'description' => __( 'The third footer widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 6, located in the footer. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
- 'id' => 'fourth-footer-widget-area',
- 'description' => __( 'The fourth footer widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- }
- /** Area de Registro en Tekilaz Media
- *
- */
- function display_message( $message = false )
- {
- if( is_wp_error( $message ) )
- {
- echo '<p>' . $message->get_error_message() . '</p>';
- }
- }
- function add_new_user($username, $password, $confirm, $email, $nombre, $apellido)
- {
- require ( ABSPATH . WPINC . '/registration.php' );
- // Remove html tags from the title and content fields
- $username_stripped = strip_tags($username);
- $password_stripped = strip_tags($password);
- $confirm_stripped = strip_tags($confirm);
- $email_stripped = strip_tags($email);
- $nombre_stripped = strip_tags($nombre);
- $apellido_stripped = strip_tags($apellido);
- // Check to see if User Registration is turned OFF
- if (get_option('users_can_register') == '0') return new WP_Error('reg_off', 'Lo sentimos, los registros están desactivados');
- // Validate the Form Data
- if(isEmptyString($nombre_stripped)) return new WP_Error('forgot_nombre', 'Por favor ingresa tu Nombre');
- if(isEmptyString($apellido_stripped)) return new WP_Error('forgot_apellido', 'Por favor ingresa tu Apellido');
- if(isEmptyString($username_stripped)) return new WP_Error('forgot_username', 'Por favor ingresa un Nombre de Usuario');
- if(strlen($username_stripped)<6) return new WP_Error('username_corto', 'El Nombre de Usuario debe tener 6 caracteres como mínimo');
- if(username_exists($username_stripped)) return new WP_Error('username_exists', 'Lo sentimos, ese Nombre de Usuario ya existe');
- if(!is_email($email_stripped)) return new WP_Error('verify_email', 'Por favor ingresa un Correo Electrónico valido');
- if(email_exists($email_stripped)) return new WP_Error('email_exists', 'Lo sentimos, ese Correo Electrónico ya esta siendo usado por otro usuario');
- if(isEmptyString($password_stripped)) return new WP_Error('forgot_password', 'Por favor ingresa una Contraseña');
- if(strlen($password_stripped)<6) return new WP_Error('password_corto', 'La Contraseña debe tener por lo menos 6 caracteres');
- if($password_stripped != $confirm_stripped) return new WP_Error('passwords_no_match', 'Tu Contraseña no concuerda');
- // Create the user
- $user_data = array
- (
- 'first_name' => $nombre_stripped,
- 'last_name' => $apellido_stripped,
- 'user_login' => $username_stripped,
- 'user_pass' => $password_stripped,
- 'user_email' => $email_stripped,
- );
- $user_id = wp_insert_user($user_data);
- $user = get_userdata($user_id);
- // Log the User In
- wp_login($username_stripped, $password_stripped);
- wp_clearcookie();
- wp_setcookie($username_stripped, $remember, false);
- // Email User with Login Info
- $site = get_bloginfo("name");
- $sitename = str_replace("&", "&", $site);
- $headers = 'From: '.$sitename.' <noreply@'.$sitename.'>' . "\r\n";
- $to = $user->user_email;
- $subject = sprintf(__('Ya tienes cuenta en %s - ¡Bienvenido!'), $sitename) . "\r\n\r\n";
- $message = sprintf(__('Estimado %s:'), $user->user_login) . "\r\n\r\n";
- $message .= sprintf(__('Gracias por registrarte a %s la Comunidad en la que podrás dar a conocer Tus Propias Opiniones de todos los Productos y Servicios que hayas Comprado o Usado.'), $sitename) . "\r\n\r\n";
- $message .= sprintf(__('-------------------------------------------------------------------------------------')). "\r\n\r\n";
- $message .= sprintf(__('Te recordamos tus datos:)')). "\r\n\r\n";
- $message .= sprintf(__('Nombre de Usuario: %s'), $user->user_login) . "\r\n\r\n";
- $message .= sprintf(__('Contraseña: %s'), $password_stripped) . "\r\n\r\n";
- $message .= sprintf(__('-------------------------------------------------------------------------------------')). "\r\n\r\n";
- $message .= sprintf(__('Una vez más, ¡bienvenido!')) . "\r\n\r\n";
- $message .= sprintf(__('Equipo de %s'), $sitename) . "\r\n\r\n";
- wp_mail($to, $subject, $message, $headers);
- // Redirect the User to My Account
- redirect_to_myaccount_url();
- }
- function isEmptyString($data)
- {
- return (trim($data) === "" or $data === null);
- }
- function redirect_to_myaccount_url()
- {
- wp_redirect(get_bloginfo('url') . '/panel/');
- }
- // Log In User
- function log_in_user($username, $password)
- {
- // Get the user based on the username from the POST
- $user = parse_user($username);
- // Remove html tags from the title and content fields
- $username_stripped = strip_tags($username);
- $password_stripped = strip_tags($password);
- // Validate the Form Data
- if(isEmptyString($username_stripped)) return new WP_Error('forgot_username', 'Por favor ingresa un Nombre de Usuario');
- if(isEmptyString($password_stripped)) return new WP_Error('incorrect_password', 'Por favor ingresa una Contraseña');
- if(!wp_check_password( $password_stripped, $user->user_pass ) ) return new WP_Error('incorrect_password', 'Ingresaste una Contraseña incorrecta');
- wp_set_auth_cookie($user->ID, $remember);
- wp_login($username_stripped, $password_stripped);
- redirect_to_myaccount_url();
- }
- /** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
- add_action( 'widgets_init', 'twentyten_widgets_init' );
- /**
- * Removes the default styles that are packaged with the Recent Comments widget.
- *
- * To override this in a child theme, remove the filter and optionally add your own
- * function tied to the widgets_init action hook.
- *
- * This function uses a filter (show_recent_comments_widget_style) new in WordPress 3.1
- * to remove the default style. Using Twenty Ten 1.2 in WordPress 3.0 will show the styles,
- * but they won't have any effect on the widget in default Twenty Ten styling.
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_remove_recent_comments_style() {
- add_filter( 'show_recent_comments_widget_style', '__return_false' );
- }
- add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
- if ( ! function_exists( 'twentyten_posted_on' ) ) :
- /**
- * Prints HTML with meta information for the current post-date/time and author.
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_posted_on() {
- printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
- 'meta-prep meta-prep-author',
- sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
- get_permalink(),
- esc_attr( get_the_time() ),
- get_the_date()
- ),
- sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
- get_the_author()
- )
- );
- }
- endif;
- if ( ! function_exists( 'twentyten_posted_in' ) ) :
- /**
- * Prints HTML with meta information for the current post (category, tags and permalink).
- *
- * @since Twenty Ten 1.0
- */
- function twentyten_posted_in() {
- // Retrieves tag list of current post, separated by commas.
- $tag_list = get_the_tag_list( '', ', ' );
- if ( $tag_list ) {
- $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
- $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } else {
- $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- }
- // Prints the string, replacing the placeholders.
- printf(
- $posted_in,
- get_the_category_list( ', ' ),
- $tag_list,
- get_permalink(),
- the_title_attribute( 'echo=0' )
- );
- }
- endif;
- // Get all custom fields attached to a page
- if( !function_exists('base_get_all_custom_fields') ) {
- function base_get_all_custom_fields(){
- global $post;
- global $wpdb;
- $sql = "SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID ORDER BY meta_id ASC";
- $custom_fields = $wpdb->get_results($sql);
- $custom_field_array = array();
- foreach($custom_fields as $field) {
- $custom_field_array["$field->meta_key"] = $field->meta_value;
- }
- return $custom_field_array;
- }
- }
- function addUploadMimes($mimes) {
- $mimes = array_merge($mimes, array(
- 'srt|tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' => 'application/octet-stream'
- ));
- return $mimes;
- }
- add_filter('upload_mimes', 'addUploadMimes');
- function atom_search_where($where){
- global $wpdb;
- if (is_search())
- $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')";
- return $where;
- }
- function atom_search_join($join){
- global $wpdb;
- if (is_search())
- $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id";
- return $join;
- }
- function atom_search_groupby($groupby){
- global $wpdb;
- // we need to group on post ID
- $groupby_id = "{$wpdb->posts}.ID";
- if(!is_search() || strpos($groupby, $groupby_id) !== false) return $groupby;
- // groupby was empty, use ours
- if(!strlen(trim($groupby))) return $groupby_id;
- // wasn't empty, append ours
- return $groupby.", ".$groupby_id;
- }
- add_filter('posts_where','atom_search_where');
- add_filter('posts_join', 'atom_search_join');
- add_filter('posts_groupby', 'atom_search_groupby');
- function new_excerpt_length($length) {
- return 35;
- }
- add_filter('excerpt_length', 'new_excerpt_length');
- // -------------------------------- prev next functions
- function get_the_subcategory()
- {
- $categories = get_the_category();
- // get the sub category if we have them
- foreach ($categories as $cat)
- {
- $parent = $cat->category_parent;
- if ($parent != 0 )
- {
- $sub_cat_ID = $cat->cat_ID;
- }
- }
- if (!$sub_cat_ID)
- {
- return false;
- }
- else
- {
- return $sub_cat_ID;
- }
- }
- function transformar($link_iframe){
- $src = explode("?",$link_iframe,2);
- $params = explode("&",$src[1]);
- for ( $i = 0; $i < count($params); $i++) {
- $param = explode("=",$params[$i],2);
- if ( $param[0] != 'id' && $param[0] != 'sub' && $param[0] != 'sub_pre' ){
- $param[1] = encriptar($param[1]);
- $params[$i] = $param[0].'='.$param[1];
- }
- }
- $src[1]=implode("&",$params);
- return $src[0]."?".$src[1];
- }
- function encriptar( $info_a_encriptar) {
- $abc1 = "abcdefghijklmnopqrstuvwxyz01234ABCDEFGHIJKLMNOPQRSTUVWXYZ56789";
- $len_abc = strlen($abc1);
- $info_encriptada = "";
- $cambio = false;
- for ($i = 0; $i < strlen($info_a_encriptar); $i++) {
- for ($j = 0; $j < $len_abc; $j++) {
- if ($info_a_encriptar[$i] == $abc1[$j] ){
- $cambio = true;
- if ( $j > $len_abc - 4 ) {
- $info_encriptada = $info_encriptada.$abc1[$j - ( $len_abc - 3 )];
- } else {
- $info_encriptada = $info_encriptada.$abc1[$j + 3];
- }
- $j = $len_abc;
- }
- }
- if (!$cambio) {
- $info_encriptada = $info_encriptada.$info_a_encriptar[$i];
- }
- $cambio = false;
- }
- $info_a_encriptar = $info_encriptada;
- return $info_a_encriptar;
- }
- function get_next_subcategory_post_link()
- {
- $category = get_the_category(2216);
- $cat_ID = 2217;
- if($cat_ID != false)
- {
- $args = array(
- ‘numberposts’ => 1000,
- ‘category’ => $cat_ID,
- ‘orderby’ => ‘post_date’,
- ‘order’ => ‘ASC’ );
- $list = get_posts($args);
- ?>
- <textarea>
- <?php print_r ($list); ?>
- </textarea>
- <?
- $current = false;
- foreach($list as $post)
- {
- if($current == true)
- {
- return get_permalink($post->ID);
- }
- if($post->ID == get_the_ID())
- {
- $current = true;
- }
- else
- {
- }
- }
- }
- else
- {
- return '#error';
- }
- }
- function get_previous_subcategory_post_link()
- {
- $cat_ID = get_the_subcategory();
- $args = array(
- ‘numberposts’ => 1000,
- ‘category’ => $cat_ID,
- ‘orderby’ => ‘post_date’,
- ‘order’ => ‘DESC’ );
- $list = get_posts($args);
- $current = false;
- foreach($list as $post)
- {
- if($current == true)
- {
- return get_permalink($post->ID);
- }
- if($post->ID == get_the_ID())
- {
- $current = true;
- }
- else
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement