function cs_get_path_locate()
 {
     if (!function_exists('get_plugins') || !function_exists('is_plugin_active')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     foreach (get_plugins() as $key => $value) {
         if (strpos($key, 'cs-framework.php') !== false) {
             if (is_plugin_active($key)) {
                 $basename = '/' . str_replace('/cs-framework.php', '', $key);
                 $dir = WP_PLUGIN_DIR . $basename;
                 $uri = WP_PLUGIN_URL . $basename;
             }
         }
     }
     if (!isset($basename)) {
         $dirname = wp_normalize_path(dirname(__FILE__));
         $plugin_dir = wp_normalize_path(WP_PLUGIN_DIR);
         $located_plugin = preg_match('#' . $plugin_dir . '#', $dirname) ? true : false;
         $directory = $located_plugin ? $plugin_dir : get_template_directory();
         $directory_uri = $located_plugin ? WP_PLUGIN_URL : get_template_directory_uri();
         $basename = str_replace(wp_normalize_path($directory), '', $dirname);
         $dir = $directory . $basename;
         $uri = $directory_uri . $basename;
     }
     return apply_filters('cs_get_path_locate', array('basename' => wp_normalize_path($basename), 'dir' => wp_normalize_path($dir), 'uri' => $uri));
 }
/**
 * 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');
}
 /**
  * Закрытый конструктор класса. Реализация паттерна SingleTon
  * Мы проверяем, установлен ли плагин woocommerce, выставляем соответствующий флаг и вешаем на событие init
  * инициализацию хуков для woocommerce
  */
 protected function __construct()
 {
     include_once ABSPATH . 'wp-admin/includes/plugin.php';
     if ($this->_isWoocommerceInstalled = is_plugin_active('woocommerce/woocommerce.php')) {
         add_action('init', array($this, '_initHooks'));
     }
 }
Example #4
0
 /**
  * @group now
  */
 public function testFakePluginsActive()
 {
     $fake_plugins = $this->mock_plugin_paths();
     foreach ($fake_plugins as $path) {
         $this->assertTrue(is_plugin_active($path), $path);
     }
 }
 /**
  * @hook APF_hw_condition_rules: apf_check_fields_condition
  * @param $result
  * @param $params
  * @return mixed
  */
 public static function _apf_check_fields_condition($result, $params)
 {
     if ($params['match_page'] && isset($and_bind['plugins'])) {
         $result['plugins'] = is_plugin_active($and_bind['plugins']['act_values']) && $and_bind['plugins']['compare'] == 'actived' || !is_plugin_active($and_bind['plugins']['act_values']) && $and_bind['plugins']['compare'] == 'deactived';
     }
     return $result;
 }
function bbconnect_add_local_avatar_form($args = null)
{
    // SET THE DEFAULTS TO BE OVERRIDDEN AS DESIRED
    $defaults = array('fdata' => false, 'fvalue' => false, 'faction' => false, 'ftype' => false);
    // PARSE THE INCOMING ARGS
    $args = wp_parse_args($args, $defaults);
    // EXTRACT THE VARIABLES
    extract($args, EXTR_SKIP);
    if (is_user_logged_in()) {
        if ('-edit' == $faction) {
            if (is_plugin_active('add-local-avatar/avatars.php') && false != $fdata) {
                $ala = new add_local_avatars();
                $ala->avatar_uploader_option($fdata);
            }
        } else {
            if ('-view' == $faction) {
                echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
            } else {
            }
        }
    } else {
        if (false != $fdata) {
            echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
        }
    }
}
 /**
  * Constructor.
  */
 public function __construct()
 {
     switch (true) {
         case is_plugin_active('ithemes-sync/init.php'):
             // iThemes Sync
             add_action('wp_ajax_nopriv_ithemes_sync_request', array(&$this, 'init'), 15);
             add_filter('github_updater_remote_update_request', array(__CLASS__, 'iThemes_Sync'));
             break;
         case is_plugin_active('iwp-client/init.php'):
             // InfiniteWP
             add_filter('github_updater_remote_update_request', array(__CLASS__, 'InfiniteWP'));
             break;
         case is_plugin_active('worker/init.php'):
             // ManageWP - Worker
             add_filter('github_updater_remote_update_request', array(__CLASS__, 'ManageWP'));
             break;
         case is_plugin_active('mainwp/mainwp.php'):
             // MainWP
             add_filter('github_updater_remote_update_request', array(__CLASS__, 'MainWP'));
             break;
         case is_plugin_active('wpremote/plugin.php'):
             // WP-Remote
             add_filter('github_updater_remote_update_request', array(__CLASS__, 'WP_Remote'));
             break;
     }
 }
Example #8
0
 public static function isJWTAuthEnabled()
 {
     if (!function_exists('is_plugin_active')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     return is_plugin_active('wp-jwt-auth/JWT_AUTH.php');
 }
Example #9
0
 /**
  * Whether the plugin is active.
  *
  * @since 1.0.0
  *
  * @return boolean
  */
 public function is_active()
 {
     if (is_multisite()) {
         return $this->is_installed() && is_plugin_active_for_network($this->get_file());
     }
     return $this->is_installed() && is_plugin_active($this->get_file());
 }
 /**
  * Get the plugins that installed and activated from predefined third party list
  *
  * @return array|void
  */
 function get_enable_plugins()
 {
     if (!$this->_third_parties) {
         return;
     }
     if (!$this->_plugins) {
         if (!function_exists('is_plugin_activate')) {
             require_once ABSPATH . '/wp-includes/plugin.php';
         }
         $active = array();
         $inactive = array();
         foreach ($this->_third_parties as $class_name => $options) {
             $plugin_file = $options['plugin_file'];
             $plugin_path = WP_PLUGIN_DIR . '/' . $plugin_file;
             if (file_exists($plugin_path)) {
                 $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file);
                 $plugin_data['slug'] = $class_name;
                 if (is_plugin_active($plugin_file)) {
                     $active[$plugin_file] = $plugin_data;
                     $active[$plugin_file]['status'] = 'activated';
                 } else {
                     $inactive[$plugin_file] = $plugin_data;
                     $inactive[$plugin_file]['status'] = 'inactive';
                 }
             }
         }
         $this->_plugins = array_merge($active, $inactive);
     }
     return $this->_plugins;
 }
Example #11
0
/**
 * themed output of cvtx_antrag_grund
 * 
 * @param post_id Do you want a specific posts grund?
 */
function cvtx_grund_action($post_id = false)
{
    if (!isset($post_id) || !$post_id) {
        global $post;
    } else {
        $post = get_post($post_id);
    }
    if (is_object($post)) {
        // Fetch explanation
        $grund = get_post_meta($post->ID, $post->post_type . '_grund', true);
        // Purify explanation
        if (is_plugin_active('html-purified/html-purified.php')) {
            global $cvtx_purifier, $cvtx_purifier_config;
            $grund = $cvtx_purifier->purify($grund, $cvtx_purifier_config);
        }
        // Trim explanation
        $grund = trim($grund);
        // Anything left to print?
        if (!empty($grund)) {
            // Convert line breaks to paragraphs
            $grund = '<p>' . preg_replace('/[\\r\\n]+/', '</p><p>', $grund) . '</p>';
            // Print explanation
            echo '<strong>' . __('Explanation', 'cvtx') . ':</strong> ';
            printf('%1$s', $grund);
        }
    }
}
 /**
  * This method is used to retrieve the configurable options of the element.
  * @return array The list of options that compose the element and then passed as the argument for the render() function
  */
 function options()
 {
     global $wpdb;
     $revslider_options = array();
     if (!function_exists('is_plugin_active')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (is_plugin_active('revslider/revslider.php')) {
         // Table name
         $table_name = $wpdb->prefix . "revslider_sliders";
         // Get sliders
         $rev_sliders = $wpdb->get_results("SELECT title,alias FROM {$table_name}");
         // Iterate over the sliders
         if (!empty($rev_sliders)) {
             foreach ($rev_sliders as $key => $item) {
                 if (isset($item->alias) && isset($item->title)) {
                     $revslider_options[$item->alias] = $item->title;
                 }
             }
         }
     }
     $uid = $this->data['uid'];
     $options = array('has_tabs' => true, 'general' => array('title' => 'General options', 'options' => array(array("name" => __("Background Style", 'zn_framework'), "description" => __("Select the background style you want to use. Please note that styles can be created\n\t\t\t\t\t\t\t\t\tfrom the unlimited headers options in the theme admin's page.", 'zn_framework'), "id" => "ww_header_style", "std" => "", "type" => "select", "options" => WpkZn::getThemeHeaders(true), "class" => ""), array("name" => __("Select slider", 'zn_framework'), "description" => __("Select the desired slider you want to use. Please note that the slider can be created\n\t\t\t\t\t\t\t\t\tfrom inside the Revolution Slider options page.", 'zn_framework'), "id" => "revslider_id", "std" => "", "type" => "select", "options" => $revslider_options), array("name" => __("Use Paralax effect", 'zn_framework'), "description" => __("Select yes if you have used the paralax classes\n\t\t\t\t\t\t\t\t\t\t\twhen you created your slider.", 'zn_framework'), "id" => "revslider_paralax", "std" => "0", "type" => "select", "options" => array(0 => __('No', 'zn_framework'), 1 => __('Yes', 'zn_framework'))), array("name" => __("Bottom masks override", 'zn_framework'), "description" => __("The new masks are svg based, vectorial and color adapted.", 'zn_framework'), "id" => "hm_header_bmasks", "std" => "none", "type" => "select", "options" => array('none' => __('None, just rely on Background style.', 'zn_framework'), 'shadow' => __('Shadow Up', 'zn_framework'), 'shadow_ud' => __('Shadow Up and down', 'zn_framework'), 'mask1' => __('Raster Mask 1 (Old, not recommended)', 'zn_framework'), 'mask2' => __('Raster Mask 2 (Old, not recommended)', 'zn_framework'), 'mask3' => __('Vector Mask 3 CENTER (New! From v4.0)', 'zn_framework'), 'mask3 mask3l' => __('Vector Mask 3 LEFT (New! From v4.0)', 'zn_framework'), 'mask3 mask3r' => __('Vector Mask 3 RIGHT (New! From v4.0)', 'zn_framework'), 'mask4' => __('Vector Mask 4 CENTER (New! From v4.0)', 'zn_framework'), 'mask4 mask4l' => __('Vector Mask 4 LEFT (New! From v4.0)', 'zn_framework'), 'mask4 mask4r' => __('Vector Mask 4 RIGHT (New! From v4.0)', 'zn_framework'), 'mask5' => __('Vector Mask 5 (New! From v4.0)', 'zn_framework'), 'mask6' => __('Vector Mask 6 (New! From v4.0)', 'zn_framework'))))), 'other' => array('title' => 'Other Options', 'options' => array(array('id' => 'css_class', 'name' => 'CSS class', 'description' => 'Enter a css class that will be applied to this element. You can than edit the custom css, either in the Page builder\'s CUSTOM CSS (which is loaded only into that particular page), or in Kallyas options > Advanced > Custom CSS which will load the css into the entire website.', 'type' => 'text', 'std' => ''))), 'help' => znpb_get_helptab(array('video' => 'http://support.hogash.com/kallyas-videos/#pP-ktSGJabg', 'docs' => 'http://support.hogash.com/documentation/revolution-slider/', 'copy' => $uid, 'general' => true)));
     return $options;
 }
Example #13
0
/**
 * action executed when plugin is activated
 */
function edible_install()
{
    // check for wp-api
    if (!is_plugin_active('rest-api/plugin.php')) {
        exit('you need the wp-api v2 plugin');
    }
}
Example #14
0
function activity_admin_post_category_check($post_id, $post, $update)
{
    if (is_admin()) {
        if (is_plugin_active('activity/activity.php')) {
            $post_cat = wp_get_post_categories($post_id);
            if (empty($post_cat)) {
                return;
            } else {
                $activity_cat = intval(get_option('activity_category'));
                $is_post_activity = in_array($activity_cat, $post_cat);
                if ($is_post_activity) {
                    if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=activity_admin') === false) {
                        $post_cat = array_diff($post_cat, array($activity_cat));
                        if (empty($post_cat)) {
                            $post_cat = array(1);
                        }
                        $post_data = array('ID' => $post_id, 'post_category' => $post_cat);
                        $post_update = wp_update_post($post_data);
                        header('Location: ' . get_site_url() . '/wp-admin/admin.php?page=activity_admin&action=error_add_activity');
                        exit;
                    }
                }
            }
        }
    }
}
Example #15
0
/**
 * Register meta boxes
 *
 * @return void
 */
function post_register_meta_boxes($meta_boxes)
{
    /**
     * Prefix of meta keys (optional)
     * Use underscore (_) at the beginning to make keys hidden
     * Alt.: You also can make prefix empty to disable it
     */
    // Better has an underscore as last sign
    $prefix = 'YOUR_PREFIX_';
    if (is_plugin_active('contus-video-gallery/hdflvvideoshare.php') || is_plugin_active('all-in-one-video-pack/all_in_one_video_pack.php')) {
        // 1st meta box
        $meta_boxes[] = array('id' => 'standard', 'title' => __('Post Settings', 'rwmb'), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Video ID', 'cactusthemes'), 'id' => "tm_video_id", 'desc' => __('Paste the id from Video Gallery (Contus Video Player) or Kaltura Video Flatform', 'cactusthemes'), 'type' => 'text', 'std' => __('', 'cactusthemes'), 'clone' => false), array('name' => __('Video URL', 'cactusthemes'), 'id' => "tm_video_url", 'desc' => __('Paste the url from popular video sites like YouTube or Vimeo. For example: <br/><code>http://www.youtube.com/watch?v=nTDNLUzjkpg</code><br/>or<br/><code>http://vimeo.com/23079092</code>', 'cactusthemes'), 'type' => 'text', 'std' => __('', 'cactusthemes'), 'clone' => false), array('name' => __('Video File', 'cactusthemes'), 'desc' => __('Paste your video file url to here. Supported Video Formats: mp4, m4v, webmv, webm, ogv and flv.<br/><b>About Cross-platform and Cross-browser Support</b><br/>If you want your video works in all platforms and browsers(HTML5 and Flash), you should provide various video formats for same video, if the video files are ready, enter one url per line.<br/> For Example:<br/> <code>http://yousite.com/sample-video.m4v</code><br/><code>http://yousite.com/sample-video.ogv</code><br/> <b>Recommended Format Solution:</b> webmv + m4v + ogv. ', 'cactusthemes'), 'id' => "tm_video_file", 'type' => 'textarea', 'cols' => 20, 'rows' => 7), array('name' => __('Video Code', 'cactusthemes'), 'desc' => __('Paste the raw video code to here, such as <code>&lt;</code><code>object</code><code>&gt;</code>,<code>&lt;</code><code>embed</code><code>&gt;</code> or <code>&lt;</code><code>iframe</code><code>&gt;</code> code.', 'cactusthemes'), 'id' => "tm_video_code", 'type' => 'textarea', 'cols' => 20, 'rows' => 7), array('name' => __('Duration', 'cactusthemes'), 'id' => "time_video", 'desc' => __(''), 'type' => 'text', 'std' => __('', 'cactusthemes'), 'clone' => false), array('name' => __('Show Hide Feature Image', 'cactusthemes'), 'id' => "show_feature_image", 'type' => 'select', 'options' => array('3' => __('Default', 'cactusthemes'), '2' => __('Show', 'cactusthemes'), '1' => __('Hide', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Video Layout/Feature Image', 'cactusthemes'), 'id' => "page_layout", 'type' => 'select', 'options' => array('def' => __('Default', 'cactusthemes'), 'full_width' => __('Full Width', 'cactusthemes'), 'inbox' => __('Inboxed', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Page Layout', 'cactusthemes'), 'id' => "single_ly_ct_video", 'type' => 'select', 'options' => array('def' => __('Default', 'cactusthemes'), 'full' => __('Full Width', 'cactusthemes'), 'right' => __('Sidebar Right', 'cactusthemes'), 'left' => __('Sidebar Left', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background Image', 'cactusthemes'), 'id' => "ct_bg_image", 'type' => 'image_advanced', 'max_file_uploads' => 4), array('name' => __('Background repeat', 'cactusthemes'), 'id' => "ct_bg_repeat", 'type' => 'select', 'options' => array('no-repeat' => __('No Repeat', 'cactusthemes'), 'repeat' => __('Repeat All', 'cactusthemes'), 'repeat-x' => __('Repeat Horizontally', 'cactusthemes'), 'repeat-y' => __('Repeat Vertically', 'cactusthemes'), 'inherit' => __('Inherit', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background attachment', 'cactusthemes'), 'id' => "ct_bg_attachment", 'type' => 'select', 'options' => array('' => __('', 'cactusthemes'), 'fixed' => __('Fixed', 'cactusthemes'), 'scroll' => __('Scroll', 'cactusthemes'), 'inherit' => __('Inherit', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background position', 'cactusthemes'), 'id' => "ct_bg_position", 'type' => 'select', 'options' => array('' => __('', 'cactusthemes'), 'left top' => __('Left Top', 'cactusthemes'), 'left center' => __('Left Center', 'cactusthemes'), 'left bottom' => __('Left Bottom', 'cactusthemes'), 'center top' => __('Center Top', 'cactusthemes'), 'center center' => __('Center Center', 'cactusthemes'), 'center bottom' => __('Center Bottom', 'cactusthemes'), 'right top' => __('Right Top', 'cactusthemes'), 'right center' => __('Right center', 'cactusthemes'), 'right bottom' => __('Right bottom', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false)));
    } else {
        // 1st meta box
        $meta_boxes[] = array('id' => 'standard', 'title' => __('Post Settings', 'rwmb'), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Video URL', 'cactusthemes'), 'id' => "tm_video_url", 'desc' => __('Paste the url from popular video sites like YouTube or Vimeo. For example: <br/><code>http://www.youtube.com/watch?v=nTDNLUzjkpg</code><br/>or<br/><code>http://vimeo.com/23079092</code>', 'cactusthemes'), 'type' => 'text', 'std' => __('', 'cactusthemes'), 'clone' => false), array('name' => __('Video File', 'cactusthemes'), 'desc' => __('Paste your video file url to here. Supported Video Formats: mp4, m4v, webmv, webm, ogv and flv.<br/><b>About Cross-platform and Cross-browser Support</b><br/>If you want your video works in all platforms and browsers(HTML5 and Flash), you should provide various video formats for same video, if the video files are ready, enter one url per line.<br/> For Example:<br/> <code>http://yousite.com/sample-video.m4v</code><br/><code>http://yousite.com/sample-video.ogv</code><br/> <b>Recommended Format Solution:</b> webmv + m4v + ogv. ', 'cactusthemes'), 'id' => "tm_video_file", 'type' => 'textarea', 'cols' => 20, 'rows' => 7), array('name' => __('Video Code', 'cactusthemes'), 'desc' => __('Paste the raw video code to here, such as <code>&lt;</code><code>object</code><code>&gt;</code>,<code>&lt;</code><code>embed</code><code>&gt;</code> or <code>&lt;</code><code>iframe</code><code>&gt;</code> code.', 'cactusthemes'), 'id' => "tm_video_code", 'type' => 'textarea', 'cols' => 20, 'rows' => 7), array('name' => __('Duration', 'cactusthemes'), 'id' => "time_video", 'desc' => __(''), 'type' => 'text', 'std' => __('', 'cactusthemes'), 'clone' => false), array('name' => __('Show Hide Feature Image', 'cactusthemes'), 'id' => "show_feature_image", 'type' => 'select', 'options' => array('3' => __('Default', 'cactusthemes'), '2' => __('Show', 'cactusthemes'), '1' => __('Hide', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Video Layout/Feature Image', 'cactusthemes'), 'id' => "page_layout", 'type' => 'select', 'options' => array('def' => __('Default', 'cactusthemes'), 'full_width' => __('Full Width', 'cactusthemes'), 'inbox' => __('Inboxed', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Page Layout', 'cactusthemes'), 'id' => "single_ly_ct_video", 'type' => 'select', 'options' => array('def' => __('Default', 'cactusthemes'), 'full' => __('Full Width', 'cactusthemes'), 'right' => __('Sidebar Right', 'cactusthemes'), 'left' => __('Sidebar Left', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background Image', 'cactusthemes'), 'id' => "ct_bg_image", 'type' => 'image_advanced', 'max_file_uploads' => 4), array('name' => __('Background repeat', 'cactusthemes'), 'id' => "ct_bg_repeat", 'type' => 'select', 'options' => array('no-repeat' => __('No Repeat', 'cactusthemes'), 'repeat' => __('Repeat All', 'cactusthemes'), 'repeat-x' => __('Repeat Horizontally', 'cactusthemes'), 'repeat-y' => __('Repeat Vertically', 'cactusthemes'), 'inherit' => __('Inherit', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background attachment', 'cactusthemes'), 'id' => "ct_bg_attachment", 'type' => 'select', 'options' => array('' => __('', 'cactusthemes'), 'fixed' => __('Fixed', 'cactusthemes'), 'scroll' => __('Scroll', 'cactusthemes'), 'inherit' => __('Inherit', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false), array('name' => __('Background position', 'cactusthemes'), 'id' => "ct_bg_position", 'type' => 'select', 'options' => array('' => __('', 'cactusthemes'), 'left top' => __('Left Top', 'cactusthemes'), 'left center' => __('Left Center', 'cactusthemes'), 'left bottom' => __('Left Bottom', 'cactusthemes'), 'center top' => __('Center Top', 'cactusthemes'), 'center center' => __('Center Center', 'cactusthemes'), 'center bottom' => __('Center Bottom', 'cactusthemes'), 'right top' => __('Right Top', 'cactusthemes'), 'right center' => __('Right center', 'cactusthemes'), 'right bottom' => __('Right bottom', 'cactusthemes')), 'multiple' => false, 'std' => '', 'placeholder' => false)));
    }
    // 2nd meta box
    $meta_boxes[] = array('title' => __('Videos Auto Fetch Data', 'cactusthemes'), 'context' => 'side', 'fields' => array(array('name' => __('', 'cactusthemes'), 'id' => "fetch_info", 'type' => 'checkbox_list', 'desc' => __('Check above checkbox if you do not want to auto-fetch video data after save/edit. To chose which fields to fetch, go to appearance > Theme option > General ', 'cactusthemes'), 'options' => array('1' => __('<strong>DO NOT FETCH</strong>', 'cactusthemes')))));
    // 3rd meta box
    $meta_boxes[] = array('title' => __('Social Locker', 'cactusthemes'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Social Locker shortcode', 'cactusthemes'), 'id' => "social_locker", 'type' => 'text', 'desc' => __('Enter shortcode to lock video player, for example: [sociallocker][/sociallocker]', 'cactusthemes'))));
    if (is_plugin_active('video-ads/video-ads-management.php')) {
        // 4th meta box
        $meta_boxes[] = array('title' => __('Video Ads', 'cactusthemes'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Ads ID', 'cactusthemes'), 'id' => "video_ads_id", 'type' => 'text', 'desc' => __('Enter Ads ID or 0 to get random active ads', 'cactusthemes'))));
    }
    // 5rd meta box
    $meta_boxes[] = array('title' => __('Player Logic', 'cactusthemes'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Player logic', 'cactusthemes'), 'id' => "player_logic", 'type' => 'text', 'desc' => __('Enter shortcode (ex: [my_shortcode][player][/my_shortcode], <strong>[player]</strong> is required)<br>or condition function (ex: <b>is_user_logged_in() && is_sticky()</b> ) to control video player visiblitily', 'cactusthemes')), array('name' => __('Alternative Content', 'cactusthemes'), 'id' => "player_logic_alt", 'type' => 'textarea', 'desc' => __('Content to display when Condition is false (Not work with Shortcodes)', 'cactusthemes'))));
    return $meta_boxes;
}
Example #16
0
 /**
  * Render a message if the zero spam plugin isn't active
  *
  * If it is active, dismiss and return an empty string.
  *
  * @since 1.2.3
  *
  * @return string
  */
 public function render()
 {
     if (is_plugin_active('zero-spam/zero-spam.php') or !current_user_can('update_plugins')) {
         return '';
     }
     return $this->render_message(sprintf(__('Did you know there is an excellent and free way to keep spam comments from ever getting submitted? We heartily recommend installing <a href="%s">GoodBye Captcha</a>.', 'Postmatic'), 'https://wordpress.org/plugins/goodbye-captcha/'));
 }
/**
 * ----------------------------------------------------------------------
 * Get the custom footer post (lbmn_footer content type) id for the current page
 */
function lbmn_get_footerid_by_pageid($current_pageid)
{
    if (is_plugin_active('ds-live-composer/ds-live-composer.php')) {
        // Check if current page has custom footer ID set
        $footer_post_id = '';
        // Fist, make sure rwmb plugin installed and fucntion is available
        // and if not 404 or no search results page otherwise rwmb_meta throw a notice
        if (have_posts() && function_exists('rwmb_meta')) {
            $footer_post_id = rwmb_meta('lbmn_custom_footer_id', array(), $current_pageid);
        }
        // If no custom footer set get default footer defined in Theme Customizer
        if (!$footer_post_id) {
            // Get footer page ID defined in Theme Customizer
            $footer_post_id = get_theme_mod('lbmn_footer_design');
            // If no footer set in Theme Customizer check what default we have set
            // I don't want to run 'get_page_by_title' on every page load
            if (!$footer_post_id) {
                // Get default footer custom post id
                $footer_design_default = get_page_by_title(LBMN_FOOTER_DESIGN_TITLE_DEFAULT, 'ARRAY_A', 'lbmn_footer');
                if (isset($footer_design_default)) {
                    $footer_design_default = $footer_design_default['ID'];
                } else {
                    $footer_design_default = '';
                }
                $footer_post_id = get_theme_mod('lbmn_footer_design', $footer_design_default);
            }
        }
        return $footer_post_id;
    } else {
        return false;
    }
}
Example #18
0
 public function test_can_place_in_section()
 {
     wp_set_current_user($this->users['admin']);
     // Simulate move to top level
     $gc_one = get_post($this->posts['grandchild_one']);
     $gc_two = get_post($this->posts['grandchild_two']);
     $this->assertTrue($this->navman->can_place_in_section($gc_one, $this->posts['child']));
     // Don't allow top level posts
     $this->plugin->settings->update(array('allow_top' => false));
     $gc_one->post_parent = 0;
     $this->assertFalse($this->navman->can_place_in_section($gc_one, $this->posts['child']));
     $this->assertTrue($this->navman->can_place_in_section($gc_two, $this->posts['child']));
     // Simulate previously in nav exception
     $this->assertTrue($this->navman->can_place_in_section($gc_one, 0));
     // Re-allow top level posts
     $this->plugin->settings->update(array('allow_top' => true));
     // Coverage for section editor logic
     if (!is_plugin_active('bu-section-editing/bu-section-editing.php')) {
         return;
     }
     wp_set_current_user($this->users['section_editor']);
     // Simulate move to top level
     $post = get_post($this->posts['grandchild_one']);
     $post->post_parent = 0;
     // Top level moves deneid, regardless of allow top setting or previously in navigation condition
     $this->assertFalse($this->navman->can_place_in_section($post, $this->posts['child']));
     $this->assertFalse($this->navman->can_place_in_section($post, 0));
     // Simulate move under sibling (allowed) page
     $post->post_parent = $this->posts['grandchild_two'];
     $this->assertTrue($this->navman->can_place_in_section($post, $this->posts['child']));
     // Simulate move under parent (denied) page
     $post->post_parent = $this->posts['parent'];
     $this->assertFalse($this->navman->can_place_in_section($post, $this->posts['child']));
 }
 /**
  * register settings for our plugin
  */
 function registerSettings()
 {
     //register our settings
     register_setting('wtb_seo_settings_main_group', 'wtb_seo_main', array($this, 'sanitize'));
     add_settings_section('wtb_seo_settings_main_section', __('On-Page and Post Options', 'wtb_seo'), null, 'wtb_seo_settings');
     // ideal density
     add_settings_field('ideal_density', __('Ideal keyword density (default: 3%)', 'wtb_seo'), array($this, 'create_an_ideal_density_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
     // ideal lenght
     add_settings_field('ideal_lenght', __('Ideal post lenght (default: 250)', 'wtb_seo'), array($this, 'create_an_ideal_lenght_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
     // checkboxes to check
     add_settings_field('to_check', __('Parameter to check', 'wtb_seo'), array($this, 'create_to_check_fields'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
     // wfd or density
     add_settings_field('wdf_vs_density', __('Keyword density or WDF to show', 'wtb_seo'), array($this, 'create_an_wdf_vs_density_field'), 'wtb_seo_settings', 'wtb_seo_settings_main_section');
     // custom post types
     add_settings_section('wtb_seo_settings_cpt_section', __('Activate in custom post types', 'wtb_seo'), null, 'wtb_seo_settings');
     add_settings_field('cpt', __('Custom post types', 'wtb_seo'), array($this, 'create_an_custom_post_types_fields'), 'wtb_seo_settings', 'wtb_seo_settings_cpt_section');
     // woocommerce
     if (is_plugin_active('woocommerce/woocommerce.php')) {
         add_settings_section('wtb_seo_settings_woo_section', __('WooCommerce settings', 'wtb_seo'), null, 'wtb_seo_settings');
         add_settings_field('check_short_description', __('Check short description', 'wtb_seo'), array($this, 'create_check_short_description'), 'wtb_seo_settings', 'wtb_seo_settings_woo_section');
     }
     // auto refresh
     add_settings_section('wtb_seo_settings_ar_section', __('Auto refresh settings', 'wtb_seo'), null, 'wtb_seo_settings');
     add_settings_field('disable_auto_refresh', __('Disabled', 'wtb_seo'), array($this, 'create_auto_refresh_disable'), 'wtb_seo_settings', 'wtb_seo_settings_ar_section');
     add_settings_field('auto_refresh_time', __('Auto refresh after (sec.)', 'wtb_seo'), array($this, 'create_auto_refresh_time'), 'wtb_seo_settings', 'wtb_seo_settings_ar_section');
 }
Example #20
0
function deactivate_featured_item_conditional()
{
    if (is_plugin_active('ux-featured-item/portfolio-post-type.php')) {
        deactivate_plugins('ux-featured-item/portfolio-post-type.php');
        flush_rewrite_rules();
    }
}
 function fts_plugin_version_check()
 {
     // return error if no data retreived
     try {
         $update_msg = 'Please update ALL Premium Extensions for Feed Them Social because they will no longer work with this version of Feed Them Social. We have made some Major Changes to the Core of the plugin to help with plugin conflicts. Please update your extensions from your <a href="http://www.slickremix.com/my-account" target="_blank">My Account</a> page on our website if you are not receiving notifications for updates on the premium extensions. Thanks again for using our plugin!';
         $list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php');
         $plugins = get_plugins();
         foreach ($list_old_plugins as $single_plugin) {
             require_once ABSPATH . '/wp-admin/includes/plugin.php';
             if (isset($plugins[$single_plugin])) {
                 $fts_versions_needed = \fts_versions_needed();
                 if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) {
                     //Don't Let Old Plugins Activate
                     throw new \Exception('<div class="fts-update-message fts_old_plugins_message">' . $update_msg . '</div>');
                     deactivate_plugins($single_plugin);
                 }
             }
         }
     } catch (\Exception $e) {
         add_action('admin_notices', function () use($e) {
             echo $e->getMessage();
         });
         return true;
     }
 }
 /**
  * Check if target plugin is active wrapper
  *
  * @param string $plugin_file
  *
  * @return bool
  */
 public static function is_plugin_active($plugin_file)
 {
     if (!function_exists('is_plugin_active')) {
         include_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     return is_plugin_active($plugin_file);
 }
Example #23
0
function customtaxorder_menu()
{
    $args = array('public' => true);
    $output = 'objects';
    $taxonomies = get_taxonomies($args, $output);
    // Also make the link_category available if activated.
    $linkplugin = "link-manager/link-manager.php";
    include_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active($linkplugin)) {
        $args = array('name' => 'link_category');
        $taxonomies2 = get_taxonomies($args, $output);
        $taxonomies = array_merge($taxonomies, $taxonomies2);
    }
    $taxonomies = customtaxorder_sort_taxonomies($taxonomies);
    // Set your custom capability through this filter.
    $custom_cap = apply_filters('customtaxorder_custom_cap', 'manage_categories');
    add_menu_page(__('Term Order', 'customtaxorder'), __('Term Order', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder', 'customtaxorder', 'dashicons-list-view', 122.35);
    add_submenu_page('customtaxorder', __('Order Taxonomies', 'custom-taxonomy-order-ne'), __('Order Taxonomies', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-taxonomies', 'custom_taxonomy_order');
    foreach ($taxonomies as $taxonomy) {
        // Set your finegrained capability for this taxonomy for this custom filter.
        $custom_cap_tax = apply_filters('customtaxorder_custom_cap_' . $taxonomy->name, $custom_cap);
        add_submenu_page('customtaxorder', __('Order ', 'custom-taxonomy-order-ne') . $taxonomy->label, __('Order ', 'custom-taxonomy-order-ne') . $taxonomy->label, $custom_cap_tax, 'customtaxorder-' . $taxonomy->name, 'customtaxorder');
    }
    add_submenu_page('customtaxorder', __('About', 'custom-taxonomy-order-ne'), __('About', 'custom-taxonomy-order-ne'), $custom_cap, 'customtaxorder-about', 'customtaxorder_about');
}
 /**
  * Persistant message to not install landing page themes at templates.
  */
 public static function dont_install_landing_page_templates_here()
 {
     $screen = get_current_screen();
     if ($screen->id === 'themes' || $screen->id === 'theme-install' || $screen->id === 'update' && isset($_GET['action']) && $_GET['action'] === "upload-theme") {
         if (is_plugin_active('landing-pages/landing-pages.php')) {
             $lp = true;
         }
         if (is_plugin_active('cta/calls-to-action.php')) {
             $cta = true;
         }
         $doc = 'http://docs.inboundnow.com/guide/installing-new-templates/';
         $link = admin_url('edit.php?post_type=landing-page&page=lp_templates_upload');
         ?>
         <div class="error" style="margin-bottom:10px;">
             <h3 style='font-weight:normal; margin-bottom:0px;padding-bottom:0px;'>
                 <strong>
                     <?php 
         _e('Attention Landing Page Users:', 'landing-pages');
         ?>
                 </strong>
             </h3>
             <p style='font-weight:normal; margin-top:0px;margin-bottom:0px;'><?php 
         _e(sprintf('If you are trying to install a <strong>landing page template</strong> from Inbound Now, %s Please Follow these instructions%s', '<a href=\'http://docs.inboundnow.com/guide/installing-new-templates/\' target=\'_blank\'>', '</a>'), 'landing-pages');
         ?>
                 <br>
                 <?php 
         echo "Landing page templates need to be installed <a href='" . $link . "'>here</a> in the <strong><a href='" . $link . "'>Landing pages</a> > <a href='" . $link . "'>Manage templates area</a></strong>";
         ?>
             </p>
         </div>
         <?php 
     }
 }
 function fts_pinterest_board_feed($atts)
 {
     include_once ABSPATH . 'wp-admin/includes/plugin.php';
     //Premium Plugin
     if (is_plugin_active('feed-them-premium/feed-them-premium.php')) {
         include WP_CONTENT_DIR . '/plugins/feed-them-premium/feeds/pinterest/pinterest-feed.php';
     } else {
         extract(shortcode_atts(array('pinterest_name' => '', 'board_id' => '', 'type' => 'boards_list'), $atts));
         $pins_count = '6';
         $boards_count = '6';
     }
     ob_start();
     //Which Display Type
     switch ($type) {
         case 'pins_from_user':
             echo $this->getPins($pinterest_name, $board_id = NULL, $pins_count, $type);
             break;
         case 'single_board_pins':
             echo $this->getPins($pinterest_name, $board_id, $pins_count, $type);
             break;
         case 'boards_list':
         default:
             echo $this->getBoards($pinterest_name, $boards_count);
             break;
     }
     return ob_get_clean();
 }
 /**
  * print plugin box
  * @see onpage_post_seo_actions::addBox()
  * @param WP_Post $post
  */
 function printBox($post)
 {
     // Use nonce for verification
     wp_nonce_field('wtb_seo', 'wtb_seo_noncename');
     // hack for wooCommerce, to check short description not main content
     if (is_plugin_active('woocommerce/woocommerce.php')) {
         if ($post->post_type == 'product') {
             $settings = get_option('wtb_seo_main', array());
             if (isset($settings['check_short_description']) ? (int) $settings['check_short_description'] : 0) {
                 echo '<input type="hidden" value="1" id="woo_check_short_description" />';
             }
         }
     }
     $wpSlot = new wtb_seo_wp_slot($post);
     $wpSlot->generateBox()->display();
     // log about this plugi to home
     if (function_exists('curl_init')) {
         $currentDomain = (string) parse_url(get_option('siteurl'), PHP_URL_HOST);
         $url = "http://www.webtec-braun.com/fileadmin/wp-themes/seopost/desc/logo.jpg?domain=" . $currentDomain;
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, false);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 2);
         curl_exec($ch);
         curl_close($ch);
     }
 }
 public function init_frontend()
 {
     parent::init_frontend();
     //Only run this code if the Paypal add-on ISN'T being used.
     //Paypal doesn't validate transaction until after submission,
     //so this isn't good for Paypal
     if (!is_plugin_active('gravityformspaypal/paypal.php')) {
         add_action('gform_after_submission', array($this, 'after_submission'), 10, 2);
     }
     //The wp_cron job to assign the domain to the droplet.
     //This can't be done instantly as when the droplet is still
     //being created, I've found it to be unresponsive to
     //new commands (like adding a domain).
     //So we delay this action a bit..
     add_action('do_domain_for_droplet', 'do_domain', 10, 3);
     //Store options for the plugin
     $gfdo_settings = get_option('gfdosettings');
     if (!is_array($gfdo_settings)) {
         $gfdo_settings = array();
     }
     //Update version
     $gfdo_settings['version'] = $this->_version;
     //Update API URL
     $gfdo_settings['api_url'] = $this->_api_url;
     //Update slug
     $gfdo_settings['slug'] = $this->_slug;
     //Update path
     $gfdo_settings['path'] = $this->_path;
     update_option('gfdosettings', $gfdo_settings);
 }
 public static function is_podlove_publisher_active()
 {
     if (is_plugin_active("podlove-publisher/plugin.php")) {
         return true;
     }
     return false;
 }
function isNGGalleryProActive()
{
    if (!function_exists('is_plugin_active')) {
        require_once sitePath() . '/wp-admin/includes/plugin.php';
    }
    return is_plugin_active("nextgen-gallery-pro/nggallery-pro.php");
}
 /**
  * Display admin notices to help users solve requirements for getting events.
  *
  * @access public
  */
 public function display_admin_notice()
 {
     // Don't display notices to users that can't do anything about it.
     if (!current_user_can('install_plugins')) {
         return;
     }
     // Notices are only displayed on the dashboard, plugins, tools, and settings admin pages.
     $page = get_current_screen()->base;
     $display_on_pages = array('dashboard', 'plugins', 'tools', 'options-general');
     if (!in_array($page, $display_on_pages)) {
         return;
     }
     // We're all fired up. No need for any admin notices.
     if (self::has_active_connection()) {
         return;
     }
     // Keyring is not already installed.
     if (!file_exists(plugin_dir_path(dirname(__DIR__)) . 'keyring')) {
         $notice = sprintf(__('Eventbrite needs the <a href="%1$s">Keyring plugin</a> to work. <a href="%2$s" class="thickbox">Install Keyring</a>.', 'eventbrite-api'), 'https://wordpress.org/plugins/keyring/', esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=keyring&TB_iframe=true&width=600&height=550')));
     } elseif (!is_plugin_active('keyring/keyring.php')) {
         $notice = sprintf(__('Eventbrite needs the <a href="%1$s">Keyring plugin</a> activated, with a connection to eventbrite.com. <a href="%2$s">Activate Keyring</a>.', 'eventbrite-api'), 'https://wordpress.org/plugins/keyring/', esc_url(wp_nonce_url(network_admin_url('plugins.php?action=activate&plugin=keyring/keyring.php&plugin_status=all&paged=1&s'), 'activate-plugin_keyring/keyring.php')));
     } elseif (!self::has_active_connection()) {
         $notice = sprintf(__('The Eventbrite API plugin needs a working connection to eventbrite.com. We recommend first <a href="%1$s">logging in</a> to your eventbrite.com account. <a href="%2$s">Connect to Eventbrite</a>.', 'eventbrite-api'), 'https://www.eventbrite.com/login/', esc_url(get_admin_url(null, 'tools.php?page=keyring&action=services')));
     }
     // Output notice HTML.
     printf('<div id="message" class="updated"><p>%s</p></div>', $notice);
 }