当前位置: 首页>>代码示例>>PHP>>正文


PHP SP函数代码示例

本文整理汇总了PHP中SP函数的典型用法代码示例。如果您正苦于以下问题:PHP SP函数的具体用法?PHP SP怎么用?PHP SP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_scripts

 /**
  * Register/queue frontend scripts.
  *
  * @access public
  * @return void
  */
 public function load_scripts()
 {
     global $typenow;
     // Scripts
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-datatables', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/jquery.dataTables.min.js', array('jquery'), '1.10.4', true);
     wp_enqueue_script('jquery-countdown', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/jquery.countdown.min.js', array('jquery'), '2.0.2', true);
     wp_enqueue_script('sportspress', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/sportspress.js', array('jquery'), SP()->version, true);
     // Localize scripts
     wp_localize_script('sportspress', 'localized_strings', array('days' => __('days', 'sportspress'), 'hrs' => __('hrs', 'sportspress'), 'mins' => __('mins', 'sportspress'), 'secs' => __('secs', 'sportspress'), 'previous' => __('Previous', 'sportspress'), 'next' => __('Next', 'sportspress')));
     // Theme styles
     $theme = wp_get_theme();
     $this->theme = $theme->stylesheet;
     $dir = scandir(SP()->plugin_path() . '/assets/css/themes');
     $files = array();
     if ($dir) {
         foreach ($dir as $key => $value) {
             if (preg_replace('/\\.[^.\\s]{3,4}$/', '', $value) == $this->theme) {
                 add_filter('sportspress_enqueue_styles', array($this, 'add_theme_styles'));
                 break;
             }
         }
     }
     // CSS Styles
     wp_enqueue_style('dashicons');
     $enqueue_styles = $this->get_styles();
     if ($enqueue_styles) {
         add_action('wp_print_scripts', array($this, 'custom_css'), 30);
         foreach ($enqueue_styles as $handle => $args) {
             wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
开发者ID:krmkrl,项目名称:SportsPress,代码行数:39,代码来源:class-sp-frontend-scripts.php

示例2: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        wp_nonce_field('prosports_save_data', 'prosports_meta_nonce');
        $the_format = get_post_meta($post->ID, 'sp_format', true);
        ?>
		<div id="post-formats-select">
			<?php 
        foreach (SP()->formats->list as $key => $format) {
            ?>
				<input type="radio" name="sp_format" class="post-format" id="post-format-<?php 
            echo $key;
            ?>
" value="<?php 
            echo $key;
            ?>
" <?php 
            checked(true, $key == 'list' && !$the_format || $the_format == $key);
            ?>
> <label for="post-format-<?php 
            echo $key;
            ?>
" class="post-format-icon post-format-<?php 
            echo $key;
            ?>
"><?php 
            echo $format;
            ?>
</label><br>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
开发者ID:kleitz,项目名称:ProSports,代码行数:37,代码来源:class-sp-meta-box-list-format.php

示例3: custom_columns

 /**
  * Define our custom columns shown in admin.
  * @param  string $column
  */
 public function custom_columns($column, $post_id)
 {
     switch ($column) {
         case 'sp_player':
             $players = array_filter(get_post_meta($post_id, 'sp_player'));
             echo sizeof($players);
             break;
         case 'sp_league':
             echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
             break;
         case 'sp_season':
             echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
             break;
         case 'sp_team':
             $teams = (array) get_post_meta($post_id, 'sp_team', false);
             $teams = array_filter($teams);
             if (empty($teams)) {
                 echo __('All', 'prosports');
             } else {
                 foreach ($teams as $team_id) {
                     if (!$team_id) {
                         continue;
                     }
                     $team = get_post($team_id);
                     if ($team) {
                         echo $team->post_title . '<br>';
                     }
                 }
             }
             break;
         case 'sp_layout':
             echo sp_array_value(SP()->formats->list, get_post_meta($post_id, 'sp_format', true), '&mdash;');
             break;
     }
 }
开发者ID:kleitz,项目名称:ProSports,代码行数:39,代码来源:class-sp-admin-cpt-list.php

示例4: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->id = 'staff';
     $this->label = __('Staff', 'sportspress');
     $this->template = 'staff';
     $this->templates = SP()->templates->staff;
     add_filter('sportspress_settings_tabs_array', array($this, 'add_settings_page'), 20);
     add_action('sportspress_settings_' . $this->id, array($this, 'output'));
     add_action('sportspress_admin_field_staff_layout', array($this, 'layout_setting'));
     add_action('sportspress_settings_save_' . $this->id, array($this, 'save'));
 }
开发者ID:jpurpleman,项目名称:SportsPress,代码行数:14,代码来源:class-sp-settings-staff.php

示例5: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->id = 'events';
     $this->label = __('Events', 'sportspress');
     $this->template = 'event';
     $this->templates = SP()->templates->event;
     add_filter('sportspress_settings_tabs_array', array($this, 'add_settings_page'), 20);
     add_action('sportspress_settings_' . $this->id, array($this, 'output'));
     add_action('sportspress_admin_field_current_mode', array($this, 'current_mode_setting'));
     add_action('sportspress_admin_field_delimiter', array($this, 'delimiter_setting'));
     add_action('sportspress_admin_field_event_layout', array($this, 'layout_setting'));
     add_action('sportspress_settings_save_' . $this->id, array($this, 'save'));
 }
开发者ID:jpurpleman,项目名称:SportsPress,代码行数:16,代码来源:class-sp-settings-events.php

示例6: nationalities

 /**
  * Returns nationalities
  *
  * @access public
  * @return array
  */
 public function nationalities()
 {
     $nationalities = get_post_meta($this->ID, 'sp_nationality', false);
     if (empty($nationalities)) {
         return array();
     }
     foreach ($nationalities as $nationality) {
         if (2 == strlen($nationality)) {
             $legacy = SP()->countries->legacy;
             $nationality = strtolower($nationality);
             $nationality = sp_array_value($legacy, $nationality, null);
         }
     }
     return $nationalities;
 }
开发者ID:nicelemon,项目名称:adult-vikings,代码行数:21,代码来源:class-sp-player.php

示例7: custom_columns

 /**
  * Define our custom columns shown in admin.
  * @param  string $column
  */
 public function custom_columns($column, $post_id)
 {
     switch ($column) {
         case 'sp_league':
             echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'sportspress');
             break;
         case 'sp_season':
             echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'sportspress');
             break;
         case 'sp_rounds':
             echo get_post_meta($post_id, 'sp_rounds', true);
             break;
         case 'sp_layout':
             echo sp_array_value(SP()->formats->tournament, get_post_meta($post_id, 'sp_format', true), '&mdash;');
             break;
     }
 }
开发者ID:mttcmrn,项目名称:Suffield-Bruins-WP,代码行数:21,代码来源:class-sp-admin-cpt-tournament.php

示例8: get_preset

 public static function get_preset($id)
 {
     $json_data = @file_get_contents(SP()->plugin_path() . '/presets/' . $id . '.json', true);
     if ($json_data) {
         return json_decode($json_data, true);
     }
     $dir = scandir(SP()->plugin_path() . '/presets');
     if ($dir) {
         foreach ($dir as $key => $value) {
             if (substr($value, 0, 1) !== '.' && strpos($value, '.') === false) {
                 $json_data = @file_get_contents(SP()->plugin_path() . '/presets/' . $value . '/' . $id . '.json', true);
                 if ($json_data) {
                     return json_decode($json_data, true);
                 }
             }
         }
     }
 }
开发者ID:perren,项目名称:SportsPress,代码行数:18,代码来源:class-sp-admin-sports.php

示例9: install

 /**
  * Install SP
  */
 public function install()
 {
     $this->remove_roles();
     $this->create_roles();
     // Register post types
     include_once 'class-sp-post-types.php';
     SP_Post_types::register_post_types();
     SP_Post_types::register_taxonomies();
     $this->create_options();
     // Queue upgrades
     $current_version = get_option('sportspress_version', null);
     // Update version
     update_option('sportspress_version', SP()->version);
     // Check if pages are needed
     if (!get_option('sportspress_sport')) {
         update_option('_sp_needs_welcome', 1);
     }
     // Flush rules after install
     flush_rewrite_rules();
     // Redirect to welcome screen
     set_transient('_sp_activation_redirect', 1, 60 * 60);
 }
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:25,代码来源:class-sp-install.php

示例10: load_scripts

 /**
  * Register/queue frontend scripts.
  *
  * @access public
  * @return void
  */
 public function load_scripts()
 {
     global $typenow;
     // Scripts
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-datatables', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/jquery.dataTables.min.js', array('jquery'), '1.10.4', true);
     wp_enqueue_script('jquery-countdown', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/jquery.countdown.min.js', array('jquery'), '2.0.2', true);
     wp_enqueue_script('sportspress', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/sportspress.js', array('jquery'), SP()->version, true);
     if (is_singular('sp_event') || is_tax('sp_venue')) {
         wp_enqueue_script('google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true);
         wp_enqueue_script('sp-maps', plugin_dir_url(SP_PLUGIN_FILE) . 'assets/js/sp-maps.js', array('jquery', 'google-maps'), time(), true);
         wp_localize_script('sp-maps', 'vars', array('map_type' => strtoupper(get_option('sportspress_map_type', 'ROADMAP')), 'zoom' => get_option('sportspress_map_zoom', 15)));
     }
     // Localize scripts
     wp_localize_script('sportspress', 'localized_strings', array('days' => __('days', 'sportspress'), 'hrs' => __('hrs', 'sportspress'), 'mins' => __('mins', 'sportspress'), 'secs' => __('secs', 'sportspress'), 'previous' => __('Previous', 'sportspress'), 'next' => __('Next', 'sportspress')));
     // Theme styles
     $theme = wp_get_theme();
     $this->theme = $theme->stylesheet;
     $dir = scandir(SP()->plugin_path() . '/assets/css/themes');
     $files = array();
     if ($dir) {
         foreach ($dir as $key => $value) {
             if (preg_replace('/\\.[^.\\s]{3,4}$/', '', $value) == $this->theme) {
                 add_filter('sportspress_enqueue_styles', array($this, 'add_theme_styles'));
                 break;
             }
         }
     }
     // CSS Styles
     wp_enqueue_style('dashicons');
     $enqueue_styles = $this->get_styles();
     if ($enqueue_styles) {
         add_action('wp_print_scripts', array($this, 'custom_css'), 30);
         foreach ($enqueue_styles as $handle => $args) {
             wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
开发者ID:engrmostafijur,项目名称:SportsPress,代码行数:44,代码来源:class-sp-frontend-scripts.php

示例11: include_widgets

 /**
  * Add widgets.
  *
  * @return array
  */
 public function include_widgets()
 {
     include_once SP()->plugin_path() . '/includes/widgets/class-sp-widget-player-list.php';
     include_once SP()->plugin_path() . '/includes/widgets/class-sp-widget-player-gallery.php';
 }
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:10,代码来源:sportspress-player-lists.php

示例12: admin_scripts

 /**
  * Enqueue scripts
  */
 public function admin_scripts()
 {
     global $wp_query, $post;
     $screen = get_current_screen();
     // Register scripts
     wp_register_script('chosen', SP()->plugin_url() . '/assets/js/chosen.jquery.min.js', array('jquery'), '1.1.0', true);
     wp_register_script('jquery-tiptip', SP()->plugin_url() . '/assets/js/jquery.tipTip.min.js', array('jquery'), '1.3', true);
     wp_register_script('jquery-caret', SP()->plugin_url() . '/assets/js/jquery.caret.min.js', array('jquery'), '1.02', true);
     wp_register_script('jquery-countdown', SP()->plugin_url() . '/assets/js/jquery.countdown.min.js', array('jquery'), '2.0.2', true);
     wp_register_script('jquery-fitvids', SP()->plugin_url() . '/assets/js/jquery.fitvids.js', array('jquery'), '1.1', true);
     wp_register_script('google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places');
     wp_register_script('jquery-locationpicker', SP()->plugin_url() . '/assets/js/locationpicker.jquery.js', array('jquery', 'google-maps'), '0.1.6', true);
     wp_register_script('sportspress-admin-locationpicker', SP()->plugin_url() . '/assets/js/admin/locationpicker.js', array('jquery', 'google-maps', 'jquery-locationpicker'), SP_VERSION, true);
     wp_register_script('sportspress-admin-equationbuilder', SP()->plugin_url() . '/assets/js/admin/equationbuilder.js', array('jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable'), SP_VERSION, true);
     wp_register_script('sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array('jquery'), SP_VERSION, true);
     // SportsPress admin pages
     if (in_array($screen->id, sp_get_screen_ids()) || strpos($screen->id, 'sportspress-config')) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('chosen');
         wp_enqueue_script('jquery-ui-core');
         wp_enqueue_script('jquery-ui-draggable');
         wp_enqueue_script('jquery-ui-droppable');
         wp_enqueue_script('jquery-ui-sortable');
         wp_enqueue_script('jquery-tiptip');
         wp_enqueue_script('jquery-caret');
         wp_enqueue_script('jquery-countdown');
         wp_enqueue_script('jquery-fitvids');
         wp_enqueue_script('sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array('jquery', 'chosen', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-tiptip', 'jquery-caret', 'jquery-countdown', 'jquery-fitvids'), SP_VERSION, true);
         $strings = array('none' => __('None', 'sportspress'), 'remove_text' => __('&mdash; Remove &mdash;', 'sportspress'), 'days' => __('days', 'sportspress'), 'hrs' => __('hrs', 'sportspress'), 'mins' => __('mins', 'sportspress'), 'secs' => __('secs', 'sportspress'), 'displaying_posts' => html_entity_decode(__('Displaying %s&#8211;%s of %s', 'sportspress')));
         // Localize scripts
         wp_localize_script('sportspress-admin', 'localized_strings', $strings);
     }
     if (in_array($screen->id, array('widgets'))) {
         wp_enqueue_script('sportspress-admin-widgets');
     }
     // Edit venue pages
     if (in_array($screen->id, array('edit-sp_venue'))) {
         wp_enqueue_script('google-maps');
         wp_enqueue_script('jquery-locationpicker');
         wp_enqueue_script('sportspress-admin-locationpicker');
     }
     // Edit equation
     if (in_array($screen->id, array('sp_column', 'sp_statistic'))) {
         wp_enqueue_script('sportspress-admin-equationbuilder');
     }
 }
开发者ID:ArnaudGuillou,项目名称:SiteESBVolley,代码行数:49,代码来源:class-sp-admin-assets.php

示例13: SP

<?php

/**
 * Admin functions for the tournaments post type
 *
 * @author 		ProSports
 * @category 	Admin
 * @package 	ProSports_Tournaments
 * @version     1.4
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (!class_exists('SP_Admin_CPT')) {
    include SP()->plugin_path() . '/includes/admin/post-types/class-sp-admin-cpt.php';
}
if (!class_exists('SP_Admin_CPT_Tournament')) {
    /**
     * SP_Admin_CPT_Tournament Class
     */
    class SP_Admin_CPT_Tournament extends SP_Admin_CPT
    {
        /**
         * Constructor
         */
        public function __construct()
        {
            $this->type = 'sp_tournament';
            // Admin Columns
            add_filter('manage_edit-sp_tournament_columns', array($this, 'edit_columns'));
开发者ID:kleitz,项目名称:ProSports,代码行数:31,代码来源:class-sp-admin-cpt-tournament.php

示例14: sp_solve

 function sp_solve($equation, $vars, $precision = 0, $default = '-')
 {
     if ($equation == null) {
         return $default;
     }
     if (strpos($equation, '$gamesback') !== false) {
         // Return placeholder
         return $default;
     } elseif (strpos($equation, '$streak') !== false) {
         // Return direct value
         return sp_array_value($vars, 'streak', $default);
     } elseif (strpos($equation, '$last5') !== false) {
         // Return imploded string
         $last5 = sp_array_value($vars, 'last5', array(0));
         if (array_sum($last5) > 0) {
             return implode('-', $last5);
         } else {
             return $default;
         }
     } elseif (strpos($equation, '$last10') !== false) {
         // Return imploded string
         $last10 = sp_array_value($vars, 'last10', array(0));
         if (array_sum($last10) > 0) {
             return implode('-', $last10);
         } else {
             return $default;
         }
     } elseif (strpos($equation, '$homerecord') !== false) {
         // Return imploded string
         $homerecord = sp_array_value($vars, 'homerecord', array(0));
         return implode('-', $homerecord);
     } elseif (strpos($equation, '$awayrecord') !== false) {
         // Return imploded string
         $awayrecord = sp_array_value($vars, 'awayrecord', array(0));
         return implode('-', $awayrecord);
     }
     // Remove unnecessary variables from vars before calculating
     unset($vars['gamesback']);
     unset($vars['streak']);
     unset($vars['last5']);
     unset($vars['last10']);
     if (sp_array_value($vars, 'eventsplayed', 0) <= 0) {
         return $default;
     }
     // Equation Operating System
     if (!class_exists('phpStack')) {
         include_once SP()->plugin_path() . '/includes/libraries/class-phpstack.php';
     }
     if (!class_exists('eqEOS')) {
         include_once SP()->plugin_path() . '/includes/libraries/class-eqeos.php';
     }
     $eos = new eqEOS();
     // Remove spaces from equation
     $equation = str_replace(' ', '', $equation);
     // Create temporary equation replacing operators with spaces
     $temp = str_replace(array('+', '-', '*', '/', '(', ')'), ' ', $equation);
     // Check if each variable part is in vars
     $parts = explode(' ', $temp);
     foreach ($parts as $key => $value) {
         if (substr($value, 0, 1) == '$') {
             if (!array_key_exists(preg_replace("/[^a-z0-9_]/", '', $value), $vars)) {
                 return 0;
             }
         }
     }
     // Remove space between equation parts
     $equation = str_replace(' ', '', $equation);
     // Initialize Subequations
     $subequations = array($equation);
     // Find all equation parts contained in parentheses
     if (preg_match_all('~\\((.*?)\\)~', $equation, $results)) {
         foreach (sp_array_value($results, 1, array()) as $result) {
             if (!empty($result)) {
                 $subequations[] = $result;
             }
         }
     }
     // Initialize subequation
     $subequation = $equation;
     // Check each subequation separated by division
     foreach ($subequations as $subequation) {
         while ($pos = strpos($subequation, '/')) {
             $subequation = substr($subequation, $pos + 1);
             // Make sure paretheses match
             if (substr_count($subequation, '(') === substr_count($subequation, ')')) {
                 // Return zero if denominator is zero
                 if ($eos->solveIF($subequation, $vars) == 0) {
                     return 0;
                 }
             }
         }
     }
     // Return solution
     return number_format($eos->solveIF(str_replace(' ', '', $equation), $vars), $precision, '.', '');
 }
开发者ID:krmkrl,项目名称:SportsPress,代码行数:95,代码来源:sp-core-functions.php

示例15: sp_get_template

function sp_get_template($path)
{
    $template = SP()->plugin_dir("templates/" . $path);
    require_once $template;
}
开发者ID:LanceJernigan,项目名称:Simple-Profile-Plugin,代码行数:5,代码来源:core-function.php


注:本文中的SP函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。