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


PHP checkcount函数代码示例

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


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

示例1: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     checkcount();
     $checks = array('[ \\t\\/*#]@version' => '@version');
     foreach ($php_files as $php_key => $phpfile) {
         // leave out functions.php as this is a special case
         if (tc_filename($php_key) == 'functions.php') {
             continue;
         }
         foreach ($checks as $key => $check) {
             // We don't need to write to the file, so just open for reading.
             // This is needed, because comments are stripped out in the main plugin
             $fp = fopen($php_key, 'r');
             // Pull only the first 8kiB of the file in.
             $file_data = fread($fp, 8192);
             // PHP will close file handle, but we are good citizens. :)
             fclose($fp);
             // Make sure we catch CR-only line endings.
             $file_data = str_replace("\r", "\n", $file_data);
             if (!preg_match('/' . $key . '/i', $file_data, $matches)) {
                 //$filename = tc_filename( $php_key );
                 $filename = self::tc_templatepath($php_key);
                 // Point out the missing line.
                 $error_msg = sprintf(__('%1$s is missing in the file %2$s.', 'theme-check'), '<strong>' . $check . '</strong>', '<strong>' . $filename . '</strong>');
                 // Add the finalized error message.
                 $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . $error_msg;
             }
         }
     }
     return $ret;
 }
开发者ID:Zodiac1978,项目名称:theme-check,代码行数:32,代码来源:version.php

示例2: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     //check for levels deprecated in 2.0 in creating menus.
     $checks = array('/([^_](add_(admin|submenu|menu|dashboard|posts|media|links|pages|comments|theme|plugins|users|management|options)_page)\\s?\\([^,]*,[^,]*,\\s[\'|"]?(level_[0-9]|[0-9])[^;|\\r|\\r\\n]*)/' => __('User levels were deprecated in <strong>2.0</strong>. Please see <a href="https://codex.wordpress.org/Roles_and_Capabilities">Roles_and_Capabilities</a>', 'theme-check'), '/[^a-z0-9](current_user_can\\s?\\(\\s?[\'\\"]level_[0-9][\'\\"]\\s?\\))[^\\r|\\r\\n]*/' => __('User levels were deprecated in <strong>2.0</strong>. Please see <a href="https://codex.wordpress.org/Roles_and_Capabilities">Roles_and_Capabilities</a>', 'theme-check'));
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $key => $check) {
             checkcount();
             if (preg_match($key, $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $grep = isset($matches[2]) ? tc_grep($matches[2], $php_key) : tc_grep($matches[1], $php_key);
                 $this->error[] = sprintf('<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: <strong>%1$s</strong>. %2$s%3$s', $filename, $check, $grep);
                 $ret = false;
             }
         }
     }
     //check for add_admin_page
     $checks = array('/([^_]add_(admin|submenu|menu|dashboard|posts|media|links|pages|comments|plugins|users|management|options)_page)/' => __('Themes should use <strong>add_theme_page()</strong> for adding admin pages.', 'theme-check'));
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $key => $check) {
             checkcount();
             if (preg_match($key, $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(rtrim($matches[0], '('));
                 $grep = tc_grep($error, $php_key);
                 $this->error[] = sprintf('<span class="tc-lead tc-required">' . __('REQUIRED', 'theme-check') . '</span>: <strong>%1$s</strong>. %2$s%3$s', $filename, $check, $grep);
                 $ret = false;
             }
         }
     }
     return $ret;
 }
开发者ID:noplanman,项目名称:theme-check,代码行数:32,代码来源:admin_menu.php

示例3: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $filenames = array();
     foreach ($other_files as $other_key => $otherfile) {
         array_push($filenames, strtolower(basename($other_key)));
     }
     checkcount();
     if (in_array('screenshot.png', $filenames) || in_array('screenshot.jpg', $filenames)) {
         foreach ($other_files as $other_key => $otherfile) {
             if ((basename($other_key) === 'screenshot.png' || basename($other_key) === 'screenshot.jpg') && preg_match('/.*themes\\/[^\\/]*\\/screenshot\\.(png|jpg)/', $other_key)) {
                 // we have or screenshot!
                 $image = getimagesize($other_key);
                 if ($image[0] > 1200 || $image[1] > 900) {
                     $this->error[] = sprintf('<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . __('Screenshot is wrong size! Detected: <strong>%1$sx%2$spx</strong>. Maximum allowed size is 1200x800px.', 'theme-check'), $image[0], $image[1]);
                 }
                 if ($image[1] / $image[0] != 0.75) {
                     $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . __('Screenshot dimensions are wrong! Ratio of width to height should be 4:3.', 'theme-check');
                 }
                 if ($image[0] != 1200 || $image[1] != 900) {
                     $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . __('Screenshot size should be 880x660, to account for HiDPI displays. Any 4:3 image size is acceptable, but 1200x900 is preferred.', 'theme-check');
                 }
             }
         }
     } else {
         $this->error[] = '<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: ' . __('No screenshot detected! Please include a screenshot.png or screenshot.jpg.', 'theme-check');
         $ret = false;
     }
     return $ret;
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:30,代码来源:screenshot.php

示例4: check

 function check($php_files, $css_files, $other_files)
 {
     $grep = '';
     $ret = true;
     $checks = array(array('preview_theme' => '', '4.3'), array('_preview_theme_template_filter' => '', '4.3'), array('_preview_theme_stylesheet_filter' => '', '4.3'), array('preview_theme_ob_filter' => '', '4.3'), array('preview_theme_ob_filter_callback' => '', '4.3'), array('wp_richedit_pre' => '', '4.3'), array('wp_htmledit_pre' => '', '4.3'), array('wp_ajax_wp_fullscreen_save_post' => '', '4.3'), array('post_permalink' => 'get_permalink', '4.4'), array('wp_get_http' => 'WP_Http', '4.4'), array('force_ssl_login' => 'force_ssl_admin', '4.4'), array('create_empty_blog' => '', '4.4'), array('get_admin_users_for_domain' => '', '4.4'), array('flush_widget_cache' => '', '4.4'));
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $alt => $check) {
             checkcount();
             $version = $check;
             $key = key($check);
             $alt = $check[$key];
             if (preg_match('/[\\s?]' . $key . '\\(/', $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(rtrim($matches[0], '('));
                 $version = $check[0];
                 $grep = tc_grep($error, $php_key);
                 // Point out the deprecated function.
                 $error_msg = sprintf(__('%1$s found in the file %2$s. Deprecated since version %3$s.', 'theme-check'), '<strong>' . $error . '()</strong>', '<strong>' . $filename . '</strong>', '<strong>' . $version . '</strong>');
                 // Add alternative function when available.
                 if ($alt) {
                     $error_msg .= ' ' . sprintf(__('Use %s instead.', 'theme-check'), '<strong>' . $alt . '</strong>');
                 }
                 // Add the precise code match that was found.
                 $error_msg .= $grep;
                 // Add the finalized error message.
                 $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . $error_msg;
             }
         }
     }
     return $ret;
 }
开发者ID:zoran180,项目名称:natashazindrou,代码行数:31,代码来源:dep_recommend.php

示例5: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $found = false;
     foreach ($php_files as $name => $file) {
         checkcount();
         if (strpos($name, '.git') !== false || strpos($name, '.svn') !== false) {
             $found = true;
         }
     }
     foreach ($css_files as $name => $file) {
         checkcount();
         if (strpos($name, '.git') !== false || strpos($name, '.svn') !== false || strpos($name, '.hg') !== false || strpos($name, '.bzr') !== false) {
             $found = true;
         }
     }
     foreach ($other_files as $name => $file) {
         checkcount();
         if (strpos($name, '.git') !== false || strpos($name, '.svn') !== false || strpos($name, '.hg') !== false || strpos($name, '.bzr') !== false) {
             $found = true;
         }
     }
     if ($found) {
         $this->error[] = sprintf('<span class="tc-lead tc-required">' . __('REQUIRED', 'theme-check') . '</span>: ' . __('Please remove any extraneous directories like .git or .svn from the ZIP file before uploading it.', 'theme-check'));
         $ret = false;
     }
     return $ret;
 }
开发者ID:zoran180,项目名称:natashazindrou,代码行数:28,代码来源:directories.php

示例6: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $filenames = array();
     foreach ($other_files as $other_key => $otherfile) {
         array_push($filenames, strtolower(basename($other_key)));
     }
     checkcount();
     if (in_array('screenshot.png', $filenames)) {
         foreach ($other_files as $other_key => $otherfile) {
             if (basename($other_key) === 'screenshot.png' && preg_match('/.*themes\\/[^\\/]*\\/screenshot\\.png/', $other_key)) {
                 // we have or screenshot!
                 $image = getimagesize($other_key);
                 if ($image[0] > 640 || $image[1] > 480) {
                     $this->error[] = sprintf(__('<span class="tc-lead tc-recommended">RECOMMENDED</span>: Screenshot is wrong size! Detected: <strong>%1$sx%2$spx</strong>. Maximum allowed size is 640x480px.', 'themecheck'), $image[0], $image[1]);
                 }
                 if ($image[1] / $image[0] != 0.75) {
                     $this->error[] = __('<span class="tc-lead tc-recommended">RECOMMENDED</span>: Screenshot dimensions are wrong! Ratio of width to height should be 4:3.', 'themecheck');
                 }
                 if ($image[0] != 600 || $image[1] != 450) {
                     $this->error[] = __('<span class="tc-lead tc-recommended">RECOMMENDED</span>: Screenshot size should be 600x450, to account for HiDPI displays. Any 4:3 image size is acceptable, but 600x450 is preferred.', 'themecheck');
                 }
             }
         }
     } else {
         $this->error[] = __("<span class='tc-lead tc-warning'>WARNING</span>: No screenshot detected! Please include a screenshot.png.", "themecheck");
         $ret = false;
     }
     return $ret;
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:30,代码来源:screenshot.php

示例7: check

 function check($php_files, $css_files, $other_files)
 {
     $grep = '';
     $ret = true;
     $checks = array(array('rich_edit_exists' => '', '3.9'), array('default_topic_count_text' => '', '3.9'), array('format_to_post' => '', '3.9'), array('get_current_site_name' => 'get_current_site()', '3.9'), array('wpmu_current_site' => '', '3.9'), array('get_all_category_ids' => 'get_terms()', '4.0'), array('like_escape' => 'wpdb::esc_like()', '4.0'), array('url_is_accessable_via_ssl' => '', '4.0'));
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $alt => $check) {
             checkcount();
             $version = $check;
             $key = key($check);
             $alt = $check[$key];
             if (preg_match('/[\\s?]' . $key . '\\(/', $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(rtrim($matches[0], '('));
                 $version = $check[0];
                 $grep = tc_grep($error, $php_key);
                 // Point out the deprecated function.
                 $error_msg = sprintf(__('%1$s found in the file %2$s. Deprecated since version %3$s.', 'theme-check'), '<strong>' . $error . '()</strong>', '<strong>' . $filename . '</strong>', '<strong>' . $version . '</strong>');
                 // Add alternative function when available.
                 if ($alt) {
                     $error_msg .= ' ' . sprintf(__('Use %s instead.', 'theme-check'), '<strong>' . $alt . '</strong>');
                 }
                 // Add the precise code match that was found.
                 $error_msg .= $grep;
                 // Add the finalized error message.
                 $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . $error_msg;
             }
         }
     }
     return $ret;
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:31,代码来源:dep_recommend.php

示例8: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $check = AvadaRedux_ThemeCheck::get_instance();
     $avadaredux = $check::get_avadaredux_details($php_files);
     if ($avadaredux) {
         $blacklist = array('.tx' => __('AvadaRedux localization utilities', 'themecheck'), 'bin' => __('AvadaRedux Resting Diles', 'themecheck'), 'codestyles' => __('AvadaRedux Code Styles', 'themecheck'), 'tests' => __('AvadaRedux Unit Testing', 'themecheck'), 'class.avadaredux-plugin.php' => __('AvadaRedux Plugin File', 'themecheck'), 'bootstrap_tests.php' => __('AvadaRedux Boostrap Tests', 'themecheck'), '.travis.yml' => __('CI Testing FIle', 'themecheck'), 'phpunit.xml' => __('PHP Unit Testing', 'themecheck'));
         $errors = array();
         foreach ($blacklist as $file => $reason) {
             checkcount();
             if (file_exists($avadaredux['parent_dir'] . $file)) {
                 $errors[$avadaredux['parent_dir'] . $file] = $reason;
             }
         }
         if (!empty($errors)) {
             $error = '<span class="tc-lead tc-required">REQUIRED</span> ' . __('It appears that you have embedded the full AvadaRedux package inside your theme. You need only embed the <strong>AvadaReduxCore</strong> folder. Embedding anything else will get your rejected from theme submission. Suspected AvadaRedux package file(s):', 'avadaredux-framework');
             $error .= '<ol>';
             foreach ($errors as $key => $e) {
                 $error .= '<li><strong>' . $e . '</strong>: ' . $key . '</li>';
             }
             $error .= '</ol>';
             $this->error[] = '<div class="avadaredux-error">' . $error . '</div>';
             $ret = false;
         }
     }
     return $ret;
 }
开发者ID:pedrom40,项目名称:sazoo.org,代码行数:27,代码来源:full_package.php

示例9: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     checkcount();
     /**
      * Check whether every Customizer setting has a sanitization callback set.
      */
     foreach ($php_files as $file_path => $file_content) {
         // Get the arguments passed to the add_setting method
         if (preg_match_all('/\\$wp_customize->add_setting\\(([^;]+)/', $file_content, $matches)) {
             // The full match is in [0], the match group in [1]
             foreach ($matches[1] as $match) {
                 // Check if we have sanitize_callback or sanitize_js_callback
                 if (false === strpos($match, 'sanitize_callback') && false === strpos($match, 'sanitize_js_callback')) {
                     $this->error[] = '<span class="tc-lead tc-required">' . __('REQUIRED', 'theme-check') . '</span>: ' . __('Found a Customizer setting that did not have a sanitization callback function. Every call to the <strong>add_setting()</strong> method needs to have a sanitization callback function passed.', 'theme-check');
                     $ret = false;
                 } else {
                     // There's a callback, check that no empty parameter is passed.
                     if (preg_match('/[\'"](?:sanitize_callback|sanitize_js_callback)[\'"]\\s*=>\\s*[\'"]\\s*[\'"]/', $match)) {
                         $this->error[] = '<span class="tc-lead tc-required">' . __('REQUIRED', 'theme-check') . '</span>: ' . __('Found a Customizer setting that had an empty value passed as sanitization callback. You need to pass a function name as sanitization callback.', 'theme-check');
                         $ret = false;
                     }
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:jesusone,项目名称:wp_astro,代码行数:28,代码来源:customizer.php

示例10: check

 function check($php_files, $css_files, $other_files)
 {
     checkcount();
     $ret = true;
     $filenames = array();
     foreach ($css_files as $cssfile => $content) {
         if (basename($cssfile) === 'style.css') {
             $data = get_theme_data_from_contents($content);
         }
     }
     if (!$data['Tags']) {
         $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . __('<strong>Tags:</strong> is either empty or missing in style.css header.', 'theme-check');
         return $ret;
     }
     $deprecated_tags = array("flexible-width", "fixed-width", "black", "blue", "brown", "gray", "green", "orange", "pink", "purple", "red", "silver", "tan", "white", "yellow", "dark", "light", "fixed-layout", "fluid-layout", "responsive-layout", "blavatar", "holiday", "photoblogging", "seasonal");
     $allowed_tags = array('grid-layout', "one-column", "two-columns", "three-columns", "four-columns", "left-sidebar", "right-sidebar", "flexible-header", 'footer-widgets', "accessibility-ready", "buddypress", "custom-background", "custom-colors", "custom-header", "custom-menu", "custom-logo", "editor-style", "featured-image-header", "featured-images", "front-page-post-form", "full-width-template", "microformats", "post-formats", "rtl-language-support", "sticky-post", "theme-options", "threaded-comments", "translation-ready", 'blog', 'e-commerce', 'education', 'entertainment', 'food-and-drink', 'holiday', 'news', 'photography', 'portfolio');
     foreach ($data['Tags'] as $tag) {
         if (strpos(strtolower($tag), "accessibility-ready") !== false) {
             $this->error[] = '<span class="tc-lead tc-info">' . __('INFO', 'theme-check') . '</span>: ' . __('Themes that use the tag accessibility-ready will need to undergo an accessibility review.', 'theme-check') . ' ' . __('See <a href="https://make.wordpress.org/themes/handbook/review/accessibility/">https://make.wordpress.org/themes/handbook/review/accessibility/</a>', 'theme-check');
         }
         if (!in_array(strtolower($tag), $allowed_tags)) {
             if (in_array(strtolower($tag), $deprecated_tags)) {
                 $this->error[] = '<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: ' . sprintf(__('The tag %s has been deprecated, please remove it from your style.css header.', 'theme-check'), '<strong>' . $tag . '</strong>');
             } else {
                 $this->error[] = '<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: ' . sprintf(__('Found wrong tag, remove %s from your style.css header.', 'theme-check'), '<strong>' . $tag . '</strong>');
                 $ret = false;
             }
         }
     }
     return $ret;
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:31,代码来源:style_tags.php

示例11: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     // combine all the php files into one string to make it easier to search
     $php = implode(' ', $php_files);
     checkcount();
     // no widgets registered or used...
     if (strpos($php, 'register_sidebar') === false && strpos($php, 'dynamic_sidebar') === false) {
         $this->error[] = "<span class='tc-lead tc-recommended'>" . __("RECOMMENDED", 'theme-check') . '</span>: ' . __("This theme contains no sidebars/widget areas. See <a href='https://codex.wordpress.org/Widgets_API'>Widgets API</a>", "theme-check");
         $ret = true;
     }
     if (strpos($php, 'register_sidebar') !== false && strpos($php, 'dynamic_sidebar') === false) {
         $this->error[] = "<span class='tc-lead tc-required'>" . __("REQUIRED", 'theme-check') . '</span>: ' . __("The theme appears to use <strong>register_sidebar()</strong> but no <strong>dynamic_sidebar()</strong> was found. See: <a href='https://codex.wordpress.org/Function_Reference/dynamic_sidebar'>dynamic_sidebar</a><pre> &lt;?php dynamic_sidebar( \$index ); ?&gt;</pre>", "theme-check");
         $ret = false;
     }
     if (strpos($php, 'register_sidebar') === false && strpos($php, 'dynamic_sidebar') !== false) {
         $this->error[] = "<span class='tc-lead tc-required'>" . __("REQUIRED", 'theme-check') . '</span>: ' . __("The theme appears to use <strong>dynamic_sidebars()</strong> but no <strong>register_sidebar()</strong> was found. See: <a href='https://codex.wordpress.org/Function_Reference/register_sidebar'>register_sidebar</a><pre> &lt;?php register_sidebar( \$args ); ?&gt;</pre>", "theme-check");
         $ret = false;
     }
     /**
      * There are widgets registered, is the widgets_init action present?
      */
     if (strpos($php, 'register_sidebar') !== false && preg_match('/add_action\\(\\s*("|\')widgets_init("|\')\\s*,/', $php) == false) {
         $this->error[] = "<span class='tc-lead tc-required'>" . __("REQUIRED", 'theme-check') . '</span>: ' . sprintf(__("Sidebars need to be registered in a custom function hooked to the <strong>widgets_init</strong> action. See: %s.", "theme-check"), '<a href="https://codex.wordpress.org/Function_Reference/register_sidebar">register_sidebar()</a>');
         $ret = false;
     }
     return $ret;
 }
开发者ID:lenguyenitc,项目名称:donations,代码行数:28,代码来源:widgets.php

示例12: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $check = Redux_ThemeCheck::get_instance();
     $redux = $check::get_redux_details($php_files);
     if ($redux) {
         if (!isset($_POST['redux_wporg'])) {
             checkcount();
             $this->error[] = '<div class="redux-error">' . sprintf(__('<span class="tc-lead tc-recommended">RECOMMENDED</span>: If you are submitting to WordPress.org Theme Repository, it is <strong>strongly</strong> suggested that you read <a href="%1" target="_blank">this document</a>, or your theme will be rejected because of Redux.', 'redux-framework'), 'https://docs.reduxframework.com/core/wordpress-org-submissions/') . '</div>';
             $ret = false;
         } else {
             // TODO Granular WP.org tests!!!
             // Check for Tracking
             checkcount();
             $tracking = $redux['dir'] . 'inc/tracking.php';
             if (file_exists($tracking)) {
                 $this->error[] = '<div class="redux-error">' . sprintf(__('<span class="tc-lead tc-required">REQUIRED</span>: You MUST delete <strong> %s </strong>, or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework'), $tracking) . '</div>';
                 $ret = false;
             }
             // Embedded CDN package
             //use_cdn
             // Arguments
             checkcount();
             $args = '<ol>';
             $args .= "<li><code>'save_defaults' => false</code></li>";
             $args .= "<li><code>'use_cdn' => false</code></li>";
             $args .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
             $args .= "<li><code>'database' => 'theme_mods'</code> (" . __('Optional', 'redux-framework') . ")</li>";
             $args .= '</ol>';
             $this->error[] = '<div class="redux-error">' . __('<span class="tc-lead tc-recommended">RECOMMENDED</span>: The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework') . $args . '</div>';
         }
     }
     return $ret;
 }
开发者ID:mauricioabisay,项目名称:loc,代码行数:34,代码来源:embedded.php

示例13: check

 function check($php_files, $css_files, $other_files)
 {
     $grep = '';
     $ret = true;
     $checks = array(array('get_postdata' => 'get_post()', '1.5.1'), array('start_wp' => 'the Loop', '1.5'), array('the_category_id' => 'get_the_category()', '0.71'), array('the_category_head' => 'get_the_category_by_ID()', '0.71'), array('previous_post' => 'previous_post_link()', '2.0'), array('next_post' => 'next_post_link()', '2.0'), array('user_can_create_post' => 'current_user_can()', '2.0'), array('user_can_create_draft' => 'current_user_can()', '2.0'), array('user_can_edit_post' => 'current_user_can()', '2.0'), array('user_can_delete_post' => 'current_user_can()', '2.0'), array('user_can_set_post_date' => 'current_user_can()', '2.0'), array('user_can_edit_post_comments' => 'current_user_can()', '2.0'), array('user_can_delete_post_comments' => 'current_user_can()', '2.0'), array('user_can_edit_user' => 'current_user_can()', '2.0'), array('get_linksbyname' => 'get_bookmarks()', '2.1'), array('wp_get_linksbyname' => 'wp_list_bookmarks()', '2.1'), array('get_linkobjectsbyname' => 'get_bookmarks()', '2.1'), array('get_linkobjects' => 'get_bookmarks()', '2.1'), array('get_linksbyname_withrating' => 'get_bookmarks()', '2.1'), array('get_links_withrating' => 'get_bookmarks()', '2.1'), array('get_autotoggle' => '', '2.1'), array('list_cats' => 'wp_list_categories', '2.1'), array('wp_list_cats' => 'wp_list_categories', '2.1'), array('dropdown_cats' => 'wp_dropdown_categories()', '2.1'), array('list_authors' => 'wp_list_authors()', '2.1'), array('wp_get_post_cats' => 'wp_get_post_categories()', '2.1'), array('wp_set_post_cats' => 'wp_set_post_categories()', '2.1'), array('get_archives' => 'wp_get_archives', '2.1'), array('get_author_link' => 'get_author_posts_url()', '2.1'), array('link_pages' => 'wp_link_pages()', '2.1'), array('get_settings' => 'get_option()', '2.1'), array('permalink_link' => 'the_permalink()', '1.2'), array('permalink_single_rss' => 'permalink_rss()', '2.3'), array('wp_get_links' => 'wp_list_bookmarks()', '2.1'), array('get_links' => 'get_bookmarks()', '2.1'), array('get_links_list' => 'wp_list_bookmarks()', '2.1'), array('links_popup_script' => '', '2.1'), array('get_linkrating' => 'sanitize_bookmark_field()', '2.1'), array('get_linkcatname' => 'get_category()', '2.1'), array('comments_rss_link' => 'post_comments_feed_link()', '2.5'), array('get_category_rss_link' => 'get_category_feed_link()' . '2.5'), array('get_author_rss_link' => 'get_author_feed_link()', '2.5'), array('comments_rss' => 'get_post_comments_feed_link()', '2.2'), array('create_user' => 'wp_create_user()', '2.0'), array('gzip_compression' => '', '2.5'), array('get_commentdata' => 'get_comment()', '2.7'), array('get_catname' => 'get_cat_name()', '2.8'), array('get_category_children' => 'get_term_children', '2.8'), array('get_the_author_description' => 'get_the_author_meta(\'description\')', '2.8'), array('the_author_description' => 'the_author_meta(\'description\')', '2.8'), array('get_the_author_login' => 'the_author_meta(\'login\')', '2.8'), array('get_the_author_firstname' => 'get_the_author_meta(\'first_name\')', '2.8'), array('the_author_firstname' => 'the_author_meta(\'first_name\')', '2.8'), array('get_the_author_lastname' => 'get_the_author_meta(\'last_name\')', '2.8'), array('the_author_lastname' => 'the_author_meta(\'last_name\')', '2.8'), array('get_the_author_nickname' => 'get_the_author_meta(\'nickname\')', '2.8'), array('the_author_nickname' => 'the_author_meta(\'nickname\')', '2.8'), array('get_the_author_email' => 'get_the_author_meta(\'email\')', '2.8'), array('the_author_email' => 'the_author_meta(\'email\')', '2.8'), array('get_the_author_icq' => 'get_the_author_meta(\'icq\')', '2.8'), array('the_author_icq' => 'the_author_meta(\'icq\')', '2.8'), array('get_the_author_yim' => 'get_the_author_meta(\'yim\')', '2.8'), array('the_author_yim' => 'the_author_meta(\'yim\')', '2.8'), array('get_the_author_msn' => 'get_the_author_meta(\'msn\')', '2.8'), array('the_author_msn' => 'the_author_meta(\'msn\')', '2.8'), array('get_the_author_aim' => 'get_the_author_meta(\'aim\')', '2.8'), array('the_author_aim' => 'the_author_meta(\'aim\')', '2.8'), array('get_author_name' => 'get_the_author_meta(\'display_name\')', '2.8'), array('get_the_author_url' => 'get_the_author_meta(\'url\')', '2.8'), array('the_author_url' => 'the_author_meta(\'url\')', '2.8'), array('get_the_author_ID' => 'get_the_author_meta(\'ID\')', '2.8'), array('the_author_ID' => 'the_author_meta(\'ID\')', '2.8'), array('the_content_rss' => 'the_content_feed()', '2.9'), array('make_url_footnote' => '', '2.9'), array('_c' => '_x()', '2.9'), array('translate_with_context' => '_x()', '3.0'), array('nc' => 'nx()', '3.0'), array('__ngettext' => '_n_noop()', '2.8'), array('__ngettext_noop' => '_n_noop()', '2.8'), array('get_alloptions' => 'wp_load_alloptions()', '3.0'), array('get_the_attachment_link' => 'wp_get_attachment_link()', '2.5'), array('get_attachment_icon_src' => 'wp_get_attachment_image_src()', '2.5'), array('get_attachment_icon' => 'wp_get_attachment_image()', '2.5'), array('get_attachment_innerhtml' => 'wp_get_attachment_image()', '2.5'), array('get_link' => 'get_bookmark()', '2.1'), array('sanitize_url' => 'esc_url()', '2.8'), array('clean_url' => 'esc_url()', '3.0'), array('js_escape' => 'esc_js()', '2.8'), array('wp_specialchars' => 'esc_html()', '2.8'), array('attribute_escape' => 'esc_attr()', '2.8'), array('register_sidebar_widget' => 'wp_register_sidebar_widget()', '2.8'), array('unregister_sidebar_widget' => 'wp_unregister_sidebar_widget()', '2.8'), array('register_widget_control' => 'wp_register_widget_control()', '2.8'), array('unregister_widget_control' => 'wp_unregister_widget_control()', '2.8'), array('delete_usermeta' => 'delete_user_meta()', '3.0'), array('get_usermeta' => 'get_user_meta()', '3.0'), array('update_usermeta' => 'update_user_meta()', '3.0'), array('automatic_feed_links' => 'add_theme_support( \'automatic-feed-links\' )', '3.0'), array('get_profile' => 'get_the_author_meta()', '3.0'), array('get_usernumposts' => 'count_user_posts()', '3.0'), array('funky_javascript_callback' => '', '3.0'), array('funky_javascript_fix' => '', '3.0'), array('is_taxonomy' => 'taxonomy_exists()', '3.0'), array('is_term' => 'term_exists()', '3.0'), array('is_plugin_page' => '$plugin_page and/or get_plugin_page_hookname() hooks', '3.1'), array('update_category_cache' => 'No alternatives', '3.1'), array('get_users_of_blog' => 'get_users()', '3.1'), array('wp_timezone_supported' => '', '3.2'), array('the_editor' => 'wp_editor', '3.3'), array('get_user_metavalues' => '', '3.3'), array('sanitize_user_object' => '', '3.3'), array('get_boundary_post_rel_link' => '', '3.3'), array('start_post_rel_link' => 'none available ', '3.3'), array('get_index_rel_link' => '', '3.3'), array('index_rel_link' => '', '3.3'), array('get_parent_post_rel_link' => '', '3.3'), array('parent_post_rel_link' => '', '3.3'), array('wp_admin_bar_dashboard_view_site_menu' => '', '3.3'), array('is_blog_user' => 'is_member_of_blog()', '3.3'), array('debug_fopen' => 'error_log()', '3.3'), array('debug_fwrite' => 'error_log()', '3.3'), array('debug_fclose' => 'error_log()', '3.3'), array('get_themes' => 'wp_get_themes()', '3.4'), array('get_theme' => 'wp_get_theme()', '3.4'), array('get_current_theme' => 'wp_get_theme()', '3.4'), array('clean_pre' => '', '3.4'), array('add_custom_image_header' => 'add_theme_support( \'custom-header\', $args )', '3.4'), array('remove_custom_image_header' => 'remove_theme_support( \'custom-header\' )', '3.4'), array('add_custom_background' => 'add_theme_support( \'custom-background\', $args )', '3.4'), array('remove_custom_background' => 'remove_theme_support( \'custom-background\' )', '3.4'), array('get_theme_data' => 'wp_get_theme()', '3.4'), array('update_page_cache' => 'update_post_cache()', '3.4'), array('clean_page_cache' => 'clean_post_cache()', '3.4'), array('wp_explain_nonce' => 'wp_nonce_ays', '3.4.1'), array('sticky_class' => 'post_class()', '3.5'), array('_get_post_ancestors' => '', '3.5'), array('wp_load_image' => 'wp_get_image_editor()', '3.5'), array('image_resize' => 'wp_get_image_editor()', '3.5'), array('wp_get_single_post' => 'get_post()', '3.5'), array('user_pass_ok' => 'wp_authenticate()', '3.5'), array('_save_post_hook' => '', '3.5'), array('gd_edit_image_support' => 'wp_image_editor_supports', '3.5'), array('get_user_id_from_string' => 'get_user_by()', '3.6'), array('wp_convert_bytes_to_hr' => 'size_format()', '3.6'), array('_search_terms_tidy' => '', '3.7'), array('get_blogaddress_by_domain' => '', '3.7'), array('tinymce_include' => 'wp_tiny_mce()', '2.1'), array('documentation_link' => '', '2.5'), array('wp_shrink_dimensions' => 'wp_constrain_dimensions()', '3.0'), array('dropdown_categories' => 'wp_category_checklist()', '2.6'), array('dropdown_link_categories' => 'wp_link_category_checklist()', '2.6'), array('wp_dropdown_cats' => 'wp_dropdown_categories()', '3.0'), array('add_option_update_handler' => 'register_setting()', '3.0'), array('remove_option_update_handler' => 'unregister_setting()', '3.0'), array('codepress_get_lang' => '', '3.0'), array('codepress_footer_js' => '', '3.0'), array('use_codepress' => '', '3.0'), array('get_author_user_ids' => '', '3.1'), array('get_editable_authors' => '', '3.1'), array('get_editable_user_ids' => '', '3.1'), array('get_nonauthor_user_ids' => '', '3.1'), array('WP_User_Search' => 'WP_User_Query', '3.1'), array('get_others_unpublished_posts' => '', '3.1'), array('get_others_drafts' => '', '3.1'), array('get_others_pending' => '', '3.1'), array('wp_dashboard_quick_press()' => '', '3.2'), array('wp_tiny_mce' => 'wp_editor', '3.2'), array('wp_preload_dialogs' => 'wp_editor()', '3.2'), array('wp_print_editor_js' => 'wp_editor()', '3.2'), array('wp_quicktags' => 'wp_editor()', '3.2'), array('favorite_actions' => 'WP_Admin_Bar', '3.2'), array('screen_layout' => '$current_screen->render_screen_layout()', '3.3'), array('screen_options' => '$current_screen->render_per_page_options()', '3.3'), array('screen_meta' => ' $current_screen->render_screen_meta()', '3.3'), array('media_upload_image' => 'wp_media_upload_handler()', '3.3'), array('media_upload_audio' => 'wp_media_upload_handler()', '3.3'), array('media_upload_video' => 'wp_media_upload_handler()', '3.3'), array('media_upload_file' => 'wp_media_upload_handler()', '3.3'), array('type_url_form_image' => 'wp_media_insert_url_form( \'image\' )', '3.3'), array('type_url_form_audio' => 'wp_media_insert_url_form( \'audio\' )', '3.3'), array('type_url_form_video' => 'wp_media_insert_url_form( \'video\' )', '3.3'), array('type_url_form_file' => 'wp_media_insert_url_form( \'file\' )', '3.3'), array('add_contextual_help' => 'get_current_screen()->add_help_tab()', '3.3'), array('get_allowed_themes' => 'wp_get_themes( array( \'allowed\' => true ) )', '3.4'), array('get_broken_themes' => 'wp_get_themes( array( \'errors\' => true )', '3.4'), array('current_theme_info' => 'wp_get_theme()', '3.4'), array('_insert_into_post_button' => '', '3.5'), array('_media_button' => '', '3.5'), array('get_post_to_edit' => 'get_post()', '3.5'), array('get_default_page_to_edit' => 'get_default_post_to_edit()', '3.5'), array('wp_create_thumbnail' => 'image_resize()', '3.5'), array('wp_nav_menu_locations_meta_box' => '', '3.6'), array('the_attachment_links' => '', '3.7'), array('wp_update_core' => 'new Core_Upgrader()', '3.7'), array('wp_update_plugin' => 'new Plugin_Upgrader()', '3.7'), array('wp_update_theme' => 'new Theme_Upgrader()', '3.7'), array('get_screen_icon' => '', '3.8'), array('screen_icon' => '', '3.8'), array('wp_dashboard_incoming_links' => '', '3.8'), array('wp_dashboard_incoming_links_control' => '', '3.8'), array('wp_dashboard_incoming_links_output' => '', '3.8'), array('wp_dashboard_plugins' => '', '3.8'), array('wp_dashboard_primary_control' => '', '3.8'), array('wp_dashboard_recent_comments_control' => '', '3.8'), array('wp_dashboard_secondary' => '', '3.8'), array('wp_dashboard_secondary_control' => '', '3.8'), array('wp_dashboard_secondary_output' => '', '3.8'));
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $alt => $check) {
             checkcount();
             $key = key($check);
             $alt = $check[$key];
             if (preg_match('/[\\s?]' . $key . '\\(/', $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(rtrim($matches[0], '('));
                 $version = $check[0];
                 $grep = tc_grep($error, $php_key);
                 // Point out the deprecated function.
                 $error_msg = sprintf(__('%1$s found in the file %2$s. Deprecated since version %3$s.', 'theme-check'), '<strong>' . $error . '()</strong>', '<strong>' . $filename . '</strong>', '<strong>' . $version . '</strong>');
                 // Add alternative function when available.
                 if ($alt) {
                     $error_msg .= ' ' . sprintf(__('Use %s instead.', 'theme-check'), '<strong>' . $alt . '</strong>');
                 }
                 // Add the precise code match that was found.
                 $error_msg .= $grep;
                 // Add the finalized error message.
                 $this->error[] = '<span class="tc-lead tc-required">' . __('REQUIRED', 'theme-check') . '</span>: ' . $error_msg;
                 $ret = false;
             }
         }
     }
     return $ret;
 }
开发者ID:jesusone,项目名称:wp_astro,代码行数:31,代码来源:deprecated.php

示例14: check

 function check($php_files, $css_files, $other_files)
 {
     $ret = true;
     $checks = array('/(?<![_|a-z0-9|\\.])eval\\s?\\(/i' => __('eval() is not allowed.', 'themecheck'), '/[^a-z0-9](?<!_)(popen|proc_open|[^_]exec|shell_exec|system|passthru)\\(/' => __('PHP sytem calls should be disabled by server admins anyway!', 'themecheck'), '/\\s?ini_set\\(/' => __('Themes should not change server PHP settings', 'themecheck'), '/uudecode/ims' => __('uudecode() is not allowed', 'themecheck'), '/str_rot13/ims' => __('str_rot13() is not allowed', 'themecheck'), '/cx=[0-9]{21}:[a-z0-9]{10}/' => __('Google search code detected', 'themecheck'), '/pub-[0-9]{16}/i' => __('Googe advertising code detected', 'themecheck'));
     $grep = '';
     foreach ($php_files as $php_key => $phpfile) {
         foreach ($checks as $key => $check) {
             checkcount();
             if (preg_match($key, $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(trim($matches[0], '('));
                 $grep = tc_grep($error, $php_key);
                 $this->error[] = sprintf(__('<span class="tc-lead tc-warning">WARNING</span>: Found <strong>%1$s</strong> in the file <strong>%2$s</strong>. %3$s. %4$s', 'themecheck'), $error, $filename, $check, $grep);
                 $ret = false;
             }
         }
     }
     $checks = array('/cx=[0-9]{21}:[a-z0-9]{10}/' => __('Google search code detected', 'themecheck'), '/pub-[0-9]{16}/' => __('Google advertising code detected', 'themecheck'));
     foreach ($other_files as $php_key => $phpfile) {
         foreach ($checks as $key => $check) {
             checkcount();
             if (preg_match($key, $phpfile, $matches)) {
                 $filename = tc_filename($php_key);
                 $error = ltrim(rtrim($matches[0], '('));
                 $grep = tc_grep($error, $php_key);
                 $this->error[] = sprintf(__('<span class="tc-lead tc-warning">WARNING</span>: Found <strong>%1$s</strong> in the file <strong>%2$s</strong>. %3$s.%4$s', 'themecheck'), $error, $filename, $check, $grep);
                 $ret = false;
             }
         }
     }
     return $ret;
 }
开发者ID:lenguyenitc,项目名称:donations,代码行数:32,代码来源:badthings.php

示例15: check

 function check($php_files, $css_files, $other_files)
 {
     checkcount();
     $ret = true;
     $filenames = array();
     foreach ($css_files as $cssfile => $content) {
         if (basename($cssfile) === 'style.css') {
             $data = get_theme_data_from_contents($content);
         }
     }
     if (!$data['Tags']) {
         $this->error[] = '<span class="tc-lead tc-recommended">' . __('RECOMMENDED', 'theme-check') . '</span>: ' . __('<strong>Tags:</strong> is either empty or missing in style.css header.', 'theme-check');
         return $ret;
     }
     $allowed_tags = array("black", "blue", "brown", "gray", "green", "orange", "pink", "purple", "red", "silver", "tan", "white", "yellow", "dark", "light", "one-column", "two-columns", "three-columns", "four-columns", "left-sidebar", "right-sidebar", "fixed-layout", "fluid-layout", "responsive-layout", "flexible-header", "accessibility-ready", "blavatar", "buddypress", "custom-background", "custom-colors", "custom-header", "custom-menu", "editor-style", "featured-image-header", "featured-images", "front-page-post-form", "full-width-template", "microformats", "post-formats", "rtl-language-support", "sticky-post", "theme-options", "threaded-comments", "translation-ready", "holiday", "photoblogging", "seasonal");
     foreach ($data['Tags'] as $tag) {
         if (!in_array(strtolower($tag), $allowed_tags)) {
             if (in_array(strtolower($tag), array("flexible-width", "fixed-width"))) {
                 $this->error[] = '<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: ' . __('The flexible-width and fixed-width tags changed to fluid-layout and fixed-layout tags in WordPress 3.8. Additionally, the responsive-layout tag was added. Please change to using one of the new tags.', 'theme-check');
             } else {
                 $this->error[] = '<span class="tc-lead tc-warning">' . __('WARNING', 'theme-check') . '</span>: ' . sprintf(__('Found wrong tag, remove %s from your style.css header.', 'theme-check'), '<strong>' . $tag . '</strong>');
                 $ret = false;
             }
         }
     }
     return $ret;
 }
开发者ID:ericnicolaas,项目名称:theme-check,代码行数:27,代码来源:style_tags.php


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