Ejemplo n.º 1
6
 /**
  * 当开启UEditor插件时,关闭默认的编辑器
  */
 function ue_closeDefaultEditor()
 {
     if (!get_option("close_default_editor")) {
         add_option("close_default_editor");
     }
     update_option("close_default_editor", "true");
 }
Ejemplo n.º 2
2
function base_getBreadcrumbs()
{
    if (is_404()) {
        return false;
    }
    // Hack to fix breadcrumbs when you're viewing the news home
    if (is_home()) {
        $post = new \Timber\Post(get_option('page_for_posts'));
    } else {
        global $post;
    }
    $breadcrumbs = [];
    if ($post->post_parent) {
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = new \Timber\Post($page->ID);
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
    }
    // Add 'Blog Home' to breadcrumbs if you're on a news post or archive
    if ((is_single() || is_archive()) && !is_search()) {
        $breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
    }
    return $breadcrumbs;
}
 /**
  * Sends and receives data to and from the server API
  *
  * @access public
  * @since  1.0.0
  * @return object $response
  */
 public function plugin_information($args)
 {
     $target_url = $this->create_upgrade_api_url($args);
     $apisslverify = get_option('mainwp_api_sslVerifyCertificate') === false || get_option('mainwp_api_sslVerifyCertificate') == 1 ? 1 : 0;
     $request = wp_remote_get($target_url, array('timeout' => 50, 'sslverify' => $apisslverify));
     //      $request = wp_remote_post( MainWP_Api_Manager::instance()->getUpgradeUrl() . 'wc-api/upgrade-api/', array('body' => $args) );
     if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
         return false;
     }
     $response = unserialize(wp_remote_retrieve_body($request));
     /**
      * For debugging errors from the API
      * For errors like: unserialize(): Error at offset 0 of 170 bytes
      * Comment out $response above first
      */
     // $response = wp_remote_retrieve_body( $request );
     // print_r($response); exit;
     if (is_object($response)) {
         if (isset($response->package)) {
             $response->package = apply_filters('mainwp_api_manager_upgrade_url', $response->package);
         }
         return $response;
     } else {
         return false;
     }
 }
    public function render_content()
    {
        ?>
		<label>
		<span class="customize-control-title"><?php 
        echo esc_html($this->label);
        ?>
</span>
		<p class="description customize-section-description"><?php 
        echo esc_html($this->description);
        ?>
</p>
		<select <?php 
        $this->link();
        ?>
 disabled="disabled">
		<?php 
        $var = get_option($this->field);
        foreach ($this->options as $option) {
            if ($this->options == $var) {
                echo '<option value="' . $option . '" selected="selected">' . $option . '</option>';
            } else {
                echo '<option value="' . $option . '">' . $option . '</option>';
            }
        }
        ?>
		</select>

		</label>
	<?php 
    }
Ejemplo n.º 5
0
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
     $sticky = get_option('sticky_posts');
     $number = empty($instance['number']) ? 1 : (int) $instance['number'];
     $cat = empty($instance['category']) ? 0 : (int) $instance['category'];
     if (is_single()) {
         array_push($sticky, get_the_ID());
     }
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     } else {
         echo '<br />';
     }
     $featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
     while ($featuredPosts->have_posts()) {
         $featuredPosts->the_post();
         global $mb_content_area, $more;
         $mb_content_area = 'sidebar';
         get_template_part('content', get_post_format());
     }
     wp_reset_postdata();
     echo $after_widget;
 }
 public function __construct($data = array())
 {
     parent::__construct($data);
     if (!isset($data['name'])) {
         $this->name = 'eventlist';
     }
     if (!isset($data['posts'])) {
         $event_args = array();
         // Get the active plugins.
         $active_plugins = get_option('active_plugins');
         // We do some guessing here for Tzolkin
         if (in_array('tzolkin/tzolkin.php', $active_plugins)) {
             $event_args = ['post_type' => 'tz_events'];
         }
         // Some more guessing for The Events Calendar
         if (in_array('the-events-calendar/the-events-calendar.php', $active_plugins)) {
             $event_args = ['post_type' => \Tribe__Events__Main::POSTTYPE, 'orderby' => 'event_date', 'order' => 'ASC', 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'tribe_render_context' => 'default'];
         }
         $eventlist_event_args_filter = $this->name . '_event_args';
         $event_args = apply_filters($eventlist_event_args_filter, $event_args);
         Atom::add_debug_entry('Filter', $eventlist_event_args_filter);
         $this->posts = new \WP_Query($event_args);
     }
     if (!isset($data['posts-structure'])) {
         $posts_structure = ['PostClass' => ['children' => ['image', 'text']], 'image' => ['parts' => ['PostThumbnail']], 'text' => ['parts' => ['EventBadge', 'PostTitleLink', 'EventDate', 'ForceExcerpt', 'PostLink' => 'Read More']]];
         $postlist_posts_structure_filter = $this->name . '_posts_structure';
         $this->posts_structure = apply_filters($postlist_posts_structure_filter, $posts_structure);
         Atom::add_debug_entry('Filter', $postlist_posts_structure_filter);
     }
 }
Ejemplo n.º 7
0
 function __construct()
 {
     add_action('init', array(&$this, 'set_core_fields'), 1);
     add_action('init', array(&$this, 'set_predefined_fields'), 1);
     add_action('init', array(&$this, 'set_custom_fields'), 1);
     $this->saved_fields = get_option('um_fields');
 }
Ejemplo n.º 8
0
 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');
         }
     }
 }
Ejemplo n.º 9
0
/**
 * Things to run during init hook
 *
 * @since 0.8.6
 */
function nktagcloud_init()
{
    // http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
    // Pre-2.6 compatibility
    if (!defined('WP_CONTENT_URL')) {
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    }
    if (!defined('WP_CONTENT_DIR')) {
        define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    }
    if (!defined('WP_PLUGIN_URL')) {
        define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
    }
    if (!defined('WP_PLUGIN_DIR')) {
        define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
    }
    global $nktagcloud;
    $nktagcloud = array('path' => WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)), 'url' => WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
    // always needed for footer link
    // TODO which footer link? we don't need this in admin, or do we?
    require_once 'inc/page.php';
    if (is_admin()) {
        require_once 'inc/admin.php';
        add_action('admin_menu', 'nktagcloud_add_pages');
        register_widget_control(__('Better Tag Cloud', 'nktagcloud'), 'nktagcloud_control');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    } else {
        add_shortcode('nktagcloud', 'nktagcloud_shortcode');
        add_shortcode('nktagcloud_single', 'nktagcloud_single_shortcode');
        register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
    }
}
Ejemplo n.º 10
0
 function follow_pinterest($type, $id, $text = '', $icon = '')
 {
     $url = 'http://pinterest.com/' . $id . '/';
     $text = $text == '' ? __('Follow me on', 'mr_social_sharing_toolkit') . ' Pinterest' : $text;
     $blank = get_option('mr_social_sharing_follow_new') == 1 ? true : false;
     return $this->get_icon($type, $url, $text, $icon, false, $blank);
 }
 function run()
 {
     $this->settings = get_site_option('itsec_hide_backend');
     //Execute module functions on frontend init
     if ($this->settings['enabled'] === true) {
         $jetpack_active_modules = get_option('jetpack_active_modules');
         if (is_multisite() && function_exists('is_plugin_active_for_network')) {
             //see if Jetpack is active
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array())) || is_plugin_active_for_network('jetpack/jetpack.php');
         } else {
             $is_jetpack_active = in_array('jetpack/jetpack.php', (array) get_option('active_plugins', array()));
         }
         if (!($is_jetpack_active === true && is_array($jetpack_active_modules) && in_array('json-api', $jetpack_active_modules) && isset($_GET['action']) && $_GET['action'] == 'jetpack_json_api_authorization')) {
             $this->auth_cookie_expired = false;
             add_action('auth_cookie_expired', array($this, 'auth_cookie_expired'));
             add_action('init', array($this, 'execute_hide_backend'), 1000);
             add_action('login_init', array($this, 'execute_hide_backend_login'));
             add_action('plugins_loaded', array($this, 'plugins_loaded'), 11);
             add_filter('body_class', array($this, 'remove_admin_bar'));
             add_filter('loginout', array($this, 'filter_loginout'));
             add_filter('wp_redirect', array($this, 'filter_login_url'), 10, 2);
             add_filter('lostpassword_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('site_url', array($this, 'filter_login_url'), 10, 2);
             add_filter('retrieve_password_message', array($this, 'retrieve_password_message'));
             add_filter('comment_moderation_text', array($this, 'comment_moderation_text'));
             remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
         }
     }
 }
Ejemplo n.º 12
0
 function load_plugin_settings()
 {
     $this->context_options = get_option($this->options_name);
     if (!is_array($this->context_options) || empty($this->context_options)) {
         $this->context_options = array();
     }
 }
 /**
  * Export data
  * @param string $format
  * @param array $options
  * @throws Exception
  */
 public function export($format = self::EXPORT_DISPLAY, $options = array())
 {
     global $wpdb;
     $options = array();
     $options['upload_dir'] = wp_upload_dir();
     $options['options'] = array();
     $options['options']['permalink_structure'] = get_option('permalink_structure');
     $widgets = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE 'widget_%'");
     foreach ($widgets as $widget) {
         $options['options'][$widget->option_name] = $this->compress(get_option($widget->option_name));
     }
     $options['options']['sidebars_widgets'] = $this->compress(get_option('sidebars_widgets'));
     $current_template = get_option('stylesheet');
     $options['options']["theme_mods_{$current_template}"] = $this->compress(get_option("theme_mods_{$current_template}"));
     $data = serialize($options);
     if ($format == self::EXPORT_DISPLAY) {
         echo '<textarea>' . $data . '</textarea>';
     }
     //export settings to file
     if ($format == self::EXPORT_FILE) {
         $path = isset($options['path']) ? $options['path'] : self::getWpOptionsPath();
         if (!file_put_contents($path, $data)) {
             throw new Exception("Cannot save settings to: " . $path);
         }
     }
 }
Ejemplo n.º 14
0
/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
 /**
  * Outputs the HTML for this widget.
  *
  * @param array  An array of standard parameters for widgets in this theme 
  * @param array  An array of settings for this widget instance 
  * @return void Echoes it's output
  **/
 public function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $count = esc_attr($instance['count']);
     $count = 0 < $count && $count < 10 ? $count : 2;
     $loop = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $count, 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_key' => '_event_start', 'meta_query' => array(array('key' => '_event_end', 'value' => time(), 'compare' => '>'))));
     if ($loop->have_posts()) {
         echo $before_widget;
         if ($instance['title']) {
             echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
         }
         echo '<ul>';
         while ($loop->have_posts()) {
             $loop->the_post();
             global $post;
             $output = '<span class="meta">' . date(get_option('date_format'), get_post_meta(get_the_ID(), '_event_start', true)) . '</span> <a href="' . get_permalink() . '">' . get_the_title() . '</a>';
             $read_more = apply_filters('em4wp_events_manager_upcoming_widget_output', $output, $post);
             if ($read_more) {
                 echo '<li>' . $read_more . '</li>';
             }
         }
         if ($instance['more_text']) {
             echo '<li><a href="' . get_post_type_archive_link('event') . '">' . esc_attr($instance['more_text']) . '</a></li>';
         }
         echo '</ul>';
         echo $after_widget;
     }
     wp_reset_postdata();
 }
Ejemplo n.º 16
0
function porto_page_title()
{
    global $porto_settings;
    $output = '';
    if (!is_front_page()) {
    } elseif (is_home()) {
        $output .= $porto_settings['blog-title'];
    }
    if (is_singular()) {
        $output .= porto_page_title_leaf();
    } else {
        if (is_post_type_archive()) {
            if (is_search()) {
                $output .= porto_page_title_leaf('search');
            } else {
                $output .= porto_page_title_archive();
            }
        } elseif (is_tax() || is_tag() || is_category()) {
            $html = porto_page_title_leaf('term');
            if (is_tag()) {
                $output .= sprintf(__('Tag - %s', 'porto'), $html);
            } elseif (is_tax('product_tag')) {
                $output .= sprintf(__('Product Tag - %s', 'porto'), $html);
            } else {
                $output .= $html;
            }
        } elseif (is_date()) {
            if (is_year()) {
                $output .= porto_page_title_leaf('year');
            } elseif (is_month()) {
                $output .= porto_page_title_leaf('month');
            } elseif (is_day()) {
                $output .= porto_page_title_leaf('day');
            }
        } elseif (is_author()) {
            $output .= porto_page_title_leaf('author');
        } elseif (is_search()) {
            $output .= porto_page_title_leaf('search');
        } elseif (is_404()) {
            $output .= porto_page_title_leaf('404');
        } elseif (class_exists('bbPress') && is_bbpress()) {
            if (bbp_is_search()) {
                $output .= porto_page_title_leaf('bbpress_search');
            } elseif (bbp_is_single_user()) {
                $output .= porto_page_title_leaf('bbpress_user');
            } else {
                $output .= porto_page_title_leaf();
            }
        } else {
            if (is_home() && !is_front_page()) {
                if (get_option('show_on_front') == 'page') {
                    $output .= get_the_title(get_option('page_for_posts', true));
                } else {
                    $output .= $porto_settings['blog-title'];
                }
            }
        }
    }
    return apply_filters('porto_page_title', $output);
}
Ejemplo n.º 17
0
 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());
     }
 }
/**
 * Register jquery scripts
 */
function spacious_scripts_styles_method()
{
    /**
     * Loads our main stylesheet.
     */
    wp_enqueue_style('spacious_style', get_stylesheet_uri());
    if (of_get_option('spacious_color_skin', 'light') == 'dark') {
        wp_enqueue_style('spacious_dark_style', SPACIOUS_CSS_URL . '/dark.css');
    }
    /**
     * Adds JavaScript to pages with the comment form to support
     * sites with threaded comments (when in use).
     */
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    /**
     * Register JQuery cycle js file for slider.
     */
    wp_register_script('jquery_cycle', SPACIOUS_JS_URL . '/jquery.cycle.all.min.js', array('jquery'), '2.9999.5', true);
    //   wp_register_style( 'google_fonts', 'http://fonts.googleapis.com/css?family=Lato' );
    /**
     * Enqueue Slider setup js file.	 
     */
    if (is_home() || is_front_page() && of_get_option('spacious_activate_slider', '0') == '1') {
        wp_enqueue_script('spacious_slider', SPACIOUS_JS_URL . '/spacious-slider-setting.js', array('jquery_cycle'), false, true);
    }
    wp_enqueue_script('spacious-navigation', SPACIOUS_JS_URL . '/navigation.js', array('jquery'), false, true);
    wp_enqueue_script('spacious-custom', SPACIOUS_JS_URL . '/spacious-custom.js', array('jquery'));
    wp_enqueue_style('google_fonts');
    $spacious_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    if (preg_match('/(?i)msie [1-8]/', $spacious_user_agent)) {
        wp_enqueue_script('html5', SPACIOUS_JS_URL . '/html5.js', true);
    }
}
/**
 * Enqueue scripts and styles for the theme.
 */
function fast_scripts()
{
    //LOAD style.css via filesystem. Uses Sass to ompile '/assets/scss/style.scss' to: 'styl.css'
    wp_enqueue_style('fast-sass', get_stylesheet_uri(), array(), '1.0.0');
    //LOAD jQuery.min.js via CDN JS
    wp_enqueue_script('fast-jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js', array(), '1.0.0', true);
    //LOAD Boostrap.min.js via CDN JS
    wp_enqueue_script('fast-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js', array(), '1.0.0', true);
    //LOAD navigation.js via filesystem
    wp_enqueue_script('fast-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '1.0.0', true);
    //LOAD fast-skip-link-focus.js via filesystem
    //wp_enqueue_script( 'fast-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '1.0.0', true );
    //LOAD instantclick.js via CDN JS
    wp_enqueue_script('fast-instantclick', 'https://cdnjs.cloudflare.com/ajax/libs/instantclick/3.0.1/instantclick.min.js', array(), '1.0.0', true);
    //CALL instant click into end of footer scripts, for init
    function call_instant_click()
    {
        echo '<script data-no-instant>InstantClick.init();</script>';
    }
    add_action('wp_footer', 'call_instant_click', 200);
    //load at end
    //IF IS singlular & comments are enabled, load comment-reply.js via filesystem
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
Ejemplo n.º 20
0
 /**
  * Generate the data from the PHPDoc markup.
  *
  * @param string $path   Directory or file to scan for PHPDoc
  * @param string $format What format the data is returned in: [json|array].
  *
  * @return string|array
  */
 protected function _get_phpdoc_data($path, $format = 'json')
 {
     $output_cache_file = dirname(__DIR__) . '/cache-phpdoc.json';
     /**
      * Force delete last cache of phpdoc
      * Compare directory and WordPress Version for detecting
      */
     $delete_output_cache_file = false;
     $wp_parser_root_import_dir = get_option('wp_parser_root_import_dir', '');
     $directory_to_compare = wp_normalize_path(__DIR__);
     if (false !== strpos($wp_parser_root_import_dir, $directory_to_compare)) {
         $current_wp_version = get_bloginfo('version');
         $wp_parser_imported_wp_version = get_option('wp_parser_imported_wp_version', $current_wp_version);
         $delete_output_cache_file = $wp_parser_imported_wp_version != $current_wp_version;
     }
     /**
      * Delete last cache of phpdoc, true for deleting or false to skip
      *
      * Default: false or compare wordpress version see above
      */
     $delete_output_cache_file = apply_filters('sublime_delete_phpdoc_output_cache', $delete_output_cache_file);
     if ($delete_output_cache_file) {
         if (false !== stream_resolve_include_path($output_cache_file)) {
             unlink($output_cache_file);
         }
     }
     if (false !== stream_resolve_include_path($output_cache_file)) {
         if ($output = file_get_contents($output_cache_file)) {
             $output = 'json' == $format ? $output : json_decode($output, true);
         }
     } else {
         WP_CLI::line(sprintf('Extracting PHPDoc from %s. This may take a few minutes...', $path));
         $is_file = is_file($path);
         $files = $is_file ? array($path) : Importer::set_parser_phpdoc($path);
         $path = $is_file ? dirname($path) : $path;
         if ($files instanceof WP_Error) {
             WP_CLI::error(sprintf('Problem with %1$s: %2$s', $path, $files->get_error_message()));
             exit;
         }
         $output = Importer::get_parser_phpdoc($files, $path);
         /**
          * Generate cache file from phpdoc, true for generate or false to skip
          *
          * Default: true
          */
         if (apply_filters('sublime_create_phpdoc_output_cache', true)) {
             file_put_contents($output_cache_file, json_encode($output, JSON_PRETTY_PRINT));
         }
         if ('json' == $format) {
             $output = json_encode($output, JSON_PRETTY_PRINT);
         }
     }
     if ($helper_directory = realpath(dirname(__DIR__) . '/missing')) {
         $helpers = glob($helper_directory . '/*.php');
         if (is_array($helpers)) {
             $output = array_merge($output, Importer::get_parser_phpdoc($helpers, $helper_directory));
         }
     }
     return $output;
 }
 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>';
     }
 }
Ejemplo n.º 22
0
/**
 * check if multi-user ebabled
 * 
 * @param mixed $cond
 */
function wpdm_multi_user($cond = '')
{
    global $wpdb, $current_user;
    get_currentuserinfo();
    $ismu = get_option('wpdm_multi_user') == 1 && !$current_user->caps['administrator'] ? true : false;
    return $ismu && $cond ? $cond : $ismu;
}
 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;
                 });
             }
         }
     }
 }
Ejemplo n.º 24
0
/**
 * understrap enqueue scripts
 *
 * @package understrap
 */
function understrap_scripts()
{
    // wp_enqueue_style( 'understrap-theme', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), '0.2.8', false );
    wp_enqueue_style('understrap-theme', get_stylesheet_directory_uri() . '/css/theme.css', array(), '0.2.8', false);
    // wp_enqueue_script('jquery');
    wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery.js', array(), '2.1.4', false);
    wp_enqueue_script('understrap-navigation', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '20120206', true);
    wp_enqueue_script('understrap-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
    // angular relations
    wp_enqueue_script('angular', get_template_directory_uri() . '/js/angular.js', array(), '1.4.9', true);
    wp_enqueue_script('angular-ui-router', '//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.17/angular-ui-router.min.js', array(), '0.2.17', true);
    wp_enqueue_script('angular-animate', '//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-animate.js', array(), '1.4.9', true);
    wp_enqueue_script('angular-sanitize', '//ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-sanitize.min.js', array(), '1.4.9', true);
    wp_enqueue_script('ui-bootstrap', '//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.1.2.js', array(), '1.1.2', true);
    // Angualr APP
    wp_enqueue_script('app', get_template_directory_uri() . '/js/app.js', array(), null, true);
    // Custom JS
    wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', array(), null, true);
    // NON SASS CSS
    wp_enqueue_style('animate', get_stylesheet_directory_uri() . '/css/animate.css', array(), '0.2.8', false);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if (is_active_sidebar('hero')) {
        wp_enqueue_style('understrap-carousel-style', get_template_directory_uri() . '/css/owl.carousel.css', array(), '20024', false);
        wp_enqueue_script('understrap-carousel-script', get_template_directory_uri() . '/js/owl.carousel.min.js', array(), '20024', true);
    }
}
Ejemplo n.º 25
0
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");
    }
}
Ejemplo n.º 26
0
/**
 * Loads the Hybrid theme settings once and allows the input of the specific field the user would 
 * like to show.  Hybrid theme settings are added with 'autoload' set to 'yes', so the settings are 
 * only loaded once on each page load.
 *
 * @since 0.7.0
 * @access public
 * @uses get_option() Gets an option from the database.
 * @uses hybrid_get_prefix() Gets the prefix of the theme.
 * @global object $hybrid The global Hybrid object.
 * @param string $option The specific theme setting the user wants.
 * @return mixed $settings[$option] Specific setting asked for.
 */
function hybrid_get_setting($option = '')
{
    global $hybrid;
    /* If no specific option was requested, return false. */
    if (!$option) {
        return false;
    }
    /* Get the default settings. */
    $defaults = hybrid_get_default_theme_settings();
    /* If the settings array hasn't been set, call get_option() to get an array of theme settings. */
    if (!isset($hybrid->settings) || !is_array($hybrid->settings)) {
        $hybrid->settings = get_option(hybrid_get_prefix() . '_theme_settings', $defaults);
    }
    /* If the option isn't set but the default is, set the option to the default. */
    if (!isset($hybrid->settings[$option]) && isset($defaults[$option])) {
        $hybrid->settings[$option] = $defaults[$option];
    }
    /* If no option is found at this point, return false. */
    if (!isset($hybrid->settings[$option])) {
        return false;
    }
    /* If the specific option is an array, return it. */
    if (is_array($hybrid->settings[$option])) {
        return $hybrid->settings[$option];
    } else {
        return wp_kses_stripslashes($hybrid->settings[$option]);
    }
}
Ejemplo n.º 27
0
 public function init()
 {
     $this->settings = get_option('ninja_forms_settings');
     if (!extension_loaded('curl')) {
         throw new Exception(sprintf(__('The cURL extension is not loaded. %sPlease ensure its installed and activated.%s', 'ninja-forms-upload'), '<a href="http://php.net/manual/en/curl.installation.php">', '</a>'));
     }
     $this->oauth = new Dropbox_OAuth_Consumer_Curl(self::CONSUMER_KEY, self::CONSUMER_SECRET);
     $this->oauth_state = $this->get_option('dropbox_oauth_state');
     $this->request_token = $this->get_token('request');
     $this->access_token = $this->get_token('access');
     if ($this->oauth_state == 'request') {
         //If we have not got an access token then we need to grab one
         try {
             $this->oauth->setToken($this->request_token);
             $this->access_token = $this->oauth->getAccessToken();
             $this->oauth_state = 'access';
             $this->oauth->setToken($this->access_token);
             $this->save_tokens();
             //Supress the error because unlink, then init should be called
         } catch (Exception $e) {
         }
     } elseif ($this->oauth_state == 'access') {
         $this->oauth->setToken($this->access_token);
     } else {
         //If we don't have an acess token then lets setup a new request
         $this->request_token = $this->oauth->getRequestToken();
         $this->oauth->setToken($this->request_token);
         $this->oauth_state = 'request';
         $this->save_tokens();
     }
     $this->dropbox = new Dropbox_API($this->oauth);
 }
Ejemplo n.º 28
0
 public function all($lang, $args)
 {
     $orderby = isset($args['orderby']) ? $args['orderby'] : 'id';
     $order = isset($args['order']) ? $args['order'] : 'asc';
     $columns = isset($args['columns']) ? $args['columns'] : ['*'];
     $key = isset($args['key']) ? $args['key'] : null;
     $sfield = isset($args['search_field']) ? $args['search_field'] : 'name';
     $order_multilang = isset($args['multilang']) ? $args['multilang'] : false;
     if ($order_multilang == 1) {
         return $this->model->whereHas('langs', function ($q1) use($key, $sfield, $lang, $orderby, $order) {
             $q1->where('code', $lang);
             if ($key) {
                 $q1->where($sfield, 'like', "%{$key}%");
             }
             $q1->orderBy($orderby, $order);
         })->with(['langs' => function ($q) use($lang) {
             $q->where('code', $lang);
             $q->select('id', 'code');
         }])->paginate(get_option('_paginate'), $columns);
     } else {
         return $this->model->with(['langs' => function ($q) use($lang) {
             $q->where('code', $lang);
             $q->select('id', 'code');
         }])->whereHas('langs', function ($q1) use($key, $sfield, $lang) {
             $q1->where('code', $lang);
             if ($key) {
                 $q1->where($sfield, 'like', "%{$key}%");
             }
         })->orderBy($orderby, $order)->paginate(get_option('_paginate'), $columns);
     }
 }
Ejemplo n.º 29
0
 /**
  * Add TagManager-script (if defined)
  *
  * @hook nord_after_body
  */
 public function tagmanager()
 {
     $options = get_option('nord_general_options');
     if (!empty($options['nord_tagmanager'])) {
         echo $options['nord_tagmanager'];
     }
 }
function localedge_scripts_and_styles()
{
    global $wp_styles;
    // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
    // modernizr (without media query polyfill)
    wp_enqueue_script('localedge-modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js', false, null);
    // respondjs
    wp_enqueue_script('localedge-respondjs', '//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js', false, null);
    // register main stylesheet
    wp_enqueue_style('localedge-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), '', 'all');
    // ie-only style sheet
    wp_enqueue_style('localedge-ie-only', get_stylesheet_directory_uri() . '/css/ie.css', array(), '');
    $wp_styles->add_data('localedge-ie-only', 'conditional', 'lt IE 9');
    // add conditional wrapper around ie stylesheet
    //Magnific Popup (LightBox)
    wp_enqueue_script('localedge-magnific-popup-js', '//cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/0.9.9/jquery.magnific-popup.min.js', array('jquery'), '0.9.9', true);
    //Font Awesome (icon set)
    wp_enqueue_style('localedge-font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3');
    // iCheck (better radio and checkbox inputs)
    wp_enqueue_script('localedge-icheck', '//cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.1/icheck.min.js', array('jquery'), '1.0.1', true);
    //Chosen - http://harvesthq.github.io/chosen/
    wp_enqueue_script('chosen-js', '//cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js', array('jquery'), '1.1.0', true);
    // comment reply script for threaded comments
    if (is_singular() and comments_open() and get_option('thread_comments') == 1) {
        wp_enqueue_script('comment-reply');
    }
    //adding scripts file in the footer
    wp_enqueue_script('localedge-js', get_stylesheet_directory_uri() . '/js/scripts.js', array('jquery'), '', true);
}