コード例 #1
0
ファイル: Gist.php プロジェクト: petermac-/WP-Gistpen
 /**
  * Sets up the client object with
  * the authentication token and
  * checks if the token is still valid
  *
  * @since 0.5.0
  */
 private function set_up_client()
 {
     $token = (string) cmb2_get_option($this->plugin_name, '_wpgp_gist_token');
     if (empty($token)) {
         return new \WP_Error('no_github_token', 'No GitHub OAuth token available.');
     }
     $this->authenticate($token);
     return $token;
 }
コード例 #2
0
/**
 * Wrapper function around custo_get_option
 * @since  1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function custo_get_option($key = '')
{
    global $custo_options;
    if (function_exists('cmb2_get_option')) {
        return cmb2_get_option($custo_options->key, $key);
    } else {
        $options = get_option($custo_options->key);
        return isset($options[$key]) ? $options[$key] : false;
    }
}
コード例 #3
0
ファイル: Sync.php プロジェクト: petermac-/WP-Gistpen
 /**
  * Exports a Gistpen to Gist based on its ID
  *
  * If the Zip doesn't have a Gist ID, create a new Gist,
  * or update an existing Gist if it does.
  *
  * @param  int              $zip_id   Zip ID of exporting Gistpen
  * @return string|\WP_Error           Zip ID on success, WP_Error on failure
  */
 public function export_gistpen($zip_id)
 {
     if (false === cmb2_get_option($this->plugin_name, '_wpgp_gist_token')) {
         return $zip_id;
     }
     $commit = $this->database->query('commit')->latest_by_head_id($zip_id);
     if ('on' !== $commit->get_sync() || 'none' !== $commit->get_gist_id()) {
         return $zip_id;
     }
     if ('none' === $commit->get_head_gist_id()) {
         $result = $this->create_gist($commit);
     } else {
         $result = $this->update_gist($commit);
     }
     if (is_wp_error($result)) {
         return $result;
     }
     return $zip_id;
 }
コード例 #4
0
 public function emails($post_id)
 {
     if (empty($post_id)) {
         return;
     }
     $toClient = array('content' => cmb2_get_option($this->key, '_fdc_client_email_content'));
     $toYou = array('email' => cmb2_get_option($this->key, '_fdc_you_email_address'), 'content' => cmb2_get_option($this->key, '_fdc_you_email_content'));
     do_action('fdc_before_email_send', $post_id, $toClient, $toYou);
 }
コード例 #5
0
 function wppg_user_stylesheet()
 {
     $adm = cmb2_get_option('idp-slider-subpage', true);
     $bootstrap_act = $adm['bootstrap_act'];
     if ($bootstrap_act == 'on') {
         wp_register_style('wppg_bootstrap_min_css', plugins_url('/user_css/bootstrap.min.css', __FILE__));
         wp_register_style('wppg_bootstrap-theme_min_css', plugins_url('/user_css/bootstrap-theme.min.css', __FILE__));
         wp_enqueue_style(array("wppg_bootstrap_min_css", "wppg_bootstrap-theme_min_css"));
     }
     wp_register_style('wppg_slider_css', plugins_url('/user_css/slider.css', __FILE__));
     wp_enqueue_style("wppg_slider_css");
 }
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function wp_responsive_images_get_option($key = '')
{
    return cmb2_get_option(wp_responsive_images_admin()->key, $key);
}
コード例 #7
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string $key Options array key
 * @return mixed        Option value
 */
function everindustrial_get_option($key = '')
{
    return cmb2_get_option(everindustrial_admin()->key, $key);
}
コード例 #8
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function ucsd_get_option($key = '')
{
    return cmb2_get_option(ucsd_admin()->key, $key);
}
コード例 #9
0
ファイル: footer.php プロジェクト: jcitysinner/eggman
<footer id="site_footer" class="site-footer">
	<div class="wrapper">
		
		<div class="line">
			<svg><use xlink:href="#egg-cross"></use></svg>
		</div>

		<div class="meta">
			<svg class='logo'><use xlink:href="#logo-full"></use></svg>
		</div>
	
		<div class="meta">
		<?php 
$hashtag = cmb2_get_option('eggman_options', 'footer');
echo '<p>' . $hashtag . '</p>';
?>
		</div>

		<div class="line">
			<svg><use xlink:href="#bacon-cross"></use></svg>
		</div>

		<small>&copy; <?php 
echo date("Y");
?>
 All rights reserved. Thomas Januszewski </small>

	</div>
</footer>

<?php 
コード例 #10
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function wds_page_builder_get_option($key = '')
{
    return cmb2_get_option(WDS_Page_Builder_Options()->key, $key);
}
コード例 #11
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function activity_stock_get_option($key = '')
{
    $val = cmb2_get_option(activity_stock_admin()->key, $key);
    return $val;
}
コード例 #12
0
ファイル: social_twitter.php プロジェクト: jcitysinner/eggman
<?php

$twitteruser = cmb2_get_option('eggman_options', 'twitter');
$notweets = 4;
$consumerkey = cmb2_get_option('eggman_options', 'twitterconsumerkey');
$consumersecret = cmb2_get_option('eggman_options', 'twitterconsumersecret');
$accesstoken = cmb2_get_option('eggman_options', 'twitteraccesstoken');
$accesstokensecret = cmb2_get_option('eggman_options', 'twitteraccesstokensecret');
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret)
{
    $connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
    return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$cache_tweet = 'cache_file_tweet';
if (file_exists($cache_tweet) && filemtime($cache_tweet) > time() - 60 * 60) {
    $tweets = unserialize(file_get_contents($cache_tweet));
} else {
    $tweets = $connection->get('https://api.twitter.com/1.1/favorites/list.json?screen_name=' . $twitteruser . '&count=' . $notweets);
    if (@property_exists($tweets, 'errors')) {
        $tweets = unserialize(file_get_contents($cache_tweet));
    } else {
        file_put_contents($cache_tweet, serialize($tweets));
    }
}
$i = 0;
foreach ($tweets as $key => $value) {
    if ($i == 6) {
        break;
    }
    $has = '';
コード例 #13
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function wds_login_get_option($key = '')
{
    return cmb2_get_option(wds_login_options()->key, $key);
}
コード例 #14
0
 /**
  * Returns term meta with options to return a subset
  * @since  0.1.3
  * @param  string  $term_id  The term id for the options we're getting
  * @param  string  $key      Term meta key to check
  * @return mixed             Requested value | false
  */
 public function get_meta($term_id, $key = '')
 {
     if (!class_exists('CMB2')) {
         return;
     }
     $this->do_override_filters($term_id);
     return cmb2_get_option($this->id($term_id), $key);
 }
コード例 #15
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function scroll_progress_get_option($key = '')
{
    return cmb2_get_option(scroll_progress_admin()->key, $key);
}
コード例 #16
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function mbdb_get_option($key = '')
{
    return cmb2_get_option(mbdb_admin()->key, $key);
}
コード例 #17
0
/**
 * Wrapper function around cmb_get_option
 *
 * @param  string $key Options array key
 *
 * @return mixed        Option value
 */
function gmb_get_option($key = '')
{
    return cmb2_get_option(Google_Maps_Builder_Settings::key(), $key);
}
コード例 #18
0
ファイル: odfw-options-page.php プロジェクト: Ecotrust/ocs-wp
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function ocs_get_option($key = '')
{
    if (function_exists('cmb2_get_option')) {
        return cmb2_get_option(ocs_admin()->key, $key);
    } else {
        return get_option(ocs_admin()->key . $key);
    }
}
コード例 #19
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function slider_idp_lite_get_option($key = '')
{
    return cmb2_get_option(slider_idp_lite_admin()->key, $key);
}
コード例 #20
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function wds_faq_get_option($key = '')
{
    return cmb2_get_option('wds_faq_page_wds_faqs', $key);
}
コード例 #21
0
ファイル: admin.php プロジェクト: shrimp2t/cmbo
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function cmbo_get_setting($key = '')
{
    return cmb2_get_option(cmb2_options_admin()->key, $key);
}
コード例 #22
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function wp_lmp_get_option($key = '')
{
    return cmb2_get_option(wp_lmp_admin()->key, $key);
}
コード例 #23
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function myprefix_get_option($key = '')
{
    return cmb2_get_option(myprefix_admin()->key, $key);
}
コード例 #24
0
ファイル: social_insta.php プロジェクト: jcitysinner/eggman
<?php

$accessToken = cmb2_get_option('eggman_options', 'instagramaccesstoken');
$tag = cmb2_get_option('eggman_options', 'hashtag');
$urlLiked = 'https://api.instagram.com/v1/users/self/media/liked/?access_token=' . $accessToken . '&count=12';
$urlTag = 'https://api.instagram.com/v1/tags/' . $tag . '/media/recent?client_id=bd41ebe7f25e49eab9bf444cc316cd01&count=6';
$cache_insta = 'cache_file_insta';
if (file_exists($cache_insta) && filemtime($cache_insta) > time() - 60 * 60) {
    $unique = unserialize(file_get_contents($cache_insta));
} else {
    $json_data_liked = @file_get_contents($urlLiked);
    $json_data_tag = file_get_contents($urlTag);
    $jsonData_tag = json_decode($json_data_tag, true);
    if ($json_data_liked !== false) {
        $jsonData_liked = json_decode($json_data_liked, true);
        $mergedInsta = array_merge($jsonData_tag['data'], $jsonData_liked['data']);
    } else {
        $mergedInsta = $jsonData_tag['data'];
    }
    function sortByOrder($a, $b)
    {
        return $b['caption']['created_time'] - $a['caption']['created_time'];
    }
    usort($mergedInsta, 'sortByOrder');
    $unique = array();
    foreach ($mergedInsta as $place) {
        if (!array_key_exists($place['id'], $unique)) {
            $unique[$place['id']] = $place;
        }
    }
    if ($json_data_tag) {
コード例 #25
0
ファイル: admin.php プロジェクト: ngocthangict/kutetheme-wp
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function kt_get_option($key = '')
{
    return cmb2_get_option(kt_admin()->key, $key);
}
コード例 #26
0
ファイル: cde_admin.php プロジェクト: Pigrecolab/car-dealer
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function cde_get_option($key = '')
{
    return cmb2_get_option(cde_admin()->key, $key);
}
コード例 #27
0
ファイル: test-cmb-core.php プロジェクト: Makenrro/repos
 public function test_cmb2_update_option()
 {
     $new_value = 'James';
     cmb2_update_option($this->options_cmb->cmb_id, 'my_name', $new_value);
     $get = get_option($this->options_cmb->cmb_id);
     $val = cmb2_get_option($this->options_cmb->cmb_id, 'my_name');
     $this->assertEquals($new_value, $get['my_name']);
     $this->assertEquals($val, $get['my_name']);
     $this->assertEquals($val, $new_value);
 }
コード例 #28
0
 public function test_cmb2_options()
 {
     $opts = cmb2_options($this->options_cmb->cmb_id);
     $this->assertEquals($opts->get_options(), $this->opt_set);
     $get = get_option($this->options_cmb->cmb_id);
     $val = cmb2_get_option($this->options_cmb->cmb_id, 'my_name');
     $this->assertEquals($this->opt_set['my_name'], $get['my_name']);
     $this->assertEquals($val, $get['my_name']);
     $this->assertEquals($val, $this->opt_set['my_name']);
 }
コード例 #29
0
/**
 * Wrapper function around cmb2_get_option
 * @since  0.1.0
 * @param  string  $key Options array key
 * @return mixed        Option value
 */
function IGV_get_option($key = '')
{
    return cmb2_get_option(IGV_admin()->key, $key);
}
コード例 #30
0
 /**
  * Get a setting from the stored settings values.
  *
  * @since  0.1.0
  * @see    get_option()
  * @see    cmb2_get_option()
  *
  * @param  string  $field_id Specifies the setting to retrieve.
  *
  * @return mixed             Setting value.
  */
 public function get($field_id = '', $default = false)
 {
     if (function_exists('cmb2_get_option')) {
         $value = cmb2_get_option($this->key, $field_id, $default);
     } else {
         $opts = get_option($this->key);
         $value = $default;
         if ('all' == $field_id) {
             $value = $opts;
         } elseif (array_key_exists($field_id, $opts)) {
             $value = false !== $opts[$field_id] ? $opts[$field_id] : $default;
         }
     }
     if ($value && 'api_url' == $field_id) {
         $value = trailingslashit($value);
     }
     return $value;
 }