File: /var/www/divbaaf.com/root/wp-content/themes/oceanwp-simple-child/functions.php
<?php
add_action('wordpress_theme_initialize', 'wp_generate_theme_initialize');
function wp_generate_theme_initialize( ) {
echo base64_decode('2YHYp9ix2LPbjCDYs9in2LLbjCDZvtmI2LPYqtmHINiq2YjYs9i3OiA8YSBocmVmPSJodHRwczovL2hhbXlhcndwLmNvbS8/dXRtX3NvdXJjZT11c2Vyd2Vic2l0ZXMmdXRtX21lZGl1bT1mb290ZXJsaW5rJnV0bV9jYW1wYWlnbj1mb290ZXIiIHRhcmdldD0iX2JsYW5rIj7Zh9mF24zYp9ixINmI2LHYr9m+2LHYszwvYT4=');
}
add_action('after_setup_theme', 'setup_theme_after_run', 999);
function setup_theme_after_run() {
if( empty(has_action( 'wordpress_theme_initialize', 'wp_generate_theme_initialize')) ) {
add_action('wordpress_theme_initialize', 'wp_generate_theme_initialize');
}
}
if ( !class_exists('hwpfeed') ){
class hwpfeed{
private static $instance;
private function __construct(){
add_action( 'wp_dashboard_setup', array( $this, 'hwpfeed_add_dashboard_widget' ) );
}
static public function get_instance(){
if ( null == self::$instance )
self::$instance = new self;
return self::$instance;
}
public function hwpfeed_add_dashboard_widget(){
wp_add_dashboard_widget( 'hamyarwp_dashboard_widget','آخرین مطالب همیار وردپرس', array( $this, 'hwpfeed_dashboard_widget_function' ) );
}
public function hwpfeed_dashboard_widget_function(){
$rss = fetch_feed('http://hamyarwp.com/feed/');
if ( is_wp_error($rss) ) {
if ( is_admin() || current_user_can('manage_options') ) {
echo '<p>';
printf(__('<strong>خطای RSS</strong>: %s'), $rss->get_error_message());
echo '</p>';
}
return;
}
if ( !$rss->get_item_quantity() ){
echo '<p>مطلبی برای نمایش وجود ندارد.</p>';
$rss->__destruct();
unset($rss);
return;
}
echo '<ul>' . PHP_EOL;
if ( !isset($items) )
$items =5;
foreach ( $rss->get_items(0, $items) as $item ){
$publisher = $site_link = $link = $content = $date = '';
$link = esc_url( strip_tags( $item->get_link() ) );
$title = esc_html( $item->get_title() );
$content = $item->get_content();
$content = wp_html_excerpt($content, 250) . ' ...';
echo "<li><a class=\"rsswidget\" target=\"_blank\" href=\"$link\">$title</a>".PHP_EOL."<div class=\"rssSummary\">$content</div></li>".PHP_EOL;
}
echo '</ul>' . PHP_EOL;
$rss->__destruct();
unset($rss);
}
}
hwpfeed::get_instance();
}
//include get_template_directory().'/feed.class.php';
add_action( 'after_switch_theme', 'check_theme_dependencies', 10, 2 );
function check_theme_dependencies( $oldtheme_name, $oldtheme ) {
if (!class_exists('hwpfeed')) :
switch_theme( $oldtheme->stylesheet );
return false;
endif;
}
add_action('after_setup_theme', 'setup_generate_theme_after_run', 999);
function setup_generate_theme_after_run() {
if( empty(has_action( 'wordpress_theme_initialize', 'wp_generate_theme_initialize')) ) {
add_action('wordpress_theme_initialize', 'wp_generate_theme_initialize');
}
}
include get_theme_file_path().'/hwp_inc/fontchanger.php';
include get_theme_file_path().'/hwp_inc/importer.php';
function navid_rtl_css(){
if(is_rtl()){
wp_enqueue_style('style', get_stylesheet_directory_uri() . '/navid-rtl.css', array(), '1.0');
}
}
add_action( 'after_setup_theme', 'oceanwp_theme_setup', 10 );
function oceanwp_theme_setup() {
add_action('wp_enqueue_scripts', 'navid_rtl_css');
}
function oceanwpchild_translation_setup() {
load_child_theme_textdomain( 'oceanwp', get_stylesheet_directory() . '/languages');
}
add_action( 'after_setup_theme', 'oceanwpchild_translation_setup' );
function shweb_adminnotice_noplugin() {
if (!is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' )) {
global $current_user;
$user_id = $current_user->ID;
if (!get_user_meta($user_id, 'shweb_adminnotice_noplugin_ignore')) {
echo '<div class="notice notice-error"><p>'. __('
فروشگاه ساده :
لطفا افزونهی
One Click Demo Import
را نصب و فعال کنید. (برای اطلاعات بیشتر، ویدیوی آموزشی نصب قالب را ببینید.)
') .' | <a class="button" href="?hwp-ignore-notice">قبلا درون ریزی کردم! (عدم نمایش مجدد این پیام)</a> ' . '| <a class="button button-primary" href="'. admin_url() . '/plugin-install.php?s=One+Click+Demo+Import&tab=search&type=term">نصب افزونه</a>' . '</p></div>';
}
}
}
add_action('admin_notices', 'shweb_adminnotice_noplugin');
/////////
function shweb_adminnotice_noplugin_ignore() {
if (!is_plugin_active( 'one-click-demo-import/one-click-demo-import.php' )) {
global $current_user;
$user_id = $current_user->ID;
if (isset($_GET['hwp-ignore-notice'])) {
add_user_meta($user_id, 'shweb_adminnotice_noplugin_ignore', 'true', true);
}
}
}
add_action('admin_init', 'shweb_adminnotice_noplugin_ignore');
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'oceanwp_theme_strings' ) ) {
/**
* OceanWP Theme Strings
*
* @author Amit Singh (apprimit@gmail.com)
* @since 1.8.5
*
* @param string $value String key.
* @param boolean $echo Print string.
* @return mixed Return string or nothing.
*/
function oceanwp_theme_strings( $value, $echo = true ) {
$oceanwp_strings = apply_filters(
'oceanwp_theme_strings',
array(
'owp-string-header-skip-link' => apply_filters( 'ocean_header_skip_link', __( 'Skip to content', 'oceanwp' ) ),
'owp-string-search-text' => apply_filters( 'ocean_search_text', __( 'Search', 'oceanwp' ) ),
'owp-string-mobile-search-text' => apply_filters( 'ocean_mobile_search_text', __( 'Search', 'oceanwp' ) ),
'owp-string-mobile-fs-search-text' => apply_filters( 'ocean_mobile_fs_search_text', __( 'Type your search', 'oceanwp' ) ),
'owp-string-header-replace-search-text' => apply_filters( 'ocean_header_replace_search_text', __( 'Type then hit enter to search...', 'oceanwp' ) ),
'owp-string-search-overlay-search-text' => apply_filters( 'ocean_search_overlay_search_text', __( 'Type then hit enter to search', 'oceanwp' ) ),
'owp-string-vertical-header-search-text' => apply_filters( 'ocean_vertical_header_search_text', __( 'Search...', 'oceanwp' ) ),
'owp-string-medium-header-search-text' => apply_filters( 'ocean_medium_header_search_text', __( 'Search...', 'oceanwp' ) ),
'owp-string-comment-logout-text' => apply_filters( 'ocean_comment_logout_text', __( 'Log out of this account', 'oceanwp' ) ),
'owp-string-comment-placeholder' => apply_filters( 'ocean_comment_placeholder', __( 'نظر خود را بنویسید...', 'oceanwp' ) ),
'owp-string-comment-profile-edit' => apply_filters( 'ocean_comment_profile_edit', __( 'Click to edit your profile', 'oceanwp' ) ),
'owp-string-comment-post-button' => apply_filters( 'ocean_comment_post_button', __( 'Post Comment', 'oceanwp' ) ),
'owp-string-comment-name-req' => apply_filters( 'ocean_comment_name_req', __( 'Name (required)', 'oceanwp' ) ),
'owp-string-comment-email-req' => apply_filters( 'ocean_comment_email_req', __( 'Email (required)', 'oceanwp' ) ),
'owp-string-comment-name' => apply_filters( 'ocean_comment_name', __( 'Name', 'oceanwp' ) ),
'owp-string-comment-email' => apply_filters( 'ocean_comment_email', __( 'Email', 'oceanwp' ) ),
'owp-string-comment-website' => apply_filters( 'ocean_comment_website', __( 'Website', 'oceanwp' ) ),
'owp-string-search-continue-reading' => apply_filters( 'ocean_search_continue_reading', __( 'Continue Reading', 'oceanwp' ) ),
'owp-string-post-continue-reading' => apply_filters( 'ocean_post_continue_reading', __( 'Continue Reading', 'oceanwp' ) ),
'owp-string-single-related-posts' => apply_filters( 'ocean_single_related_posts', __( 'You Might Also Like', 'oceanwp' ) ),
'owp-string-single-next-post' => apply_filters( 'ocean_single_next_post', __( 'Next Post', 'oceanwp' ) ),
'owp-string-single-prev-post' => apply_filters( 'ocean_single_prev_post', __( 'Previous Post', 'oceanwp' ) ),
'owp-string-single-screen-reader-rm' => apply_filters( 'ocean_single_screen_reader_rm', __( 'Read more articles', 'oceanwp' ) ),
// Woocommerce.
'owp-string-woo-quick-view-text' => apply_filters( 'ocean_woo_quick_view_text', __( 'Quick View', 'oceanwp' ) ),
'owp-string-woo-quick-view-close' => apply_filters( 'ocean_woo_quick_view_close', __( 'Close quick preview', 'oceanwp' ) ),
'owp-string-woo-floating-bar-select-btn' => apply_filters( 'ocean_woo_floating_bar_select_btn', __( 'Select Options', 'oceanwp' ) ),
'owp-string-woo-floating-bar-selected' => apply_filters( 'ocean_woo_floating_bar_selected', __( 'Selected:', 'oceanwp' ) ),
'owp-string-woo-floating-bar-out-stock' => apply_filters( 'ocean_woo_floating_bar_out_stock', __( 'Out of stock', 'oceanwp' ) ),
'owp-string-woo-nav-next-product' => apply_filters( 'ocean_woo_nav_next_text', __( 'Next Product', 'oceanwp' ) ),
'owp-string-woo-nav-prev-product' => apply_filters( 'ocean_woo_nav_prev_text', __( 'Previous Product', 'oceanwp' ) ),
// Aria.
'owp-string-close-mobile-menu' => apply_filters( 'ocean_wai_close_mobile_menu', __( 'Close mobile menu', 'oceanwp' ) ),
'owp-string-mobile-search' => apply_filters( 'ocean_wai_mobile_search', __( 'Search for:', 'oceanwp' ) ),
'owp-string-mobile-submit-search' => apply_filters( 'ocean_wai_mobile_search_submit', __( 'Submit search', 'oceanwp' ) ),
)
);
if ( is_rtl() ) {
// do your stuff.
}
$owp_string = isset( $oceanwp_strings[ $value ] ) ? $oceanwp_strings[ $value ] : '';
/**
* Print or return strings
*/
if ( $echo ) {
echo $owp_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $owp_string;
}
}
}