Plugin Directory

Changeset 2413780


Ignore:
Timestamp:
11/06/2020 09:12:59 AM (5 years ago)
Author:
kodeks
Message:

Ifs på alle funksjoner

Location:
kodeks-dashboard/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kodeks-dashboard/trunk/functions.php

    r2413770 r2413780  
    55
    66    /* Enable / disable Dashboard */
    7     if (!isset($kodeks_options['setting_dashboard']) || $kodeks_options['setting_dashboard'] == 1) {
     7    if (!isset($kodeks_options['setting_dashboard']) || $kodeks_options['setting_dashboard'] == 1 && !function_exists( 'kodeks_add_dashboard_widgets' )) {
    88        // add new dashboard widgets
    99        function kodeks_add_dashboard_widgets() {
     
    6767
    6868    /* Enable / disable front page widgets */
    69     if (!isset($kodeks_options['setting_fp_widget_disable']) || $kodeks_options['setting_fp_widget_disable'] == 1) {
     69    if (!isset($kodeks_options['setting_fp_widget_disable']) || $kodeks_options['setting_fp_widget_disable'] == 1 && !function_exists( 'kodeks_remove_dashboard_meta' ) ) {
    7070        function kodeks_remove_dashboard_meta() {
    7171            remove_action('welcome_panel', 'wp_welcome_panel');
     
    8989
    9090    /* Enable / disable branding */
    91     if (!isset($kodeks_options['setting_branding']) || $kodeks_options['setting_branding'] == 1) {
     91    if (!isset($kodeks_options['setting_branding']) || $kodeks_options['setting_branding'] == 1 && !function_exists( 'kodeks_admin_theme_style' )) {
    9292        /* Admin page style */
    9393        function kodeks_admin_theme_style() {
     
    153153
    154154    /* Enable / disable acl */
    155     if (!isset($kodeks_options['setting_acl']) || $kodeks_options['setting_acl'] == 1) {
     155    if (!isset($kodeks_options['setting_acl']) || $kodeks_options['setting_acl'] == 1 && !function_exists( 'isa_editor_manage_users' )) {
    156156        /*
    157157     * Let Editors manage users, and run this only once.
     
    256256
    257257    /* Enable / disable emoji */
    258     if (!isset($kodeks_options['setting_emoji']) || $kodeks_options['setting_emoji'] == 1) {
     258    if (!isset($kodeks_options['setting_emoji']) || $kodeks_options['setting_emoji'] == 1 && !function_exists( 'disable_wp_emojicons' ) ) {
    259259        add_filter( 'emoji_svg_url', '__return_false' );
    260260        add_action( 'init', 'disable_wp_emojicons' );
     
    295295
    296296        // Disable X-Pingback to header
    297         add_filter( 'wp_headers', 'disable_x_pingback' );
    298         function disable_x_pingback( $headers ) {
    299             unset( $headers['X-Pingback'] );
    300             return $headers;
     297        if ( !function_exists( 'disable_x_pingback' )){
     298            add_filter( 'wp_headers', 'disable_x_pingback' );
     299            function disable_x_pingback( $headers ) {
     300                unset( $headers['X-Pingback'] );
     301                return $headers;
     302            }
    301303        }
    302304
     
    335337
    336338    /* Enable / disable widgets */
    337     if (!isset($kodeks_options['setting_widget']) || $kodeks_options['setting_widget'] == 0) {
     339    if (!isset($kodeks_options['setting_widget']) || $kodeks_options['setting_widget'] == 0 && !function_exists( 'kodeks_widgets_init' )) {
    338340        /**
    339341     * Register widget area.
     
    357359    /* Gutenberg */
    358360
    359     if (!isset($kodeks_options['setting_gutenberg']) || $kodeks_options['setting_gutenberg'] == 1) {
     361    if (!isset($kodeks_options['setting_gutenberg']) || $kodeks_options['setting_gutenberg'] == 1 && !function_exists( 'custom_theme_assets' )) {
    360362        add_action( 'enqueue_block_editor_assets', function() {
    361363            // Main block styles.
     
    380382
    381383    /* Enable / disable css */
    382     if (!isset($kodeks_options['setting_css']) || $kodeks_options['setting_css'] == 1) {
     384    if (!isset($kodeks_options['setting_css']) || $kodeks_options['setting_css'] == 1 && !function_exists( 'prefix_remove_css_section' )) {
    383385
    384386        /**
     
    396398    // Fjerne static_front_page
    397399
    398     add_action( 'customize_register', 'prefix_remove_front', 15 );
    399     function prefix_remove_front( $wp_customize ) {
    400         $wp_customize->remove_section( 'static_front_page' );
     400    if ( !function_exists( 'prefix_remove_front' )){
     401        add_action( 'customize_register', 'prefix_remove_front', 15 );
     402        function prefix_remove_front( $wp_customize ) {
     403            $wp_customize->remove_section( 'static_front_page' );
     404        }
    401405    }
    402406
     
    419423
    420424    // remove version from scripts and styles
    421     function shapeSpace_remove_version_scripts_styles($src) {
    422         if (strpos($src, 'ver=')) {
    423             $src = remove_query_arg('ver', $src);
    424         }
    425         return $src;
    426     }
    427     add_filter('style_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
    428     add_filter('script_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
     425    if ( ! function_exists( 'shapeSpace_remove_version_scripts_styles' )){
     426        function shapeSpace_remove_version_scripts_styles($src) {
     427            if (strpos($src, 'ver=')) {
     428                $src = remove_query_arg('ver', $src);
     429            }
     430            return $src;
     431        }
     432        add_filter('style_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
     433        add_filter('script_loader_src', 'shapeSpace_remove_version_scripts_styles', 9999);
     434    }
    429435
    430436
    431437    // Media uploader - enable SVG
    432     function cc_mime_types($mimes) {
    433         $mimes['svg'] = 'image/svg+xml';
    434         return $mimes;
    435     }
    436     add_filter('upload_mimes', 'cc_mime_types');
     438    if ( ! function_exists( 'cc_mime_types' )){
     439        function cc_mime_types($mimes) {
     440            $mimes['svg'] = 'image/svg+xml';
     441            return $mimes;
     442        }
     443        add_filter('upload_mimes', 'cc_mime_types');
     444    }
    437445
    438446    // Move Yoast to bottom
    439     function yoasttobottom() {
    440         return 'low';
    441     }
    442     add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
     447    if ( ! function_exists( 'yoasttobottom' )){
     448        function yoasttobottom() {
     449            return 'low';
     450        }
     451        add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
     452    }
    443453
    444454    // Remove All Yoast HTML Comments
     
    450460
    451461    // STOP TINYMCE CLASSES
    452     add_filter('tiny_mce_before_init', 'customize_tinymce');
    453 
    454     function customize_tinymce($in) {
    455         $in['paste_preprocess'] = "function(pl,o){ o.content = o.content.replace(/p class=\"p[0-9]+\"/g,'p'); o.content = o.content.replace(/span class=\"s[0-9]+\"/g,'span'); }";
    456         return $in;
     462    if ( ! function_exists( 'customize_tinymce' )){
     463        add_filter('tiny_mce_before_init', 'customize_tinymce');
     464
     465        function customize_tinymce($in) {
     466            $in['paste_preprocess'] = "function(pl,o){ o.content = o.content.replace(/p class=\"p[0-9]+\"/g,'p'); o.content = o.content.replace(/span class=\"s[0-9]+\"/g,'span'); }";
     467            return $in;
     468        }
    457469    }
    458470
     
    467479        add_filter('redirect_canonical', 'shapeSpace_check_enum', 10, 2);
    468480    }
    469     function shapeSpace_check_enum($redirect, $request) {
    470         // permalink URL format
    471         if (preg_match('/\?author=([0-9]*)(\/*)/i', $request)) die();
    472         else return $redirect;
    473     }
    474 
    475     add_action('init','do_stuff');
    476     function do_stuff(){
    477         $current_user = wp_get_current_user();
    478         // Disable W3TC footer comment for everyone but Admins (single site & network mode)
    479         if ( !current_user_can( 'activate_plugins' ) ) {
    480             add_filter( 'w3tc_can_print_comment', '__return_false', 10, 1 );
    481         }
    482 
     481
     482    if ( ! function_exists( 'shapeSpace_check_enum' )){
     483        function shapeSpace_check_enum($redirect, $request) {
     484            // permalink URL format
     485            if (preg_match('/\?author=([0-9]*)(\/*)/i', $request)) die();
     486            else return $redirect;
     487        }
     488    }
     489
     490    if ( ! function_exists( 'do_stuff' )){
     491        add_action('init','do_stuff');
     492        function do_stuff(){
     493            $current_user = wp_get_current_user();
     494            // Disable W3TC footer comment for everyone but Admins (single site & network mode)
     495            if ( !current_user_can( 'activate_plugins' ) ) {
     496                add_filter( 'w3tc_can_print_comment', '__return_false', 10, 1 );
     497            }
     498
     499        }
    483500    }
    484501
     
    499516
    500517    // remove links/menus from the admin bar
    501     function mytheme_admin_bar_render() {
    502         global $wp_admin_bar;
    503         $wp_admin_bar->remove_menu('comments');
    504         $wp_admin_bar->remove_menu('updates');
    505     }
    506     add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
    507 
    508 
    509     function jp_wpseo_fat_slicer() {
    510 
    511         // Only do this for users who don't have Editor capabilities
    512         if ( ! current_user_can( 'edit_others_posts' ) ) {
    513             add_action( 'add_meta_boxes', 'jp_remove_yoast_metabox', 99 );
    514             add_filter( 'manage_edit-post_columns', 'jp_remove_columns' );
    515             add_filter( 'manage_edit-page_columns', 'jp_remove_columns' );
    516             // add_filter( 'manage_edit-CPTNAME_columns', 'jp_remove_columns' ); // Replace CPTNAME with your custom post type name, for example "restaurants".
    517         }
    518     }
    519     add_action( 'init', 'jp_wpseo_fat_slicer' );
    520 
     518    if ( ! function_exists( 'mytheme_admin_bar_render' )){
     519        function mytheme_admin_bar_render() {
     520            global $wp_admin_bar;
     521            $wp_admin_bar->remove_menu('comments');
     522            $wp_admin_bar->remove_menu('updates');
     523        }
     524        add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
     525    }
     526    if ( ! function_exists( 'jp_wpseo_fat_slicer' )){
     527        function jp_wpseo_fat_slicer() {
     528
     529            // Only do this for users who don't have Editor capabilities
     530            if ( ! current_user_can( 'edit_others_posts' ) ) {
     531                add_action( 'add_meta_boxes', 'jp_remove_yoast_metabox', 99 );
     532                add_filter( 'manage_edit-post_columns', 'jp_remove_columns' );
     533                add_filter( 'manage_edit-page_columns', 'jp_remove_columns' );
     534                // add_filter( 'manage_edit-CPTNAME_columns', 'jp_remove_columns' ); // Replace CPTNAME with your custom post type name, for example "restaurants".
     535            }
     536        }
     537        add_action( 'init', 'jp_wpseo_fat_slicer' );
     538    }
    521539
    522540
     
    527545 * @uses remove_meta_box()
    528546 */
    529     function jp_remove_yoast_metabox() {
    530 
    531         $post_types = array( 'page', 'post' ); // add any custom post types here
    532 
    533         foreach( $post_types as $post_type ) {
    534             remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
    535         }
    536     }
    537 
     547    if ( ! function_exists( 'jp_remove_yoast_metabox' )){
     548        function jp_remove_yoast_metabox() {
     549
     550            $post_types = array( 'page', 'post' ); // add any custom post types here
     551
     552            foreach( $post_types as $post_type ) {
     553                remove_meta_box( 'wpseo_meta', $post_type, 'normal' );
     554            }
     555        }
     556    }
    538557
    539558
     
    544563 * @uses remove_menu
    545564 */
    546     function jp_admin_bar_seo_cleanup() {
    547 
    548         global $wp_admin_bar;
    549         $wp_admin_bar->remove_menu( 'wpseo-menu' );
     565    if ( ! function_exists( 'jp_admin_bar_seo_cleanup' )){
     566        function jp_admin_bar_seo_cleanup() {
     567
     568            global $wp_admin_bar;
     569            $wp_admin_bar->remove_menu( 'wpseo-menu' );
     570        }
    550571    }
    551572
     
    557578 * @since 1.0.0
    558579 */
    559     function jp_remove_columns( $columns ) {
    560 
    561         unset( $columns['wpseo-score'] );
    562         unset( $columns['wpseo-title'] );
    563         unset( $columns['wpseo-metadesc'] );
    564         unset( $columns['wpseo-focuskw'] );
    565 
    566         return $columns;
     580    if ( ! function_exists( 'jp_remove_columns' )){
     581        function jp_remove_columns( $columns ) {
     582
     583            unset( $columns['wpseo-score'] );
     584            unset( $columns['wpseo-title'] );
     585            unset( $columns['wpseo-metadesc'] );
     586            unset( $columns['wpseo-focuskw'] );
     587
     588            return $columns;
     589        }
    567590    }
    568591
    569592    /** Hide update nag
    570593 */
    571 
    572     function hide_update_notice_to_all_but_admin_users()
    573     {
    574         if (!current_user_can('update_core')) {
    575             remove_action( 'admin_notices', 'update_nag',      3  );
    576             remove_action( 'admin_notices', 'maintenance_nag', 10 );
    577         }
    578     }
    579     add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
    580 
     594    if ( ! function_exists( 'hide_update_notice_to_all_but_admin_users' )){
     595        function hide_update_notice_to_all_but_admin_users()
     596        {
     597            if (!current_user_can('update_core')) {
     598                remove_action( 'admin_notices', 'update_nag',      3  );
     599                remove_action( 'admin_notices', 'maintenance_nag', 10 );
     600            }
     601        }
     602        add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
     603    }
    581604
    582605    /* Show current teplate --- echo get_current_template( true ); */
    583606
    584     add_filter( 'template_include', 'var_template_include', 1000 );
    585     function var_template_include( $t ){
    586         $GLOBALS['current_theme_template'] = basename($t);
    587         return $t;
    588     }
    589 
    590     function get_current_template( $echo = false ) {
    591         if( !isset( $GLOBALS['current_theme_template'] ) )
     607    if ( ! function_exists( 'var_template_include' )){
     608        add_filter( 'template_include', 'var_template_include', 1000 );
     609        function var_template_include( $t ){
     610            $GLOBALS['current_theme_template'] = basename($t);
     611            return $t;
     612        }
     613    }
     614
     615    if ( ! function_exists( 'get_current_template' )){
     616        function get_current_template( $echo = false ) {
     617            if( !isset( $GLOBALS['current_theme_template'] ) )
     618                return false;
     619            if( $echo )
     620                echo $GLOBALS['current_theme_template'];
     621            else
     622                return $GLOBALS['current_theme_template'];
     623        }
     624    }
     625
     626    if ( ! function_exists( 'is_post_type' )){
     627        function is_post_type($type){
     628            global $wp_query;
     629            if($type == get_post_type($wp_query->post->ID)) return true;
    592630            return false;
    593         if( $echo )
    594             echo $GLOBALS['current_theme_template'];
    595         else
    596             return $GLOBALS['current_theme_template'];
    597     }
    598 
    599     function is_post_type($type){
    600         global $wp_query;
    601         if($type == get_post_type($wp_query->post->ID)) return true;
    602         return false;
    603     }
     631        }
     632    }
    604633
    605634    // Add options page
     
    678707 * Enqueue scripts and styles.
    679708 */
    680     function kodeks_scripts() {
    681         if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    682             wp_enqueue_script( 'comment-reply' );
    683         }
    684     }
    685     add_action( 'wp_enqueue_scripts', 'kodeks_scripts' );
     709    if ( ! function_exists( 'kodeks_scripts' )){
     710        function kodeks_scripts() {
     711            if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
     712                wp_enqueue_script( 'comment-reply' );
     713            }
     714        }
     715        add_action( 'wp_enqueue_scripts', 'kodeks_scripts' );
     716    };
    686717
    687718    // post thumbnails support
  • kodeks-dashboard/trunk/kodeks-dashboard.php

    r2413770 r2413780  
    33Plugin Name: Kodeks Dashboard
    44Description: This plugin customizes WordPress for Kodeks customers.
    5 Version: 3.0.9
     5Version: 3.0.10
    66Author: Thomas Johannessen & Marius Kaase
    77Author URI: http://kodeks.no
  • kodeks-dashboard/trunk/readme.txt

    r2413770 r2413780  
    11=== Kodeks Dashboard ===
    2 Version: 3.0.9
     2Version: 3.0.10
    33Contributors: Kodeks AS
    44Tested up to: 5.5.3
Note: See TracChangeset for help on using the changeset viewer.