option_defaults(); $bytab = $this->admin_get_options_by_tab( $currenttab ); foreach( $bytab as $id){ $new = (isset($newoptions[$id])?$newoptions[$id]:''); $old = (isset($oldoptions[$id])?$oldoptions[$id]:''); $opt = (isset($options[$id])?$options[$id]:''); $oldoptions[$id] = $this->MenuOptionsValidate( $new, $old, $opt ); // Make changes to existing options array } update_option( $this->get_private('settings'), $oldoptions); return $oldoptions; } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////// Admin Option Functions ////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /** * Create array of option names for a given tab * * @ Since 1.2.0 */ function admin_get_options_by_tab( $tab = 'generator' ){ $default_options = $this->option_defaults(); $return = array(); foreach($default_options as $key => $val){ if( $val['tab'] == $tab ){ $return[$key] = $key; } } return $return; } /** * Create array of option names and current values for a given tab * * @ Since 1.2.0 */ function admin_get_settings_by_tab( $tab = 'generator' ){ $current = $this->get_all_options(); $default_options = $this->option_defaults(); $return = array(); foreach($default_options as $key => $val){ if( $val['tab'] == $tab ){ $return[$key] = $current[$key]; } } return $return; } /** * Create array of positions for a given tab along with a list of settings for each position * * @ Since 1.2.0 * @ Updated 1.2.3 */ function get_option_positions_by_tab( $tab = 'generator' ){ $positions = $this->admin_option_positions(); $return = array(); if( isset($positions[$tab]) ){ $options = $this->admin_get_options_by_tab( $tab ); $defaults = $this->option_defaults(); foreach($positions[$tab] as $pos => $info ){ $return[$pos]['title'] = (isset($info['title'])?$info['title']:''); $return[$pos]['description'] = (isset($info['description'])?$info['description']:''); $return[$pos]['options'] = array(); } foreach($options as $name){ $pos = (isset($defaults[$name]['position'])?$defaults[$name]['position']:'none'); $return[ $pos ]['options'][] = $name; } } return $return; } /** * Create array of positions for each widget along with a list of settings for each position * * @ Since 1.2.0 */ function admin_get_widget_options_by_position(){ $default_options = $this->option_defaults(); $positions = $this->admin_widget_positions(); $return = array(); foreach($positions as $key => $val ){ $return[$key]['title'] = $val; $return[$key]['options'] = array(); } foreach($default_options as $key => $val){ if(!empty($val['widget'])){ $return[ $val['position'] ]['options'][] = $key; } } return $return; } ////////////////////////////////////////////////////////////////////////////////////// /////////////////////// Admin Page Functions ////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /** * Create shortcode based on given options * * @ Since 1.1.0 * @ Update 1.2.5 */ function admin_generate_shortcode( $options, $optiondetails ){ $short = '['.$this->get_private('short'); $trigger = ''; foreach( $options as $key=>$value ){ if($value && isset($optiondetails[$key]['short'])){ if( isset($optiondetails[$key]['child']) && isset($optiondetails[$key]['hidden']) ){ $hidden = @explode(' ',$optiondetails[$key]['hidden']); if( !in_array( $options[ $optiondetails[$key]['child'] ] ,$hidden) ){ $short .= ' '.$optiondetails[$key]['short'].'="'.$value.'"'; } }else{ $short .= ' '.$optiondetails[$key]['short'].'="'.$value.'"'; } } } $short .= ']'; return $short; } /** * Define Settings Page Tab Markup * * @since 1.1.0 * @link`http://www.onedesigns.com/tutorials/separate-multiple-theme-options-pages-using-tabs Daniel Tara * */ function admin_options_page_tabs( $current = 'general' ) { $tabs = $this->admin_settings_page_tabs(); $links = array(); foreach( $tabs as $tab ){ $tabname = $tab['name']; $tabtitle = $tab['title']; if( $tabname == $current ){ $links[] = ''.$tabtitle.''; }else{ $links[] = ''.$tabtitle.''; } } echo '

'.$this->get_private('name').'

'; echo '
'; } /** * Function for printing general settings page * * @ Since 1.2.0 * @ Updated 1.2.4 */ function admin_display_general(){ ?>

get_private('name'); _e(", a WordPress plugin by the Alpine Press.");?>

check_private('termsofservice') ) { echo '

'.$this->get_private('termsofservice').'

'; }?>

the Alpine PressWordPress.org.


check_private('plugins') && is_array( $this->get_private('plugins') ) ){ foreach($this->get_private('plugins') as $each){ ?>

Please support further development of this plugin with a small donation.

get_all_options(); $settings_section = $this->get_private('id'). '_' . $currenttab . '_tab'; $submitted = ( ( isset($_POST[ "hidden" ]) && ($_POST[ "hidden" ]=="Y") ) ? true : false ); if( $submitted ){ $options = $this->admin_simple_update( $currenttab, $_POST, $options ); } $buttom = (isset($_POST[$this->get_private('settings').'_'.$currenttab]['submit-'.$currenttab])?$_POST[$this->get_private('settings').'_'.$currenttab]['submit-'.$currenttab]:''); if( $buttom == 'Delete Current Cache' ){ $bot = new PhotoTileForPinterestBot(); $bot->clearAllCache(); echo '
'.__("Cache Cleared").'
'; } elseif( $buttom == 'Save Settings' ){ $bot = new PhotoTileForPinterestBot(); $bot->clearAllCache(); echo '
'.__("Settings Saved").'
'; } echo '
'; echo ''; $this->admin_display_opt_form($options,$currenttab); echo '
'; echo '
'; } /** * Second function for printing options page * * @ Since 1.1.0 * @ Updated 1.2.6.1 * */ function admin_display_opt_form($options,$currenttab){ $defaults = $this->option_defaults(); $positions = $this->get_option_positions_by_tab( $currenttab ); $submitted = ( ( isset($_POST[ "hidden" ]) && ($_POST[ "hidden" ]=="Y") ) ? true : false ); if( 'generator' == $currenttab ) { $preview = (isset($_POST[ $this->get_private('settings').'_preview']['submit-preview']) && $_POST[ $this->get_private('settings').'_preview']['submit-preview'] == 'Preview')?true:false; if( $submitted && isset($_POST['shortcode']) && $preview ){ $short = str_replace('\"','"',$_POST['shortcode']); }elseif( $submitted ){ $short = $this->admin_generate_shortcode( $_POST, $defaults ); } ?>

This tool allows you to create shortcodes for the Alpine PhotoTile plugin.

A shortcode is a line of text that tells WordPress how to load a plugin inside the content of a page or post. Rather than explaining how to put together a shortcode, this tool will create the shortcode for you.

Now, copy (Crtl+C) and paste (Crtl+V) the following shortcode into a page or post. Or preview using the button below.

'; echo do_shortcode($short); echo ''; } } echo '
'; } if( !empty($positions) && count($positions) ){ foreach( $positions as $position=>$positionsinfo){ echo '
'; if( !empty($positionsinfo['title']) ){ echo '

'. $positionsinfo['title'].'

'; } if( !empty($positionsinfo['description']) ){ echo '
'. $positionsinfo['description'].'
'; } echo ''; echo ''; if( !empty($positionsinfo['options']) && count($positionsinfo['options']) ){ foreach( $positionsinfo['options'] as $optionname ){ $option = $defaults[$optionname]; $fieldname = ( $option['name'] ); $fieldid = ( $option['name'] ); if( !empty($option['hidden-option']) && !empty($option['check']) ){ $show = $this->get_option( $option['check'] ); if( !$show ){ continue; } } if(isset($option['parent'])){ $class = $option['parent']; }elseif(isset($option['child'])){ $class =($option['child']); }else{ $class = ('unlinked'); } $trigger = (isset($option['trigger'])?('data-trigger="'.(($option['trigger'])).'"'):''); $hidden = (isset($option['hidden'])?' '.$option['hidden']:''); if( 'generator' == $currenttab ){ echo ''; }else{ echo ''; } } } echo ''; echo '
'; $this->MenuDisplayCallback($options,$option,$fieldname,$fieldid); echo '
'; $this->AdminDisplayCallback($options,$option,$fieldname,$fieldid); echo '
'; echo '
'; } } if( 'generator' == $currenttab ) { echo ''; }elseif( 'plugin-settings' == $currenttab ){ echo ''; echo ''; } } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////// Menu Display Functions ///////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /** * Function for displaying forms in the widget page * * @ Since 1.0.0 * @ Updated 1.2.6.1 */ function MenuDisplayCallback($options,$option,$fieldname,$fieldid){ $default = (isset($option['default'])?$option['default']:''); $optionname = (isset($option['name'])?$option['name']:''); $optiontitle = (isset($option['title'])?$option['title']:''); $optiondescription = (isset($option['description'])?$option['description']:''); $fieldtype = (isset($option['type'])?$option['type']:''); $value = ( isset($options[$optionname]) ? $options[$optionname] : $default ); // Output checkbox form field markup if ( 'checkbox' == $fieldtype ) { ?> /> value="" />

/>
value="" />

=$min && $newinput<=$max) ? $newinput : $valid_input ); } // Validate text input and textarea fields else if ( ( 'text' == $type || 'textarea' == $type || 'image-upload' == $type) ) { $valid_input = strip_tags( $newinput ); $sanatize = (isset($optiondetails['sanitize'])?$optiondetails['sanitize']:''); // Validate no-HTML content // nospaces option offers additional filters if ( 'nospaces' == $sanatize ) { // Pass input data through the wp_filter_nohtml_kses filter $valid_input = wp_filter_nohtml_kses( $newinput ); // Remove specified character(s) if( isset($optiondetails['remove']) ){ if( is_array($optiondetails['remove']) ){ foreach( $optiondetails['remove'] as $remove ){ $valid_input = str_replace($remove,'',$valid_input); } }else{ $valid_input = str_replace($optiondetails['remove'],'',$valid_input); } } // Switch or encode characters if( isset($optiondetails['encode']) && is_array( $optiondetails['encode'] ) ){ foreach( $optiondetails['encode'] as $find=>$replace ){ $valid_input = str_replace($find,$replace,$valid_input); } } // Replace spaces with provided character or just remove spaces if( isset($optiondetails['replace']) ){ $valid_input = str_replace(array(' ',' '),$optiondetails['replace'],$valid_input); }else{ $valid_input = str_replace(' ','',$valid_input); } } // Check if numeric elseif ( 'numeric' == $sanatize && is_numeric( wp_filter_nohtml_kses( $newinput ) ) ) { // Pass input data through the wp_filter_nohtml_kses filter $valid_input = wp_filter_nohtml_kses( $newinput ); if( isset($optiondetails['min']) && $valid_input<$optiondetails['min']){ $valid_input = $optiondetails['min']; } if( isset($optiondetails['max']) && $valid_input>$optiondetails['max']){ $valid_input = $optiondetails['max']; } } elseif ( 'int' == $sanatize && is_numeric( wp_filter_nohtml_kses( $newinput ) ) ) { // Pass input data through the wp_filter_nohtml_kses filter $valid_input = round( wp_filter_nohtml_kses( $newinput ) ); if( isset($optiondetails['min']) && $valid_input<$optiondetails['min']){ $valid_input = $optiondetails['min']; } if( isset($optiondetails['max']) && $valid_input>$optiondetails['max']){ $valid_input = $optiondetails['max']; } } elseif ( 'tag' == $sanatize ) { // Pass input data through the wp_filter_nohtml_kses filter $valid_input = wp_filter_nohtml_kses( $newinput ); $valid_input = str_replace(' ','-',$valid_input); } // Validate no-HTML content elseif ( 'nohtml' == $sanatize ) { // Pass input data through the wp_filter_nohtml_kses filter $valid_input = wp_filter_nohtml_kses( $newinput ); $valid_input = str_replace(' ','',$valid_input); } // Validate HTML content elseif ( 'html' == $sanatize ) { // Pass input data through the wp_filter_kses filter using allowed post tags $valid_input = wp_kses_post($newinput ); } // Validate URL address elseif( 'url' == $sanatize ){ $valid_input = esc_url( $newinput ); } // Validate CSS elseif( 'css' == $sanatize ){ $valid_input = wp_htmledit_pre( stripslashes( $newinput ) ); } // Just strip slashes elseif( 'stripslashes' == $sanatize ){ $valid_input = stripslashes( $newinput ); } }else if( 'wp-textarea' == $type ){ // Text area filter $valid_input = wp_kses_post( force_balance_tags($newinput) ); } elseif( 'color' == $type ){ $value = wp_filter_nohtml_kses( $newinput ); if( '#' == $value ){ $valid_input = ''; }else{ $valid_input = $value; } } return $valid_input; } } /** ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * ############################################################################################################################################## * * AlpineBot * * ADMIN Functions * Contains ONLY UNIQUE ADMIN functions * * ########################################################################################## */ class PhotoTileForPinterestAdmin extends PhotoTileForPinterestAdminSecondary{ ////////////////////////////////////////////////////////////////////////////////////// //////////////////// Unique Admin Functions //////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// /** * Alpine PhotoTile: Options Page * * @ Since 1.1.1 * @ Updated 1.2.7.6 */ function admin_build_settings_page(){ $currenttab = isset( $_GET['tab'] )?$_GET['tab']:'general'; // Check for valid tab $possible_tabs = array_keys( $this->admin_settings_page_tabs() ); if( !in_array($currenttab,$possible_tabs) ){ $currenttab = 'general'; } echo '
'; $this->admin_options_page_tabs( $currenttab ); echo '
'; echo '
'; if( 'general' == $currenttab ){ $this->admin_display_general(); }else{ $this->admin_setup_options_form($currenttab); } echo '
'; echo '
'; //$this->admin_donate_button(); echo ''; echo '
**Please Note: This plugin is no longer being developed or maintained. If you are a WordPress developer, I encourage you to take this plugin and make it your own.**
'; echo '
'; echo '
'; // Close Container echo '
'; // Close wrap } } ?>