/** * Update a plugin * * @access private * @param mixed $plugin * @return array */ function _wprp_upgrade_plugin($plugin) { include_once ABSPATH . 'wp-admin/includes/admin.php'; if (!_wprp_supports_plugin_upgrade()) { return array('status' => 'error', 'error' => 'WordPress version too old for plugin upgrades'); } $skin = new WPRP_Plugin_Upgrader_Skin(); $upgrader = new Plugin_Upgrader($skin); $is_active = is_plugin_active($plugin); // Do the upgrade ob_start(); $result = $upgrader->upgrade($plugin); $data = ob_get_contents(); ob_clean(); if (!$result && !is_null($result) || $data) { return array('status' => 'error', 'error' => 'file_permissions_error'); } elseif (is_wp_error($result)) { return array('status' => 'error', 'error' => $result->get_error_code()); } if ($skin->error) { return array('status' => 'error', 'error' => $skin->error); } // If the plugin was activited, we have to re-activate it // @todo Shouldn't this use activate_plugin? if ($is_active) { $current = get_option('active_plugins', array()); $current[] = plugin_basename(trim($plugin)); sort($current); update_option('active_plugins', $current); } return array('status' => 'success'); }
function mytheme_add_admin() { global $themename, $shortname, $options; if ($_GET['page'] == basename(__FILE__)) { if ('save' == $_REQUEST['action']) { foreach ($options as $value) { if ($value['type'] != 'header') { update_option($value['id'], $_REQUEST[$value['id']]); } } foreach ($options as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } else { delete_option($value['id']); } } header("Location: themes.php?page=settings.php&saved=true"); die; } else { if ('reset' == $_REQUEST['action']) { foreach ($options as $value) { delete_option($value['id']); } header("Location: themes.php?page=settings.php&reset=true"); die; } } } add_theme_page($themename . " Settings", "Theme Settings", 'edit_themes', basename(__FILE__), 'mytheme_admin'); }
public function load($parent) { $this->parent = $parent; //delete_option('redux-framework-tracking'); $this->options = get_option('redux-framework-tracking'); $this->options['dev_mode'] = $parent->args['dev_mode']; if (!isset($this->options['hash']) || !$this->options['hash'] || empty($this->options['hash'])) { $this->options['hash'] = md5(site_url() . '-' . $_SERVER['REMOTE_ADDR']); update_option('redux-framework-tracking', $this->options); } if (isset($_GET['redux_framework_disable_tracking']) && !empty($_GET['redux_framework_disable_tracking'])) { $this->options['allow_tracking'] = false; update_option('redux-framework-tracking', $this->options); } if (isset($_GET['redux_framework_enable_tracking']) && !empty($_GET['redux_framework_enable_tracking'])) { $this->options['allow_tracking'] = true; update_option('redux-framework-tracking', $this->options); } if (isset($_GET['page']) && $_GET['page'] == $this->parent->args['page_slug']) { if (!isset($this->options['allow_tracking'])) { add_action('admin_enqueue_scripts', array($this, '_enqueue_tracking')); } else { if (!isset($this->options['tour']) && ($this->parent->args['dev_mode'] == "true" || $this->parent->args['page_slug'] == "redux_demo")) { add_action('admin_enqueue_scripts', array($this, '_enqueue_newsletter')); } } } if (isset($this->options['allow_tracking']) && $this->options['allow_tracking'] == true) { // The tracking checks daily, but only sends new data every 7 days. if (!wp_next_scheduled('redux_tracking')) { wp_schedule_event(time(), 'daily', 'redux_tracking'); } add_action('redux_tracking', array($this, 'tracking')); } }
/** * Install * * Runs on plugin install to populates the settings fields for those plugin * pages. After successful install, the user is redirected to the MASHSB Welcome * screen. * * @since 2.0 * @global $wpdb * @global $mashsb_options * @global $wp_version * @return void */ function mashsb_install() { global $wpdb, $mashsb_options, $wp_version; // Add Upgraded From Option $current_version = get_option('mashsb_version'); if ($current_version) { update_option('mashsb_version_upgraded_from', $current_version); } // Update the current version update_option('mashsb_version', MASHSB_VERSION); // Add plugin installation date and variable for rating div add_option('mashsb_installDate', date('Y-m-d h:i:s')); add_option('mashsb_RatingDiv', 'no'); if (!get_option('mashsb_update_notice')) { add_option('mashsb_update_notice', 'no'); } /* Setup some default options * Store our initial social networks in separate option row. * For easier modification and to prevent some trouble */ $networks = array('Facebook', 'Twitter', 'Subscribe'); if (is_plugin_inactive('mashshare-networks/mashshare-networks.php')) { update_option('mashsb_networks', $networks); } // Bail if activating from network, or bulk if (is_network_admin() || isset($_GET['activate-multi'])) { return; } // Add the transient to redirect / not for multisites set_transient('_mashsb_activation_redirect', true, 30); }
function renova_setup() { //Feed links add_theme_support('automatic-feed-links'); //Nav menu register_nav_menu('primary', __('Primary Menu', 'renovalang')); //Sidebar $args = array('name' => __('renova_side', 'renovalang'), 'id' => 'renova01', 'description' => '', 'class' => '', 'before_widget' => '<section id="%1$s" class="blog-side-panel %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2>', 'after_title' => '</h2>'); register_sidebar($args); //Content width if (!isset($content_width)) { $content_width = 900; } //Initiate custom post types add_action('init', 'renova_post_types'); add_action('init', 'renova_post_gallery'); //Load the text domain load_theme_textdomain('renovalang', get_template_directory() . '/languages'); //Post Thumbnails add_theme_support('post-thumbnails', array('portfolio_item', 'gallery_item', 'post')); //Post formats add_theme_support('post-formats', array('image', 'audio', 'link', 'quote', 'video')); set_post_thumbnail_size(300, 300, true); // Standard Size Thumbnails //Function to crop all thumbnails if (false === get_option("thumbnail_crop")) { add_option("thumbnail_crop", "1"); } else { update_option("thumbnail_crop", "1"); } }
public static function init() { if (!is_admin()) { return; } if (!isset($_FILES['podlove_import_tracking'])) { return; } set_time_limit(10 * MINUTE_IN_SECONDS); // allow xml+gz uploads add_filter('upload_mimes', function ($mimes) { return array_merge($mimes, array('xml' => 'application/xml', 'gz|gzip' => 'application/x-gzip')); }); require_once ABSPATH . '/wp-admin/includes/file.php'; $file = wp_handle_upload($_FILES['podlove_import_tracking'], array('test_form' => false)); if ($file && (!isset($file['error']) || !$file['error'])) { update_option('podlove_import_tracking_file', $file['file']); if (!($file = get_option('podlove_import_tracking_file'))) { return; } $importer = new \Podlove\Modules\ImportExport\Import\TrackingImporter($file); $importer->import(); } else { echo '<div class="error"><p>' . $file['error'] . '</p></div>'; } }
function wss_plugin_activation_action() { $defaults = array('twitter_username' => "", 'auto_add_post_types' => array('post'), 'social_options' => array('facebook', 'twitter', 'googleplus'), 'social_icon_position' => 'after', 'load_static' => array('load_css', 'load_js'), 'facebook_text' => "Share on Facebook", 'twitter_text' => "Share on Twitter", 'googleplus_text' => "Share on Google+", 'linkedin_text' => "Share on Linkedin", 'pinterest_text' => "Share on Pinterest", 'pinterest_image' => "", 'show_icons' => '0', 'before_button_text' => '', 'text_position' => 'left'); update_option('wp_social_sharing', $defaults); update_option('wss_wp_social_sharing', 'f,t,g,l,p'); update_option('wss_pluign_version ', SS_VERSION); }
static function InitClass() { wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all'); wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'bower_components/jquery-deserialize/dist/jquery.deserialize.min.js', array('jquery'), WPFB_VERSION); if (isset($_GET['page'])) { $page = $_GET['page']; if ($page == 'wpfilebase_files') { wp_enqueue_script('postbox'); wp_enqueue_style('dashboard'); } elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') { do_action('wpfilebase_sync'); wp_die("Filebase synced."); } } add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup')); //wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list','wp-filebase'), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED','wp-filebase'))); add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts')); self::CheckChangedVer(); if (basename($_SERVER['PHP_SELF']) === "plugins.php") { if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) { update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0"); } if (get_option('wpfb_uninstall')) { function wpfb_uninstall_warning() { echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.', 'wp-filebase') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t"; } add_action('admin_notices', 'wpfb_uninstall_warning'); } } }
/** * The theme option name is set as 'options-theme-customizer' here. * In your own project, you should use a different option name. * I'd recommend using the name of your theme. * * This option name will be used later when we set up the options * for the front end theme customizer. */ function optionsframework_option_name() { $optionsframework_settings = get_option('optionsframework'); // Edit 'options-theme-customizer' and set your own theme name instead $optionsframework_settings['id'] = 'options_theme_customizer'; update_option('optionsframework', $optionsframework_settings); }
/** * Build the custom settings & update OptionTree. * * @return void * @since 2.3.0 */ function custom_theme_options() { /* OptionTree is not loaded yet */ if (!function_exists('ot_settings_id')) { return false; } /** * Get a copy of the saved settings array. */ $saved_settings = get_option(ot_settings_id(), array()); /** * Custom settings array that will eventually be * passes to the OptionTree Settings API Class. */ $custom_settings = array('contextual_help' => array('content' => array(array('id' => 'option_types_help', 'title' => __('Option Types', 'themecountry'), 'content' => '<p>' . __('Help content goes here!', 'themecountry') . '</p>')), 'sidebar' => '<p>' . __('Sidebar content goes here!', 'themecountry') . '</p>'), 'sections' => array(array('id' => 'option_general', 'title' => __('General', 'themecountry')), array('id' => 'option_style', 'title' => __('Styles', 'themecountry')), array('id' => 'option_header', 'title' => __('Header', 'themecountry')), array('id' => 'option_footer', 'title' => __('Footer', 'themecountry')), array('id' => 'option_blog', 'title' => __('Home Page', 'themecountry')), array('id' => 'option_home_slider', 'title' => __('Feature Slider', 'themecountry')), array('id' => 'option_single', 'title' => __('Single Post', 'themecountry')), array('id' => 'option_sidebar', 'title' => __('Sidebar', 'themecountry')), array('id' => 'option_social_button', 'title' => __('Social Buttons', 'themecountry')), array('id' => 'option_typography', 'title' => __('Typography', 'themecountry')), array('id' => 'option_ad_mangment', 'title' => __('Ad Managment', 'themecountry')), array('id' => 'option_import_export', 'title' => __('Import/Export', 'themecountry'))), 'settings' => array(array('id' => 'responsive', 'label' => __('Responsiveness', 'themecountry'), 'desc' => __('Wimple pro is responsive witch mean that the layout is adapt to Mobile and table screen. Using This option to enable or disable responsiveness.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_general'), array('id' => 'header-code', 'label' => __('Header Code', 'themecountry'), 'desc' => __('If you have any code you want to appear between and , Pastes it here. For example: Google Web Master Cool Code or Pinterest Verify Code.', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_general', 'rows' => '3'), array('id' => 'tracking-code', 'label' => __('Footer Code (Tracing, JavaScript Code)', 'themecountry'), 'desc' => __('If you have tracking code (Google Analytic or other ), Pastes Your Code here which be inserted before the closing body tag of your theme.', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_general', 'rows' => '3'), array('id' => 'page-comments', 'label' => __('Comment on Page', 'themecountry'), 'desc' => __('Use this option to to enable or completely Hide Comment and Comment form on Page', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_general'), array('id' => 'back_to_top', 'label' => __('Back To Top Button', 'themecountry'), 'desc' => __('Use this option to hide or show "Back To Top" button.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_general'), array('id' => 'logo', 'label' => __('Custom Logo Image', 'themecountry'), 'desc' => __('Upload your custom logo image here.', 'themecountry'), 'type' => 'upload', 'section' => 'option_header'), array('id' => 'header_layout', 'label' => __('Header Layout', 'themecountry'), 'desc' => __('Use this option to Choose Header Design Style for your website.', 'themecountry'), 'std' => 'left', 'type' => 'radio-image', 'section' => 'option_header', 'class' => '', 'choices' => array(array('value' => 'left', 'label' => __('Header Content With Navigation', 'themecountry'), 'src' => get_template_directory_uri() . '/images/header-layout/header-menu.png'), array('value' => 'right', 'label' => __('Header Suppurate From Navigation', 'themecountry'), 'src' => get_template_directory_uri() . '/images/header-layout/menu-out-of-header.png'))), array('id' => 'fixed_menu', 'label' => __('Floating Navigation Menu', 'themecountry'), 'desc' => __('Use this option to enable Floating Navigation Menu.', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_header'), array('id' => 'footer-widgets', 'label' => __('Footer Widget Columns', 'themecountry'), 'desc' => __('Select Number of Columns for your Footer area or Disable it.', 'themecountry'), 'std' => '3', 'type' => 'radio-image', 'section' => 'option_footer', 'class' => '', 'choices' => array(array('value' => '0', 'label' => __('Disable', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/layout-off.png'), array('value' => '1', 'label' => __('1 Column', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/footer-widgets-1.png'), array('value' => '2', 'label' => __('2 Columns', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/footer-widgets-2.png'), array('value' => '3', 'label' => __('3 Columns', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/footer-widgets-3.png'))), array('id' => 'copyright', 'label' => __('Footer Copyright Text', 'themecountry'), 'desc' => __('Add Text you want to show in "Copyright Sction" at Bottom Left of your Website.', 'themecountry'), 'type' => 'textarea-simple', 'rows' => '3', 'section' => 'option_footer'), array('id' => 'post-text', 'label' => __('Home Page Entry Text', 'themecountry'), 'desc' => __('Use this option to show Expert or Full Content from your each post show on Homepage and Archive Page.', 'themecountry'), 'std' => 'excerpt', 'type' => 'radio', 'section' => 'option_blog', 'choices' => array(array('value' => 'excerpt', 'label' => __('Show Excerpt', 'themecountry')), array('value' => 'content', 'label' => __('Show Content', 'themecountry')))), array('id' => 'home-post-read-more', 'label' => __('Read More Button', 'themecountry'), 'desc' => __('Enable or Disable Read More Button on Homepage for Each Post.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_blog'), array('id' => 'excerpt-length', 'label' => 'Excerpt Length', 'desc' => __('Number of word as Expert Length To be Shown in Homepage when you choose to show entry text as Excerpt.', 'themecountry'), 'std' => '34', 'type' => 'numeric-slider', 'section' => 'option_blog', 'min_max_step' => '0,100,1'), array('id' => 'home-post-meta', 'label' => __('HomePage & Single Post Meta Info', 'themecountry'), 'desc' => __('Use this button to Show or Hide Post Meta Info on HomePage. (Author name, Date etc.).', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_blog'), array('id' => 'home-post-meta-show', 'label' => __('What To Hide in Meta Info', 'themecountry'), 'desc' => __('Choose What Meta Info to Hide.', 'themecountry'), 'type' => 'checkbox', 'section' => 'option_blog', 'choices' => array(array('value' => 'autho_name', 'label' => __('Author Name', 'themecountry')), array('value' => 'date', 'label' => __('Date', 'themecountry')), array('value' => 'category', 'label' => __('Category', 'themecountry')), array('value' => 'tag', 'label' => __('Tag', 'themecountry')), array('value' => 'comment_count', 'label' => __('Comment Count', 'themecountry')))), array('id' => 'pagination', 'label' => __('Pagination', 'themecountry', 'themecountry'), 'desc' => __('Choose your Preferred Pagination Style.', 'themecountry'), 'std' => 'default', 'type' => 'radio', 'section' => 'option_blog', 'choices' => array(array('value' => 'default', 'label' => __('Default (Older Posts/Newer Posts)', 'themecountry')), array('value' => 'numberal', 'label' => __('Numberal (1 2 3 ...)', 'themecountry')), array('value' => 'loading', 'label' => __('Load More...', 'themecountry')), array('value' => 'infinite', 'label' => __('Auto Infinite Scroll', 'themecountry')))), array('id' => 'enable-home-slider', 'label' => __('Featured Content Slider', 'themecountry'), 'desc' => __('use this option to enable or Disable Featured Content Slider.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_home_slider'), array('id' => 'number-of-post', 'label' => __('Number of Slides', 'themecountry'), 'desc' => __('Enter the number of Slides', 'themecountry'), 'std' => '5', 'type' => 'text', 'section' => 'option_home_slider'), array('id' => 'type-of-slider', 'label' => __('Use Categories Slider', 'themecountry'), 'desc' => __('Use Post from Category As Featured Content Sliders', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_home_slider'), array('id' => 'category-slide-option', 'label' => __('Choose Categories', 'themecountry'), 'desc' => '', 'std' => '', 'type' => 'category-checkbox', 'section' => 'option_home_slider', 'operator' => 'and'), array('id' => 'customize_slider_option', 'label' => __('Custom Sliders', 'themecountry'), 'desc' => __('With this option you can set up a Sliders with custom image and text instead of the default slidshow automatically generated from your posts.', 'themecountry'), 'std' => '', 'type' => 'list-item', 'section' => 'option_home_slider', 'operator' => 'and', 'settings' => array(array('id' => 'slide_image', 'label' => __('Image', 'themecountry'), 'desc' => __('Upload or select an image for this slide', 'themecountry'), 'type' => 'upload'), array('id' => 'slide_url', 'label' => __('Link', 'themecountry'), 'desc' => __('URL of the slide', 'themecountry'), 'std' => '#', 'type' => 'text', 'operator' => 'and'))), array('id' => 'author-bio', 'label' => __('Author Bio', 'themecountry'), 'desc' => __('Display Author Bio below each Post.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'author-highlight', 'label' => __('Highlight Author Comment', 'themecountry'), 'desc' => __('Use this Option to highlight author comments.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'breadcrumb', 'label' => __('Breadcrumbs', 'themecountry'), 'desc' => __('Use This Option to enable or Disable breadcrumbs.', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'yoast_breadcrumb', 'desc' => __('Check it if you install WordPress SEO by Yoast', 'themecountry'), 'type' => 'checkbox', 'section' => 'option_single', 'choices' => array(array('value' => 'yoast_breadcrumb_yes', 'label' => __('Use Yoast Breadcrumb', 'option-tree-theme')))), array('id' => 'post-nav', 'label' => __('Post Navigation', 'themecountry'), 'desc' => __('Shows links to the next and previous post', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'post-related', 'label' => __('Related Posts', 'themecountry'), 'desc' => __('Use This Option to enable or Disable related Posts below your Post.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'related-posts-taxonomy', 'label' => __('Related Posts Taxonomy', 'themecountry'), 'desc' => __('Choose the Way Related Post Work.', 'themecountry'), 'std' => 'tag', 'type' => 'radio', 'section' => 'option_single', 'choices' => array(array('value' => 'tag', 'label' => 'Tags'), array('value' => 'category', 'label' => 'Categories'))), array('id' => 'number-related', 'std' => '3', 'label' => __('Number Related Posts', 'themecountry'), 'desc' => __('Enter the number of posts to show in the related posts section.', 'themecountry'), 'type' => 'text', 'section' => 'option_single'), array('id' => 'display-related-posts', 'label' => __('Display Related Posts', 'themecountry'), 'desc' => __('Related Posts type to display.'), 'std' => 'thumbnail', 'type' => 'radio', 'section' => 'option_single', 'choices' => array(array('value' => 'thumbnail', 'label' => __('Thumbnail and Title', 'themecountry')), array('value' => 'list', 'label' => __('Only Tittle, In List style.', 'themecountry')))), array('id' => 'pinterest', 'label' => __('Pinterest Pin In Button', 'themecountry'), 'desc' => __('Use This Option to enable or Disable Pinterest "Pin In" button which will be shown when visitor add mouse hover images in your post.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_single'), array('id' => 'sidebar-areas', 'label' => __('Create Sidebars', 'themecountry'), 'desc' => __('Create Custom Sidebars Here if you want to Have Different Sidebar for Homepage and Single Post and So on.', 'themecountry'), 'type' => 'list-item', 'section' => 'option_sidebar', 'choices' => array(), 'settings' => array(array('id' => 'id', 'label' => __('Sidebar ID', 'themecountry'), 'desc' => __('This ID must be unique, for example "sidebar-about"', 'themecountry'), 'std' => 'sidebar-select', 'type' => 'text', 'choices' => array()))), array('id' => 's1-home', 'label' => __('Home', 'themecountry'), 'desc' => __('Choose Sidebar to Show On Hompage.', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-single', 'label' => __('Single', 'themecountry'), 'desc' => __('Choose Sidebar to Show On Single Post.', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-archive', 'label' => __('Archive (Date Based)', 'themecountry'), 'desc' => __('Choose Sidebar to Show On Archive Page (Date Based Archive)', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-archive-category', 'label' => __('Archive Category', 'themecountry'), 'desc' => __('Choose Sidebar to Show On Category Page.', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-search', 'label' => __('Search', 'themecountry'), 'desc' => __('Choose Sidebar to Show On Search Page', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-404', 'label' => __('Error 404', 'themecountry'), 'desc' => __('Choose Sidebar to Show On "Error 404, Page Not Found" Page.', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 's1-page', 'label' => __('Page', 'themecountry'), 'desc' => __('Choose Sidebar to Show On "Page".', 'themecountry'), 'type' => 'sidebar-select', 'section' => 'option_sidebar'), array('id' => 'tc-google-typography', 'label' => '', 'desc' => '', 'type' => 'typography-google', 'section' => 'option_typography'), array('id' => 'social-button-enable', 'label' => __('Social Sharing Button', 'themecountry'), 'desc' => __('Use This Option to Show Social Sharing Button.', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'twitter-username', 'label' => __('Twitter Username', 'themecountry'), 'desc' => __('Your @username will be added to share-tweets of your posts (optional)', 'themecountry'), 'type' => 'text', 'section' => 'option_social_button'), array('id' => 'social-sharing-pos', 'label' => __('Social Sharing Buttons Position', 'themecountry'), 'desc' => __('Choose position for Social Sharing Buttons.', 'themecountry'), 'type' => 'checkbox', 'section' => 'option_social_button', 'std' => 'top', 'choices' => array(array('value' => 'top', 'label' => __('After Title', 'themecountry')), array('value' => 'bottom', 'label' => __('After Post', 'themecountry')), array('value' => 'float', 'label' => __('Float Social To Left', 'themecountry')))), array('id' => 'social-twitter', 'label' => __('Twitter', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'social-facebook', 'label' => __('Facebook', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'social-google-plus', 'label' => __('Google Plus', 'themecountry'), 'std' => 'on', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'social-linkedin', 'label' => __('Linkedin', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'social-pinterest', 'label' => __('Pinterest', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_social_button'), array('id' => 'ad-header-banner', 'label' => __('Header Banner Ads', 'themecountry'), 'desc' => __('Paste Your Ads Code Here ( Adsense, Buy Sell Ads ). It will be shown on the top of Header ( Note: This Ads won`t be shown If you choose the 1st design in Header Option )', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_ad_mangment', 'rows' => '3'), array('id' => 'ad-after-post-title', 'label' => __('Below Post Title', 'themecountry'), 'desc' => __('Paste Your Ads Code Here ( Adsense, Buy Sell Ads ). It will be shown Below Each Post title.', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_ad_mangment', 'rows' => '3'), array('id' => 'top-ads-position', 'label' => '', 'desc' => __('Choose Alignment Of your Ads.', 'themecountry'), 'type' => 'select', 'section' => 'option_ad_mangment', 'choices' => array(array('value' => 'ad-none', 'label' => __('None', 'themecountry')), array('value' => 'ad-left', 'label' => __('Left', 'themecountry')), array('value' => 'ad-center', 'label' => __('Center', 'themecountry')), array('value' => 'ad-right', 'label' => __('Right', 'themecountry')))), array('id' => 'ad-middle-post', 'label' => __('Middle Post Content', 'themecountry'), 'desc' => __('Paste Your Ads Code Here ( Adsense, Buy Sell Ads ). It will be shown right middle of your post.', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_ad_mangment', 'rows' => '3'), array('id' => 'middle-ads-position', 'label' => '', 'desc' => __('Choose Alignment Of your Ads.', 'themecountry'), 'type' => 'select', 'section' => 'option_ad_mangment', 'choices' => array(array('value' => 'ad-none', 'label' => __('None', 'themecountry')), array('value' => 'ad-left', 'label' => __('Left', 'themecountry')), array('value' => 'ad-center', 'label' => __('Center', 'themecountry')), array('value' => 'ad-right', 'label' => __('Right', 'themecountry')))), array('id' => 'ad-below-post', 'label' => __('Below Post content', 'themecountry'), 'desc' => __('Paste Your Ads Code Here ( Adsense, Buy Sell Ads ). It will be shown Below Each Post.', 'themecountry'), 'type' => 'textarea-simple', 'section' => 'option_ad_mangment', 'rows' => '3'), array('id' => 'below-ads-position', 'label' => '', 'desc' => __('Choose Alignment Of your Ads.', 'themecountry'), 'type' => 'select', 'section' => 'option_ad_mangment', 'choices' => array(array('value' => 'ad-none', 'label' => __('None', 'themecountry')), array('value' => 'ad-left', 'label' => __('Left', 'themecountry')), array('value' => 'ad-center', 'label' => __('Center', 'themecountry')), array('value' => 'ad-right', 'label' => __('Right', 'themecountry')))), array('id' => 'duration-ads-top', 'label' => __('Ads and Post Age', 'themecountry'), 'desc' => __('Only Show Ads on Post Which is Older than number of days you choose.', 'themecountry'), 'type' => 'numeric-slider', 'std' => '100', 'section' => 'option_ad_mangment'), array('id' => 'layout-width-sidebar', 'label' => __('Layout', 'themecountry'), 'desc' => __('Choose To Show Sidebar On Left Or Right or No-Sidebar', 'themecountry'), 'std' => 'right', 'type' => 'radio-image', 'section' => 'option_style', 'class' => '', 'choices' => array(array('value' => 'left', 'label' => __('Sidebare Left', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/col-2cr.png'), array('value' => 'right', 'label' => __('Sidebar Right', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/col-2cl.png'), array('value' => 'no-sidebar', 'label' => __('No Sidebar', 'themecountry'), 'src' => get_template_directory_uri() . '/images/layout/col-1cl.png'))), array('id' => 'on-off-option-style', 'label' => __('Custom Header Color', 'themecountry'), 'desc' => __('Enable Custom Header Color Setting Or Use Our Ready Made Color Scheme.', 'themecountry'), 'std' => 'off', 'type' => 'on-off', 'section' => 'option_style'), array('id' => 'header_style', 'label' => __('Ready Made Header Color Scheme', 'themecountry'), 'desc' => __('Choose Color You Like.', 'themecountry'), 'std' => 'default', 'type' => 'radio-image', 'section' => 'option_style', 'class' => '', 'choices' => array(array('value' => 'default', 'label' => '', 'src' => get_template_directory_uri() . '/images/default.jpg'), array('value' => 'green-sea', 'label' => '', 'src' => get_template_directory_uri() . '/images/green-sea.jpg'), array('value' => 'belize-hole', 'label' => '', 'src' => get_template_directory_uri() . '/images/belize-hole.jpg'), array('value' => 'wisteria', 'label' => '', 'src' => get_template_directory_uri() . '/images/wisteria.jpg'), array('value' => 'midnight-blue', 'label' => '', 'src' => get_template_directory_uri() . '/images/midnight-blue.jpg'), array('value' => 'orange', 'label' => '', 'src' => get_template_directory_uri() . '/images/orange.jpg'), array('value' => 'pumkin', 'label' => '', 'src' => get_template_directory_uri() . '/images/pumkin.jpg'), array('value' => 'asbestos', 'label' => '', 'src' => get_template_directory_uri() . '/images/asbestos.jpg'), array('value' => 'pomegranate', 'label' => '', 'src' => get_template_directory_uri() . '/images/pomegranate.jpg'))), array('id' => 'primary_header_color', 'label' => __('Custom Primary Header Color', 'themecountry'), 'desc' => __('Pick the primary header color.', 'themecountry'), 'type' => 'colorpicker', 'std' => '', 'section' => 'option_style', 'operator' => 'and'), array('id' => 'secondary_header_color', 'label' => __('Custom Secondary Header Color', 'themecountry'), 'desc' => __('Pick the secondary header color.', 'themecountry'), 'type' => 'colorpicker', 'std' => '', 'section' => 'option_style', 'operator' => 'and'), array('id' => 'custom_style', 'label' => __('Custom CSS', 'themecountry'), 'desc' => __('Add you CSS Custom Code here. (Only For Advance User)', 'themecountry'), 'type' => 'css', 'section' => 'option_style', 'rows' => '3'), array('id' => 'text_desscription_import_export', 'desc' => sprintf(__('<b>Click link to <a href="%s">Import/Export</a></b>', 'themecountry'), admin_url('themes.php?page=tc-theme-backup')), 'std' => '', 'type' => 'textblock', 'section' => 'option_import_export'))); /* allow settings to be filtered before saving */ $custom_settings = apply_filters(ot_settings_id() . '_args', $custom_settings); /* settings are not the same update the DB */ if ($saved_settings !== $custom_settings) { update_option(ot_settings_id(), $custom_settings); } /* Lets OptionTree know the UI Builder is being overridden */ global $ot_has_custom_theme_options; $ot_has_custom_theme_options = true; }
/** * Defines an array of options that will be used to generate the settings page and be saved in the database. * When creating the "id" fields, make sure to use all lowercase and no spaces. * */ function optionsframework_options() { $themename = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme(); $themename = $themename['Name']; $shortname = "of"; //Stylesheet Reader $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow"); // Test data $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five"); // Multicheck Array $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle"); // Multicheck Defaults $multicheck_defaults = array("one" => "1", "five" => "1"); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_stylesheet_directory_uri() . '/images/'; $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 215px Wide by 55px Height", "id" => "colorway_logo", "type" => "upload"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "colorway_favicon", "type" => "upload"), array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => "colorway_analytics", "std" => "", "type" => "textarea"), array("name" => "Body Background Image", "desc" => "Select image to change your website background", "id" => "inkthemes_bodybg", "std" => "", "type" => "upload"), array("name" => "Home Top Feature", "type" => "heading"), array("name" => "Home Top Feature Image", "desc" => "Choose Image for your Home Top Feature. Optimal Size: 900px x 350px", "id" => "colorway_slideimage1", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter the Heading for Home Top Feature", "id" => "colorway_slideheading1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Heading Link", "desc" => "Enter the Link URL in Heading for Home Top Feature", "id" => "colorway_slidelink1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Description for Home Top Feature", "id" => "colorway_slidedescription1", "std" => "", "type" => "textarea"), array("name" => "Home Page Settings", "type" => "heading"), array("name" => "Home Page Intro", "desc" => "Enter your heading text for home page", "id" => "inkthemes_mainheading", "std" => "", "type" => "text"), array("name" => "First Feature Image", "desc" => "Choose image for your feature column first. Optimal size 198px x 115px", "id" => "inkthemes_fimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Heading", "desc" => "Enter your heading line for first column", "id" => "inkthemes_headline1", "std" => "", "type" => "text"), array("name" => "First Feature Link", "desc" => "Enter your link for feature column first", "id" => "inkthemes_link1", "std" => "", "type" => "text"), array("name" => "First Feature Content", "desc" => "Enter your feature content for column first", "id" => "inkthemes_feature1", "std" => "", "type" => "textarea"), array("name" => "Second Feature Image", "desc" => "Choose image for your feature column second. Optimal size 198px x 115px", "id" => "inkthemes_fimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Heading", "desc" => "Enter your heading line for second column", "id" => "inkthemes_headline2", "std" => "", "type" => "text"), array("name" => "Second Feature Link", "desc" => "Enter your link for feature column second", "id" => "inkthemes_link2", "std" => "", "type" => "text"), array("name" => "Second Feature Content", "desc" => "Enter your feature content for column second", "id" => "inkthemes_feature2", "std" => "", "type" => "textarea"), array("name" => "Third Feature Image", "desc" => "Choose image for your feature column thrid. Optimal size 198px x 115px", "id" => "inkthemes_fimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Heading", "desc" => "Enter your heading line for third column", "id" => "inkthemes_headline3", "std" => "", "type" => "text"), array("name" => "Third Feature Link", "desc" => "Enter your link for feature column third", "id" => "inkthemes_link3", "std" => "", "type" => "text"), array("name" => "Third Feature Content", "desc" => "Enter your feature content for third column", "id" => "inkthemes_feature3", "std" => "", "type" => "textarea"), array("name" => "Fourth Feature Image", "desc" => "Choose image for your feature column fourth. Optimal size 198px x 115px", "id" => "inkthemes_fimg4", "std" => "", "type" => "upload"), array("name" => "Fourth Feature Heading", "desc" => "Enter your heading line for fourth column", "id" => "inkthemes_headline4", "std" => "", "type" => "text"), array("name" => "Fourth Feature link", "desc" => "Enter your link for feature column fourth", "id" => "inkthemes_link4", "std" => "", "type" => "text"), array("name" => "Fourth Feature Content", "desc" => "Enter your feature content for fourth column", "id" => "inkthemes_feature4", "std" => "", "type" => "textarea"), array("name" => "Home Page Testimonial", "desc" => "Enter your text for homepage testimonial in short paragraph.", "id" => "inkthemes_testimonial", "std" => "", "type" => "textarea"), $options[] = array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "inkthemes_customcss", "std" => "", "type" => "textarea"), array("name" => "Footer Settings", "type" => "heading"), array("name" => "Facebook URL", "desc" => "Enter your Facebook URL if you have one", "id" => "colorway_facebook", "std" => "", "type" => "text"), array("name" => "Twitter URL", "desc" => "Enter your Twitter URL if you have one", "id" => "colorway_twitter", "std" => "", "type" => "text"), array("name" => "RSS Feed URL", "desc" => "Enter your RSS Feed URL if you have one", "id" => "colorway_rss", "std" => "", "type" => "text"), array("name" => "Linked In URL", "desc" => "Enter your Linkedin URL if you have one", "id" => "colorway_linkedin", "std" => "", "type" => "text"), array("name" => "Stumble Upon URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_stumble", "std" => "", "type" => "text"), array("name" => "Digg URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_digg", "std" => "", "type" => "text")); update_option('of_themename', $themename); return $options; }
function twitterWidgetAdmin() { $settings = get_option('widget_twitterwidget'); if (!is_array($settings)) { $settings = array('account' => 'silesia', 'title' => __('Twitter Updates', 'silesia'), 'show' => '3'); } // form posted? if (isset($_POST['Twitter-submit'])) { // Remember to sanitize and format use input appropriately. $settings['account'] = strip_tags(stripslashes($_POST['Twitter-account'])); $settings['title'] = strip_tags(stripslashes($_POST['Twitter-title'])); $settings['show'] = strip_tags(stripslashes($_POST['Twitter-show'])); update_option('widget_twitterwidget', $settings); } // Get options for form fields to show $account = htmlspecialchars($settings['account'], ENT_QUOTES); $title = htmlspecialchars($settings['title'], ENT_QUOTES); $show = htmlspecialchars($settings['show'], ENT_QUOTES); // The form fields echo '<p> <label for="Twitter-account">' . __('Account:', 'silesia') . ' <input style="width: 200px;" id="Twitter-account" name="Twitter-account" type="text" value="' . $account . '" /> </label></p>'; echo '<p> <label for="Twitter-title">' . __('Title:', 'silesia') . ' <input style="width: 200px;" id="Twitter-title" name="Twitter-title" type="text" value="' . $title . '" /> </label></p>'; echo '<p> <label for="Twitter-show">' . __('Show:', 'silesia') . ' <input style="width: 200px;" id="Twitter-show" name="Twitter-show" type="text" value="' . $show . '" /> </label></p>'; echo '<input type="hidden" id="Twitter-submit" name="Twitter-submit" value="1" />'; }
function speedymarket_tables() { //Get the table name with the WP database prefix global $wpdb; $speedymarket_table_version = "1.0"; $installed_ver = get_option("speedymarket_table_version"); //Check if the table already exists and if the table is up to date, if not create it if ($wpdb->get_var("SHOW TABLES LIKE '{$wpc_cat_table}'") != $wpc_cat_table || $installed_ver != $speedymarket_table_version) { $sql = "CREATE TABLE `tb_article` (\r\n `id_article` int(11) NOT NULL,\r\n `a_designation` varchar(100) NOT NULL,\r\n `a_pht` float(6,2) DEFAULT NULL,\r\n `a_description` text,\r\n `a_quantite_stock` int(11) DEFAULT NULL,\r\n `a_visible` tinyint(1) NOT NULL,\r\n `id_categorie` int(11) DEFAULT NULL,\r\n `url_image` varchar(200) DEFAULT NULL,\r\n `id_tva` int(11) DEFAULT NULL\r\n UNIQUE KEY id_article (id)\r\n )"; $sql1 = "CREATE TABLE `tb_categorie` (\r\n`id_categorie` int(11) NOT NULL,\r\n `c_libelle` varchar(100) NOT NULL,\r\n `id_categorie_mere` int(11) DEFAULT NULL,\r\n `url_image` varchar(200) DEFAULT NULL\r\n )"; $sql2 = "CREATE TABLE `tb_client` (\r\n `id_personne` int(11) NOT NULL,\r\n UNIQUE KEY id_personne()\r\n)"; $sql3 = "CREATE TABLE `tb_commande` (\r\n`id_commande` int(11) NOT NULL,\r\n `c_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n `c_dateretrait` date DEFAULT NULL,\r\n `id_statut` int(11) DEFAULT NULL,\r\n `client_id_pers` int(11) DEFAULT NULL,\r\n `prepa_id_pers` int(11) DEFAULT NULL\r\n)"; $sql4 = "CREATE TABLE `tb_image` (\r\n `url_image` varchar(200) NOT NULL,\r\n `i_nom` varchar(100) NOT NULL,\r\n `i_libelle` varchar(100) DEFAULT NULL\r\n)"; $sql5 = "CREATE TABLE IF NOT EXISTS `tb_ligne_commande` (\r\n `id_article` int(11) NOT NULL,\r\n `id_commande` int(11) NOT NULL,\r\n `qte_cmde` int(11) NOT NULL\r\n)"; $sql6 = "CREATE TABLE IF NOT EXISTS `tb_personne` (\r\n`id_personne` int(11) NOT NULL,\r\n `p_nom` varchar(100) NOT NULL,\r\n `p_prenom` varchar(100) NOT NULL,\r\n `p_arue` varchar(100) DEFAULT NULL,\r\n `p_aville` varchar(100) NOT NULL,\r\n `p_acp` int(11) NOT NULL,\r\n `p_tel` int(11) DEFAULT NULL,\r\n `p_mail` varchar(100) NOT NULL,\r\n `p_mdp` varchar(128) NOT NULL\r\n)"; $sql7 = "CREATE TABLE IF NOT EXISTS `tb_preparateur` (\r\n `id_personne` int(11) NOT NULL\r\n)"; $sql8 = "CREATE TABLE IF NOT EXISTS `tb_statut` (\r\n`id_statut` int(11) NOT NULL,\r\n `s_libelle` varchar(50) NOT NULL\r\n)"; $sql9 = "CREATE TABLE IF NOT EXISTS `tb_tva` (\r\n`id_tva` int(11) NOT NULL,\r\n `t_libelle` varchar(100) NOT NULL,\r\n `t_taux` float(4,3) NOT NULL\r\n)"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); update_option("speedymarket_table_version", $speedymarket_table_version); } //Add database table versions to options add_option("wpc_cat_table_version", $speedymarket_table_version); }
/** * Sets option defaults * * @since 1.7.0 */ function set_theme_option() { // Load settings $optionsframework_settings = get_option('optionsframework'); // Updates the unique option id in the database if it has changed if (function_exists('optionsframework_option_name')) { optionsframework_option_name(); } elseif (has_action('optionsframework_option_name')) { do_action('optionsframework_option_name'); } else { $default_themename = get_option('stylesheet'); $default_themename = preg_replace("/\\W/", "_", strtolower($default_themename)); $default_themename = 'optionsframework_' . $default_themename; if (isset($optionsframework_settings['id'])) { if ($optionsframework_settings['id'] == $default_themename) { // All good, using default theme id } else { $optionsframework_settings['id'] = $default_themename; update_option('optionsframework', $optionsframework_settings); } } else { $optionsframework_settings['id'] = $default_themename; update_option('optionsframework', $optionsframework_settings); } } }
public function sendContact() { $res = new responseGmp(); $time = time(); $prevSendTime = (int) get_option(GMP_CODE . '_last__time_contact_send'); if ($prevSendTime && $time - $prevSendTime < 5 * 60) { // Only one message per five minutes $res->pushError(__('Please don\'t send contact requests so often - wait for response for your previous requests.')); $res->ajaxExec(); } $data = reqGmp::get('post'); $fields = $this->getModule()->getContactFormFields(); foreach ($fields as $fName => $fData) { $validate = isset($fData['validate']) ? $fData['validate'] : false; $data[$fName] = isset($data[$fName]) ? trim($data[$fName]) : ''; if ($validate) { $error = ''; foreach ($validate as $v) { if (!empty($error)) { break; } switch ($v) { case 'notEmpty': if (empty($data[$fName])) { $error = $fData['html'] == 'selectbox' ? __('Please select %s', GMP_LANG_CODE) : __('Please enter %s', GMP_LANG_CODE); $error = sprintf($error, $fData['label']); } break; case 'email': if (!is_email($data[$fName])) { $error = __('Please enter valid email address', GMP_LANG_CODE); } break; } if (!empty($error)) { $res->pushError($error, $fName); } } } } if (!$res->error()) { $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />'; $msg .= 'Plugin: ' . GMP_WP_PLUGIN_NAME . '<br />'; foreach ($fields as $fName => $fData) { if (in_array($fName, array('name', 'email', 'subject'))) { continue; } if ($fName == 'category') { $data[$fName] = $fData['options'][$data[$fName]]; } $msg .= '<b>' . $fData['label'] . '</b>: ' . nl2br($data[$fName]) . '<br />'; } if (frameGmp::_()->getModule('mail')->send('*****@*****.**', $data['subject'], $msg, $data['name'], $data['email'])) { update_option(GMP_CODE . '_last__time_contact_send', $time); } else { $res->pushError(frameGmp::_()->getModule('mail')->getMailErrors()); } } $res->ajaxExec(); }
function mystique_setup_options() { mystique_remove_options(); $default_settings = mystique_default_settings(); update_option('mystique', $default_settings); do_action('mystique_setup_options'); }
/** * @inheritdoc * * @param array $arguments */ public function process_call($arguments) { $am = $this->get_am(); $am->ajax_begin(array('nonce' => $am->get_action_js_name(Types_Ajax::CALLBACK_SETTINGS_ACTION))); $setting = sanitize_text_field(wpcf_getpost('setting')); $setting_value = wpcf_getpost('setting_value'); if (!is_array($setting_value)) { parse_str($setting_value, $setting_value); $setting_value = array_pop($setting_value); } $sanitized_value = array(); foreach ($setting_value as $key => $value) { $sanitized_key = sanitize_title($key); $sanitized_value[$sanitized_key] = sanitize_text_field($value); } // use toolset settings if available if (class_exists('Toolset_Settings') && method_exists('Toolset_Settings', 'get_instance')) { $toolset_settings = Toolset_Settings::get_instance(); if (method_exists($toolset_settings, 'save')) { $toolset_settings[$setting] = $sanitized_value; $toolset_settings->save(); $am->ajax_finish('success', true); } } else { update_option($setting, $sanitized_value); $am->ajax_finish('success', true); } // default toolset setting error will be used // todo throw specific error $am->ajax_finish(array('error'), false); }
/** * Remove default link for images */ function mb_imagelink_setup() { $image_set = get_option('image_default_link_type'); if ($image_set !== 'none') { update_option('image_default_link_type', 'none'); } }
/** * Update theme modifications for the current theme. * Note: Candidate core function. * http://core.trac.wordpress.org/ticket/20091 * * @since 3.4.0 * * @param array $mods Theme modifications. */ public function set_theme_mods($mods) { $current = get_theme_mods(); $mods = wp_parse_args($mods, $current); $theme = get_stylesheet(); update_option("theme_mods_{$theme}", $mods); }
public function updateWPCFMSettings(&$viewData) { if ($this->isCFMInstalled()) { $cfmSettings = json_decode(get_option('wpcfm_settings', '{"bundles":[]}')); $pos = $this->findObjInArrayPosition('wpbootstrap', 'name', $cfmSettings->bundles); if ($pos === false) { $obj = new stdClass(); $obj->name = 'wpbootstrap'; $obj->label = 'wpbootstrap'; $obj->config = array(); $cfmSettings->bundles[] = $obj; $pos = 0; } $wpbBundle = $cfmSettings->bundles[$pos]; $wpbBundle->config = array(); foreach ($_POST as $name => $value) { if (substr($name, 0, 8) == 'managed_') { $optionName = substr($name, 8); if (!in_array($optionName, $wpbBundle->config)) { $wpbBundle->config[] = $optionName; } } } $cfmSettings->bundles[$pos] = $wpbBundle; update_option('wpcfm_settings', json_encode($cfmSettings)); } }
function tie_save_settings($data, $refresh = 0) { global $array_options; foreach ($array_options as $option) { if (isset($data[$option])) { array_walk_recursive($data[$option], 'tie_clean_options'); update_option($option, $data[$option]); if (function_exists('icl_register_string') && $option == 'tie_home_cats') { foreach ($data[$option] as $item) { if (!empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['title']); } if (!empty($item['type']) && $item['type'] == 'ads' && !empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['text']); } } } } elseif (!isset($data[$option]) && $option != 'tie_options') { delete_option($option); } } if ($refresh == 2) { die('2'); } elseif ($refresh == 1) { die('1'); } }
function woo_version_init() { $woo_framework_version = wf_get_version(); if (get_option('woo_framework_version') != $woo_framework_version) { update_option('woo_framework_version', $woo_framework_version); } }
function ping_search_system() { global $site_link; $url = ''; $last_ping = get_option('last_ping_search_system') != false ? get_option('last_ping_search_system') : 0; $limit_time = time() - $last_ping > 3600; //limit time 3600 sm - 1 hour; if (count($_POST) > 1 && $limit_time) { foreach ($_POST as $key) { switch ($key) { case 'google_ping': $url = '//google.com/webmasters/sitemaps/ping?sitemap='; break; case 'yandex_ping': $url = '//webmaster.yandex.ru/wmconsole/sitemap_list.xml?host='; break; case 'yahoo_ping': $url = '//search.yahooapis.com/SiteExplorerService/V1/ping?sitemap='; break; case 'bing_ping': $url = '//www.bing.com/webmaster/ping.aspx?siteMap='; break; case 'ask_ping': $url = '//submissions.ask.com/ping?sitemap='; break; } if (@get_headers($url)) { wp_remote_get($url . $site_link . "sitemap.xml"); } } update_option('last_ping_search_system', time()); } }
function add_demo_templates() { $dir = dirname(__FILE__) . '/templates'; if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != ".DS_Store") { $template_name = str_replace('.php', '', $entry); $template_name = str_replace('-', ' ', $template_name); $template_name = ucwords($template_name); $template = file_get_contents($dir . '/' . $entry); $template_arr = array("name" => stripslashes($template_name), "template" => stripslashes($template)); $option_name = 'wpb_js_templates'; $saved_templates = get_option($option_name); $template_id = sanitize_title($template_name) . "_" . rand(); if ($saved_templates == false) { $deprecated = ''; $autoload = 'no'; // $new_template = array(); $new_template[$template_id] = $template_arr; // add_option($option_name, $new_template, $deprecated, $autoload); } else { $saved_templates[$template_id] = $template_arr; update_option($option_name, $saved_templates); } } } closedir($handle); } return true; }
public function admin_init() { // used to load even inactive extensions if they want to $s = get_option('w3tc_extensions_hooks'); $hooks = @json_decode($s, true); if (!isset($hooks['next_check_date']) || $hooks['next_check_date'] < time() || true) { $hooks = array('actions' => array(), 'filters' => array(), 'next_check_date' => time() + 24 * 60 * 60); $hooks = apply_filters('w3tc_extensions_hooks', $hooks); update_option('w3tc_extensions_hooks', json_encode($hooks)); } if (isset($hooks['actions'])) { foreach ($hooks['actions'] as $hook => $actions_to_call) { if (is_array($actions_to_call)) { add_action($hook, function () use($actions_to_call) { foreach ($actions_to_call as $action) { do_action($action); } }); } } } if (isset($hooks['filters'])) { foreach ($hooks['filters'] as $hook => $filters_to_call) { if (is_array($filters_to_call)) { add_filter($hook, function ($v) use($filters_to_call) { foreach ($filters_to_call as $filter) { $v = apply_filters($filter, $v); } return $v; }); } } } }
function ultimatemember_activation_hook($plugin) { if ($plugin == um_plugin && get_option('um_version') != ultimatemember_version) { update_option('um_version', ultimatemember_version); exit(wp_redirect(admin_url('admin.php?page=ultimatemember-about'))); } }
function form_add_admin() { global $form_name, $form_shortname, $form; $form_options = form_options(); if (isset($_GET['page']) && $_GET['page'] == "form") { if (isset($_REQUEST['action']) && 'install' == $_REQUEST['action']) { delete_option('form_log'); foreach ($form_options as $value) { if (isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } else { delete_option($value['id']); } } header("Location: admin.php?page=form&installed=true"); die; } } add_menu_page($form_name, $form_name, 'manage_options', 'form', 'form_main'); add_submenu_page('form', $form_name . ' - Setup', 'Setup', 'manage_options', 'form', 'form_main'); if (get_option("form_version")) { if (!isset($form['output']['menus']) && !isset($_SESSION['form']['menus'])) { form_output('headers'); } //load menus if (isset($form['output']['menus']) && is_array($form['output']['menus']) && count($form['output']['menus']) > 0) { $_SESSION['form']['menus'] = $form['output']['menus']; } if (isset($_SESSION['form']['menus'])) { foreach ($_SESSION['form']['menus'] as $menu) { add_submenu_page('form', $form_name . ' - ' . $menu[0], $menu[0], 'manage_options', $menu[1], 'form_main'); } } } }
public function subscribe_if_not_subscribed() { global $bc_accounts; $accounts = $bc_accounts->get_sanitized_all_accounts(); $completed_accounts = array(); foreach ($accounts as $account => $account_data) { // We may have multiple accounts for an account_id, prevent syncing that account more than once. if (!in_array($account_data['account_id'], $completed_accounts)) { $completed_accounts[] = $account_data['account_id']; $bc_accounts->set_current_account($account); $subscriptions = $this->cms_api->get_subscriptions(); if (is_array($subscriptions)) { foreach ($subscriptions as $subscription) { if ($bc_accounts->get_account_id() === $subscription['service_account'] && isset($subscription['id']) && false !== strpos($subscription['endpoint'], get_admin_url())) { $this->cms_api->remove_subscription($subscription['id']); } } } $subscription_status = $this->cms_api->add_subscription(); if (is_wp_error($subscription_status)) { $bc_accounts->restore_default_account(); return false; } if (isset($subscription_status['id']) && $subscription_status['service_account'] === $bc_accounts->get_account_id()) { $subscription_id = BC_Utility::sanitize_subscription_id($subscription_status['id']); update_option($this->get_option_key_for($bc_accounts->get_account_id()), $subscription_id); } $bc_accounts->restore_default_account(); } } }
function mm_cs_notice_launch() { if (isset($_GET['mm_cs_launch'])) { update_option('mm_coming_soon', 'false'); add_action('admin_notices', 'mm_cs_notice_launch_message'); } }
public static function set_id_matrix($ids) { $ret = @file_put_contents(self::$matrix_file, $ids); if ($ret == false) { return update_option(self::$matrix_key, $ids); } }