Esempio n. 1
0
    function td_cake_panel()
    {
        ?>
        <style type="text/css">
            .updated, .error {
                display: none !important;

            }

            .td-small-bottom {
                font-size: 12px;
                color:#686868;
                margin-top: 5px;
            }

            .td-manual-activation {
                display: none;
            }
        </style>

        <?php 
        $td_key = '';
        $td_server_id = '';
        $td_envato_code = '';
        if (!empty($_POST['td_active'])) {
            //is for activation?
            if (!empty($_POST['td_envato_code'])) {
                $td_envato_code = $_POST['td_envato_code'];
            }
            if (!empty($_POST['td_server_id'])) {
                $td_server_id = $_POST['td_server_id'];
            }
            if (!empty($_POST['td_key'])) {
                $td_key = $_POST['td_key'];
            }
            //manual activation
            if ($_POST['td_active'] == 'manual') {
                if ($this->td_cake_manual($td_server_id, $td_envato_code, $td_key) === true) {
                    td_util::update_option('envato_key', $td_envato_code);
                    td_util::update_option('td_cake_status', '2');
                    ?>
                    <script type="text/javascript">
                        alert('Thanks for activating the theme!');
                        window.location = "<?php 
                    echo admin_url();
                    ?>
";
                    </script>
                <?php 
                } else {
                    ?>
                    <script type="text/javascript">
                        alert('The code is invalid!');
                    </script>
                <?php 
                }
            } elseif ($_POST['td_active'] == 'auto') {
                if (TD_DEPLOY_MODE == 'dev') {
                    //auto activation
                    $td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
                } else {
                    //auto activation
                    $td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
                }
                if (is_wp_error($td_cake_response)) {
                    //error http
                    ?>
                    <script type="text/javascript">
                        alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
                    </script>
                <?php 
                } else {
                    if (isset($td_cake_response['response']['code']) and $td_cake_response['response']['code'] != '200') {
                        ?>
                        <script type="text/javascript">
                            alert('Error accessing our activation service. Please use the manual activation. Sorry about this. Server code: <?php 
                        echo $td_cake_response['response']['code'];
                        ?>
');
                        </script>
                    <?php 
                    }
                    if (!empty($td_cake_response['body'])) {
                        $api_response = @unserialize($td_cake_response['body']);
                        if (!empty($api_response['envato_is_valid']) and !empty($api_response['envato_is_valid_msg'])) {
                            if ($api_response['envato_is_valid'] == 'valid' or $api_response['envato_is_valid'] == 'td_fake_valid') {
                                td_util::update_option('envato_key', $td_envato_code);
                                td_util::update_option('td_cake_status', '2');
                                ?>
                                <script type="text/javascript">
                                    alert(<?php 
                                echo json_encode($api_response['envato_is_valid_msg']);
                                ?>
);
                                    window.location = "<?php 
                                echo admin_url();
                                ?>
";
                                </script>
                            <?php 
                            } else {
                                ?>
                                <script type="text/javascript">
                                    alert(<?php 
                                echo json_encode($api_response['envato_is_valid_msg']);
                                ?>
);
                                </script>
                            <?php 
                            }
                        } else {
                            ?>
                            <script type="text/javascript">
                                alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
                            </script>
                        <?php 
                        }
                    } else {
                        //empty body error
                    }
                }
            }
        }
        ?>

        <?php 
        require_once "wp-admin/panel/td_view_header.php";
        ?>


        <div class="about-wrap td-admin-wrap">
            <h1>Activate <?php 
        echo TD_THEME_NAME;
        ?>
</h1>
            <div class="about-text" style="margin-bottom: 32px;">
                <p>
                    Please activate <?php 
        echo TD_THEME_NAME;
        ?>
 to enjoy the full benefits of the theme. We're sorry about this extra step but we built the activation system to prevent
                    mass piracy of our themes, this allows us to better serve our paying customers.

                    <strong>Once activated</strong> you can easily register for support form the support tab.
                </p>
            </div>



            <form method="post" action="admin.php?page=td_cake_panel">
                <table class="form-table">
                    <tr valign="top">
                        <th scope="row">Envato purchase code:</th>
                        <td>
                            <input style="width: 400px" type="text" name="td_envato_code" value="<?php 
        echo $td_envato_code;
        ?>
" />
                            <br/>
                            <div class="td-small-bottom"><a href="http://forum.tagdiv.com/how-to-find-your-envato-purchase-code/" target="_blank">Where to find your purchase code ?</a></div>
                        </td>
                    </tr>



                </table>

                <input type="hidden" name="td_active" value="auto">
                <?php 
        submit_button('Activate theme');
        ?>

            </form>

            <br/><br/><br/><br/><br/>
            <h3>Manual activation</h3>
            <p>If the above activation method fails, <a href="#" class="td-manual-activation-btn">activate the theme manually</a></p>

            <div class="td-manual-activation">
                <ul>
                    <li>1. <a href="http://tagdiv.com/td_cake/manual.php" target="_blank">Go to our manual activation page</a></li>
                    <li>2. Paste your unique ID there and the <a href="http://forum.tagdiv.com/how-to-find-your-envato-purchase-code/" target="_blank">envato purchase code</a></li>
                    <li>3. <a href="http://forum.tagdiv.com/wp-content/uploads/2014/09/2014-09-09_1458.png" target="_blank">Get the activation code</a> and paste it in this form</li>
                </ul>

                <form method="post" action="admin.php?page=td_cake_panel">
                    <table class="form-table">

                        <tr valign="top">
                            <th scope="row">Your server ID:</th>
                            <td>
                                <input style="width: 400px" type="text" value="<?php 
        echo $this->td_cake_server_id();
        ?>
" />
                                <br/>
                                <div class="td-small-bottom">Copy this id and paste it in our manual activation page</div>
                            </td>

                        </tr>


                        <tr valign="top">
                            <th scope="row">Envato purchase code:</th>
                            <td><input style="width: 400px" type="text" name="td_envato_code" value="<?php 
        echo $td_envato_code;
        ?>
" /></td>
                        </tr>

                        <tr valign="top">
                            <th scope="row">tagDiv activation key:</th>
                            <td>
                                <input style="width: 400px" type="text" name="td_key" value="<?php 
        echo $td_key;
        ?>
" />
                                <br/>
                                <div class="td-small-bottom">You will get this id from the <a href="http://tagdiv.com/td_cake/manual.php" target="_blank">manual activation page</a></div>
                            </td>

                        </tr>

                        <input type="hidden" name="td_active" value="manual">
                        <input type="hidden" name="td_server_id" value="<?php 
        echo $this->td_cake_server_id();
        ?>
">

                    </table>

                    <?php 
        submit_button('Manual activate theme');
        ?>
                </form>
            </div>

        </div>



        <script type="text/javascript">
            jQuery('.td-manual-activation-btn').click(function(event){
                event.preventDefault();
                jQuery('.td-manual-activation').css('display', 'block');
                //alert('ra');
            });
        </script>
    <?php 
    }
Esempio n. 2
0
 function set_theme_copyright($text)
 {
     td_util::update_option('tds_footer_copyright', $text);
     $this->log("set_theme_copyright({$text})", "copyright text updated");
 }
echo td_panel_generator::box_start('Load an available translation', false);
?>

<div class="td-box-row">
    <div class="td-box-description td-box-full">
        <span class="td-box-title">MORE INFORMATION:</span>
        <p>Available translations: English, Dutch, Finnish, German, Greek, Hindi, Indonesian, Japanese, Marathi, Polish, Portuguese, Romanian, Russian, Spanish, Tamil, Thai, Turkish and Urdu. The rest are translated via google translate. Please note that the translations are loaded from our servers.</p>
        <p><strong style="margin-right: 2px">Note:</strong>English translation being the default translation of our theme, will set default values for your translate input fields.</p>
    </div>
</div>

<div class="td-box-row">
    <div class="td-box-description">
            <div class="td-box-control-full">
                <?php 
td_util::update_option('tds_language', '');
$languages[] = array('text' => 'Choose a language...', 'val' => '');
foreach (td_global::$translate_languages_list as $language_code => $language_name) {
    $languages[] = array('text' => $language_name, 'val' => $language_code);
}
echo td_panel_generator::dropdown(array('ds' => 'td_option', 'option_id' => 'tds_language', 'values' => $languages));
?>
            </div>
    </div>

    <a id="load_translation" class="td-big-button td-medium-button" href="">Load translation</a>

</div>

<?php 
echo td_panel_generator::box_end();
Esempio n. 4
0
function td_theme_migration()
{
    $td_db_version = td_util::get_option('td_version');
    // empty -> any version
    if (empty($td_db_version)) {
        // wp_parse_args format
        $args = array('post_type' => array('page', 'post'), 'numberposts' => '200', 'orderby' => 'post_date', 'order' => 'DESC', 'meta_query' => array('relation' => 'OR', array('key' => 'td_homepage_loop_filter'), array('key' => 'td_unique_articles'), array('key' => 'td_smart_list'), array('key' => 'td_review')), 'update_post_term_cache' => false);
        $recent_posts = wp_get_recent_posts($args);
        foreach ($recent_posts as $recent_post) {
            // page settings
            $update_td_homepage_loop = false;
            $td_homepage_loop = get_post_meta($recent_post['ID'], 'td_homepage_loop');
            $td_page = get_post_meta($recent_post['ID'], 'td_page');
            $td_homepage_loop_filter = get_post_meta($recent_post['ID'], 'td_homepage_loop_filter');
            $td_unique_articles = get_post_meta($recent_post['ID'], 'td_unique_articles');
            if (!empty($td_homepage_loop_filter) and is_array($td_homepage_loop_filter) and count($td_homepage_loop_filter) > 0) {
                foreach ($td_homepage_loop_filter[0] as $filter_key => $filter_value) {
                    $td_homepage_loop[0][$filter_key] = $filter_value;
                }
                $update_td_homepage_loop = true;
            }
            if (!empty($td_unique_articles) and is_array($td_unique_articles) and count($td_unique_articles) > 0) {
                foreach ($td_unique_articles[0] as $filter_key => $filter_value) {
                    $td_homepage_loop[0][$filter_key] = $filter_value;
                    $td_page[0][$filter_key] = $filter_value;
                }
                $update_td_homepage_loop = true;
            }
            if ($update_td_homepage_loop === true) {
                update_post_meta($recent_post['ID'], 'td_homepage_loop', $td_homepage_loop[0]);
                update_post_meta($recent_post['ID'], 'td_page', $td_page[0]);
            }
            // post settings
            $update_td_post_theme_settings = false;
            $td_post_theme_settings = get_post_meta($recent_post['ID'], 'td_post_theme_settings');
            $td_smart_list = get_post_meta($recent_post['ID'], 'td_smart_list');
            $td_review = get_post_meta($recent_post['ID'], 'td_review');
            if (!empty($td_review) and is_array($td_review) and count($td_review) > 0) {
                foreach ($td_review[0] as $filter_key => $filter_value) {
                    $td_post_theme_settings[0][$filter_key] = $filter_value;
                }
                $update_td_post_theme_settings = true;
            }
            if (!empty($td_smart_list) and is_array($td_smart_list) and count($td_smart_list) > 0) {
                foreach ($td_smart_list[0] as $filter_key => $filter_value) {
                    $td_post_theme_settings[0][$filter_key] = $filter_value;
                }
                $update_td_post_theme_settings = true;
            }
            if ($update_td_post_theme_settings === true) {
                update_post_meta($recent_post['ID'], 'td_post_theme_settings', $td_post_theme_settings[0]);
            }
            //delete_post_meta($recent_post['ID'], 'td_homepage_loop_filter');
            //delete_post_meta($recent_post['ID'], 'td_unique_articles');
            //delete_post_meta($recent_post['ID'], 'td_smart_list');
            //delete_post_meta($recent_post['ID'], 'td_review');
        }
        // the following delete operations must be done
        //delete_post_meta_by_key('td_homepage_loop_filter');
        //delete_post_meta_by_key('td_unique_articles');
        //delete_post_meta_by_key('td_smart_list');
        //delete_post_meta_by_key('td_review');
    }
    // update the database version
    if ($td_db_version != TD_THEME_VERSION) {
        td_util::update_option('td_version', TD_THEME_VERSION);
    }
}
Esempio n. 5
0
<div class="td-visible-tablet-portrait">
    <a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/rec200.png') . '" alt="" /></a>
</div>
<div class="td-visible-phone">
    <a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/rec300.png') . '" alt="" /></a>
</div>');
//social counter widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_social_counter_widget', array('custom_title' => 'STAY CONNECTED', 'facebook' => 'themeforest', 'twitter' => 'envato', 'youtube' => 'ChilloutLoungeMusic', 'open_in_new_window' => 'y', 'border_top' => 'no_border_top'));
//ad box widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_ad_box_widget', array('spot_id' => 'sidebar'));
//block 9 widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_9_widget', array('sort' => 'featured', 'custom_title' => 'EDITOR PICKS', 'limit' => '4', 'header_color' => '#f24b4b'));
//footer setup
$td_demo_site->set_footer($td_demo_site->get_demo_image('newsmag-footer.png'), $td_demo_site->get_demo_image('*****@*****.**'), 'Newsmag is your news, entertainment, music fashion website. We provide you with the latest breaking news and videos straight from the entertainment industry.', '*****@*****.**');
//sub-footer setup
td_util::update_option('tds_footer_copyright', 'Copyright 2014 - Newsmag by TagDiv');
// sub-footer copyright
//sub-footer menu
$td_demo_site->create_menu('Footer menu');
$td_demo_site->add_top_menu('Disclaimer');
$td_demo_site->add_top_menu('Privacy');
$td_demo_site->add_top_menu('Advertisement');
$td_demo_site->add_top_menu('Contact us');
$td_demo_site->activate_menu('footer-menu');
/*  ----------------------------------------------------------------------------
                            create categories

                            $td_demo_site->add_category has an array parameter
                            @param[0] : name of category
                            @param[1] : parent category
                         */
Esempio n. 6
0
 /**
  * remove the sidebars that begin with td_demo_
  */
 static function remove()
 {
     $tmp_sidebars = td_util::get_option('sidebars');
     if (!empty($tmp_sidebars)) {
         foreach ($tmp_sidebars as $index => $sidebar) {
             if (substr($sidebar, 0, 8) == 'td_demo_') {
                 unset($tmp_sidebars[$index]);
             }
         }
     }
     td_util::update_option('sidebars', $tmp_sidebars);
 }
Esempio n. 7
0
    function td_cake_panel()
    {
        ?>
        <style type="text/css">
            .updated, .error {
                display: none !important;

            }

            .td-small-bottom {
                font-size: 12px;
                color:#686868;
                margin-top: 5px;
            }

            .td-manual-activation {
                display: none;
            }
        </style>

        <?php 
        $td_key = '';
        $td_server_id = '';
        $td_envato_code = '';
        if (!empty($_POST['td_active'])) {
            //is for activation?
            if (!empty($_POST['td_envato_code'])) {
                $td_envato_code = $_POST['td_envato_code'];
            }
            if (!empty($_POST['td_server_id'])) {
                $td_server_id = $_POST['td_server_id'];
            }
            if (!empty($_POST['td_key'])) {
                $td_key = $_POST['td_key'];
            }
            //manual activation
            if ($_POST['td_active'] == 'manual') {
                if ($this->td_cake_manual($td_server_id, $td_envato_code, $td_key) === true) {
                    td_util::update_option('envato_key', $td_envato_code);
                    td_util::update_option('td_cake_status', '2');
                    ?>
                    <script type="text/javascript">
                        alert('Thanks for activating the theme!');
                        window.location = "<?php 
                    echo admin_url();
                    ?>
";
                    </script>
                <?php 
                } else {
                    ?>
                    <script type="text/javascript">
                        alert('The code is invalid!');
                    </script>
                <?php 
                }
            } elseif ($_POST['td_active'] == 'auto') {
                if (TD_DEPLOY_MODE == 'dev') {
                    //auto activation
                    $td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
                } else {
                    //auto activation
                    $td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
                }
                if (is_wp_error($td_cake_response)) {
                    //error http
                    ?>
                    <script type="text/javascript">
                        alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
                    </script>
                <?php 
                } else {
                    if (isset($td_cake_response['response']['code']) and $td_cake_response['response']['code'] != '200') {
                        ?>
                        <script type="text/javascript">
                            alert('Error accessing our activation service. Please use the manual activation. Sorry about this. Server code: <?php 
                        echo $td_cake_response['response']['code'];
                        ?>
');
                        </script>
                    <?php 
                    }
                    if (!empty($td_cake_response['body'])) {
                        $api_response = @unserialize($td_cake_response['body']);
                        if (!empty($api_response['envato_is_valid']) and !empty($api_response['envato_is_valid_msg'])) {
                            if ($api_response['envato_is_valid'] == 'valid' or $api_response['envato_is_valid'] == 'td_fake_valid') {
                                td_util::update_option('envato_key', $td_envato_code);
                                td_util::update_option('td_cake_status', '2');
                                ?>
                                <script type="text/javascript">
                                    alert(<?php 
                                echo json_encode($api_response['envato_is_valid_msg']);
                                ?>
);
                                    window.location = "<?php 
                                echo admin_url();
                                ?>
";
                                </script>
                            <?php 
                            } else {
                                ?>
                                <script type="text/javascript">
                                    alert(<?php 
                                echo json_encode($api_response['envato_is_valid_msg']);
                                ?>
);
                                </script>
                            <?php 
                            }
                        } else {
                            ?>
                            <script type="text/javascript">
                                alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
                            </script>
                        <?php 
                        }
                    } else {
                        //empty body error
                    }
                }
            }
        }
        ?>

        <?php 
        require_once "wp-admin/panel/td_view_header.php";
        ?>


        <div class="about-wrap td-admin-wrap">
            <h1>激活<?php 
        echo TD_THEME_NAME;
        ?>
</h1>
            <div class="about-text" style="margin-bottom: 32px;">
                <p>
                    请激活<?php 
        echo TD_THEME_NAME;
        ?>
享受主题全部好处。我们很抱歉这个额外的步骤,但我们建立了激活系统,以防止盗版我们的主题,这允许我们更好地服务于我们的付费用户。

                    <strong>一旦激活</strong> 你可以从支持选项卡轻松支持注册.
                </p>
            </div>



            <form method="post" action="admin.php?page=td_cake_panel">
                <table class="form-table">
                    <tr valign="top">
                        <th scope="row">Envato购买代码:</th>
                        <td>
                            <input style="width: 400px" type="text" name="td_envato_code" value="<?php 
        echo $td_envato_code;
        ?>
" />
                            <br/>
                            <div class="td-small-bottom"><a href="http://forum.tagdiv.com/how-to-find-your-envato-purchase-code/" target="_blank">在哪里找到购买代码?</a></div>
                        </td>
                    </tr>



                </table>

                <input type="hidden" name="td_active" value="auto">
                <?php 
        submit_button('激活主题');
        ?>

            </form>

            <br/><br/><br/><br/><br/>
            <h3>手动激活</h3>
            <p>如果上述激活方法失败, <a href="#" class="td-manual-activation-btn">手动激活主题</a></p>

            <div class="td-manual-activation">
                <ul>
                    <li>1. <a href="http://tagdiv.com/td_cake/manual.php" target="_blank">去我们的手动激活页面</a></li>
                    <li>2. 粘贴你的唯一ID和<a href="http://forum.tagdiv.com/how-to-find-your-envato-purchase-code/" target="_blank">envato购物代码</a></li>
                    <li>3. <a href="http://forum.tagdiv.com/wp-content/uploads/2014/09/2014-09-09_1458.png" target="_blank">获取激活代码</a>并粘贴到此表单</li>
                </ul>

                <form method="post" action="admin.php?page=td_cake_panel">
                    <table class="form-table">

                        <tr valign="top">
                            <th scope="row">您的服务ID:</th>
                            <td>
                                <input style="width: 400px" type="text" value="<?php 
        echo $this->td_cake_server_id();
        ?>
" />
                                <br/>
                                <div class="td-small-bottom">复制此ID并粘贴它到我们的拖动激活页面</div>
                            </td>

                        </tr>


                        <tr valign="top">
                            <th scope="row">Envato购买代码:</th>
                            <td><input style="width: 400px" type="text" name="td_envato_code" value="<?php 
        echo $td_envato_code;
        ?>
" /></td>
                        </tr>

                        <tr valign="top">
                            <th scope="row">tagDiv激活key:</th>
                            <td>
                                <input style="width: 400px" type="text" name="td_key" value="<?php 
        echo $td_key;
        ?>
" />
                                <br/>
                                <div class="td-small-bottom">你将获取此ID来自<a href="http://tagdiv.com/td_cake/manual.php" target="_blank">手动激活页面</a></div>
                            </td>

                        </tr>

                        <input type="hidden" name="td_active" value="manual">
                        <input type="hidden" name="td_server_id" value="<?php 
        echo $this->td_cake_server_id();
        ?>
">

                    </table>

                    <?php 
        submit_button('手动激活主题');
        ?>
                </form>
            </div>

        </div>



        <script type="text/javascript">
            jQuery('.td-manual-activation-btn').click(function(event){
                event.preventDefault();
                jQuery('.td-manual-activation').css('display', 'block');
                //alert('ra');
            });
        </script>
    <?php 
    }
Esempio n. 8
0
Stanford, CA 452 14 521


(650) 723-2558 (main number)

(650) 725-0247 (fax)


Email: contact@newspaper.com

[/td_text_with_title][/vc_column_inner][vc_column_inner width=\\"1/2\\"][td_social custom_title=\\"OUR SOCIAL PROFILES\\" icon_style=\\"1\\" icon_size=\\"32\\" dribbble=\\"http://www.tagdiv.com\\" facebook=\\"http://www.tagdiv.com\\" googleplus=\\"#\\" grooveshark=\\"http://www.tagdiv.com\\" linkedin=\\"#\\" twitter=\\"http://www.tagdiv.com\\" youtube=\\"http://www.tagdiv.com\\" el_position=\\"first\\"][td_text_with_title custom_title=\\"WORKING HOUR\\"]

The office is open from 8 a.m. to 5 p.m. Monday through Friday except university holidays.

[/td_text_with_title][/vc_column_inner][/vc_row_inner][contact-form-7 id=\\"1\\" title=\\"LEAVE US A MESSAGE\\"][/vc_column][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\" el_position=\\"first last\\"][/vc_column][/vc_row]', 'sidebar-right_28390' => array('name' => 'Sidebar right', 'template' => '[vc_row][vc_column width=\\"2/3\\"][/vc_column][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\"][/vc_column][/vc_row]'), 'sidebar-left_18719' => array('name' => 'Sidebar left', 'template' => '[vc_row][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\"][/vc_column][vc_column width=\\"2/3\\"][/vc_column][/vc_row]')));
    update_option('wpb_js_templates', $td_pagebuilder_templates);
    //update the wordpress default time format
    update_option('date_format', 'M j, Y');
    //echo get_option('date_format');
}
add_action("after_switch_theme", "td_on_theme_activate", 10, 2);
//update_option('wpb_js_templates',unserialize(''));
//td_on_theme_activate('', false);
//echo str_replace(array("\r\n","\r"),"",serialize(get_option('wpb_js_templates'))); ;
//print_r(get_option('wpb_js_templates'));
$td_isFirstInstall = td_util::get_option('firstInstall');
if (empty($td_isFirstInstall)) {
    wp_insert_term('Featured', 'category', array('description' => 'Featured posts', 'slug' => 'featured', 'parent' => 0));
    td_util::update_option('firstInstall', 'themeInstalled');
}
Esempio n. 9
0
$td_demo_site->add_top_menu('Products review');
$td_demo_site->add_top_menu('Custom 404');
$td_demo_site->add_top_menu('Contact us');
$td_demo_site->activate_menu('top-menu');
/*  ----------------------------------------------------------------------------
       logo + ad
    */
$td_demo_site->update_logo(get_template_directory_uri() . '/images/demo/logo-top.png', get_template_directory_uri() . '/images/demo/logo-top-retina.png');
$td_demo_site->add_ad_spot('demo top ad', '', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-468.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-468.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-728.jpg') . '" alt="" /></a>');
$td_demo_site->set_header_adspot('demo top ad');
/*  ----------------------------------------------------------------------------
       demo sidebar 1 //create custom sidebar in our theme option
    */
//this is the new list with sidebars
$import_unique_id_key = uniqid() . '_' . rand(1, 999999);
td_util::update_option('sidebars', array($import_unique_id_key => 'demo-1'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_social_widget', array('custom_title' => 'SOCIAL', 'facebook' => '#', 'youtube' => '#', 'github' => '#', 'google' => '#', 'googledrive' => '#', 'googlemaps' => '#', 'paypal' => '#'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_block2_widget', array('sort' => '', 'custom_title' => 'LATEST REVIEWS', 'limit' => '3'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_slide_widget', array('sort' => '', 'custom_title' => 'POPULAR VIDEO', 'limit' => '3'));
/*  ----------------------------------------------------------------------------
       default sidebar
    */
$td_demo_site->remove_widgets_from_sidebar('default');
//ad widget + adspot
$td_demo_site->add_ad_spot('demo sidebar ad', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-300.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-200.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-250.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-300.jpg') . '" alt="" /></a>');
$td_demo_site->add_widget_to_sidebar('default', 'td_ad_box_widget', array('spot_name' => 'Ad spot -- demo sidebar ad'));
$td_demo_site->add_widget_to_sidebar('default', 'td_block1_widget', array('sort' => '', 'custom_title' => 'RANDOM POSTS', 'limit' => '4', 'ajax_pagination' => "next_prev"));
/*  ----------------------------------------------------------------------------
       footer widgets
    */
$td_demo_site->remove_widgets_from_sidebar('footer-1');
Esempio n. 10
0
 /**
  * returns the html of a remote page or FALSE on error. This function also automatically logs HTTP request errors to td_log
  * @param $url - the remote url
  * @param string $caller_id - a string id to aid us with information about what component called this function. When we get the logs from our clients
  * the $caller_id will help us to know what component generated the failed http request and what method was used to request the data
  *
  * @return bool|string
  *          - string: the page html
  *          - bool FALSE: if the request failed
  */
 static function get_page($url, $caller_id = '')
 {
     $td_remote_http = td_util::get_option('td_remote_http');
     // see if we have a manual channel
     if (!empty($td_remote_http['manual_channel'])) {
         //return here
         return self::get_page_via_channel($url, $caller_id, $td_remote_http['manual_channel']);
     }
     // check if the test ran
     if (isset($td_remote_http['test_status'])) {
         // the test ran
         if ($td_remote_http['test_status'] == 'all_fail') {
             // all the tests fail, see if the requiered time passed to run all of them again
             if (time() - $td_remote_http['test_time'] > self::run_test_on_fail_after) {
                 // run the test again
                 $channel_that_passed = '';
                 $test_result = self::run_test($url, $caller_id, $channel_that_passed);
                 $td_remote_http['test_time'] = time();
                 if ($test_result !== false) {
                     $td_remote_http['test_status'] = $channel_that_passed;
                     td_util::update_option('td_remote_http', $td_remote_http);
                     // save new status
                     td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> time passed -> Test passed with channel: ' . $channel_that_passed, $url);
                     return $test_result;
                 } else {
                     // all tests failed
                     $td_remote_http['test_status'] = 'all_fail';
                     td_util::update_option('td_remote_http', $td_remote_http);
                     // save new status
                     td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> time passed -> all_fail again', $url);
                     return false;
                 }
             } else {
                 td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> waiting' . (time() - $td_remote_http['test_time']) . 's passed', $url);
                 return false;
                 // no working channels, and we have to wait more
             }
         } else {
             // we have a channel that passed in test_status
             // @todo here we can count the number of fails and run the test again
             td_log::log_info(__FILE__, __FUNCTION__, 'we have a channel that passed in test_status: ' . $td_remote_http['test_status'], $url);
             return self::get_page_via_channel($url, $caller_id, $td_remote_http['test_status']);
         }
     } else {
         // the test was not run
         $channel_that_passed = '';
         $test_result = self::run_test($url, $caller_id, $channel_that_passed);
         $td_remote_http['test_time'] = time();
         if ($test_result !== false) {
             $td_remote_http['test_status'] = $channel_that_passed;
             td_util::update_option('td_remote_http', $td_remote_http);
             //save
             td_log::log_info(__FILE__, __FUNCTION__, 'first run -> test passed with channel: ' . $channel_that_passed, $url);
             return $test_result;
         } else {
             // all tests failed
             $td_remote_http['test_status'] = 'all_fail';
             td_util::update_option('td_remote_http', $td_remote_http);
             //save
             td_log::log_info(__FILE__, __FUNCTION__, 'first run -> all failed', $url);
             return false;
         }
     }
 }