/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user; if (!is_admin($current_user)) { sugar_die("Unauthorized access to administration."); } }
function init() { wpv_register_type_view_template(); add_action('wp_ajax_set_view_template', array($this, 'ajax_action_callback')); add_filter('the_content', array($this, 'the_content'), 1, 1); add_filter('the_content', array($this, 'restore_wpautop'), 999, 1); add_filter('the_excerpt', array($this, 'the_excerpt_for_archives'), 1, 1); if (is_admin()) { global $pagenow; // Post/page language box if ($pagenow == 'post.php' || $pagenow == 'post-new.php') { add_action('admin_head', array($this, 'post_edit_template_options')); add_action('admin_head', array($this, 'post_edit_tinymce')); add_action('admin_footer', array($this, 'hide_view_template_author')); add_action('admin_notices', array($this, 'show_admin_messages')); // Post/page save actions add_action('save_post', array($this, 'save_post_actions'), 10, 2); add_filter('user_can_richedit', array($this, 'disable_rich_edit_for_views')); } elseif ($pagenow == 'admin-ajax.php') { // For when Types saves a child post add_action('save_post', array($this, 'save_post_actions'), 10, 2); } add_action('admin_head', array($this, 'include_admin_css')); add_action('wp_ajax_wpv_get_archive_view_template_taxonomy_summary', array($this, '_ajax_get_taxonomy_loop_summary')); add_action('wp_ajax_wpv_get_archive_view_template_post_type_summary', array($this, '_ajax_get_post_type_loop_summary')); add_action('wp_ajax_wpv_get_archive_view_template_post_type_edit', array($this, '_ajax_get_post_type_loop_edit')); } else { add_filter('edit_post_link', array($this, 'edit_post_link'), 10, 2); add_filter('body_class', array($this, 'body_class'), 10, 2); add_action('wp_footer', array($this, 'wpv_meta_html_extra')); } add_action('save_post', array($this, 'set_default_template'), 10, 2); }
function process() { if (!is_admin($GLOBALS['current_user']) && in_array($this->action, $this->admin_actions)) { $this->hasAccess = false; } parent::process(); }
/** * * DO_REDIRECT * * This function will redirect the user if it can resolve that this url request has a redirect. * * @author epstudios * */ public function do_redirect() { if (is_admin()) { return false; } $redirects = self::get_redirects(true); // True for only active redirects. if (empty($redirects)) { return false; } // No redirects. // Get current url $url_request = self::get_url(); $query_string = explode('?', $url_request); $query_string = isset($query_string[1]) ? $query_string[1] : false; foreach ($redirects as $redirect) { $from = urldecode($redirect->url_from); if ($redirect->status != 'inactive' && rtrim(trim($url_request), '/') === self::format_from_url(trim($from))) { // Match, this needs to be redirected // increment this hit counter. self::increment_field($redirect->id, 'count'); if ($redirect->status == '301') { header('HTTP/1.1 301 Moved Permanently'); } elseif ($redirect->status == '302') { header('HTTP/1.1 302 Moved Temporarily'); } $to = $redirect->type == "url" && !is_numeric($redirect->url_to) ? urldecode($redirect->url_to) : get_permalink($redirect->url_to); $to = $query_string ? $to . "?" . $query_string : $to; header('Location: ' . $to, true, (int) $redirect->status); exit; } } }
public function __construct() { global $AmazonWooCommerce; $this->the_plugin = $AmazonWooCommerce; $this->module_folder = $this->the_plugin->cfg['paths']['plugin_dir_url'] . 'modules/depedencies/'; if (is_admin()) { add_action("admin_enqueue_scripts", array(&$this, 'admin_print_styles')); add_action("admin_print_scripts", array(&$this, 'admin_load_scripts')); } // load the ajax helper require_once $this->the_plugin->cfg['paths']['plugin_dir_path'] . 'modules/dashboard/ajax.php'; new AmazonWooCommerceDashboardAjax($this->the_plugin); // add the boxes $this->addBox('website_preview', '', $this->website_preview(), array('size' => 'grid_1')); $this->addBox('plugin_depedencies', '', $this->plugin_depedencies(), array('size' => 'grid_3')); /*$this->addBox( 'dashboard_links', '', $this->links(), array( 'size' => 'grid_3' ) ); $this->addBox( 'products_performances', 'Top <select class="AmazonWooCommerce-numer-items-in-top"> <option value="10">10</option> <option value="20">20</option> <option value="30">30</option> <option value="50">50</option> <option value="100">100</option> <option value="0">Show All</option> </select> Amazon Products Performances', $this->products_performances(), array( 'size' => 'grid_4' ) );*/ $this->addBox('aateam_products', 'Other products by AA-Team:', $this->aateam_products(), array('size' => 'grid_4')); $this->addBox('support', 'Need AA-Team Support?', $this->support()); }
/** * Constructor. * * @param array $details * @return \YITH_WCWL * @since 1.0.0 */ public function __construct($details) { $this->details = $details; $this->wcwl_init = YITH_WCWL_Init(); if (is_admin()) { $this->wcwl_admin_init = YITH_WCWL_Admin_Init(); } add_action('after_setup_theme', array($this, 'plugin_fw_loader'), 1); // add rewrite rule add_action('init', array($this, 'add_rewrite_rules'), 0); add_filter('query_vars', array($this, 'add_public_query_var')); add_action('init', array($this, 'add_to_wishlist')); add_action('wp_ajax_add_to_wishlist', array($this, 'add_to_wishlist_ajax')); add_action('wp_ajax_nopriv_add_to_wishlist', array($this, 'add_to_wishlist_ajax')); add_action('init', array($this, 'remove_from_wishlist')); add_action('wp_ajax_remove_from_wishlist', array($this, 'remove_from_wishlist_ajax')); add_action('wp_ajax_nopriv_remove_from_wishlist', array($this, 'remove_from_wishlist_ajax')); add_action('wp_ajax_reload_wishlist_and_adding_elem', array($this, 'reload_wishlist_and_adding_elem_ajax')); add_action('wp_ajax_nopriv_reload_wishlist_and_adding_elem', array($this, 'reload_wishlist_and_adding_elem_ajax')); add_action('woocommerce_add_to_cart', array($this, 'remove_from_wishlist_after_add_to_cart')); add_filter('woocommerce_product_add_to_cart_url', array($this, 'redirect_to_cart'), 10, 2); add_action('yith_wcwl_before_wishlist_title', array($this, 'print_notices')); add_filter('woocommerce_add_to_cart_redirect', array($this, 'yith_wfbt_redirect_after_add_to_cart'), 10, 1); // add filter for font-awesome compatibility add_filter('option_yith_wcwl_add_to_wishlist_icon', array($this, 'update_font_awesome_classes')); add_filter('option_yith_wcwl_add_to_cart_icon', array($this, 'update_font_awesome_classes')); }
/** * @see SugarView::preDisplay() */ public function preDisplay() { global $current_user; if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) { sugar_die("Unauthorized access to administration."); } }
function __construct() { // If we're in the admin area, load the settings class if (is_admin()) { require dirname(__FILE__) . '/settings.php'; $settingsClass = new LazyLoadXTSettings(); // If this is the first time we've enabled the plugin, setup default settings register_activation_hook(__FILE__, array($settingsClass, 'first_time_activation')); add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($settingsClass, 'lazyloadxt_action_links')); } else { // Store our settings in memory to reduce mysql calls $this->settings = $this->get_settings(); $this->dir = plugin_dir_url(__FILE__); // The CDN has an older version if ($this->settings['cdn']) { $this->lazyloadxt_ver = '1.0.5'; } // Enqueue Lazy Load XT scripts and styles add_action('wp_enqueue_scripts', array($this, 'load_scripts')); // Replace the 'src' attr with 'data-src' in the_content add_filter('the_content', array($this, 'filter_html')); // If enabled replace the 'src' attr with 'data-src' in text widgets if ($this->settings['textwidgets']) { add_filter('widget_text', array($this, 'filter_html')); } // If enabled replace the 'src' attr with 'data-src' in the_post_thumbnail if ($this->settings['thumbnails']) { add_filter('post_thumbnail_html', array($this, 'filter_html')); } // If enabled replace the 'src' attr with 'data-src' in the_post_thumbnail if ($this->settings['avatars']) { add_filter('get_avatar', array($this, 'filter_html')); } } }
function amr_check_if_widget_debug() { global $said; // only do these debug if we are logged in and are the administrator if (is_admin()) { return false; } // if running in backend, then do not do debug. 20151217 if (!is_user_logged_in() or !current_user_can('administrator')) { return false; } if (isset($_REQUEST['do_widget_debug'])) { if (empty($said)) { $said = true; } else { return true; } $url_without_debug_query = esc_url(remove_query_arg('do_widget_debug')); $eek = '<a href="' . $url_without_debug_query . '">Remove debug</a>'; echo '<br/>Note: Debug help is only shown to a logged-in Administrator.' . $eek . '<br />'; $text = amr_show_shortcode_widget_possibilities(); echo $text; return true; } else { return false; } }
public function metaform() { $value = $this->getValue(); $data = $this->getData(); $attributes = $this->getAttr(); $form = array(); $options = array(); if (isset($data['options'])) { if (!is_admin()) { $new_options = array(); foreach ($data['options'] as $key => $option) { $tmp = $option['value']; $option['value'] = $option['types-value']; $option['types-value'] = $tmp; $new_options[$key] = $option; unset($tmp); } $data['options'] = $new_options; } foreach ($data['options'] as $key => $option) { $one_option_data = array('#value' => $option['value'], '#title' => stripslashes($option['title'])); /** * add default value if needed * issue: frontend, multiforms CRED */ // if (array_key_exists('types-value', $option)) { // $one_option_data['#types-value'] = $option['types-value']; // } $options[] = $one_option_data; } } /** * for user fields we reset title and description to avoid double * display */ $title = $this->getTitle(); if (empty($title)) { $title = $this->getTitle(true); } $options = apply_filters('wpt_field_options', $options, $title, 'select'); /** * default_value */ if (!empty($value) || $value == '0') { $data['default_value'] = $value; } $is_multiselect = array_key_exists('multiple', $attributes) && 'multiple' == $attributes['multiple']; $default_value = isset($data['default_value']) ? $data['default_value'] : null; //Fix https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189219391/comments if ($is_multiselect) { $default_value = new RecursiveIteratorIterator(new RecursiveArrayIterator($default_value)); $default_value = iterator_to_array($default_value, false); } //############################################################################################## /** * metaform */ $form[] = array('#type' => 'select', '#title' => $this->getTitle(), '#description' => $this->getDescription(), '#name' => $this->getName(), '#options' => $options, '#default_value' => $default_value, '#multiple' => $is_multiselect, '#validate' => $this->getValidationData(), '#class' => 'form-inline', '#repetitive' => $this->isRepetitive()); return $form; }
function whitepaper_fonts() { if (!is_admin()) { wp_register_style('open-sans', '//fonts.googleapis.com/css?family=Open+Sans'); wp_enqueue_style('open-sans', get_stylesheet_uri(), array('open-sans')); } }
function ox_adding_scripts() { if (!function_exists('is_login_page')) { function is_login_page() { return !strncmp($_SERVER['REQUEST_URI'], '/wp-login.php', strlen('/wp-login.php')); } } if (!is_admin() && !is_login_page()) { /*removed wp-embed.min.js*/ wp_deregister_script('wp-embed'); /*jquery*/ wp_deregister_script('jquery'); $infooter = !is_page(array($order_form_pages)) ? true : false; wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js", false, '1.11.3', $infooter); wp_enqueue_script('jquery'); /*bootstrap*/ wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css'); /*slicknav menu*/ wp_enqueue_script('slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', array('jquery'), '', true); /*bxslider*/ wp_enqueue_style('bxslider', get_template_directory_uri() . '/css/jquery.bxslider.min.css'); wp_enqueue_script('bxslider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '', true); /*zopim chat*/ wp_enqueue_script('zopim', get_template_directory_uri() . '/js/zopimClear.js', array('jquery'), '', true); /*custom css*/ wp_enqueue_style('custom', get_template_directory_uri() . '/style.css', array('bootstrap')); /*custom js*/ wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '', true); } }
/** * Constructor * @since 1.3.0 * * @param $file */ public function __construct($file) { $this->name = __('Grading', 'woothemes-sensei'); $this->file = $file; $this->page_slug = 'sensei_grading'; // Admin functions if (is_admin()) { add_action('admin_menu', array($this, 'grading_admin_menu'), 20); add_action('grading_wrapper_container', array($this, 'wrapper_container')); if (isset($_GET['page']) && $_GET['page'] == $this->page_slug) { add_action('admin_print_scripts', array($this, 'enqueue_scripts')); add_action('admin_print_styles', array($this, 'enqueue_styles')); } add_action('admin_init', array($this, 'admin_process_grading_submission')); add_action('admin_notices', array($this, 'add_grading_notices')); // add_action( 'sensei_grading_notices', array( $this, 'sensei_grading_notices' ) ); } // End If Statement // Ajax functions if (is_admin()) { add_action('wp_ajax_get_lessons_dropdown', array($this, 'get_lessons_dropdown')); add_action('wp_ajax_get_redirect_url', array($this, 'get_redirect_url')); } // End If Statement }
function __construct() { // update setting acf_update_setting('pro', true); acf_update_setting('name', __('Advanced Custom Fields PRO', 'acf')); // api acf_include('pro/api/api-pro.php'); acf_include('pro/api/api-options-page.php'); // updates acf_include('pro/core/updates.php'); // admin if (is_admin()) { // options page acf_include('pro/admin/options-page.php'); // settings acf_include('pro/admin/settings-updates.php'); } // fields acf_include('pro/fields/repeater.php'); acf_include('pro/fields/flexible-content.php'); acf_include('pro/fields/gallery.php'); // actions add_action('init', array($this, 'wp_init')); add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts')); add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts')); add_action('acf/field_group/admin_l10n', array($this, 'field_group_admin_l10n')); // filters add_filter('acf/get_valid_field', array($this, 'get_valid_field'), 11, 1); add_filter('acf/update_field', array($this, 'update_field'), 1, 1); add_filter('acf/prepare_field_for_export', array($this, 'prepare_field_for_export')); add_filter('acf/prepare_field_for_import', array($this, 'prepare_field_for_import')); }
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>'; } }
public function tinymce_addbuttons() { if (get_user_option('rich_editing') == 'true' && !is_admin()) { add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin')); add_filter('mce_buttons', array($this, 'register_custom_button')); } }
/** * Constructor */ public function __construct() { if (is_admin()) { $this->update_tables(); add_filter('wpmu_drop_tables', array($this, 'wpmu_drop_tables'), 11, 2); } }
/** * 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'); } }
/** * Constructor */ public function __construct($type = 'mycred_default') { parent::__construct('myCRED_BuddyPress', array('module_name' => 'buddypress', 'defaults' => array('visibility' => array('balance' => 0, 'history' => 0), 'balance_location' => '', 'balance_template' => '%plural% balance:', 'history_location' => '', 'history_menu_title' => array('me' => __("My History", 'mycred'), 'others' => __("%s's History", 'mycred')), 'history_menu_pos' => 99, 'history_url' => 'mycred-history', 'history_num' => 10), 'register' => false, 'add_to_core' => true), $type); if (!is_admin()) { add_action('bp_setup_nav', array($this, 'setup_nav')); } }
/** * constructor */ function HW_Taxonomy_Post_List_widget() { //Hoangweb Taxonomy Post List parent::WP_Widget(false, $name = "Truy xuất nội dung theo chuyên mục", array('description' => 'Hiển thị bài viết theo danh mục/taxonomy')); //you should check if whether this widget actived on frontend or neither maybe you can get widget data by get_option($this->option_name) if (!is_admin() && !is_active_widget(false, false, $this->id_base, true)) { return; } $this->setup_actions(); //instance skin if (class_exists('HW_SKIN')) { $this->skin = new HW_SKIN($this, plugin_dir_path(__FILE__), self::SKINS_FOLDER, 'hw-category-posts.php', 'skins'); //$this->skin->skin_name='hw-category-posts.php'; #/wp-contents/hw_yahooskype/yahooskype.php //$this->skin->skin_folder='wcp_hw_skins'; #create folder in /wp-contents/hw_yahooskype $this->skin->plugin_url = plugins_url('', __FILE__); $this->skin->enable_external_callback = false; $this->skin->create('pagination', '__paginations', 'hwtpl-pagination.php')->enable_external_callback = false; //create new skin for pagination //create scrollbar skins $this->skin->create('scrollbar', '__scrollbars', 'hwtpl-scrollbar.php')->enable_external_callback = false; $this->skin->enable_template_engine(); } self::$instance = $this; //save lastest instance of this widget //register widget features from HW_AWC if (class_exists('HW_AWC')) { /*HW_AWC::register_widget_feature($this,'grid_posts'); //depricated HW_AWC::register_widget_feature($this, 'saveconfig'); HW_AWC::register_widget_feature($this, 'fancybox');*/ } $this->hwtpl = new HW_Taxonomy_Post_List(); $this->hwtpl->localize_object_callback = array($this, '_set_localize_scripts_data'); }
/** * nggGallery::get_thumbnail_folder() * * @param mixed $gallerypath * @param bool $include_Abspath * @return string $foldername */ static function create_thumbnail_folder($gallerypath, $include_Abspath = TRUE) { if (!$include_Abspath) { $gallerypath = ABSPATH . $gallerypath; } if (!file_exists($gallerypath)) { return FALSE; } if (is_dir($gallerypath . '/thumbs/')) { return '/thumbs/'; } if (is_admin()) { if (!is_dir($gallerypath . '/thumbs/')) { if (!wp_mkdir_p($gallerypath . '/thumbs/')) { if (SAFE_MODE) { nggAdmin::check_safemode($gallerypath . '/thumbs/'); } else { nggGallery::show_error(__('Unable to create directory ', 'nggallery') . $gallerypath . '/thumbs !'); } return FALSE; } return '/thumbs/'; } } return FALSE; }
function init() { global $sitepress_settings; $this->settings = $sitepress_settings; if (!empty($this->settings['icl_lang_sel_footer'])) { add_action('wp_head', array(&$this, 'language_selector_footer_style'), 19); add_action('wp_footer', array(&$this, 'language_selector_footer'), 19); } if (is_admin()) { add_action('icl_language_switcher_options', array(&$this, 'admin'), 1); } else { if (!empty($this->settings['icl_post_availability'])) { if (function_exists('icl_register_string')) { icl_register_string('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']); } add_filter('the_content', array(&$this, 'post_availability')); } } // the language selector widget $this->language_selector_widget_init(); if (is_admin() && isset($_GET['page']) && $_GET['page'] == ICL_PLUGIN_FOLDER . '/menu/languages.php') { add_action('admin_head', 'icl_lang_sel_nav_css', 1, 1, true); add_action('admin_head', array(&$this, 'custom_language_switcher_style')); } if (!is_admin()) { add_action('wp_head', array(&$this, 'custom_language_switcher_style')); } if (!empty($sitepress_settings['display_ls_in_menu'])) { add_filter('wp_nav_menu_items', array($this, 'wp_nav_menu_items_filter'), 10, 2); } }
/** * Init hook. * * @since 0.9.0 * @return void * @author nguyenvanduocit */ function wpb_basket_init() { if (!is_admin()) { add_filter('script_loader_tag', 'wpb_replace_script_tag', 10, 3); add_action('wp_head', 'wpb_print_basket_script', 1); } }
function rsttst_load_styles() { if (!is_admin()) { wp_enqueue_style('rest-styles', plugins_url('assets/rest-styles.css', __FILE__)); wp_enqueue_script('rest-scripts', plugins_url('assets/rest-scripts.js', __FILE__), array('jquery'), 1.0); } }
/** * */ private function __construct() { register_activation_hook(__FILE__, array($this, 'activate')); $this->includes(); if (is_admin()) { $this->admin_includes(); } add_filter('woocommerce_shipping_methods', array($this, 'add_method')); add_filter('woocommerce_checkout_fields', array($this, 'add_delivery_points_field'), 99); add_filter('woocommerce_default_address_fields', array($this, 'default_address_fields'), 99); add_filter('woocommerce_country_locale_field_selectors', array($this, 'add_city_id_field_selector')); add_filter('woocommerce_form_field_hidden', array($this, 'form_field_hidden'), 10, 4); add_action('woocommerce_after_checkout_billing_form', array($this, 'delivery_points_map')); add_action('woocommerce_checkout_process', array($this, 'delivery_point_field_process')); add_action('woocommerce_checkout_update_order_review', array($this, 'update_order_review')); add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_field_update_order_meta')); add_action('woocommerce_email_order_meta', array($this, 'email_order_meta'), 99); add_filter('default_checkout_state', array($this, 'default_checkout_state')); add_filter('pre_update_option_woocommerce_' . self::$method_id . '_settings', array($this, 'check_shop_contract'), 10, 2); add_filter('woocommerce_cart_shipping_packages', array($this, 'shipping_packages'), 10); //Ajax add_filter('woocommerce_update_order_review_fragments', array($this, 'ajax_update_delivery_points')); add_filter('woocommerce_params', array($this, 'is_door_params')); add_action('wp_enqueue_scripts', array($this, 'load_script')); add_action('admin_enqueue_scripts', array($this, 'admin_load_script')); }
/** * WP CAS Server plugin constructor. * * @param CAS\Server $server CAS server instance. * * @uses is_admin() * @uses register_activation_hook() * @uses register_deactivation_hook() * @uses add_action() */ public function __construct(CAS\Server $server) { $this->server = $server; if (is_admin()) { $this->admin = new Admin(); } }
/** * Class contructor * * @since 0.2 **/ public function __construct() { // activation ## register_activation_hook(__FILE__, array($this, 'register_activation_hook')); // deactivation ## register_deactivation_hook(__FILE__, array($this, 'register_deactivation_hook')); // uninstall ## // TODO ## // load in mobile detect class ## if (!class_exists('Mobile_Detect')) { include Q_BROWSERS_PATH . '/library/mobile_detect.php'; } // instatiate class ## $this->detect = new Mobile_Detect(); $this->detect->setDetectionType('extended'); // extended search ## // grab user agent ## $this->useragent = $_SERVER['HTTP_USER_AGENT'] ? $_SERVER['HTTP_USER_AGENT'] : false; if (is_admin()) { // text-domain ## add_action('plugins_loaded', array($this, 'load_plugin_textdomain'), 1); // plugin URL ## $this->plugin_URL = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)); $this->plugin_dir_path = plugin_dir_url(__FILE__); } else { // conditional stylesheets for browser tweaks ## add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_conditional'), 10000000); // load them late ## // browser body_class ## add_filter('body_class', array($this, 'body_classes'), 1); // comments ## add_action('wp_footer', array($this, 'comments'), 1000); } }
function core_mods() { if ( !is_admin() ) { wp_deregister_script('jquery'); wp_register_script('jquery', ("//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false); wp_enqueue_script('jquery'); } }
function __construct() { parent::__construct(); if (is_admin()) { wpcf_admin_add_js_settings('wpcf_repetitive_last_warning', __('Sorry, can not delete all fields.', 'wpcf')); } }
function __construct() { $this->the_path = plugin_dir_path(__FILE__); $this->the_url = plugin_dir_url(__FILE__); $this->icon_size = get_option('msdsocial_icon_size') ? get_option('msdsocial_icon_size') : '0'; $this->ver = '0.9.6'; /* * Pull in some stuff from other files */ //$this->requireDir($this->the_path . 'lib/inc'); require_once $this->the_path . 'lib/inc/settings.php'; require_once $this->the_path . 'lib/inc/widgets.php'; if (!is_admin()) { wp_enqueue_style('msd-social-style', $this->the_url . 'lib/css/style.css'); wp_enqueue_style('msd-social-style-' . $this->icon_size, $this->the_url . 'lib/css/style' . $this->icon_size . '.css'); wp_enqueue_style('font-awesome-style', '//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css'); } add_action('admin_enqueue_scripts', array(&$this, 'add_admin_scripts')); add_action('admin_enqueue_scripts', array(&$this, 'add_admin_styles')); add_action('wp_head', array(&$this, 'setup_notification_bar')); add_shortcode('msd-address', array(&$this, 'get_address')); add_shortcode('msd-additional-locations', array(&$this, 'get_additional_locations')); add_shortcode('msd-all-locations', array(&$this, 'get_all_locations')); add_shortcode('msd-bizname', array(&$this, 'get_bizname')); add_shortcode('msd-copyright', array(&$this, 'get_copyright')); add_shortcode('msd-digits', array(&$this, 'get_digits')); add_shortcode('msd-social', array(&$this, 'social_media')); add_shortcode('msd-hours', array(&$this, 'get_hours')); }