/** * Initializes client object and fetches API KEY */ public function __construct() { /* * Fetching API key from the wp_options table */ $this->apiKey = op_get_option(self::OPTION_NAME_API_KEY); }
function __construct() { global $wpdb; if (op_get_option('installed') == 'Y') { require_once OP_ASSETS . 'default.php'; // This isn't used but it is causing unnecessary DB request // $assets = $wpdb->get_col( "SELECT name FROM `{$wpdb->prefix}optimizepress_assets`" ); // if($assets){ // foreach($assets as $asset){ // $this->load_addon($asset); // } // } add_action('wp_ajax_' . OP_SN . '-assets-folder-list', array($this, 'folder_list')); /* * Email marketing services integration hooks */ add_action('wp_ajax_' . OP_SN . '-email-provider-list', array($this, 'providerList')); add_action('wp_ajax_' . OP_SN . '-email-provider-enabled', array($this, 'providerEnabled')); add_action('wp_ajax_' . OP_SN . '-email-provider-details', array($this, 'providerDetails')); add_action('wp_ajax_' . OP_SN . '-email-provider-items', array($this, 'providerItems')); add_action('wp_ajax_' . OP_SN . '-email-provider-item-fields', array($this, 'providerItemFields')); /** * Live search hooks */ add_action('wp_ajax_' . OP_SN . '-live-search', array($this, 'liveSearch')); add_action('wp_ajax_nopriv_' . OP_SN . '-live-search', array($this, 'liveSearch')); add_action('the_content', array($this, 'removeContentFromSearchResults')); add_filter('the_content', array($this, 'fixptag')); /* * Content template */ add_action('wp_ajax_' . OP_SN . '-content-layout-delete', array($this, 'deleteContentLayout')); } }
function initalize_theme() { $pages = array(OP_SN, OP_SN . '-setup-wizard'); $reinit_theme = $reinit_page_theme = false; $disable_theme = false; if (isset($_GET['page'])) { if ($_GET['page'] == OP_SN || $_GET['page'] == OP_SN . '-setup-wizard') { $cur = op_get_option('theme', 'dir'); if (isset($_GET['theme_switch']) && $_GET['theme_switch'] != $cur && ($conf = op_load_theme_config($_GET['theme_switch'])) !== false) { $theme = array('name' => $conf['name'], 'screenshot' => $conf['screenshot'], 'screenshot_thumbnail' => $conf['screenshot_thumbnail'], 'description' => $conf['description'], 'dir' => $_GET['theme_switch']); op_update_option('theme', $theme); $reinit_theme = true; } } elseif ($_GET['page'] == OP_SN . '-page-builder') { $disable_theme = true; } } elseif (defined('DOING_AJAX')) { $action = ''; if (!($action = op_get('action'))) { $action = op_post('action'); } $chk = OP_SN . '-live-editor'; if (is_string($action) && substr($action, 0, strlen($chk)) == $chk) { $disable_theme = true; } } if ($disable_theme === false) { op_init_theme(); define('OP_REINIT_THEME', $reinit_theme); if ($reinit_theme) { define('OP_SHOW_THEME_MSG', $cur !== false); do_action(OP_SN . '-reinit_theme'); } } }
/** * Constructor, initializes $accessToken, $organizerKey and creates $client */ public function __construct() { /* * Fetching values from wp_options table */ $this->enabled = (bool) op_get_option(self::OPTION_NAME_ENABLED); }
function __construct() { global $wpdb; if (op_get_option('installed') == 'Y') { require_once OP_ASSETS . 'default.php'; $assets = $wpdb->get_col("SELECT name FROM `{$wpdb->prefix}optimizepress_assets`"); if ($assets) { foreach ($assets as $asset) { $this->load_addon($asset); } } add_action('wp_ajax_' . OP_SN . '-assets-folder-list', array($this, 'folder_list')); /* * Email marketing services integration hooks */ add_action('wp_ajax_' . OP_SN . '-email-provider-list', array($this, 'providerList')); add_action('wp_ajax_' . OP_SN . '-email-provider-details', array($this, 'providerDetails')); /** * Live search hooks */ add_action('wp_ajax_' . OP_SN . '-live-search', array($this, 'liveSearch')); add_action('wp_ajax_nopriv_' . OP_SN . '-live-search', array($this, 'liveSearch')); add_filter('the_content', array($this, 'fixptag')); } }
/** * Initializes client object and fetches API KEY */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { $this->apiKey = op_get_option(self::OPTION_NAME_API_KEY); /* * Initializing logger */ $this->logger = $logger; }
/** * Constructor, initializes $username and $password */ public function __construct() { /* * Fetching values from wp_options table */ $this->username = op_get_option(self::OPTION_NAME_USERNAME); $this->password = op_get_option(self::OPTION_NAME_PASSWORD); }
/** * Constructor, initializes $accessToken, $organizerKey and creates $client */ public function __construct() { /* * Fetching values from wp_options table */ $this->accessToken = op_get_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN); $this->organizerKey = op_get_option(self::OPTION_NAME_OAUTH_ORGANIZER_KEY); $this->apiKey = op_get_option(self::OPTION_NAME_OAUTH_API_KEY); }
/** * Initializes client object and fetches API KEY */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { $this->accountID = op_get_option(self::OPTION_NAME_ACCOUNT_ID); $this->publicKey = op_get_option(self::OPTION_NAME_PUBLIC_KEY); $this->privateKey = op_get_option(self::OPTION_NAME_PRIVATE_KEY); /* * Initializing logger */ $this->logger = $logger; }
/** * Constructor */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { /* * Fetching values from wp_options table */ $this->enabled = (bool) op_get_option(self::OPTION_NAME_ENABLED); /* * Initializing logger */ $this->logger = $logger; }
/** * Constructor, initializes $username and $password */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { /* * Fetching values from wp_options table */ $this->username = op_get_option(self::OPTION_NAME_USERNAME); $this->password = op_get_option(self::OPTION_NAME_PASSWORD); /* * Initializing logger */ $this->logger = $logger; }
/** * Initializes client object and fetches API KEY */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { /* * Fetching API key from the wp_options table */ $this->accountId = op_get_option(self::OPTION_NAME_ACCOUNT_ID); $this->authToken = op_get_option(self::OPTION_NAME_AUTH_TOKEN); /* * Initializing logger */ $this->logger = $logger; }
/** * Initializes client object and fetches API KEY */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { /* * Fetching API key from the wp_options table */ $this->apiKey = op_get_option(self::OPTION_NAME_API_KEY); $this->apiUrl = op_get_option(self::OPTION_NAME_API_URL); /* * Initializing logger */ $this->logger = $logger; }
/** * Constructor, initializes $accessToken, $organizerKey and creates $client */ public function __construct(OptimizePress_Modules_Email_LoggerInterface $logger) { /* * Fetching values from wp_options table */ $this->accessToken = op_get_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN); $this->organizerKey = op_get_option(self::OPTION_NAME_OAUTH_ORGANIZER_KEY); $this->apiKey = op_get_option(self::OPTION_NAME_OAUTH_API_KEY); /* * Initializing logger */ $this->logger = $logger; }
<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar cf"> <label class="form-title"><?php _e('AWeber API connection', 'optimizepress'); ?> </label> <?php if (op_get_option('aweber_access_token') === false || op_get_option('aweber_access_secret') === false) { ?> <p class="op-micro-copy"><?php _e('AWeber is disconnected.', 'optimizepress'); ?> <a href="<?php echo admin_url('admin.php?action=' . OP_AWEBER_AUTH_URL); ?> "><?php _e('Connect', 'optimizepress'); ?> </a></p> <?php } else { ?> <p class="op-micro-copy"><?php _e('AWeber is connected.', 'optimizepress'); ?> <a href="<?php echo admin_url('admin.php?action=' . OP_AWEBER_AUTH_URL); ?> &disconnect=1"><?php _e('Disconnect', 'optimizepress'); ?> </a></p>
</td> <td align="center"> <input type="checkbox" name="op[sections][le_external_plugins][css][]" data-type="css" value="<?php echo esc_attr($pluginId); ?> " <?php checked(true, is_array(op_get_option('op_le_external_plugins_css')) && in_array($pluginId, op_get_option('op_le_external_plugins_css'))); ?> /> </td> <td align="center"> <input type="checkbox" name="op[sections][le_external_plugins][js][]" data-type="js" value="<?php echo esc_attr($pluginId); ?> " <?php checked(true, is_array(op_get_option('op_le_external_plugins_js')) && in_array($pluginId, op_get_option('op_le_external_plugins_js'))); ?> /> </td> </tr> <?php } ?> </table> <?php } ?> <?php if (false === $hasActive) { ?>
<?php if (($theme_dir = op_get_option('theme', 'dir')) === false && count($themes) > 0) { $theme_dir = $themes[0]['dir']; } ?> <h2><?php _e('Theme Style', OP_SN); ?> </h2> <!--<?php op_help_vid('theme'); ?> --> <div class="clear"></div> <p><?php _e('Use the options below to choose a look and feel for your blog.', OP_SN); ?> </p> <?php $sel_text = __('Selected', OP_SN); $prev_text = __('Preview', OP_SN); $previews = array(); $img = op_img('', true); foreach ($themes as $key => $theme) { $field_id = 'op_theme_' . $theme['dir']; $selected = $theme_dir == $theme['dir']; /*$get_theme = (isset($_GET['theme_switch']) ? $_GET['theme_switch'] : 1); $selected = ($get_theme==($key+1) ? true : false);*/ $li_class = $input_attr = ''; if ($selected) {
?> <li> <label for="<?php echo $tmp_id; ?> size" class="form-title"><?php echo $title; ?> </label> <?php echo empty($help) ? '' : '<p class="op-micro-copy">' . $help . '</p>'; ?> <div class="font-chooser cf"> <?php $opt_array = array('typography', 'font_elements', $element); $opts = op_get_option($opt_array); echo op_font_size_dropdown($tmp_field . '[size]', op_default_option($opt_array, 'size'), $tmp_id . 'size'); echo op_font_dropdown($tmp_field . '[font]', op_default_option($opt_array, 'font'), $tmp_id . 'font'); echo op_font_style_dropdown($tmp_field . '[style]', op_default_option($opt_array, 'style'), $tmp_id . 'style'); // echo "<div class='clear'></div>"; op_color_picker($tmp_field . '[color]', op_default_option($opt_array, 'color'), $tmp_id . 'color'); ?> <a href="#reset" class="reset-link"><?php _e('Reset', OP_SN); ?> </a> </div> </li> <?php }
<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar cf"> <label for="op_sections_email_marketing_services_convertkit_api_key" class="form-title"><?php _e('API Key', OP_SN); ?> </label> <?php op_text_field('op[sections][email_marketing_services][convertkit_api_key]', op_get_option('convertkit_api_key')); ?> </div>
function op_opengraph_meta() { /*$metas = array( //'og:url' => get_bloginfo('wpurl'), 'og:type' => 'article', ); $site_title = ''; if(!$site_title = op_get_option('seo','title')){ $site_title = get_bloginfo('name'); $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $site_title .= ' — '.$site_description; } $metas['og:site_name'] = $site_title; if(is_single()){ global $post; while(have_posts()){ the_post(); $metas['og:url'] = get_permalink($post->ID); $seo = get_post_meta($post->ID,'op_seo',true); $seo = is_array($seo) ? $seo : array(); $title = op_get_var($seo,'title'); $description = op_get_var($seo,'description'); $metas['og:title'] = empty($title) ? $post->post_title : $title; $metas['og:description'] = empty($description) ? wp_trim_excerpt($post->post_excerpt) : $description; if(has_post_thumbnail($post->ID)){ $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'list-image'); $metas['og:image'] = $thumbnail[0]; } } rewind_posts(); }*/ $metas = array(); $appId = op_get_option('comments', 'facebook', 'id'); if (!empty($appId)) { $metas['fb:app_id'] = op_get_option('comments', 'facebook', 'id'); if ($notify = op_get_option('comments', 'facebook', 'notify') && !empty($notify)) { $metas['fb:admins'] = $notify; } } //$metas = apply_filters('op_meta_tags',$metas); foreach ($metas as $property => $content) { echo ' <meta property="' . $property . '" content="' . esc_attr($content) . '" /> '; } }
/** * Checks that 'optimizepress_gotowebinar_access_token' is defined and if 'optimizepress_gotowebinar_expires_in' is larger smaller than two weeks * @author Luka Peharda <*****@*****.**> * @return void */ function goToWebinarTokenExpiry() { $accessToken = op_get_option('gotowebinar_access_token'); $expiresIn = op_get_option('gotowebinar_expires_in'); $expiryTime = (int) $expiresIn - time(); if (false !== $accessToken && false !== $expiresIn && $expiryTime < OP_GOTOWEBINAR_EXPIRE_NOTICE) { if ($expiryTime > 0) { echo '<div class="update-nag">' . sprintf(__('GoToWebinar access token is going to expire in %1$d day(s). Please <a href="%2$s">re-authorize</a>.', OP_SN), intval($expiryTime / 86400), admin_url('admin.php?action=op-gotowebinar-authorize&authorize=1')) . '</div>'; } else { echo '<div class="update-nag">' . sprintf(__('GoToWebinar access token is expired. Please <a href="%1$s">re-authorize</a>.', OP_SN), admin_url('admin.php?action=op-gotowebinar-authorize&authorize=1')) . '</div>'; } } }
function save_typography($op) { if (isset($op['typography'])) { $op = $op['typography']; $typography = op_get_option('typography'); $typography = is_array($typography) ? $typography : array(); $typography_elements = op_typography_elements(); $typography['font_elements'] = op_get_var($typography, 'font_elements', array()); $typography['color_elements'] = op_get_var($typography, 'font_elements', array()); if (isset($typography_elements['font_elements'])) { foreach ($typography_elements['font_elements'] as $name => $options) { $tmp = op_get_var($op, $name, op_get_var($typography['font_elements'], $name, array())); $typography['font_elements'][$name] = array('size' => op_get_var($tmp, 'size'), 'font' => op_get_var($tmp, 'font'), 'style' => op_get_var($tmp, 'style'), 'color' => op_get_var($tmp, 'color')); } } if (isset($typography_elements['color_elements'])) { foreach ($typography_elements['color_elements'] as $name => $options) { $typography['color_elements'][$name] = op_get_var($op, $name, op_get_var($typography['color_elements'], $name, array())); } } op_update_option('typography', $typography); } }
/** * Ping SL service with API key * @param string $type * @param string $version * @return bool|WP_Error */ public function ping($type = null, $version = null) { $args = array('headers' => array(self::HEADER_INSTALLATION_URL_PARAM => $this->getInstallationUrl(), self::HEADER_API_KEY_PARAM => $this->getApiKey()), 'body' => array('type' => $type !== null ? $type : OP_TYPE, 'version' => $version !== null ? $version : OP_VERSION, 'php' => phpversion(), 'locale' => get_locale())); if ($type === null && OP_TYPE === 'plugin') { $theme = wp_get_theme(); $args['body']['theme'] = $theme->get('Name'); } else { if ($type === null && OP_TYPE === 'theme') { $themeNum = op_get_option('theme', 'dir'); // There is no theme selected cause the blog setup wasn't finished if (empty($themeNum)) { $themeNum = '0 (not selected)'; } $args['body']['theme'] = 'OptimizePress #' . $themeNum; } } $args['body']['optin_stats_current'] = op_optin_stats_get_local_month_count('current'); $args['body']['optin_stats_last'] = op_optin_stats_get_local_month_count('last'); $response = wp_remote_post(base64_decode(self::OP_SL_BASE_URL) . 'ping', $args); if (is_wp_error($response)) { /* * Request failed */ $this->log('OP SL error: ' . $response->get_error_message()); return new WP_Error($response->get_error_code(), $response->get_error_message()); } else { if ((int) $response['response']['code'] !== 200) { /* * API key issues */ $data = json_decode($response['body']); $this->log('OP SL error: ' . $data->error); return new WP_Error('invalid', $data->error); } else { /* * Success */ $data = json_decode($response['body']); // If SL customer data exists we'll save it if (isset($data->data->customer)) { op_update_option('sl_customer', (array) $data->data->customer); } // If global optin stats exists we'll save it if (isset($data->data->optin_stats)) { op_optin_stats_save_global_data($data->data->optin_stats); } return true; } } }
?> " data-type="css" class="op-disable-all-css"><?php _e('CSS', 'optimizepress'); ?> </a></th> <th width="10%"><a href="#toggle-js" title="<?php _e('Toggle all checkboxes', 'optimizepress'); ?> " data-type="js" class="op-disable-all-js"><?php _e('JS', 'optimizepress'); ?> </a></th> </tr> <tr> <td><?php echo $theme->name; ?> </td> <td align="center"> <?php op_checkbox_field('op[sections][le_external_theme_css]', 1, checked(1, op_get_option('op_le_external_theme_css'), false), 'data-type="css"'); ?> </td> <td align="center"> <?php op_checkbox_field('op[sections][le_external_theme_js]', 1, checked(1, op_get_option('op_le_external_theme_js'), false), 'data-type="js"'); ?> </td> </tr> </table> </div>
function get_metas() { global $page, $paged, $post; $title = $keywords = $description = ''; if (is_single() || is_page()) { $seo = maybe_unserialize(get_post_meta(get_queried_object_id(), '_' . OP_SN . '_seo', true)); $seo = is_array($seo) ? $seo : array(); $title = op_get_var($seo, 'title'); $keywords = op_get_var($seo, 'keywords'); $description = op_get_var($seo, 'description'); $ogtitle = op_get_var($seo, 'ogtitle'); $ogdescription = op_get_var($seo, 'ogdescription'); $ogimage = op_get_var($seo, 'ogimage'); } if (empty($title)) { $titleFull = false; $title = wp_title('—', false, 'right'); $temp = explode('—', $title); if (isset($temp[1]) && strlen($temp[1]) == 1) { $title .= get_bloginfo('name'); } } else { $titleFull = true; //$title .= ' — '; } $site_title = ''; if (!($site_title = op_get_option('seo', 'title'))) { $site_title = get_bloginfo('name'); /*$site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $site_title .= ' — ' . $site_description;*/ } if ($titleFull) { if (!empty($site_title)) { $title .= ' — ' . $site_title; } } if ($paged >= 2 || $page >= 2) { $title .= ' — ' . sprintf(__('Page %s', OP_SN), max($paged, $page)); } if (empty($keywords)) { $keywords = ''; } if (empty($description)) { if (!empty($post->post_content)) { $cont = substr(strip_tags(strip_shortcodes($post->post_content)), 0, 150); $description = trim($cont); } else { $description = ''; } } if (empty($ogtitle)) { $ogtitle = $title; } if (empty($ogdescription)) { $ogdescription = $description; } if (empty($ogimage)) { if (has_post_thumbnail($post->ID)) { $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'list-image'); $ogimage = $thumbnail[0]; } else { $ogimage = ''; } } return array('title' => $title, 'description' => $description, 'keywords' => $keywords, 'ogtitle' => $ogtitle, 'ogdescription' => $ogdescription, 'ogimage' => $ogimage); }
function save_typography($op) { if (isset($op['default_typography'])) { $op = $op['default_typography']; $typography = op_get_option('default_typography'); $typography = is_array($typography) ? $typography : array(); $typography_elements = op_typography_elements(); $typography_elements['color_elements'] = array('footer_text_color' => '', 'footer_link_color' => '', 'footer_link_hover_color' => '', 'feature_text_color' => '', 'feature_link_color' => '', 'feature_link_hover_color' => ''); $typography['font_elements'] = op_get_var($typography, 'font_elements', array()); $typography['color_elements'] = op_get_var($typography, 'color_elements', array()); if (isset($typography_elements['font_elements'])) { foreach ($typography_elements['font_elements'] as $name => $options) { $tmp = op_get_var($op, $name, op_get_var($typography['font_elements'], $name, array())); $typography['font_elements'][$name] = array('size' => op_get_var($tmp, 'size'), 'font' => op_get_var($tmp, 'font'), 'style' => op_get_var($tmp, 'style'), 'color' => op_get_var($tmp, 'color')); } } if (isset($typography_elements['color_elements'])) { foreach ($typography_elements['color_elements'] as $name => $options) { $typography['color_elements'][$name] = $op[$name]; } } op_update_option('default_typography', $typography); //Check for blanks so we can set the defaults. //Otherwise a refresh would be necessary to see the defaults. // op_set_font_defaults(); } }
<div class="op-bsw-grey-panel-content op-bsw-grey-panel-no-sidebar cf"> <label for="op_sections_email_marketing_services_icontact_username" class="form-title"><?php _e('iContact Username', OP_SN); ?> </label> <?php op_text_field('op[sections][email_marketing_services][icontact_username]', op_get_option('icontact_username')); ?> <label for="op_sections_email_marketing_services_icontact_password" class="form-title"><?php _e('API password', OP_SN); ?> </label> <?php op_text_field('op[sections][email_marketing_services][icontact_password]', op_get_option('icontact_password')); ?> <p class="op-micro-copy"><a href="https://app.icontact.com/icp/core/externallogin?sAppId=<?php echo OP_ICONTACT_APP_ID; ?> " target="_blank"><?php _e('Get API password', OP_SN); ?> </a></p> <p class="op-note"><em><?php _e('Note: You need to allow external program to access your account and generate password for the API access.', OP_SN); ?> </em></p> </div>
public function __construct() { $this->appId = op_get_option(self::OPTION_NAME_APP_ID); $this->apiKey = op_get_option(self::OPTION_NAME_API_KEY); }
/** * Fetching API key from options table * @return [type] [description] */ public function getApiKey() { return op_get_option(self::OPTION_API_KEY_PARAM); }
function op_flowplayer_license($default, $type = 'js_file') { $flowplayer_license = op_get_option('flowplayer_license'); if (!empty($flowplayer_license[$type]) && !empty($flowplayer_license['license_key'])) { return $flowplayer_license[$type]; } else { return $default; } }